• Bjørn Mork's avatar
    USB: serial: option: fix Quectel BG96 matching · c98fff73
    Bjørn Mork authored
    This is a partial revert of commit 2bb70f0a ("USB: serial:
    option: support dynamic Quectel USB compositions")
    
    The Quectel BG96 is different from most other modern Quectel modems,
    having serial functions with 3 endpoints using ff/ff/ff and ff/fe/ff
    class/subclass/protocol. Including it in the change to accommodate
    dynamic function mapping was incorrect.
    
    Revert to interface number matching for the BG96, assuming static
    layout of the RMNET function on interface 4. This restores support
    for the serial functions on interfaces 2 and 3.
    
    Full lsusb output for the BG96:
    
    Bus 002 Device 003: ID 2c7c:0296
    Device Descriptor:
     bLength                18
     bDescriptorType         1
     bcdUSB               2.00
     bDeviceClass            0 (Defined at Interface level)
     bDeviceSubClass         0
     bDeviceProtocol         0
     bMaxPacketSize0        64
     idVendor           0x2c7c
     idProduct          0x0296
     bcdDevice            0.00
     iManufacturer           3 Qualcomm, Incorporated
     iProduct                2 Qualcomm CDMA Technologies MSM
     iSerial                 4 d1098243
     bNumConfigurations      1
     Configuration Descriptor:
       bLength                 9
       bDescriptorType         2
       wTotalLength          145
       bNumInterfaces          5
       bConfigurationValue     1
       iConfiguration          1 Qualcomm Configuration
       bmAttributes         0xe0
         Self Powered
         Remote Wakeup
       MaxPower              500mA
       Interface Descriptor:
         bLength                 9
         bDescriptorType         4
         bInterfaceNumber        0
         bAlternateSetting       0
         bNumEndpoints           2
         bInterfaceClass       255 Vendor Specific Class
         bInterfaceSubClass    255 Vendor Specific Subclass
         bInterfaceProtocol    255 Vendor Specific Protocol
         iInterface              0
         Endpoint Descriptor:
           bLength                 7
           bDescriptorType         5
           bEndpointAddress     0x81  EP 1 IN
           bmAttributes            2
             Transfer Type            Bulk
             Synch Type               None
             Usage Type               Data
           wMaxPacketSize     0x0200  1x 512 bytes
           bInterval               0
         Endpoint Descriptor:
           bLength                 7
           bDescriptorType         5
           bEndpointAddress     0x01  EP 1 OUT
           bmAttributes            2
             Transfer Type            Bulk
             Synch Type               None
             Usage Type               Data
           wMaxPacketSize     0x0200  1x 512 bytes
           bInterval               0
       Interface Descriptor:
         bLength                 9
         bDescriptorType         4
         bInterfaceNumber        1
         bAlternateSetting       0
         bNumEndpoints           2
         bInterfaceClass       255 Vendor Specific Class
         bInterfaceSubClass    255 Vendor Specific Subclass
         bInterfaceProtocol    255 Vendor Specific Protocol
         iInterface              0
         Endpoint Descriptor:
           bLength                 7
           bDescriptorType         5
           bEndpointAddress     0x82  EP 2 IN
           bmAttributes            2
             Transfer Type            Bulk
             Synch Type               None
             Usage Type               Data
           wMaxPacketSize     0x0200  1x 512 bytes
           bInterval               0
         Endpoint Descriptor:
           bLength                 7
           bDescriptorType         5
           bEndpointAddress     0x02  EP 2 OUT
           bmAttributes            2
             Transfer Type            Bulk
             Synch Type               None
             Usage Type               Data
           wMaxPacketSize     0x0200  1x 512 bytes
           bInterval               0
       Interface Descriptor:
         bLength                 9
         bDescriptorType         4
         bInterfaceNumber        2
         bAlternateSetting       0
         bNumEndpoints           3
         bInterfaceClass       255 Vendor Specific Class
         bInterfaceSubClass    255 Vendor Specific Subclass
         bInterfaceProtocol    255 Vendor Specific Protocol
         iInterface              0
         Endpoint Descriptor:
           bLength                 7
           bDescriptorType         5
           bEndpointAddress     0x83  EP 3 IN
           bmAttributes            3
             Transfer Type            Interrupt
             Synch Type               None
             Usage Type               Data
           wMaxPacketSize     0x0040  1x 64 bytes
           bInterval               5
         Endpoint Descriptor:
           bLength                 7
           bDescriptorType         5
           bEndpointAddress     0x84  EP 4 IN
           bmAttributes            2
             Transfer Type            Bulk
             Synch Type               None
             Usage Type               Data
           wMaxPacketSize     0x0200  1x 512 bytes
           bInterval               0
         Endpoint Descriptor:
           bLength                 7
           bDescriptorType         5
           bEndpointAddress     0x03  EP 3 OUT
           bmAttributes            2
             Transfer Type            Bulk
             Synch Type               None
             Usage Type               Data
           wMaxPacketSize     0x0200  1x 512 bytes
           bInterval               0
       Interface Descriptor:
         bLength                 9
         bDescriptorType         4
         bInterfaceNumber        3
         bAlternateSetting       0
         bNumEndpoints           3
         bInterfaceClass       255 Vendor Specific Class
         bInterfaceSubClass    254
         bInterfaceProtocol    255
         iInterface              0
         Endpoint Descriptor:
           bLength                 7
           bDescriptorType         5
           bEndpointAddress     0x85  EP 5 IN
           bmAttributes            3
             Transfer Type            Interrupt
             Synch Type               None
             Usage Type               Data
           wMaxPacketSize     0x0040  1x 64 bytes
           bInterval               5
         Endpoint Descriptor:
           bLength                 7
           bDescriptorType         5
           bEndpointAddress     0x86  EP 6 IN
           bmAttributes            2
             Transfer Type            Bulk
             Synch Type               None
             Usage Type               Data
           wMaxPacketSize     0x0200  1x 512 bytes
           bInterval               0
         Endpoint Descriptor:
           bLength                 7
           bDescriptorType         5
           bEndpointAddress     0x04  EP 4 OUT
           bmAttributes            2
             Transfer Type            Bulk
             Synch Type               None
             Usage Type               Data
           wMaxPacketSize     0x0200  1x 512 bytes
           bInterval               0
       Interface Descriptor:
         bLength                 9
         bDescriptorType         4
         bInterfaceNumber        4
         bAlternateSetting       0
         bNumEndpoints           3
         bInterfaceClass       255 Vendor Specific Class
         bInterfaceSubClass    255 Vendor Specific Subclass
         bInterfaceProtocol    255 Vendor Specific Protocol
         iInterface              0
         Endpoint Descriptor:
           bLength                 7
           bDescriptorType         5
           bEndpointAddress     0x87  EP 7 IN
           bmAttributes            3
             Transfer Type            Interrupt
             Synch Type               None
             Usage Type               Data
           wMaxPacketSize     0x0040  1x 64 bytes
           bInterval               5
         Endpoint Descriptor:
           bLength                 7
           bDescriptorType         5
           bEndpointAddress     0x88  EP 8 IN
           bmAttributes            2
             Transfer Type            Bulk
             Synch Type               None
             Usage Type               Data
           wMaxPacketSize     0x0200  1x 512 bytes
           bInterval               0
         Endpoint Descriptor:
           bLength                 7
           bDescriptorType         5
           bEndpointAddress     0x05  EP 5 OUT
           bmAttributes            2
             Transfer Type            Bulk
             Synch Type               None
             Usage Type               Data
           wMaxPacketSize     0x0200  1x 512 bytes
           bInterval               0
    Device Qualifier (for other device speed):
     bLength                10
     bDescriptorType         6
     bcdUSB               2.00
     bDeviceClass            0 (Defined at Interface level)
     bDeviceSubClass         0
     bDeviceProtocol         0
     bMaxPacketSize0        64
     bNumConfigurations      1
    Device Status:     0x0000
     (Bus Powered)
    
    Cc: Sebastian Sjoholm <sebastian.sjoholm@gmail.com>
    Fixes: 2bb70f0a ("USB: serial: option: support dynamic Quectel USB compositions")
    Signed-off-by: default avatarBjørn Mork <bjorn@mork.no>
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
    c98fff73
option.c 125 KB