Re: [PATCH] USB: qcserial: Add support for Quectel EC20 Mini PCIe module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Bjørn Mork <bjorn@xxxxxxx> [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 */
 	__u8		bInterfaceNumber;
 
+	/* Used for config descriptor matches */
+	__u8		bNumInterfaces;
+
 	/* 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_NINTERFACES	0x0800
 
 #define HID_ANY_ID				(~0)
 #define HID_BUS_ANY				0xffff

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



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux