From 48618969bac7c24f96ae0f8dbb7b9bc69d095ac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= Date: Fri, 16 Mar 2012 15:41:27 +0100 Subject: [PATCH] --- yaml --- r: 289709 b: refs/heads/master c: 11207b6fe05438b2e87a26435cd98db3d55e6fa7 h: refs/heads/master i: 289707: 2e45b9d98215003f30d9d179a31cb3180724a7aa v: v3 --- [refs] | 2 +- trunk/drivers/net/usb/qmi_wwan.c | 34 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index d49cb5a23c56..6d27860af28a 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5889d3d4209c1050b4a3c96c41faf6c0976a4acf +refs/heads/master: 11207b6fe05438b2e87a26435cd98db3d55e6fa7 diff --git a/trunk/drivers/net/usb/qmi_wwan.c b/trunk/drivers/net/usb/qmi_wwan.c index e14479dd2438..aac68f5195c0 100644 --- a/trunk/drivers/net/usb/qmi_wwan.c +++ b/trunk/drivers/net/usb/qmi_wwan.c @@ -214,6 +214,20 @@ static int qmi_wwan_bind_shared(struct usbnet *dev, struct usb_interface *intf) struct usb_driver *subdriver = NULL; atomic_t *pmcount = (void *)&dev->data[1]; + /* ZTE makes devices where the interface descriptors and endpoint + * configurations of two or more interfaces are identical, even + * though the functions are completely different. If set, then + * driver_info->data is a bitmap of acceptable interface numbers + * allowing us to bind to one such interface without binding to + * all of them + */ + if (dev->driver_info->data && + !test_bit(intf->cur_altsetting->desc.bInterfaceNumber, &dev->driver_info->data)) { + dev_info(&intf->dev, "not on our whitelist - ignored"); + rv = -ENODEV; + goto err; + } + atomic_set(pmcount, 0); /* collect all three endpoints */ @@ -341,6 +355,17 @@ static const struct driver_info qmi_wwan_gobi = { .manage_power = qmi_wwan_manage_power, }; +/* ZTE suck at making USB descriptors */ +static const struct driver_info qmi_wwan_force_int4 = { + .description = "Qualcomm Gobi wwan/QMI device", + .flags = FLAG_WWAN, + .bind = qmi_wwan_bind_gobi, + .unbind = qmi_wwan_unbind_shared, + .manage_power = qmi_wwan_manage_power, + .data = BIT(4), /* interface whitelist bitmap */ +}; + + #define HUAWEI_VENDOR_ID 0x12D1 #define QMI_GOBI_DEVICE(vend, prod) \ USB_DEVICE(vend, prod), \ @@ -375,6 +400,15 @@ static const struct usb_device_id products[] = { .bInterfaceProtocol = 0xff, .driver_info = (unsigned long)&qmi_wwan_shared, }, + { /* ZTE MF820D */ + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x19d2, + .idProduct = 0x0167, + .bInterfaceClass = 0xff, + .bInterfaceSubClass = 0xff, + .bInterfaceProtocol = 0xff, + .driver_info = (unsigned long)&qmi_wwan_force_int4, + }, {QMI_GOBI_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ {QMI_GOBI_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ {QMI_GOBI_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */