diff options
author | Michael Brown | 2015-09-14 18:52:25 +0200 |
---|---|---|
committer | Michael Brown | 2015-09-14 22:56:40 +0200 |
commit | 668dc73d526fa67957b9c10100f9ca5f2ab60522 (patch) | |
tree | cf6887506d5ac016fd04497cbd568463292903de /src/drivers/usb | |
parent | [usb] Select preferred USB device configuration based on driver score (diff) | |
download | ipxe-668dc73d526fa67957b9c10100f9ca5f2ab60522.tar.gz ipxe-668dc73d526fa67957b9c10100f9ca5f2ab60522.tar.xz ipxe-668dc73d526fa67957b9c10100f9ca5f2ab60522.zip |
[usb] Allow for wildcard USB class IDs
Make the class ID a property of the USB driver (rather than a property
of the USB device ID), and allow USB drivers to specify a wildcard ID
for any of the three component IDs (class, subclass, or protocol).
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/usb')
-rw-r--r-- | src/drivers/usb/usbhub.c | 18 | ||||
-rw-r--r-- | src/drivers/usb/usbio.c | 7 | ||||
-rw-r--r-- | src/drivers/usb/usbkbd.c | 7 |
3 files changed, 8 insertions, 24 deletions
diff --git a/src/drivers/usb/usbhub.c b/src/drivers/usb/usbhub.c index 97d21ef4..5cfc4052 100644 --- a/src/drivers/usb/usbhub.c +++ b/src/drivers/usb/usbhub.c @@ -517,24 +517,9 @@ static void hub_remove ( struct usb_function *func ) { /** USB hub device IDs */ static struct usb_device_id hub_ids[] = { { - .name = "hub-1", + .name = "hub", .vendor = USB_ANY_ID, .product = USB_ANY_ID, - .class = { - .class = USB_CLASS_HUB, - .subclass = 0, - .protocol = 0, - }, - }, - { - .name = "hub-2", - .vendor = USB_ANY_ID, - .product = USB_ANY_ID, - .class = { - .class = USB_CLASS_HUB, - .subclass = 0, - .protocol = 1, - }, }, }; @@ -542,6 +527,7 @@ static struct usb_device_id hub_ids[] = { struct usb_driver usb_hub_driver __usb_driver = { .ids = hub_ids, .id_count = ( sizeof ( hub_ids ) / sizeof ( hub_ids[0] ) ), + .class = USB_CLASS_ID ( USB_CLASS_HUB, 0, USB_ANY_ID ), .score = USB_SCORE_NORMAL, .probe = hub_probe, .remove = hub_remove, diff --git a/src/drivers/usb/usbio.c b/src/drivers/usb/usbio.c index 55c61ed4..153f3942 100644 --- a/src/drivers/usb/usbio.c +++ b/src/drivers/usb/usbio.c @@ -1316,6 +1316,7 @@ static int usbio_supported ( EFI_HANDLE handle ) { "%s\n", efi_handle_name ( handle ), strerror ( rc ) ); goto err_get_device_descriptor; } + memset ( &desc, 0, sizeof ( desc ) ); desc.vendor = device.IdVendor; desc.product = device.IdProduct; @@ -1327,9 +1328,9 @@ static int usbio_supported ( EFI_HANDLE handle ) { "%s\n", efi_handle_name ( handle ), strerror ( rc ) ); goto err_get_interface_descriptor; } - desc.class.class = interface.InterfaceClass; - desc.class.subclass = interface.InterfaceSubClass; - desc.class.protocol = interface.InterfaceProtocol; + desc.class.class.class = interface.InterfaceClass; + desc.class.class.subclass = interface.InterfaceSubClass; + desc.class.class.protocol = interface.InterfaceProtocol; /* Look for a driver for this interface */ driver = usb_find_driver ( &desc, &id ); diff --git a/src/drivers/usb/usbkbd.c b/src/drivers/usb/usbkbd.c index b134bc78..512adfe2 100644 --- a/src/drivers/usb/usbkbd.c +++ b/src/drivers/usb/usbkbd.c @@ -437,11 +437,6 @@ static struct usb_device_id usbkbd_ids[] = { .name = "kbd", .vendor = USB_ANY_ID, .product = USB_ANY_ID, - .class = { - .class = USB_CLASS_HID, - .subclass = USB_SUBCLASS_HID_BOOT, - .protocol = USBKBD_PROTOCOL, - }, }, }; @@ -449,6 +444,8 @@ static struct usb_device_id usbkbd_ids[] = { struct usb_driver usbkbd_driver __usb_driver = { .ids = usbkbd_ids, .id_count = ( sizeof ( usbkbd_ids ) / sizeof ( usbkbd_ids[0] ) ), + .class = USB_CLASS_ID ( USB_CLASS_HID, USB_SUBCLASS_HID_BOOT, + USBKBD_PROTOCOL ), .score = USB_SCORE_NORMAL, .probe = usbkbd_probe, .remove = usbkbd_remove, |