From: "Bjørn Mork" <bjorn@mork.no>
To: linux-usb@vger.kernel.org
Cc: "Bjørn Mork" <bjorn@mork.no>, netdev@vger.kernel.org
Subject: [PATCH usb-next 2/2] net: qmi_wwan: add support for ZTE MF820D
Date: Fri, 16 Mar 2012 15:41:27 +0100 [thread overview]
Message-ID: <1331908887-14068-3-git-send-email-bjorn@mork.no> (raw)
In-Reply-To: <1331908887-14068-1-git-send-email-bjorn@mork.no>
ZTE have yet to discover the magic of USB descriptors. These
devices use ff/ff/ff for class/subclass/protocol regardless of
function, except for usb-storage. Use an interface number
whitelist to force the driver to bind only to the QMI/wwan
interface.
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
Hello Greg and David,
is it possible to get this into the queue for 3.4 via usb-next as
well? It was supposed to be a simple pid/vid addition, but the
ZTE descriptor stupidity requires us to match on USB interface
numbers.
Bjørn
drivers/net/usb/qmi_wwan.c | 34 ++++++++++++++++++++++++++++++++++
1 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index e14479d..aac68f5 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/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 */
--
1.7.2.5
next prev parent reply other threads:[~2012-03-16 14:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-16 14:41 [PATCH usb-next 0/2] add support for ZTE MF820D LTE stick Bjørn Mork
2012-03-16 14:41 ` Bjørn Mork [this message]
2012-03-16 15:10 ` [PATCH usb-next 2/2] net: qmi_wwan: add support for ZTE MF820D Greg KH
[not found] ` <20120316151048.GA28696-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2012-03-16 16:50 ` Bjørn Mork
[not found] ` <87ty1oebia.fsf-lbf33ChDnrE/G1V5fR+Y7Q@public.gmane.org>
2012-03-16 20:38 ` David Miller
2012-03-16 20:38 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1331908887-14068-3-git-send-email-bjorn@mork.no \
--to=bjorn@mork.no \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).