You are not logged in.

#1 2012-06-26 11:58:33

llg179
Member
Registered: 2012-03-04
Posts: 12

usbnet bad CDC descriptors cdc_ether

Hello,

I would like to connect my motoroal a780 with usb net.
First I connect the phone and lsusb recognizes it as

Bus 002 Device 007: ID 22b8:3802 Motorola PCS C330/C350L/C450/EZX GSM Phone (AT)

Following appears in dmesg:

[  371.968710] usb 2-1: new full-speed USB device number 7 using ohci_hcd
[  372.179725] cdc_acm 2-1:1.0: ttyACM0: USB ACM device

Then I change phone's configuration to use usbnet and lsusb lists phone as:

Bus 002 Device 008: ID 22b8:600c Motorola PCS EZX GSM Phone (USBLAN)

Following appears in dmesg:

[  515.635829] usb 2-1: USB disconnect, device number 7
[  516.261647] usb 2-1: new full-speed USB device number 8 using ohci_hcd
[  516.472456] usb 2-1: bad CDC descriptors

lsusb -v shows:

Bus 002 Device 015: ID 22b8:600c Motorola PCS EZX GSM Phone (USBLAN)
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            2 Communications
  bDeviceSubClass         2 Abstract (modem)
  bDeviceProtocol         0 None
  bMaxPacketSize0        16
  idVendor           0x22b8 Motorola PCS
  idProduct          0x600c EZX GSM Phone (USBLAN)
  bcdDevice            0.00
  iManufacturer           3 Motorola
  iProduct                4 Motorola USBLAN
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           92
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          5 BLAN Net Cfg
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass         2 Communications
      bInterfaceSubClass     10 Mobile Direct Line
      bInterfaceProtocol      0 
      iInterface              6 Comm/Data Intf
      CDC Header:
        bcdCDC               1.10
      CDC MDLM:
        bcdCDC               1.00
        bGUID               {74f03dbd-1ec1-4470-a367-7134c9f55437}
      CDC MDLM detail:
        bGuidDescriptorType  01
        bDetailData          00 01 00
      CDC Ethernet:
        iMacAddress                      1 de5122adc912
        bmEthernetStatistics    0x00000000
        wMaxSegmentSize               1514
        wNumberMCFilters            0x0000
        bNumberPowerFilters              0
      Network Channel Terminal:
        bEntityId                 0
        iName                     2 (none)
        bChannelIndex             0
        bPhysicalInterface        0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval              10
Device Status:     0x0001
  Self Powered

Loaded modules:

lsmod | grep usbnet
usbnet                 13158  1 cdc_ether
mii                     3439  1 usbnet
usbcore               123297  7 ohci_hcd,ehci_hcd,usbhid,usbnet,cdc_acm,cdc_ether

I installed 3.4.4-2-ARCH kernel with pacman.
ip addr show lists lo and eth0 but usb0 does not appear.
Could anyone help please?

Last edited by llg179 (2012-06-26 12:02:42)

Offline

#2 2012-06-27 14:45:56

pigiron
Member
From: USA
Registered: 2009-07-14
Posts: 150

Re: usbnet bad CDC descriptors cdc_ether

[  516.472456] usb 2-1: bad CDC descriptors

I poked around the kernel looking for what might cause that message. I'm now thinking that we'll see how bad you want to use that Motorola.

If you grab the kernel source code for the kernel you're running, and look at the drivers/net/usb/cdc_ether.c file, you'll see that error message is coming from the usbnet_generic_cdc_bind() function. Notice that there appear to be a few "quirks" in that function to handle unusual cases that some devices present. Perhaps your phone is in need of a new "quirk".

Also, notice that there's many places in that function that can cause that message to appear (all those "goto bad_desc" lines). The good news is that most (but not all) of them will put something in the logs if the kernel is configured to do so.

So... I'm guessing that if you recompile the kernel, and enable CONFIG_DYNAMIC_DEBUG and then read about how to use it, you just might find the spot that's causing the error. You can learn about using dynamic debug by reading the Documentation/dynamic-debug-howto.txt file in the kernel source.

While doing all that is a major pain, it's probably something the kernel developers would ask you to do anyway if they were responding to a kernel bug report... and if you can get this fixed, you'll be helping all the other users of that phone. It's those kind of determined users that probably caused all those existing "quirks" to be created.

Good luck.

Offline

#3 2012-06-28 22:40:51

llg179
Member
Registered: 2012-03-04
Posts: 12

Re: usbnet bad CDC descriptors cdc_ether

dmesg part of connection usb:

[  628.942579] hub 1-0:1.0: state 7 ports 9 chg 0000 evt 0002
[  628.942608] ehci_hcd 0000:00:02.1: GetStatus port:1 status 001803 0  ACK POWER sig=j CSC CONNECT
[  628.942625] hub 1-0:1.0: port 1, status 0501, change 0001, 480 Mb/s
[  629.061111] hub 1-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x501
[  629.114477] ehci_hcd 0000:00:02.1: port 1 full speed --> companion
[  629.114496] ehci_hcd 0000:00:02.1: GetStatus port:1 status 003001 0  ACK POWER OWNER sig=se0 CONNECT
[  629.114543] hub 1-0:1.0: port 1 not reset yet, waiting 50ms
[  629.114556] usb usb2: usb wakeup-resume
[  629.114565] usb usb2: usb auto-resume
[  629.124391] ohci_hcd 0000:00:02.0: wakeup root hub
[  629.167759] ehci_hcd 0000:00:02.1: GetStatus port:1 status 003802 0  ACK POWER OWNER sig=j CSC
[  629.167798] hub 1-0:1.0: state 7 ports 9 chg 0000 evt 0002
[  629.194391] hub 2-0:1.0: hub_resume
[  629.194414] ohci_hcd 0000:00:02.0: GetStatus roothub.portstatus [0] = 0x00010101 CSC PPS CCS
[  629.194428] hub 2-0:1.0: port 1: status 0101 change 0001
[  629.297762] hub 2-0:1.0: state 7 ports 9 chg 0002 evt 0000
[  629.297790] hub 2-0:1.0: port 1, status 0101, change 0000, 12 Mb/s
[  629.404401] ohci_hcd 0000:00:02.0: GetStatus roothub.portstatus [0] = 0x00100103 PRSC PPS PES CCS
[  629.457719] usb 2-1: new full-speed USB device number 6 using ohci_hcd
[  629.564368] ohci_hcd 0000:00:02.0: GetStatus roothub.portstatus [0] = 0x00100103 PRSC PPS PES CCS
[  629.634348] usb 2-1: ep0 maxpacket = 16
[  629.651062] usb 2-1: skipped 4 descriptors after interface
[  629.654047] usb 2-1: default language 0x0409
[  629.660056] usb 2-1: udev 6, busnum 2, minor = 133
[  629.660065] usb 2-1: New USB device found, idVendor=22b8, idProduct=3802
[  629.660074] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  629.660081] usb 2-1: Product: Motorola USB Modem
[  629.660086] usb 2-1: Manufacturer: Motorola
[  629.660342] usb 2-1: usb_probe_device
[  629.660350] usb 2-1: configuration #1 chosen from 1 choice
[  629.666055] usb 2-1: adding 2-1:1.0 (config #1, interface 0)
[  629.669118] cdc_acm 2-1:1.0: usb_probe_interface
[  629.669130] cdc_acm 2-1:1.0: usb_probe_interface - got id
[  629.669167] cdc_acm 2-1:1.0: ttyACM0: USB ACM device
[  629.675244] usb 2-1: adding 2-1:1.1 (config #1, interface 1)
[  629.678230] hub 2-0:1.0: state 7 ports 9 chg 0000 evt 0002

dmesg part after I changed phone's setting to usblan:

[  702.573962] hub 2-0:1.0: state 7 ports 9 chg 0000 evt 0002
[  702.574027] ohci_hcd 0000:00:02.0: GetStatus roothub.portstatus [0] = 0x00030100 PESC CSC PPS
[  702.574047] hub 2-0:1.0: port 1, status 0100, change 0003, 12 Mb/s
[  702.574055] usb 2-1: USB disconnect, device number 6
[  702.574062] usb 2-1: unregistering device
[  702.574068] usb 2-1: unregistering interface 2-1:1.0
[  702.574426] usb 2-1: unregistering interface 2-1:1.1
[  702.574554] usb 2-1: usb_disable_device nuking all URBs
[  702.697403] hub 2-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x100
[  702.697432] hub 1-0:1.0: state 7 ports 9 chg 0000 evt 0002
[  702.697452] ehci_hcd 0000:00:02.1: GetStatus port:1 status 001803 0  ACK POWER sig=j CSC CONNECT
[  702.697466] hub 1-0:1.0: port 1, status 0501, change 0001, 480 Mb/s
[  702.817388] hub 1-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x501
[  702.870710] ehci_hcd 0000:00:02.1: port 1 full speed --> companion
[  702.870726] ehci_hcd 0000:00:02.1: GetStatus port:1 status 003001 0  ACK POWER OWNER sig=se0 CONNECT
[  702.870764] hub 1-0:1.0: port 1 not reset yet, waiting 50ms
[  702.924038] ehci_hcd 0000:00:02.1: GetStatus port:1 status 003802 0  ACK POWER OWNER sig=j CSC
[  702.924078] hub 2-0:1.0: state 7 ports 9 chg 0000 evt 0002
[  702.924093] ohci_hcd 0000:00:02.0: GetStatus roothub.portstatus [0] = 0x00010101 CSC PPS CCS
[  702.924105] hub 2-0:1.0: port 1, status 0101, change 0001, 12 Mb/s
[  703.044021] hub 2-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x101
[  703.150669] ohci_hcd 0000:00:02.0: GetStatus roothub.portstatus [0] = 0x00100103 PRSC PPS PES CCS
[  703.203994] usb 2-1: new full-speed USB device number 7 using ohci_hcd
[  703.310646] ohci_hcd 0000:00:02.0: GetStatus roothub.portstatus [0] = 0x00100103 PRSC PPS PES CCS
[  703.380622] usb 2-1: ep0 maxpacket = 16
[  703.397710] usb 2-1: skipped 5 descriptors after interface
[  703.400674] usb 2-1: default language 0x0409
[  703.406704] usb 2-1: udev 7, busnum 2, minor = 134
[  703.406713] usb 2-1: New USB device found, idVendor=22b8, idProduct=600c
[  703.406721] usb 2-1: New USB device strings: Mfr=3, Product=4, SerialNumber=0
[  703.406728] usb 2-1: Product: Motorola USBLAN
[  703.406733] usb 2-1: Manufacturer: Motorola
[  703.406988] usb 2-1: usb_probe_device
[  703.406996] usb 2-1: configuration #1 chosen from 1 choice
[  703.412702] usb 2-1: adding 2-1:1.0 (config #1, interface 0)
[  703.415778] cdc_ether 2-1:1.0: usb_probe_interface
[  703.415788] cdc_ether 2-1:1.0: usb_probe_interface - got id
[  703.415819] usb 2-1: bad CDC descriptors
[  703.416026] hub 1-0:1.0: state 7 ports 9 chg 0000 evt 0002
[  703.416046] hub 2-0:1.0: state 7 ports 9 chg 0000 evt 0002

I added following line to /etc/fstab:

debugfs /sys/kernel/debug debugfs 0 0

then

 mount debugfs 
cat /sys/kernel/debug/dynamic_debug/control | grep cdc_ether
drivers/net/usb/cdc_ether.c:334 [cdc_ether]usbnet_generic_cdc_bind =_ "missing RNDIS status endpoint\012"
drivers/net/usb/cdc_ether.c:329 [cdc_ether]usbnet_generic_cdc_bind =_ "bad notification endpoint\012"
drivers/net/usb/cdc_ether.c:300 [cdc_ether]usbnet_generic_cdc_bind =_ "missing cdc %s%s%sdescriptor\012"
drivers/net/usb/cdc_ether.c:292 [cdc_ether]usbnet_generic_cdc_bind =_ "rndis: master #0/%p slave #1/%p\012"
drivers/net/usb/cdc_ether.c:259 [cdc_ether]usbnet_generic_cdc_bind =_ "extra MDLM detail descriptor\012"
drivers/net/usb/cdc_ether.c:245 [cdc_ether]usbnet_generic_cdc_bind =_ "extra MDLM descriptor\012"
drivers/net/usb/cdc_ether.c:234 [cdc_ether]usbnet_generic_cdc_bind =_ "CDC ether len %u\012"
drivers/net/usb/cdc_ether.c:228 [cdc_ether]usbnet_generic_cdc_bind =_ "extra CDC ether\012"
drivers/net/usb/cdc_ether.c:222 [cdc_ether]usbnet_generic_cdc_bind =_ "slave class %u\012"
drivers/net/usb/cdc_ether.c:207 [cdc_ether]usbnet_generic_cdc_bind =_ "bogus CDC Union\012"
drivers/net/usb/cdc_ether.c:198 [cdc_ether]usbnet_generic_cdc_bind =_ "master #%u/%p slave #%u/%p\012"
drivers/net/usb/cdc_ether.c:180 [cdc_ether]usbnet_generic_cdc_bind =_ "CDC union len %u\012"
drivers/net/usb/cdc_ether.c:174 [cdc_ether]usbnet_generic_cdc_bind =_ "extra CDC union\012"
drivers/net/usb/cdc_ether.c:167 [cdc_ether]usbnet_generic_cdc_bind =_ "ACM capabilities %02x, not really RNDIS?\012"
drivers/net/usb/cdc_ether.c:151 [cdc_ether]usbnet_generic_cdc_bind =_ "CDC header len %u\012"
drivers/net/usb/cdc_ether.c:145 [cdc_ether]usbnet_generic_cdc_bind =_ "extra CDC header\012"
drivers/net/usb/cdc_ether.c:119 [cdc_ether]usbnet_generic_cdc_bind =_ "CDC descriptors on endpoint\012"
drivers/net/usb/cdc_ether.c:103 [cdc_ether]usbnet_generic_cdc_bind =_ "CDC descriptors on config\012"
drivers/net/usb/cdc_ether.c:416 [cdc_ether]usbnet_cdc_status =_ "CDC: speed change (len %d)\012"
drivers/net/usb/cdc_ether.c:408 [cdc_ether]usbnet_cdc_status =_ "CDC: carrier %s\012"
rmmod cdc_ether
echo -n 'module cdc_ether +p' >> /sys/kernel/debug/dynamic_debug/control
cat /sys/kernel/debug/dynamic_debug/control | grep cdc_ether 
# nothing within
# dmesg contains:
[ 1903.974568] usbcore: deregistering interface driver cdc_ether
[ 1963.660438] dynamic_debug:ddebug_exec_queries: processed 1 queries, with 0 matches, 0 errs

# executing:
modprobe cdc_ether
#dmesg contains:
[ 2133.615277] cdc_ether 2-1:1.0: usb_probe_interface
[ 2133.615288] cdc_ether 2-1:1.0: usb_probe_interface - got id
[ 2133.615316] usb 2-1: bad CDC descriptors
[ 2133.615367] usbcore: registered new interface driver cdc_ether

# executing:
echo -n 'module cdc_ether +p' > /sys/kernel/debug/dynamic_debug/control
#dmesg contains:
[ 2155.353608] dynamic_debug:ddebug_exec_queries: processed 1 queries, with 20 matches, 0 errs
#now what?
find /sys/kernel/debug/ -name 'cdc_ether*'
# nothing found
find /sys/kernel/debug/ -type f -exec grep cdc_ether '{}' \;
# slow so I stoped it

phone's dmesg shows :

motusbd_load: load new driver network-BLAN
usbd_admin: enable current: acm-CDC arg: network-BLAN
restore_powermode: saved_bMaxPower 0 powermode_flag 0
usbd_disable_function: DOWN USBD_BUS_SEM
usbd_disable_function: UP USBD_BUS_SEM
usbd_enable_function_irq: check: [network-BLAN] acm-CDC
usbd_enable_function_irq: check: [network-BLAN] network-BLAN
blan_init: CRC: 01 

I edited cdc_ether.c and added a line:

vi drivers/net/usb/cdc_ether.c

bad_desc:
        dev_info(&dev->udev->dev, "bad CDC descriptors\n");
        dev_info(&dev->udev->dev, "kernelmod2LLG\n"); /* this was added*/
        return -ENODEV;

then

make modules

then

cp drivers/net/usb/cdc_ether.ko /lib/modules/3.4.4-ARCH/kernel/drivers/net/usb/cdc_ether.ko

then

rmmod cdc_ether

then replug phone in usblan mode then dmesg listed:

[ 4632.181271] usb 2-1: bad CDC descriptors
[ 4632.181277] usb 2-1: kernelmod2LLG

I added similar lines before goto.
Dmesg of usbnet activation:

[ 5910.610994] hub 2-0:1.0: state 7 ports 9 chg 0000 evt 0002
[ 5910.611018] ohci_hcd 0000:00:02.0: GetStatus roothub.portstatus [0] = 0x00030100 PESC CSC PPS
[ 5910.611036] hub 2-0:1.0: port 1, status 0100, change 0003, 12 Mb/s
[ 5910.611045] usb 2-1: USB disconnect, device number 15
[ 5910.611052] usb 2-1: unregistering device
[ 5910.611058] usb 2-1: unregistering interface 2-1:1.0
[ 5910.611405] usb 2-1: unregistering interface 2-1:1.1
[ 5910.611529] usb 2-1: usb_disable_device nuking all URBs
[ 5910.733682] hub 2-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x100
[ 5910.733710] hub 1-0:1.0: state 7 ports 9 chg 0000 evt 0002
[ 5910.733729] ehci_hcd 0000:00:02.1: GetStatus port:1 status 001803 0  ACK POWER sig=j CSC CONNECT
[ 5910.733743] hub 1-0:1.0: port 1, status 0501, change 0001, 480 Mb/s
[ 5910.853665] hub 1-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x501
[ 5910.906985] ehci_hcd 0000:00:02.1: port 1 full speed --> companion
[ 5910.907001] ehci_hcd 0000:00:02.1: GetStatus port:1 status 003001 0  ACK POWER OWNER sig=se0 CONNECT
[ 5910.907039] hub 1-0:1.0: port 1 not reset yet, waiting 50ms
[ 5910.960317] ehci_hcd 0000:00:02.1: GetStatus port:1 status 003802 0  ACK POWER OWNER sig=j CSC
[ 5910.960357] hub 2-0:1.0: state 7 ports 9 chg 0000 evt 0002
[ 5910.960372] ohci_hcd 0000:00:02.0: GetStatus roothub.portstatus [0] = 0x00010101 CSC PPS CCS
[ 5910.960384] hub 2-0:1.0: port 1, status 0101, change 0001, 12 Mb/s
[ 5911.080297] hub 2-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x101
[ 5911.186946] ohci_hcd 0000:00:02.0: GetStatus roothub.portstatus [0] = 0x00100103 PRSC PPS PES CCS
[ 5911.240274] usb 2-1: new full-speed USB device number 16 using ohci_hcd
[ 5911.346922] ohci_hcd 0000:00:02.0: GetStatus roothub.portstatus [0] = 0x00100103 PRSC PPS PES CCS
[ 5911.416900] usb 2-1: ep0 maxpacket = 16
[ 5911.433622] usb 2-1: skipped 5 descriptors after interface
[ 5911.436608] usb 2-1: default language 0x0409
[ 5911.442617] usb 2-1: udev 16, busnum 2, minor = 143
[ 5911.442626] usb 2-1: New USB device found, idVendor=22b8, idProduct=600c
[ 5911.442634] usb 2-1: New USB device strings: Mfr=3, Product=4, SerialNumber=0
[ 5911.442641] usb 2-1: Product: Motorola USBLAN
[ 5911.442646] usb 2-1: Manufacturer: Motorola
[ 5911.442896] usb 2-1: usb_probe_device
[ 5911.442905] usb 2-1: configuration #1 chosen from 1 choice
[ 5911.448615] usb 2-1: adding 2-1:1.0 (config #1, interface 0)
[ 5911.451882] hub 1-0:1.0: state 7 ports 9 chg 0000 evt 0002
[ 5911.451905] hub 2-0:1.0: state 7 ports 9 chg 0000 evt 0002
[ 5911.458002] cdc_ether 2-1:1.0: usb_probe_interface
[ 5911.458013] cdc_ether 2-1:1.0: usb_probe_interface - got id
[ 5911.458040] usb 2-1: kernelmod2LLG6
[ 5911.458046] usb 2-1: bad CDC descriptors
[ 5911.458050] usb 2-1: kernelmod2LLG
[ 5911.458098] usbcore: registered new interface driver cdc_ether

This is the source where jumps from to bad CDC descriptors:

                        if (memcmp(&desc->bGUID, mbm_guid, 16)) {
        dev_info(&dev->udev->dev, "kernelmod2LLG6\n");
                                goto bad_desc;}

This is the bGUID of lsusb:

 bGUID               {74f03dbd-1ec1-4470-a367-7134c9f55437} 

From cdc_ether.c :

static const u8 mbm_guid[16] = {
        0xa3, 0x17, 0xa8, 0x8b, 0x04, 0x5e, 0x4f, 0x01,
        0xa6, 0x07, 0xc0, 0xff, 0xcb, 0x7e, 0x39, 0x2a,
};

I guess should try to understand logic of cdc_ether.c first... and add the "quirk" for the device as you mentioned.

Last edited by llg179 (2012-06-29 00:23:11)

Offline

#4 2012-06-29 03:44:05

pigiron
Member
From: USA
Registered: 2009-07-14
Posts: 150

Re: usbnet bad CDC descriptors cdc_ether

[NOTE: I wrote this before you edited post #3]

I figured I'd never hear back from you. Welcome back and good job.

A few comments.

rmmod cdc_ether
echo -n 'module cdc_ether +p' >> /sys/kernel/debug/dynamic_debug/control
cat /sys/kernel/debug/dynamic_debug/control | grep cdc_ether

You're turning on messages for a module that's (now) not installed. I don't think that works. So no surprise about no output. See the Debug Messages at Module Initialization Time section of the dynamic-debug-howto.txt file.

Keep it simple and turn them on when the module is loaded. Then recreate the problem and check the logs for messages.

I have no idea how dynamic debug will handle appends (">>"). I'd just use a redirect (">").

I'd turn on all the flags (+flmtp) just for grins.

I edited cdc_ether.c and added a line:

This whole exercise is to determine where in that function the failure occurs. So if you're going to add some debug statements, add them at the places in the function that could possibly execute the goto bad_desc statement without currently logging anything.

Like on lines 252, 255, 267, and 269. NOTE: You'll need to add brackets to all those places. For example, for line number 269, change:

 } else
        goto bad_desc;
 break;

to:

 } else {
        dev_dbg(&intf->dev, "ERROR: Line 269\n");
        goto bad_desc;
 }
 break;

BUT! I'm looking at Linus' uber bleeding edge git tree to get those line numbers, so they might not be the same for your kernel.

Crap... I just found this article:

http://lwn.net/Articles/434833/

It claims that the dev_dbg calls will be a normal printk() if CONFIG_DYNAMIC_DEBUG is off. But I don't think that's really true from my view of the dynamic_debug code (and see one of the comments to the article). If the article is true, then you should add those extra debug statements to the function because none of the dev_dbg statements were showing up in your original logs. But I'd first try it without adding any code... if you're lucky a log will appear.

FYI: The dev_dbg messages will be at the "debug" level (level 7).

Lastly, good job posting all that data. It really helps.

Offline

#5 2012-06-29 06:20:15

pigiron
Member
From: USA
Registered: 2009-07-14
Posts: 150

Re: usbnet bad CDC descriptors cdc_ether

hmmm... I may be sending you over a cliff, but you might want to check this out.

I ran across this fairly recent web page:

http://lkml.org/lkml/2012/3/9/520

It talks about a "pseudo-MDLM (Belcarra)" type rather than the "standard" MDLM.

Everything that I see on the web describing the usblan implemented inside your phone seems to point to Belcarra (belcarra.com). Who appear to make their own non-standard MDLM.

Anyway... when I followed that patch to the drivers/net/usb/zaurus.c file, I found this:

static const u8 blan_guid[16] = {
        0x74, 0xf0, 0x3d, 0xbd, 0x1e, 0xc1, 0x44, 0x70,
        0xa3, 0x67, 0x71, 0x34, 0xc9, 0xf5, 0x54, 0x37,
};

Which matches the bGUID in your phone... along with a blan_mdlm_bind() function that looks very familiar.

You might want to try blacklisting your phone in drivers/net/usb/cdc_ether.c and whitelisting it in drivers/net/usb/zaurus.c and see what happens. Just follow the templates for other devices found in each of the files.

[Edited to remove blacklisting the phone in drivers/net/usb/cdc_ether.c and added the following:]

I looked at the patches that previously added other Motorola phones using the "pseudo-MDLM (Belcarra)" protocol. All they did is whitelist the device in the drivers/net/usb/zaurus.c file. They didn't blacklist anywhere.

So modifying that zaurus.c file to something like this just might work:

}, {
       /* Motorola MOTOMAGX phones */
       USB_DEVICE_AND_INTERFACE_INFO(0x22b8, 0x6425, USB_CLASS_COMM,
                       USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
       .driver_info = (unsigned long) &bogus_mdlm_info,
}, {
       /* Motorola A780 */
       USB_DEVICE_AND_INTERFACE_INFO(0x22b8, 0x600c, USB_CLASS_COMM,
                       USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
       .driver_info = (unsigned long) &bogus_mdlm_info,
},

Last edited by pigiron (2012-06-29 15:30:35)

Offline

#6 2012-06-29 21:49:31

llg179
Member
Registered: 2012-03-04
Posts: 12

Re: usbnet bad CDC descriptors cdc_ether

After adding the code you specified, it works!

[54187.070485] cdc_ether 2-1:1.0: usb_probe_interface
[54187.070495] cdc_ether 2-1:1.0: usb_probe_interface - got id
[54187.070525] usb 2-1: bad CDC descriptors
[54187.070553] zaurus 2-1:1.0: usb_probe_interface
[54187.070558] zaurus 2-1:1.0: usb_probe_interface - got id
[54187.073932] zaurus 2-1:1.0: usb0: register 'zaurus' at usb-0000:00:02.0-1, pseudo-MDLM (BLAN) device, 12:12:12:12:12:12
[54187.074027] hub 2-0:1.0: state 7 ports 9 chg 0000 evt 0002
[54283.018017] usbcore: deregistering interface driver zaurus
[54283.018062] ohci_hcd 0000:00:02.0: shutdown urb f552c980 ep2in-bulk
[54283.018071] ohci_hcd 0000:00:02.0: shutdown urb f552c800 ep2in-bulk
[54283.018079] ohci_hcd 0000:00:02.0: shutdown urb f552cb80 ep2in-bulk
[54283.018085] ohci_hcd 0000:00:02.0: shutdown urb f552c500 ep2in-bulk
[54283.018920] zaurus 2-1:1.0: usb0: unregister 'zaurus' usb-0000:00:02.0-1, pseudo-MDLM (BLAN) device
[54302.472109] zaurus 2-1:1.0: usb_probe_interface
[54302.472120] zaurus 2-1:1.0: usb_probe_interface - got id
[54302.474652] zaurus 2-1:1.0: usb0: register 'zaurus' at usb-0000:00:02.0-1, pseudo-MDLM (BLAN) device, 12:12:12:12:12:12
[54302.474713] usbcore: registered new interface driver zaurus

After these commands I could ping the phone:

ip addr add 192.168.111.11/24 dev usb0
ip link set dev usb0 mtu 900 up

I could not telnet to the phone. Ssh from phone to computer worked well.
What is the next step? Should a bugzilla be filled or will you make the change upstream?

Thank you!

Last edited by llg179 (2012-06-29 21:52:48)

Offline

#7 2012-06-30 14:41:45

pigiron
Member
From: USA
Registered: 2009-07-14
Posts: 150

Re: usbnet bad CDC descriptors cdc_ether

I love it when a plan comes together.

I can submit the patch if you don't want to. But first I have a question. Is there anything special about your phone? Like, has it been rooted, or running custom firmware, etc..., or is it pretty much like the day you bought it? That's important because we wouldn't want to send a "normal" A780 user down the wrong (kernel) path... pun intended.

Bugzilla won't work. The kernel developers have confessed to not paying much attention to it. Watch the first 5 minutes of this video and you'll understand why:

http://video.linux.com/videos/linux-ker … -help-them

One of the lead kernel developers shows some pretty eye popping numbers about kernel changes. I think it's amazing that the kernels work as well as they do with that much "churn". It also explains why they're so grumpy.

[Edited to add...]

If I'm going the submit the patch, your last log shows something I'm not entirely happy with. It appears that cdc_ether is still being called, but "errors out", and then the zaurus code is called. Thus producing a bogus error message. So I'd like to see how things work if we also blacklist the phone in cdc_ether.

Can you also modify the cdc_ether.c file like the following and verify that things are still good?

/* Logitech Harmony 900 - uses the pseudo-MDLM (BLAN) driver */
{
        USB_DEVICE_AND_INTERFACE_INFO(0x046d, 0xc11f, USB_CLASS_COMM,
                        USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
        .driver_info            = 0,
},

/* Motorola A780 - uses the pseudo-MDLM (BLAN) driver */
{
        USB_DEVICE_AND_INTERFACE_INFO(0x22b8, 0x600c, USB_CLASS_COMM,
                        USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
        .driver_info            = 0,
},

Last edited by pigiron (2012-06-30 18:00:16)

Offline

#8 2012-06-30 20:42:10

llg179
Member
Registered: 2012-03-04
Posts: 12

Re: usbnet bad CDC descriptors cdc_ether

I did the chane in cdc_ether too as you suggested. Dmesg log is below after changing phone's setting to use usblan:

[ 2432.366613] hub 2-0:1.0: state 7 ports 9 chg 0000 evt 0002
[ 2432.366644] ohci_hcd 0000:00:02.0: GetStatus roothub.portstatus [0] = 0x00030100 PESC CSC PPS
[ 2432.366664] hub 2-0:1.0: port 1, status 0100, change 0003, 12 Mb/s
[ 2432.366672] usb 2-1: USB disconnect, device number 3
[ 2432.366679] usb 2-1: unregistering device
[ 2432.366685] usb 2-1: unregistering interface 2-1:1.0
[ 2432.366995] usb 2-1: unregistering interface 2-1:1.1
[ 2432.367120] usb 2-1: usb_disable_device nuking all URBs
[ 2432.487177] hub 2-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x100
[ 2432.487189] hub 1-0:1.0: state 7 ports 9 chg 0000 evt 0002
[ 2432.487198] ehci_hcd 0000:00:02.1: GetStatus port:1 status 001803 0  ACK POWER sig=j CSC CONNECT
[ 2432.487203] hub 1-0:1.0: port 1, status 0501, change 0001, 480 Mb/s
[ 2432.607145] hub 1-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x501
[ 2432.660516] ehci_hcd 0000:00:02.1: port 1 full speed --> companion
[ 2432.660523] ehci_hcd 0000:00:02.1: GetStatus port:1 status 003001 0  ACK POWER OWNER sig=se0 CONNECT
[ 2432.660548] hub 1-0:1.0: port 1 not reset yet, waiting 50ms
[ 2432.713814] ehci_hcd 0000:00:02.1: GetStatus port:1 status 003802 0  ACK POWER OWNER sig=j CSC
[ 2432.713855] hub 2-0:1.0: state 7 ports 9 chg 0000 evt 0002
[ 2432.713870] ohci_hcd 0000:00:02.0: GetStatus roothub.portstatus [0] = 0x00010101 CSC PPS CCS
[ 2432.713882] hub 2-0:1.0: port 1, status 0101, change 0001, 12 Mb/s
[ 2432.833777] hub 2-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x101
[ 2432.940471] ohci_hcd 0000:00:02.0: GetStatus roothub.portstatus [0] = 0x00100103 PRSC PPS PES CCS
[ 2432.993815] usb 2-1: new full-speed USB device number 4 using ohci_hcd
[ 2433.100443] ohci_hcd 0000:00:02.0: GetStatus roothub.portstatus [0] = 0x00100103 PRSC PPS PES CCS
[ 2433.170408] usb 2-1: ep0 maxpacket = 16
[ 2433.186991] usb 2-1: skipped 5 descriptors after interface
[ 2433.190005] usb 2-1: default language 0x0409
[ 2433.195997] usb 2-1: udev 4, busnum 2, minor = 131
[ 2433.196007] usb 2-1: New USB device found, idVendor=22b8, idProduct=600c
[ 2433.196016] usb 2-1: New USB device strings: Mfr=3, Product=4, SerialNumber=0
[ 2433.196023] usb 2-1: Product: Motorola USBLAN
[ 2433.196028] usb 2-1: Manufacturer: Motorola
[ 2433.196248] usb 2-1: usb_probe_device
[ 2433.196256] usb 2-1: configuration #1 chosen from 1 choice
[ 2433.201991] usb 2-1: adding 2-1:1.0 (config #1, interface 0)
[ 2433.205085] hub 1-0:1.0: state 7 ports 9 chg 0000 evt 0002
[ 2433.205098] hub 2-0:1.0: state 7 ports 9 chg 0000 evt 0002

Phone's kernel and configuration is the factory default. To activate the function some config files should be copied to the phone which places icon on the phone and makes the script available and a shell script which turns on usbnet: 

#!/bin/bash
 echo MotNet > /proc/usbd-switch
 ifconfig usbl0 up 162.254.1.2 netmask 255.255.255.0 mtu 900

This is from http://wiki.openezx.org/Get_a_shell

Is it possible to set mtu of usb0 to 900 on the host too automatically by kernel driver?
Please submit the patch. Thank you for your help!

Last edited by llg179 (2012-06-30 20:44:26)

Offline

#9 2012-07-01 07:42:15

llg179
Member
Registered: 2012-03-04
Posts: 12

Re: usbnet bad CDC descriptors cdc_ether

cdc_ether automatically loads when usbnet is activated on phone however zaurus module is not loaded. After

modprobe zaurus

usb0 becomes listed.

Offline

#10 2012-07-02 15:23:51

pigiron
Member
From: USA
Registered: 2009-07-14
Posts: 150

Re: usbnet bad CDC descriptors cdc_ether

That's good to know. Thanks for trying.

So it appears that we should only whitelist the phone in the zaurus module, and live with the bogus error message.

Might as well mark this thread as [Solved], but check back periodically as I'll post the links to the submitted patch. Please also check the patch progress in the kernel mailing list(s) I'll point to because the developers may ask questions that I can't answer since I don't have the device... and feel free to jump into the mailing list discussion (if any) at any time.

Give me a week or so to submit the patch. The developers don't like it when you submit a patch and leave, and I may be semi-"off the grid" for a week or so.

PS: No idea about the MTU size question. I'm totally guessing that's handled by the kernel network layer. Which I've not dug into... and stay away from on purpose. Probably much easier to handle that from user space.

Offline

#11 2012-07-02 18:26:22

llg179
Member
Registered: 2012-03-04
Posts: 12

Re: usbnet bad CDC descriptors cdc_ether

I should try again to confirm that zaurus is auto loaded when phone is not listed in cdc_ether. I will try this around weekend or next week.
For me the issue was resolved thank you.

Offline

#12 2012-07-03 11:05:05

andrikophoto
Member
Registered: 2012-07-03
Posts: 1

Re: usbnet bad CDC descriptors cdc_ether

I am a little succinct because I am amateur.
15 yrs hard effort device id class fake cdc USB_CLASS_COM PCS MDLM etc many!!

Is MotNet questionable?
Forgive me, I am an amateur, what about AT COMMANDS (truckloads,)
USB DEV whatever, I mean GPRS ethernet GPS, same thing, security levels.
MotNet, text file from device, firmware?
Firmware OK, I usbserial vendor=0x product Motorola VE538 OK.

I admire Marcel Holtmann Bluetooth, Great Artist Engineer

has to butcher fiasco cannibal id & class & fake sometimes
he is a big man; USB man from India.

15 yrs motorola ericsson samsung ALL, current VE538, 4 yrs,
currently (2 yr break,) spidering interweb for VE538 id class,
& Motorola Fire querty Android.
Sharp are big, zaurus significant.

Watching this post for days, live!
You are doing GLORIOUS work these days, bravo!

I hope my amateur wanderings may have some validity ideas,
maybe I guess Holtmann may machete MDLM with a sub function.
Always more ways than one to skin a cat with computers.
Slowly slowly, demokracy, relax.

Andreas.
----Thankyou.

Offline

#13 2012-07-06 20:47:50

llg179
Member
Registered: 2012-03-04
Posts: 12

Re: usbnet bad CDC descriptors cdc_ether

zaurus kernel module is not auto loaded with original cdc_ether when I plug the phone in usbnet mode. After loading zaurus the usb0 is available and usable. Please make the change upstream both in cdc_ether and zaurus.

Thank you for your efforts pigiron! I hope you enjoyed the time too, spent on this topic smile
I could not mark this topic as solved.

Offline

#14 2015-05-01 00:54:33

kooder
Member
Registered: 2015-04-30
Posts: 1

Re: usbnet bad CDC descriptors cdc_ether

Regarding to the dynamic debug, I ran into the same case with llg179. It seems that the output from

cat /sys/kernel/debug/dynamic_debug/control | grep cdc_ether

won't get refreshed when I plug in or out the USB device. The contents remain the same as do

modprobe cdc_ethe.ko

Furthermore, almost every dev_dbg() can be seen in

cat /sys/kernel/debug/dynamic_debug/control | grep cdc_ether,

does that mean those dev_dbg() actually been executed?

Offline

Board footer

Powered by FluxBB