Browse Source

[usb] Allow USB device IDs to include arbitrary driver-specific data

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 years ago
parent
commit
fb8c52de9b
2 changed files with 9 additions and 3 deletions
  1. 5
    3
      src/drivers/bus/usb.c
  2. 4
    0
      src/include/ipxe/usb.h

+ 5
- 3
src/drivers/bus/usb.c View File

1186
 		return -ENOENT;
1186
 		return -ENOENT;
1187
 	}
1187
 	}
1188
 
1188
 
1189
+	/* Record driver */
1190
+	func->driver = driver;
1191
+	func->id = id;
1192
+	func->dev.driver_name = id->name;
1193
+
1189
 	/* Probe driver */
1194
 	/* Probe driver */
1190
 	if ( ( rc = driver->probe ( func, config ) ) != 0 ) {
1195
 	if ( ( rc = driver->probe ( func, config ) ) != 0 ) {
1191
 		DBGC ( usb, "USB %s failed to probe driver %s: %s\n",
1196
 		DBGC ( usb, "USB %s failed to probe driver %s: %s\n",
1193
 		return rc;
1198
 		return rc;
1194
 	}
1199
 	}
1195
 
1200
 
1196
-	/* Record driver */
1197
-	func->driver = driver;
1198
-	func->dev.driver_name = id->name;
1199
 	return 0;
1201
 	return 0;
1200
 }
1202
 }
1201
 
1203
 

+ 4
- 0
src/include/ipxe/usb.h View File

662
 	struct usb_driver *driver;
662
 	struct usb_driver *driver;
663
 	/** Driver private data */
663
 	/** Driver private data */
664
 	void *priv;
664
 	void *priv;
665
+	/** Driver device ID */
666
+	struct usb_device_id *id;
665
 
667
 
666
 	/** List of interface numbers
668
 	/** List of interface numbers
667
 	 *
669
 	 *
1308
 	uint16_t vendor;
1310
 	uint16_t vendor;
1309
 	/** Product ID */
1311
 	/** Product ID */
1310
 	uint16_t product;
1312
 	uint16_t product;
1313
+	/** Arbitrary driver data */
1314
+	unsigned long driver_data;
1311
 };
1315
 };
1312
 
1316
 
1313
 /** Match-anything ID */
1317
 /** Match-anything ID */

Loading…
Cancel
Save