There seem to be an "infinite" number of these devices.  Replacing
the individual device entry with a vendor rule to catch them all,
adding a safeguard test to the probe function in case the same
vendor ID is used for e.g. RNDIS devices.

This adds support for the Huawei E5331 and an unknown number of
similar devices.

Cc: stable <stable@vger.kernel.org>
Signed-off-by: Bjørn Mork <bj...@mork.no>
---
 drivers/usb/serial/option.c |   18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index f7d339d..0ee8b8d 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -578,18 +578,15 @@ static const struct usb_device_id option_ids[] = {
        { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLE) },
        { USB_DEVICE(QUANTA_VENDOR_ID, 0xea42),
                .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
-       { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c05, 
USB_CLASS_COMM, 0x02, 0xff) },
-       { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c23, 
USB_CLASS_COMM, 0x02, 0xff) },
        { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173, 
0xff, 0xff, 0xff),
                .driver_info = (kernel_ulong_t) &net_intf1_blacklist },
-       { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1441, 
USB_CLASS_COMM, 0x02, 0xff) },
-       { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1442, 
USB_CLASS_COMM, 0x02, 0xff) },
        { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 
0xff, 0xff, 0xff),
                .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
        { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 
0xff, 0xff, 0xff),
                .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
        { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 
0xff, 0xff, 0xff),
                .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
+       { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_COMM, 0x02, 
0xff) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0xff, 0xff) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x01) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x02) },
@@ -1447,6 +1444,19 @@ static int option_probe(struct usb_serial *serial,
            iface_desc->bInterfaceClass != USB_CLASS_CDC_DATA)
                return -ENODEV;
 
+       /*
+        * CDC ACM with vendor specific protocol may signify RNDIS or
+        * serial or something else.  A number of Huawei devices use
+        * it for serial functions having only 2 endpoints, which
+        * cannot possibly be RNDIS or supported by the cdc-acm driver.
+        */
+       if (dev_desc->idVendor == cpu_to_le16(HUAWEI_VENDOR_ID) &&
+           iface_desc->bInterfaceClass == USB_CLASS_COMM &&
+           iface_desc->bInterfaceSubClass == 0x02 &&
+           iface_desc->bInterfaceProtocol == 0xff &&
+           iface_desc->bNumEndpoints != 2)
+               return -ENODEV;
+
        /* Store device id so we can use it during attach. */
        usb_set_serial_data(serial, (void *)id);
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe stable" 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