Re: [PATCH] USB: qmi_wwan: Add quirk for Quectel EC20 Mini PCIe module
Bjørn Mork [2015-11-05 12:03:36]: > make this function return bool. And the patch should go to netdev. Thanks, done. > With those changes it looks good to me. But I haven't tested it, so I > trust your testing :) usb 2-1.2: new high-speed USB device number 3 using ci_hdrc qcserial 2-1.2:1.0: Qualcomm USB modem converter detected usb 2-1.2: Qualcomm USB modem converter now attached to ttyUSB0 qcserial 2-1.2:1.1: Qualcomm USB modem converter detected usb 2-1.2: Qualcomm USB modem converter now attached to ttyUSB1 qcserial 2-1.2:1.2: Qualcomm USB modem converter detected usb 2-1.2: Qualcomm USB modem converter now attached to ttyUSB2 qcserial 2-1.2:1.3: Qualcomm USB modem converter detected usb 2-1.2: Qualcomm USB modem converter now attached to ttyUSB3 qmi_wwan 2-1.2:1.4: cdc-wdm0: USB WDM device qmi_wwan 2-1.2:1.4 wwan0: register 'qmi_wwan' at usb-ci_hdrc.1-1.2, WWAN/QMI device, 56:3a:52:a3:e9:f7 root@OpenWrt:/# ifconfig wwan0 wwan0 Link encap:Ethernet HWaddr 56:3A:52:A3:E9:F7 BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) root@OpenWrt:/# uqmi -d /dev/cdc-wdm0 --get-capabilities { "max_tx_channel_rate": 5000, "max_rx_channel_rate": 1, "data_service": "non_simultaneous_cs_ps", "sim": "supported", "networks": [ "gsm", "umts", "lte" ] } root@OpenWrt:/# microcom -s115200 /dev/ttyUSB2 AT+QGPS=1 OK root@OpenWrt:/# microcom -s115200 /dev/ttyUSB1 $GPRMC,,V,,N*53 $GPVTG,,T,,M,,N,,K,N*2C -- ynezz -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2] USB: qmi_wwan: Add quirk for Quectel EC20 Mini PCIe module
This device has same vendor and product IDs as G2K devices, but it has different number of interfaces(4 vs 5) and also different interface layout where EC20 has QMI on interface 4 instead of 0. lsusb output: Bus 002 Device 003: ID 05c6:9215 Qualcomm, Inc. Acer Gobi 2000 Device Descriptor: bLength18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize064 idVendor 0x05c6 Qualcomm, Inc. idProduct 0x9215 Acer Gobi 2000 Wireless Modem bcdDevice2.32 iManufacturer 1 Quectel iProduct2 Quectel LTE Module iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 209 bNumInterfaces 5 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xa0 (Bus Powered) Remote Wakeup MaxPower 500mA Signed-off-by: Petr Štetiar --- Changes since v1: * make quectel_ec20_detected return bool (Bjørn) drivers/net/usb/qmi_wwan.c | 21 + 1 file changed, 21 insertions(+) diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 2a7c1be..b81a32c 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c @@ -822,6 +822,7 @@ static const struct usb_device_id products[] = { {QMI_GOBI_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */ {QMI_GOBI_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */ {QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */ + {QMI_FIXED_INTF(0x05c6, 0x9215, 4)},/* Quectel EC20 Mini PCIe */ {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */ {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */ {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */ @@ -853,10 +854,24 @@ static const struct usb_device_id products[] = { }; MODULE_DEVICE_TABLE(usb, products); +static bool quectel_ec20_detected(struct usb_interface *intf) +{ + struct usb_device *dev = interface_to_usbdev(intf); + + if (dev->actconfig && + le16_to_cpu(dev->descriptor.idVendor) == 0x05c6 && + le16_to_cpu(dev->descriptor.idProduct) == 0x9215 && + dev->actconfig->desc.bNumInterfaces == 5) + return true; + + return false; +} + static int qmi_wwan_probe(struct usb_interface *intf, const struct usb_device_id *prod) { struct usb_device_id *id = (struct usb_device_id *)prod; + struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc; /* Workaround to enable dynamic IDs. This disables usbnet * blacklisting functionality. Which, if required, can be @@ -868,6 +883,12 @@ static int qmi_wwan_probe(struct usb_interface *intf, id->driver_info = (unsigned long)&qmi_wwan_info; } + /* Quectel EC20 quirk where we've QMI on interface 4 instead of 0 */ + if (quectel_ec20_detected(intf) && desc->bInterfaceNumber == 0) { + dev_dbg(&intf->dev, "Quectel EC20 quirk, skipping interface 0\n"); + return -ENODEV; + } + return usbnet_probe(intf, id); } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] USB: qmi_wwan: Add quirk for Quectel EC20 Mini PCIe module
This device has same vendor and product IDs as G2K devices, but it has different number of interfaces(4 vs 5) and also different interface layout where EC20 has QMI on interface 4 instead of 0. lsusb output: Bus 002 Device 003: ID 05c6:9215 Qualcomm, Inc. Acer Gobi 2000 Device Descriptor: bLength18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize064 idVendor 0x05c6 Qualcomm, Inc. idProduct 0x9215 Acer Gobi 2000 Wireless Modem bcdDevice2.32 iManufacturer 1 Quectel iProduct2 Quectel LTE Module iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 209 bNumInterfaces 5 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xa0 (Bus Powered) Remote Wakeup MaxPower 500mA Signed-off-by: Petr Štetiar --- drivers/net/usb/qmi_wwan.c | 21 + 1 file changed, 21 insertions(+) diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 2a7c1be..385b5e3 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c @@ -822,6 +822,7 @@ static const struct usb_device_id products[] = { {QMI_GOBI_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */ {QMI_GOBI_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */ {QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */ + {QMI_FIXED_INTF(0x05c6, 0x9215, 4)},/* Quectel EC20 Mini PCIe */ {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */ {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */ {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */ @@ -853,10 +854,24 @@ static const struct usb_device_id products[] = { }; MODULE_DEVICE_TABLE(usb, products); +static int quectel_ec20_detected(struct usb_interface *intf) +{ + struct usb_device *dev = interface_to_usbdev(intf); + + if (dev->actconfig && + le16_to_cpu(dev->descriptor.idVendor) == 0x05c6 && + le16_to_cpu(dev->descriptor.idProduct) == 0x9215 && + dev->actconfig->desc.bNumInterfaces == 5) + return 1; + + return 0; +} + static int qmi_wwan_probe(struct usb_interface *intf, const struct usb_device_id *prod) { struct usb_device_id *id = (struct usb_device_id *)prod; + struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc; /* Workaround to enable dynamic IDs. This disables usbnet * blacklisting functionality. Which, if required, can be @@ -868,6 +883,12 @@ static int qmi_wwan_probe(struct usb_interface *intf, id->driver_info = (unsigned long)&qmi_wwan_info; } + /* Quectel EC20 quirk where we've QMI on interface 4 instead of 0 */ + if (quectel_ec20_detected(intf) && desc->bInterfaceNumber == 0) { + dev_dbg(&intf->dev, "Quectel EC20 quirk, skipping interface 0\n"); + return -ENODEV; + } + return usbnet_probe(intf, id); } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] USB: qcserial: Add support for Quectel EC20 Mini PCIe module
Bjørn Mork [2015-11-04 16:57:06]: > > +#define QUECTEL_EC20_VENDORID 0x05c6 > > +#define QUECTEL_EC20_PRODUCTID 0x9215 > > +#define QUECTEL_EC20_NINTERFACES 5 > > +#define QUECTEL_EC20_QMI_IFACE_FIX 4 > > Not directly related to the issue at hand, but I sort of hate macros > like that. They provide little or no value, and make it much more > difficult to see what is going on. Yep, but magic number constants are worse. I don't know about better alternative. > In particular, if you went this route then you would probably want to define > > #define ACER_GOBI2K_VENDORID 0x05c6 > #define ACER_GOBI2K_PRODUCTID 0x9215 > #define ACER_GOBI2K_NINTERFACES 4 > #define ACER_GOBI2K_QMI_IFACE_FIX 0 > > to make this complete. And noone would notice that > ACER_GOBI2K_PRODUCTID and QUECTEL_EC20_PRODUCTID are the same value. > > In fact, the QUECTEL_EC20_VENDORID is really a Qualcomm device ID. > That's confusing already. Please use literals instead. So this means, that I should check for both cases? It's very unlikely, that someone would own both devices - does the Acer device even exist? > > + le16_to_cpu(dev->descriptor.idVendor) == > > QUECTEL_EC20_VENDORID && > > + le16_to_cpu(dev->descriptor.idProduct) == > > QUECTEL_EC20_PRODUCTID && > > Not that performance matters, but you can make these compile time > operations on BE by doing > >dev->descriptor.idVendor == cpu_to_le16(QUECTEL_EC20_VENDORID) && >dev->descriptor.idProduct == cpu_to_le16(QUECTEL_EC20_PRODUCTID) && > > instead. It's just a copy&paste from other sources, but thanks for the note. > I didn't think if that possibiity. Does it work? Yes it works, but in both alternatives it's still probing the interface 0 so I'll need to add rejecting of probing on it. usb 2-1.2: new high-speed USB device number 3 using ci_hdrc qmi_wwan: probe of 2-1.2:1.0 failed with error -22 qcserial 2-1.2:1.0: Qualcomm USB modem converter detected usb 2-1.2: Qualcomm USB modem converter now attached to ttyUSB0 ...snip... qmi_wwan 2-1.2:1.4: cdc-wdm0: USB WDM device qmi_wwan 2-1.2:1.4 wwan0: register 'qmi_wwan' at usb-ci_hdrc.1-1.2, WWAN/QMI device, 76:81:57:21:bb:4f > But modifying the match table like this is a little hacky in any case, I > guess. I know we do it for the dynamic part of the table, but that's > because there is no other way making dynamic device IDs work in > combination with the usbnet driver_info. Quirk is a hack in other words, isn't it? Anyway, what did you meant by a 'quirk' exactly in your 1st email reply, what would be a correct way of doing it? > Better to go for the first alternative with a double entry in the match > table. But it will need code to reject interface #0 on the Quectel > EC20, so qcserial can handle it. So this basically means merging both alternatives, but in the probe just quit the probing instead of modifying the match table, right? Thanks. -- ynezz -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] USB: qcserial: Add support for Quectel EC20 Mini PCIe module
Bjørn Mork [2015-11-04 13:15:10]: > Based on that, I wonder if it wouldn't be more appropriate to simply do > this as a device specific quirk in the qmi_wwan probe? So rather something like this? diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 2a7c1be..2dafc69 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c @@ -822,6 +822,7 @@ static const struct usb_device_id products[] = { {QMI_GOBI_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */ {QMI_GOBI_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */ {QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */ + {QMI_FIXED_INTF(0x05c6, 0x9215, 4)},/* Quectel EC20 Mini PCIe Module */ {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */ {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */ {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */ @@ -853,6 +854,23 @@ static const struct usb_device_id products[] = { }; MODULE_DEVICE_TABLE(usb, products); or rather something like this? +#define QUECTEL_EC20_VENDORID 0x05c6 +#define QUECTEL_EC20_PRODUCTID 0x9215 +#define QUECTEL_EC20_NINTERFACES 5 +#define QUECTEL_EC20_QMI_IFACE_FIX 4 +static int quectel_ec20_detected(struct usb_interface *intf) +{ + struct usb_device *dev = interface_to_usbdev(intf); + + if (dev->actconfig && + le16_to_cpu(dev->descriptor.idVendor) == QUECTEL_EC20_VENDORID && + le16_to_cpu(dev->descriptor.idProduct) == QUECTEL_EC20_PRODUCTID && + dev->actconfig->desc.bNumInterfaces == QUECTEL_EC20_NINTERFACES) + return 1; + + return 0; +} + static int qmi_wwan_probe(struct usb_interface *intf, const struct usb_device_id *prod) { @@ -868,6 +886,12 @@ static int qmi_wwan_probe(struct usb_interface *intf, id->driver_info = (unsigned long)&qmi_wwan_info; } + /* Quectel EC20 quirk where we're fixing QMI iterface index from 0 to 4 */ + if (quectel_ec20_detected(intf)) { + dev_dbg(&intf->dev, "enabling Quectel EC20 interface quirk\n"); + id->bInterfaceNumber = QUECTEL_EC20_QMI_IFACE_FIX; + } + return usbnet_probe(intf, id); } -- ynezz -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] USB: qcserial: Add support for Quectel EC20 Mini PCIe module
Bjørn Mork [2015-11-03 13:37:56]: > I guess this means that we need to add an interface count quirk to the > qmi_wwan driver as well? I assume there are devices out there with the > same device ID, the same ff/ff/ff interface descriptors, but with > QMI/net on interface #0. Indeed, your guess is correct. Would something like proposed patch bellow get accepted? diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index f603f36..f018752 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c @@ -539,6 +539,26 @@ static const struct usb_device_id products[] = { USB_CDC_PROTO_NONE), .driver_info= (unsigned long)&qmi_wwan_info, }, + { /* Acer Gobi 2000 Modem device (VP413) */ + .match_flags = USB_DEVICE_ID_MATCH_DEVICE \ + | USB_DEVICE_ID_MATCH_INT_NUMBER \ + | USB_DEVICE_ID_MATCH_CFG_NINTERFACES, \ + .idVendor = 0x05c6, \ + .idProduct = 0x9215, \ + .bNumInterfaces = 4, \ + .bInterfaceNumber = 0, \ + .driver_info= (unsigned long)&qmi_wwan_info, + }, + { /* Quectel EC20 LTE Mini PCIe */ + .match_flags = USB_DEVICE_ID_MATCH_DEVICE \ + | USB_DEVICE_ID_MATCH_INT_NUMBER \ + | USB_DEVICE_ID_MATCH_CFG_NINTERFACES, \ + .idVendor = 0x05c6, \ + .idProduct = 0x9215, \ + .bNumInterfaces = 5, \ + .bInterfaceNumber = 4, \ + .driver_info= (unsigned long)&qmi_wwan_info, + }, /* 3. Combined interface devices matching on interface number */ {QMI_FIXED_INTF(0x0408, 0xea42, 4)},/* Yota / Megafon M100-1 */ @@ -814,7 +834,6 @@ static const struct usb_device_id products[] = { {QMI_GOBI_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */ {QMI_GOBI_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */ {QMI_GOBI_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */ - {QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */ {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */ {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */ {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */ diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 818369a..330e295 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -624,6 +624,12 @@ int usb_match_device(struct usb_device *dev, const struct usb_device_id *id) (id->bDeviceProtocol != dev->descriptor.bDeviceProtocol)) return 0; + if (id->match_flags & USB_DEVICE_ID_MATCH_CFG_NINTERFACES) { + if (dev->actconfig && + (id->bNumInterfaces != dev->actconfig->desc.bNumInterfaces)) + return 0; + } + return 1; } diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 3bfd567..660b3e5 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -121,6 +121,9 @@ struct usb_device_id { /* Used for vendor-specific interface matches */ __u8bInterfaceNumber; + /* Used for config descriptor matches */ + __u8bNumInterfaces; + /* not matched against */ kernel_ulong_t driver_info __attribute__((aligned(sizeof(kernel_ulong_t; @@ -138,6 +141,7 @@ struct usb_device_id { #define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100 #define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200 #define USB_DEVICE_ID_MATCH_INT_NUMBER 0x0400 +#define USB_DEVICE_ID_MATCH_CFG_NINTERFACES0x0800 #define HID_ANY_ID (~0) #define HID_BUS_ANY0x -- ynezz -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] USB: qcserial: Add support for Quectel EC20 Mini PCIe module
Bjørn Mork [2015-11-03 13:37:56]: > > + case 4: > > + /* Don't claim the QMI/net interface */ > > + altsetting = -1; > > + break; > > + } > > I guess this means that we need to add an interface count quirk to the > qmi_wwan driver as well? I assume there are devices out there with the > same device ID, the same ff/ff/ff interface descriptors, but with > QMI/net on interface #0. Well, I don't know, it's my first device with QMI interface and I'm not that far yet, currently just playing with AT and GPS/NMEA interfaces. > Could you post the complete lsusb output? I believe it is important to > document that for the future in case we have to redo this later. Which > is likely given the experiences so far - there might be other devices > using the same ID with yet another layout. Bus 002 Device 003: ID 05c6:9215 Qualcomm, Inc. Acer Gobi 2000 Wireless Modem Device Descriptor: bLength18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize064 idVendor 0x05c6 Qualcomm, Inc. idProduct 0x9215 Acer Gobi 2000 Wireless Modem bcdDevice2.32 iManufacturer 1 Quectel iProduct2 Quectel LTE Module iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 209 bNumInterfaces 5 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xa0 (Bus Powered) Remote Wakeup MaxPower 500mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 255 Vendor Specific Class bInterfaceSubClass255 Vendor Specific Subclass bInterfaceProtocol255 Vendor Specific Protocol iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes2 Transfer TypeBulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes2 Transfer TypeBulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber1 bAlternateSetting 0 bNumEndpoints 3 bInterfaceClass 255 Vendor Specific Class bInterfaceSubClass 0 bInterfaceProtocol 0 iInterface 0 ** UNRECOGNIZED: 05 24 00 10 01 ** UNRECOGNIZED: 05 24 01 00 00 ** UNRECOGNIZED: 04 24 02 02 ** UNRECOGNIZED: 05 24 06 00 00 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x83 EP 3 IN bmAttributes3 Transfer TypeInterrupt Synch Type None Usage Type Data wMaxPacketSize 0x000a 1x 10 bytes bInterval 9 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x82 EP 2 IN bmAttributes2 Transfer TypeBulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x02 EP 2 OUT bmAttributes2 Transfer TypeBulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber2 bAlternateSetting 0 bNumEndpoints 3 bInterfaceClass 255 Vendor Specific Class bInterfaceSubClass 0 bInterfaceProtocol 0 iInterface 0 ** UNRECOGNIZED: 05 24 00 10 01 ** UNRECOGNIZED: 05 24 01 00 00 ** UNRECOGNIZED: 04 24 02 02 ** UNRECOGNIZED: 05 24 06 00 00 Endpoint Desc
[PATCH] USB: qcserial: Add support for Quectel EC20 Mini PCIe module
It seems like this device has same vendor and product IDs as G2K devices, but it has different number of interfaces(4 vs 5) and also different interface layout which makes it currently unusable: usbcore: registered new interface driver qcserial usbserial: USB Serial support registered for Qualcomm USB modem usb 2-1.2: unknown number of interfaces: 5 lsusb output: Bus 002 Device 003: ID 05c6:9215 Qualcomm, Inc. Acer Gobi 2000 Wireless Device Descriptor: bLength18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize064 idVendor 0x05c6 Qualcomm, Inc. idProduct 0x9215 Acer Gobi 2000 Wireless Modem bcdDevice2.32 iManufacturer 1 Quectel iProduct2 Quectel LTE Module iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 209 bNumInterfaces 5 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xa0 (Bus Powered) Remote Wakeup MaxPower 500mA Signed-off-by: Petr Štetiar --- drivers/usb/serial/qcserial.c | 39 +++ 1 file changed, 39 insertions(+) diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c index ebcec8c..d462132 100644 --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c @@ -22,6 +22,8 @@ #define DRIVER_AUTHOR "Qualcomm Inc" #define DRIVER_DESC "Qualcomm USB Serial driver" +#define QUECTEL_EC20_IDPRODUCT 0x9215 + /* standard device layouts supported by this driver */ enum qcserial_layouts { QCSERIAL_G2K = 0, /* Gobi 2000 */ @@ -167,6 +169,38 @@ static const struct usb_device_id id_table[] = { }; MODULE_DEVICE_TABLE(usb, id_table); +static int handle_quectel_ec20(struct device *dev, int ifnum) +{ + int altsetting = 0; + + /* +* Quectel EC20 Mini PCIe LTE module layout: +* 0: DM/DIAG (use libqcdm from ModemManager for communication) +* 1: NMEA +* 2: AT-capable modem port +* 3: Modem interface +* 4: NDIS +*/ + switch (ifnum) { + case 0: + dev_dbg(dev, "Quectel EC20 DM/DIAG interface found\n"); + break; + case 1: + dev_dbg(dev, "Quectel EC20 NMEA GPS interface found\n"); + break; + case 2: + case 3: + dev_dbg(dev, "Quectel EC20 Modem port found\n"); + break; + case 4: + /* Don't claim the QMI/net interface */ + altsetting = -1; + break; + } + + return altsetting; +} + static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) { struct usb_host_interface *intf = serial->interface->cur_altsetting; @@ -235,6 +269,11 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) altsetting = -1; break; case QCSERIAL_G2K: + if (nintf == 5 && id->idProduct == QUECTEL_EC20_IDPRODUCT) { + altsetting = handle_quectel_ec20(dev, ifnum); + goto done; + } + /* * Gobi 2K+ USB layout: * 0: QMI/net -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html