On Tue, 2016-11-15 at 20:13 +0100, Giuseppe Lippolis wrote:
> Dear all,
> I'm porting the Dlink DWR-512 device to LEDE (embedded linux).
> This device embed a 3G modem connected through the usb bus .
> The modem work properly with the option kernel module.
> 
> I added these line in the 
> 
>       #define DLINK_PRODUCT_DWM_652                  0x3e04
>       #define DLINK_PRODUCT_DWM_652_U5          0xce16
>       #define DLINK_PRODUCT_DWM_652_U5A       0xce1e
> 
> +     #define DLINK_ATL_VENDOR_ID                             0x20
> 01
> +     #define DLINK_PRODUCT_DWM_158                  0x7d04
> 
>       #define QISDA_VENDOR_ID                         0x1da5
>       #define QISDA_PRODUCT_H21_4512                          0x4512
> 
> [...]
> 
>         { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5) }, /*
> Yes,
> ALINK_VENDOR_ID */
>         { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5A) },
> +     { USB_DEVICE(DLINK_ATL_VENDOR_ID, DLINK_PRODUCT_DWM_158) },

This will make option grab all the ports, as shown by your dmesg
output.  But USB interfaces 0 and 1 are actually cdc-ether and should
*not* be grabbed by option.

You want to limit option to grabbing bInterfaceClass=255 to make sure
it only gets the serial ports.

Dan

>         { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4512) },
>         { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4523) },
> 
> And at the end the system work as expected:
> 
> [   11.659320] usbcore: registered new interface driver usbserial
> [   11.671412] usbcore: registered new interface driver
> usbserial_generic
> [   11.684835] usbserial: USB Serial support registered for generic
> [   11.739752] xt_time: kernel timezone is -0000
> [   11.865508] PPP generic driver version 2.4.2
> [   11.880069] NET: Registered protocol family 24
> [   11.919594] usbcore: registered new interface driver option
> [   11.931155] usbserial: USB Serial support registered for GSM modem
> (1-port)
> [   11.945724] option 1-1:1.0: no of_node; not parsing pinctrl DT
> [   11.946566] option 1-1:1.0: GSM modem (1-port) converter detected
> [   11.959201] option1 ttyUSB0: no of_node; not parsing pinctrl DT
> [   11.959661] option 1-1:1.1: no of_node; not parsing pinctrl DT
> [   11.960472] option 1-1:1.1: GSM modem (1-port) converter detected
> [   11.973103] option1 ttyUSB1: no of_node; not parsing pinctrl DT
> [   11.973542] option 1-1:1.2: no of_node; not parsing pinctrl DT
> [   11.974347] option 1-1:1.2: GSM modem (1-port) converter detected
> [   11.986980] option1 ttyUSB2: no of_node; not parsing pinctrl DT
> [   11.987462] usb 1-1: GSM modem (1-port) converter now attached to
> ttyUSB2
> [   12.001470] option 1-1:1.3: no of_node; not parsing pinctrl DT
> [   12.002354] option 1-1:1.3: GSM modem (1-port) converter detected
> [   12.015005] option1 ttyUSB3: no of_node; not parsing pinctrl DT
> [   12.015479] usb 1-1: GSM modem (1-port) converter now attached to
> ttyUSB3
> [   12.029487] option 1-1:1.4: no of_node; not parsing pinctrl DT
> [   12.030327] option 1-1:1.4: GSM modem (1-port) converter detected
> [   12.042978] option1 ttyUSB4: no of_node; not parsing pinctrl DT
> [   12.043463] usb 1-1: GSM modem (1-port) converter now attached to
> ttyUSB4
> [   12.057468] option 1-1:1.5: no of_node; not parsing pinctrl DT
> [   12.058395] option 1-1:1.5: GSM modem (1-port) converter detected
> [   12.070971] option1 ttyUSB5: no of_node; not parsing pinctrl DT
> [   12.071482] usb 1-1: GSM modem (1-port) converter now attached to
> ttyUSB5
> [   12.085484] option 1-1:1.6: no of_node; not parsing pinctrl DT
> 
> 
> Here the relevant lsusb info:
> 
> Bus 001 Device 002: ID 2001:7d04 D-Link Corp. 
> Device Descriptor:
>   bLength                18
>   bDescriptorType         1
>   bcdUSB               2.00
>   bDeviceClass            2 Communications
>   bDeviceSubClass         0 
>   bDeviceProtocol         0 
>   bMaxPacketSize0        64
>   idVendor           0x2001 D-Link Corp.
>   idProduct          0x7d04 
>   bcdDevice            3.00
>   iManufacturer          10 D-Link,Inc  
>   iProduct               11 D-Link DWM-158
>   iSerial                 0 
>   bNumConfigurations      1
>   Configuration Descriptor:
>     bLength                 9
>     bDescriptorType         2
>     wTotalLength          229
>     bNumInterfaces          7
>     bConfigurationValue     1
>     iConfiguration          0 
>     bmAttributes         0xa0
>       (Bus Powered)
>       Remote Wakeup
>     MaxPower              500mA
>     Interface Association:
>       bLength                 8
>       bDescriptorType        11
>       bFirstInterface         0
>       bInterfaceCount         2
>       bFunctionClass          2 Communications
>       bFunctionSubClass       6 Ethernet Networking
>       bFunctionProtocol       0 
>       iFunction               2 COM(comm_if)
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        0
>       bAlternateSetting       0
>       bNumEndpoints           1
>       bInterfaceClass         2 Communications
>       bInterfaceSubClass      6 Ethernet Networking
>       bInterfaceProtocol      0 
>       iInterface              2 COM(comm_if)
>       CDC Header:
>         bcdCDC               1.10
>       CDC Union:
>         bMasterInterface        0
>         bSlaveInterface         1 
>       CDC Ethernet:
>         iMacAddress                      1 0200FFAAAAAA
>         bmEthernetStatistics    0x7f180000
>         wMaxSegmentSize               1514
>         wNumberMCFilters            0x0000
>         bNumberPowerFilters             16
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x88  EP 8 IN
>         bmAttributes            3
>           Transfer Type            Interrupt
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0040  1x 64 bytes
>         bInterval               1
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        1
>       bAlternateSetting       0
>       bNumEndpoints           0
>       bInterfaceClass        10 CDC Data
>       bInterfaceSubClass      0 Unused
>       bInterfaceProtocol      0 
>       iInterface              3 COM(data_if)
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        1
>       bAlternateSetting       1
>       bNumEndpoints           2
>       bInterfaceClass        10 CDC Data
>       bInterfaceSubClass      0 Unused
>       bInterfaceProtocol      0 
>       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        2
>       bAlternateSetting       0
>       bNumEndpoints           3
>       bInterfaceClass       255 Vendor Specific Class
>       bInterfaceSubClass      2 
>       bInterfaceProtocol      1 
>       iInterface              4 COM(comm_if)
>       ** UNRECOGNIZED:  05 24 00 10 01
>       ** UNRECOGNIZED:  04 24 02 0f
>       ** UNRECOGNIZED:  05 24 06 02 03
>       ** UNRECOGNIZED:  05 24 01 03 03
>       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               1
>       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        3
>       bAlternateSetting       0
>       bNumEndpoints           2
>       bInterfaceClass       255 Vendor Specific Class
>       bInterfaceSubClass      0 
>       bInterfaceProtocol      0 
>       iInterface              6 COM(data_if)
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x83  EP 3 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        4
>       bAlternateSetting       0
>       bNumEndpoints           2
>       bInterfaceClass       255 Vendor Specific Class
>       bInterfaceSubClass      0 
>       bInterfaceProtocol      0 
>       iInterface              7 COM(data_if)
>       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     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        5
>       bAlternateSetting       0
>       bNumEndpoints           2
>       bInterfaceClass       255 Vendor Specific Class
>       bInterfaceSubClass      0 
>       bInterfaceProtocol      0 
>       iInterface              8 COM(data_if)
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x85  EP 5 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
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        6
>       bAlternateSetting       0
>       bNumEndpoints           2
>       bInterfaceClass         8 Mass Storage
>       bInterfaceSubClass      6 SCSI
>       bInterfaceProtocol     80 Bulk-Only
>       iInterface              9 Mass Storage 
>       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     0x06  EP 6 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            2 Communications
>   bDeviceSubClass         0 
>   bDeviceProtocol         0 
>   bMaxPacketSize0        64
>   bNumConfigurations      1
> Device Status:     0x0002
>   (Bus Powered)
>   Remote Wakeup Enabled
> 
> 
> Is it possible to register the device in the option.c code?
> 
> Regards.
> 
> 
> --
> 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
--
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