USB: allow match on bInterfaceNumber

From 81df2d594340dcb6d1a02191976be88a1ca8120c upstream.

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.

Change-Id: I0f991e507d041bbe12aa87403b9c2e1f0de274c2
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
This commit is contained in:
Bjørn Mork
2012-05-18 21:27:43 +02:00
committed by Iliyan Malchev
parent 9626571bd8
commit dca7fa1b9f
6 changed files with 40 additions and 7 deletions

View File

@@ -770,6 +770,22 @@ static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size)
.idProduct = (prod), \
.bInterfaceProtocol = (pr)
/**
* USB_DEVICE_INTERFACE_NUMBER - describe a usb device with a specific interface number
* @vend: the 16 bit USB Vendor ID
* @prod: the 16 bit USB Product ID
* @num: bInterfaceNumber value
*
* This macro is used to create a struct usb_device_id that matches a
* specific interface number of devices.
*/
#define USB_DEVICE_INTERFACE_NUMBER(vend, prod, num) \
.match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
USB_DEVICE_ID_MATCH_INT_NUMBER, \
.idVendor = (vend), \
.idProduct = (prod), \
.bInterfaceNumber = (num)
/**
* USB_DEVICE_INFO - macro used to describe a class of usb devices
* @cl: bDeviceClass value