aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2012-05-18 15:27:43 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-13 18:40:09 -0400
commit81df2d594340dcb6d1a02191976be88a1ca8120c (patch)
treef5a20ebf416c03b41611518d54706019d0c0ffa2 /include/linux
parent7e97243c2080ecae7129e83635227fdebd4feef6 (diff)
USB: allow match on bInterfaceNumber
Some composite USB devices provide multiple interfaces with different functions, all using "vendor-specific" for class/subclass/protocol. Another OS use interface numbers to match the driver and interface. It seems these devices are designed with that in mind - using static interface numbers for the different functions. This adds support for matching against the bInterfaceNumber, allowing such devices to be supported without having to resort to testing against interface number whitelists and/or blacklists in the probe. Signed-off-by: Bjørn Mork <bjorn@mork.no> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/mod_devicetable.h7
-rw-r--r--include/linux/usb.h16
2 files changed, 23 insertions, 0 deletions
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 5db93821f9c7..7771d453e5f3 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -78,6 +78,9 @@ struct ieee1394_device_id {
78 * of a given interface; other interfaces may support other classes. 78 * of a given interface; other interfaces may support other classes.
79 * @bInterfaceSubClass: Subclass of interface; associated with bInterfaceClass. 79 * @bInterfaceSubClass: Subclass of interface; associated with bInterfaceClass.
80 * @bInterfaceProtocol: Protocol of interface; associated with bInterfaceClass. 80 * @bInterfaceProtocol: Protocol of interface; associated with bInterfaceClass.
81 * @bInterfaceNumber: Number of interface; composite devices may use
82 * fixed interface numbers to differentiate between vendor-specific
83 * interfaces.
81 * @driver_info: Holds information used by the driver. Usually it holds 84 * @driver_info: Holds information used by the driver. Usually it holds
82 * a pointer to a descriptor understood by the driver, or perhaps 85 * a pointer to a descriptor understood by the driver, or perhaps
83 * device flags. 86 * device flags.
@@ -115,6 +118,9 @@ struct usb_device_id {
115 __u8 bInterfaceSubClass; 118 __u8 bInterfaceSubClass;
116 __u8 bInterfaceProtocol; 119 __u8 bInterfaceProtocol;
117 120
121 /* Used for vendor-specific interface matches */
122 __u8 bInterfaceNumber;
123
118 /* not matched against */ 124 /* not matched against */
119 kernel_ulong_t driver_info; 125 kernel_ulong_t driver_info;
120}; 126};
@@ -130,6 +136,7 @@ struct usb_device_id {
130#define USB_DEVICE_ID_MATCH_INT_CLASS 0x0080 136#define USB_DEVICE_ID_MATCH_INT_CLASS 0x0080
131#define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100 137#define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100
132#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200 138#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200
139#define USB_DEVICE_ID_MATCH_INT_NUMBER 0x0400
133 140
134#define HID_ANY_ID (~0) 141#define HID_ANY_ID (~0)
135#define HID_BUS_ANY 0xffff 142#define HID_BUS_ANY 0xffff
diff --git a/include/linux/usb.h b/include/linux/usb.h
index dea39dc551d4..f717fbdaee8e 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -777,6 +777,22 @@ static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size)
777 .bInterfaceProtocol = (pr) 777 .bInterfaceProtocol = (pr)
778 778
779/** 779/**
780 * USB_DEVICE_INTERFACE_NUMBER - describe a usb device with a specific interface number
781 * @vend: the 16 bit USB Vendor ID
782 * @prod: the 16 bit USB Product ID
783 * @num: bInterfaceNumber value
784 *
785 * This macro is used to create a struct usb_device_id that matches a
786 * specific interface number of devices.
787 */
788#define USB_DEVICE_INTERFACE_NUMBER(vend, prod, num) \
789 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
790 USB_DEVICE_ID_MATCH_INT_NUMBER, \
791 .idVendor = (vend), \
792 .idProduct = (prod), \
793 .bInterfaceNumber = (num)
794
795/**
780 * USB_DEVICE_INFO - macro used to describe a class of usb devices 796 * USB_DEVICE_INFO - macro used to describe a class of usb devices
781 * @cl: bDeviceClass value 797 * @cl: bDeviceClass value
782 * @sc: bDeviceSubClass value 798 * @sc: bDeviceSubClass value