Bjørn Mork <bj...@mork.no> [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

Reply via email to