Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: add USB_DEVICE_AND_INTERFACE_INFO for device matching

Recently, the USB device matching code stopped matching generic interface
matches against devices with vendor-specific device class values.

Some drivers now need to explicitly match USB device ID's (in addition to
generic interface info) to retain the same behaviour as before. This new macro,
suggested by Alan Stern, makes the explicit device/interface matching a little
simpler for those users.

Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Daniel Drake and committed by
Greg Kroah-Hartman
8538f96a 7f9985c2

+22
+22
include/linux/usb.h
··· 771 771 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO, .bInterfaceClass = (cl), \ 772 772 .bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr) 773 773 774 + /** 775 + * USB_DEVICE_AND_INTERFACE_INFO - macro used to describe a specific usb device 776 + * with a class of usb interfaces 777 + * @vend: the 16 bit USB Vendor ID 778 + * @prod: the 16 bit USB Product ID 779 + * @cl: bInterfaceClass value 780 + * @sc: bInterfaceSubClass value 781 + * @pr: bInterfaceProtocol value 782 + * 783 + * This macro is used to create a struct usb_device_id that matches a 784 + * specific device with a specific class of interfaces. 785 + * 786 + * This is especially useful when explicitly matching devices that have 787 + * vendor specific bDeviceClass values, but standards-compliant interfaces. 788 + */ 789 + #define USB_DEVICE_AND_INTERFACE_INFO(vend,prod,cl,sc,pr) \ 790 + .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \ 791 + | USB_DEVICE_ID_MATCH_DEVICE, \ 792 + .idVendor = (vend), .idProduct = (prod), \ 793 + .bInterfaceClass = (cl), \ 794 + .bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr) 795 + 774 796 /* ----------------------------------------------------------------------- */ 775 797 776 798 /* Stuff for dynamic usb ids */