[v2,1/3] cdc_ether: allow vendor specific data interface if control interface is vendor specific

Submitted by Bjørn Mork on Jan. 15, 2012, 6:40 a.m.

Details

Message ID 19b71374642ee38bd389048488e855e814a09914.1326607234.git.bjorn@mork.no
State Not Applicable
Delegated to: David Miller
Headers show

Commit Message

Bjørn Mork Jan. 15, 2012, 6:40 a.m.
Some vendors, like Huawei, use the vendor specific class code all over the
place even for devices which otherwise conform pretty well to the CDC ECM
specification.  This allows such devices to be supported merely by
adding them to the device specific whitelist.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
Changes from v1: Removed an unintentional debug message change.  Thanks to
Joe Perches for pointing that out


 drivers/net/usb/cdc_ether.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 41a61ef..a14a4a3 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -211,7 +211,11 @@  int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
 
 			/* a data interface altsetting does the real i/o */
 			d = &info->data->cur_altsetting->desc;
-			if (d->bInterfaceClass != USB_CLASS_CDC_DATA) {
+			if ((d->bInterfaceClass != USB_CLASS_CDC_DATA) &&
+				/* Allow vendor specific data interface iff
+				   control interface is vendor specific */
+				!(info->control->cur_altsetting->desc.bInterfaceClass == USB_CLASS_VENDOR_SPEC &&
+					d->bInterfaceClass == USB_CLASS_VENDOR_SPEC)) {
 				dev_dbg(&intf->dev, "slave class %u\n",
 					d->bInterfaceClass);
 				goto bad_desc;