netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH usb-next 0/2] add support for ZTE MF820D LTE stick
@ 2012-03-16 14:41 Bjørn Mork
  2012-03-16 14:41 ` [PATCH usb-next 2/2] net: qmi_wwan: add support for ZTE MF820D Bjørn Mork
  0 siblings, 1 reply; 6+ messages in thread
From: Bjørn Mork @ 2012-03-16 14:41 UTC (permalink / raw)
  To: linux-usb; +Cc: Bjørn Mork, netdev

The ZTE MF820D is based on a Qualcomm MDM9200 chip and include the
same combined QMI/wwan interface as other devices based on this
chip family.  The other vendor specific interfaces are assumed
to be serial interfaces which can be handled by the option driver.

The device is switched from 19d2:0166 to 19d2:0167 by this
usb_modeswitch default:

 # ZTE MF820 4G LTE
 TargetVendor=  0x19d2
 TargetProduct= 0x0167
 MessageContent="55534243123456782400000080000685000000240000000000000000000000"

The resulting USB device has 6 interfaces.  Interface #4 is the
QMI/wwan interface.  Note that interface #3 is an AT speaking
serial interface, despite having the exact same endpoints and
class/subclass/protocol.  Thank you ZTE for making it impossible
to write drivers without a blacklist/whitelist mess!


Bus 002 Device 029: ID 19d2:0167 ZTE WCDMA Technologies MSM 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x19d2 ZTE WCDMA Technologies MSM
  idProduct          0x0167 
  bcdDevice            0.00
  iManufacturer           3 ZTE,Incorporated
  iProduct                2 ZTE LTE Technologies MSM
  iSerial                 4 MF820DPLUS111111
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          161
    bNumInterfaces          6
    bConfigurationValue     1
    iConfiguration          1 ZTE Configuration
    bmAttributes         0xc0
      Self Powered
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x85  EP 5 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        4
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x86  EP 6 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x87  EP 7 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x05  EP 5 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        5
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x06  EP 6 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x88  EP 8 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0000
  (Bus Powered)



Bjørn Mork (2):
  USB: option: add ZTE MF820D
  net: qmi_wwan: add support for ZTE MF820D

 drivers/net/usb/qmi_wwan.c  |   34 ++++++++++++++++++++++++++++++++++
 drivers/usb/serial/option.c |    2 ++
 2 files changed, 36 insertions(+), 0 deletions(-)

-- 
1.7.2.5

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH usb-next 2/2] net: qmi_wwan: add support for ZTE MF820D
  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
  2012-03-16 15:10   ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Bjørn Mork @ 2012-03-16 14:41 UTC (permalink / raw)
  To: linux-usb; +Cc: Bjørn Mork, netdev

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH usb-next 2/2] net: qmi_wwan: add support for ZTE MF820D
  2012-03-16 14:41 ` [PATCH usb-next 2/2] net: qmi_wwan: add support for ZTE MF820D Bjørn Mork
@ 2012-03-16 15:10   ` Greg KH
       [not found]     ` <20120316151048.GA28696-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2012-03-16 15:10 UTC (permalink / raw)
  To: Bjørn Mork; +Cc: linux-usb, netdev

On Fri, Mar 16, 2012 at 03:41:27PM +0100, Bjørn Mork wrote:
> 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.

This requires patch 1/2, right?  If so, I'll be glad to take this in my
tree if David doesn't mind.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH usb-next 2/2] net: qmi_wwan: add support for ZTE MF820D
       [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>
  0 siblings, 1 reply; 6+ messages in thread
From: Bjørn Mork @ 2012-03-16 16:50 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA

Greg KH <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org> writes:
> On Fri, Mar 16, 2012 at 03:41:27PM +0100, Bjørn Mork wrote:
>> 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-yOkvZcmFvRU@public.gmane.org>
>> ---
>> 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.
>
> This requires patch 1/2, right?  

It doesn't require patch 1/2 of this series, but it does require the
other qmi_wwan patches you've already taken in your tree.

> If so, I'll be glad to take this in my tree if David doesn't mind.

That would be best, yes.



Bjørn
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH usb-next 2/2] net: qmi_wwan: add support for ZTE MF820D
       [not found]         ` <87ty1oebia.fsf-lbf33ChDnrE/G1V5fR+Y7Q@public.gmane.org>
@ 2012-03-16 20:38           ` David Miller
  2012-03-16 20:38           ` Greg KH
  1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2012-03-16 20:38 UTC (permalink / raw)
  To: bjorn-yOkvZcmFvRU
  Cc: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA

From: Bjørn Mork <bjorn-yOkvZcmFvRU@public.gmane.org>
Date: Fri, 16 Mar 2012 17:50:05 +0100

> Greg KH <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org> writes:
>> If so, I'll be glad to take this in my tree if David doesn't mind.
> 
> That would be best, yes.

Feel free.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH usb-next 2/2] net: qmi_wwan: add support for ZTE MF820D
       [not found]         ` <87ty1oebia.fsf-lbf33ChDnrE/G1V5fR+Y7Q@public.gmane.org>
  2012-03-16 20:38           ` David Miller
@ 2012-03-16 20:38           ` Greg KH
  1 sibling, 0 replies; 6+ messages in thread
From: Greg KH @ 2012-03-16 20:38 UTC (permalink / raw)
  To: Bjørn Mork
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA

On Fri, Mar 16, 2012 at 05:50:05PM +0100, Bjørn Mork wrote:
> Greg KH <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org> writes:
> > On Fri, Mar 16, 2012 at 03:41:27PM +0100, Bjørn Mork wrote:
> >> 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-yOkvZcmFvRU@public.gmane.org>
> >> ---
> >> 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.
> >
> > This requires patch 1/2, right?  
> 
> It doesn't require patch 1/2 of this series, but it does require the
> other qmi_wwan patches you've already taken in your tree.

Ok, I'll go apply it then.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-03-16 20:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH usb-next 2/2] net: qmi_wwan: add support for ZTE MF820D Bjørn Mork
2012-03-16 15:10   ` 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

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).