Commit cc2526f1 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

USB: serial: option: add two-endpoints device-id flag

commit 35aecc02 upstream

Allow matching on interfaces having two endpoints by adding a new
device-id flag.

This allows for the handling of devices whose interface numbers can
change (e.g. Quectel EP06) to be contained in the device-id table.

The upstream commit removes a variable that is still in use in the 4.14
version of the option-driver, so the removal is undone.
Tested-by: default avatarKristian Evensen <kristian.evensen@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Signed-off-by: default avatarKristian Evensen <kristian.evensen@gmail.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 86534d3d
...@@ -564,6 +564,9 @@ static void option_instat_callback(struct urb *urb); ...@@ -564,6 +564,9 @@ static void option_instat_callback(struct urb *urb);
/* Interface is reserved */ /* Interface is reserved */
#define RSVD(ifnum) ((BIT(ifnum) & 0xff) << 0) #define RSVD(ifnum) ((BIT(ifnum) & 0xff) << 0)
/* Interface must have two endpoints */
#define NUMEP2 BIT(16)
static const struct usb_device_id option_ids[] = { static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
...@@ -1085,7 +1088,7 @@ static const struct usb_device_id option_ids[] = { ...@@ -1085,7 +1088,7 @@ static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96),
.driver_info = RSVD(4) }, .driver_info = RSVD(4) },
{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff), { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff),
.driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) }, .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 },
{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) },
{ USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
{ USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) }, { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
...@@ -2012,16 +2015,11 @@ static int option_probe(struct usb_serial *serial, ...@@ -2012,16 +2015,11 @@ static int option_probe(struct usb_serial *serial,
return -ENODEV; return -ENODEV;
/* /*
* Don't bind to the QMI device of the Quectel EP06/EG06/EM06. Class, * Allow matching on bNumEndpoints for devices whose interface numbers
* subclass and protocol is 0xff for both the diagnostic port and the * can change (e.g. Quectel EP06).
* QMI interface, but the diagnostic port only has two endpoints (QMI
* has three).
*/ */
if (dev_desc->idVendor == cpu_to_le16(QUECTEL_VENDOR_ID) && if (device_flags & NUMEP2 && iface_desc->bNumEndpoints != 2)
dev_desc->idProduct == cpu_to_le16(QUECTEL_PRODUCT_EP06) &&
iface_desc->bInterfaceSubClass && iface_desc->bNumEndpoints == 3) {
return -ENODEV; return -ENODEV;
}
/* Store the device flags so we can use them during attach. */ /* Store the device flags so we can use them during attach. */
usb_set_serial_data(serial, (void *)device_flags); usb_set_serial_data(serial, (void *)device_flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment