Re: [PATCH] USB: qmi_wwan: Add quirk for Quectel EC20 Mini PCIe module

2015-11-05 Thread Petr Štetiar
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] USB: qmi_wwan: Add quirk for Quectel EC20 Mini PCIe module

2015-11-05 Thread Petr Štetiar
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 = >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)_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(>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: qmi_wwan: Add quirk for Quectel EC20 Mini PCIe module

2015-11-05 Thread Bjørn Mork
Petr Štetiar  writes:

> 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;
> +}

make this function return bool.  And the patch should go to netdev.
With those changes it looks good to me.  But I haven't tested it, so I
trust your testing :)


Bjørn
--
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