diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2005-11-16 16:41:28 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-04 16:48:32 -0500 |
commit | 733260ff9c45bd4db60f45d17e8560a4a68dff4d (patch) | |
tree | e7f09a9a9e2d7a9f22288c9777f7b03906a89e20 /include | |
parent | ddae41be6145f5f9cb4e6df35661a09121b90672 (diff) |
[PATCH] USB: add dynamic id functionality to USB core
Echo the usb vendor and product id to the "new_id" file in the driver's
sysfs directory, and then that driver will be able to bind to a device
with those ids if it is present.
Example:
echo 0557 2008 > /sys/bus/usb/drivers/foo_driver/new_id
adds the hex values 0557 and 2008 to the device id table for the foo_driver.
Note, usb-serial drivers do not currently work with this capability yet.
usb-storage also might have some oddities.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/usb.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h index d81b050e5955..0dd96ef78c13 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -529,6 +529,11 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, | |||
529 | 529 | ||
530 | /* ----------------------------------------------------------------------- */ | 530 | /* ----------------------------------------------------------------------- */ |
531 | 531 | ||
532 | struct usb_dynids { | ||
533 | spinlock_t lock; | ||
534 | struct list_head list; | ||
535 | }; | ||
536 | |||
532 | /** | 537 | /** |
533 | * struct usb_driver - identifies USB driver to usbcore | 538 | * struct usb_driver - identifies USB driver to usbcore |
534 | * @owner: Pointer to the module owner of this driver; initialize | 539 | * @owner: Pointer to the module owner of this driver; initialize |
@@ -553,6 +558,8 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, | |||
553 | * @id_table: USB drivers use ID table to support hotplugging. | 558 | * @id_table: USB drivers use ID table to support hotplugging. |
554 | * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set | 559 | * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set |
555 | * or your driver's probe function will never get called. | 560 | * or your driver's probe function will never get called. |
561 | * @dynids: used internally to hold the list of dynamically added device | ||
562 | * ids for this driver. | ||
556 | * @driver: the driver model core driver structure. | 563 | * @driver: the driver model core driver structure. |
557 | * | 564 | * |
558 | * USB drivers must provide a name, probe() and disconnect() methods, | 565 | * USB drivers must provide a name, probe() and disconnect() methods, |
@@ -588,6 +595,7 @@ struct usb_driver { | |||
588 | 595 | ||
589 | const struct usb_device_id *id_table; | 596 | const struct usb_device_id *id_table; |
590 | 597 | ||
598 | struct usb_dynids dynids; | ||
591 | struct device_driver driver; | 599 | struct device_driver driver; |
592 | }; | 600 | }; |
593 | #define to_usb_driver(d) container_of(d, struct usb_driver, driver) | 601 | #define to_usb_driver(d) container_of(d, struct usb_driver, driver) |