Re: cdc_ether.c incompatible with Nokia 6110 Navigator: Where's the problem?

David Brownell <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <20071020212939.529DF23A647@adsl-69-226-248-13.dsl.pltn13.pacbell.net>
> Date: Thu, 18 Oct 2007 13:48:33 +0200
> From: Hadmut Danisch <[email protected]>
>
> Hi,
>
> I just replaced an older Sony Ericsson mobile with a Nokia 6110
> Navigator and expected it to work in the same way: plug into USB and
> have a usb0 ethernet device.

Why ... is that how it's documented to work with Linux?


>	But there's a problem:
>
>
> When I plug the mobile in, the kernel reports 
>
>   bad CDC descriptors
>
>
> I have tracked this down to cdc_ether.c , in the clause
>
> 		case USB_CDC_ACM_TYPE:
> 			/* paranoia:  disambiguate a "real" vendor-specific
> 			 * modem interface from an RNDIS non-modem.
> 			 */
> 			if (rndis) {
> 				struct usb_cdc_acm_descriptor *acm;
>
> 				acm = (void *) buf;
> 				if (acm->bmCapabilities) {
> 					dev_dbg(&intf->dev,
> 						"ACM capabilities %02x, "
> 						"not really RNDIS?\n",
> 						acm->bmCapabilities);
> 					goto bad_desc;
> 				}
> 			}
> 			break;
>
>
> which prints 
>
>   rndis_host 1-3.1:1.10: ACM capabilities 0f, not really RNDIS?

That seems appropriate.  The descriptors you show later indicate
that it's not really RNDIS.


> I am not at all familiar with USB programming, but for some reason the 
> cdc_ether.c expects the bmCapabilities to be zero when an rndis
> devices is found. 

That's because Microsoft specified that, as I recall.  Of course,
they've played (undocumented) games with more recent versions of
their RNDIS crap.  But they haven't AFAIK gone so far as to let
this interface fit.


> When I remove the 'goto bad_desc', it continues with a SubType 6 
> (Union Functional Descriptor) entry and then issues the error message
>
> rndis_host 1-3.1:1.10: RNDIS init failed, -32

That is, it's neither looks nor acts like RNDIS.
This diagnostic means that it doesn't even respond
to the funky RPC protocol RNDIS devices implement.


> As I said, I am not familiar with USB protocols and programming, but
> even the output of lsusb -v reports problems (invalid and unrecognized
> CDC) with the descriptor: 

Right, there are some standard interfaces here and many nonstandard
ones.


> Bus 001 Device 007: ID 0421:046e Nokia Mobile Phones 
> Device Descriptor:
>   bLength                18
>   bDescriptorType         1
>   bcdUSB               2.00
>   bDeviceClass            2 Communications
>   bDeviceSubClass         0 
>   bDeviceProtocol         0 
>   bMaxPacketSize0        64
>   idVendor           0x0421 Nokia Mobile Phones
>   idProduct          0x046e 
>   bcdDevice            1.00
>   iManufacturer           1 Nokia
>   iProduct                2 Nokia 6110 Navigator
>   iSerial                 0 
>   bNumConfigurations      1
>   Configuration Descriptor:
>     bLength                 9
>     bDescriptorType         2
>     wTotalLength          408
>     bNumInterfaces         14
>     bConfigurationValue     1
>     iConfiguration          4 Bulk transfer method configuration
>     bmAttributes         0xc0
>       Self Powered
>     MaxPower               20mA
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        0
>       bAlternateSetting       0
>       bNumEndpoints           0
>       bInterfaceClass         2 Communications
>       bInterfaceSubClass      8 Wireless Handset Control

Basically means:  "this is complicated USB stuff".  ;)


>       bInterfaceProtocol      0 
>       iInterface              0 
>       CDC Header:
>         bcdCDC               1.10
>       CDC WHCM:
>         bcdVersion           1.00
>       CDC Union:
>         bMasterInterface        0
>         bSlaveInterface         1 2 3 4 5 6 7 8 9 10 11 12 13 

I didn't think Union descriptors were supposed to be used this way,
but maybe they are...


>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        1
>       bAlternateSetting       0
>       bNumEndpoints           0
>       bInterfaceClass         2 Communications
>       bInterfaceSubClass      8 Wireless Handset Control
>       bInterfaceProtocol      1 
>       iInterface              0 
>       CDC Header:
>         bcdCDC               1.10
>       INVALID CDC (Telephone Operations):  05 24 08 00 01

Telephone operations descriptors are only four bytes long,
not five; that's why this descriptor is invalid.

>       CDC Union:
>         bMasterInterface        1
>         bSlaveInterface         2 3 
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        2
>       bAlternateSetting       0
>       bNumEndpoints           0
>       bInterfaceClass         2 Communications
>       bInterfaceSubClass    254 

The current www.usb.org website doesn't seem to have documents
defining this interface subclass (0xfe).

>       bInterfaceProtocol      0 
>       iInterface              0 
>       CDC Header:
>         bcdCDC               1.10
>       UNRECOGNIZED CDC:  05 24 ab 05 15

Ditto this descriptor type (0xab).

>       CDC Union:
>         bMasterInterface        2
>         bSlaveInterface         3 

Curious ... note the odd master/slave interface structure:

	0 	masters 1 2 3 4 5 6 7 8 9 10 11 12 13 
	1	masters 2 3
	2	masters 3
	(etc)

So interface 3 has three different masters ... right, sure it does.


>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        3
>       bAlternateSetting       0
>       bNumEndpoints           0
>       bInterfaceClass        10 CDC Data
>       bInterfaceSubClass      0 Unused
>       bInterfaceProtocol      0 
>       iInterface              0 

Presumably there's a reason to have an altsetting for this interface.

>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        3
>       bAlternateSetting       1
>       bNumEndpoints           2
>       bInterfaceClass        10 CDC Data
>       bInterfaceSubClass      0 Unused
>       bInterfaceProtocol      0 
>       iInterface              0 
>       Class specific interface descriptor for class 10 is unsupported

Unsupported, because it's not supposed to have descriptors.  Of course,
"lsusb" should have dumped that raw data; that's a minor bug to fix.

>       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     0x84  EP 4 IN
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0040  1x 64 bytes
>         bInterval               0

(End first chunk of confusion)


>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        4
>       bAlternateSetting       0
>       bNumEndpoints           0
>       bInterfaceClass         2 Communications
>       bInterfaceSubClass     11 OBEX
>       bInterfaceProtocol      0 
>       iInterface              6 SYNCML-SYNC
>       CDC Header:
>         bcdCDC               1.10
>       CDC OBEX:
>         bcdVersion           1.00
>       CDC Union:
>         bMasterInterface        4
>         bSlaveInterface         5 
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        5
>       bAlternateSetting       0
>       bNumEndpoints           0
>       bInterfaceClass        10 CDC Data
>       bInterfaceSubClass      0 Unused
>       bInterfaceProtocol      0 
>       iInterface              0 
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        5
>       bAlternateSetting       1
>       bNumEndpoints           2
>       bInterfaceClass        10 CDC Data
>       bInterfaceSubClass      0 Unused
>       bInterfaceProtocol      0 
>       iInterface              0 
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x85  EP 5 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     0x02  EP 2 OUT
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0040  1x 64 bytes
>         bInterval               0

OK, that's OBEX ... ISTR there are some userspace Linux tools that
can handle that.


>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        6
>       bAlternateSetting       0
>       bNumEndpoints           0
>       bInterfaceClass         2 Communications
>       bInterfaceSubClass     11 OBEX
>       bInterfaceProtocol      0 
>       iInterface              7 PC Suite Services
>       CDC Header:
>         bcdCDC               1.10
>       CDC OBEX:
>         bcdVersion           1.00
>       CDC Union:
>         bMasterInterface        6
>         bSlaveInterface         7 
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        7
>       bAlternateSetting       0
>       bNumEndpoints           0
>       bInterfaceClass        10 CDC Data
>       bInterfaceSubClass      0 Unused
>       bInterfaceProtocol      0 
>       iInterface              0 
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        7
>       bAlternateSetting       1
>       bNumEndpoints           2
>       bInterfaceClass        10 CDC Data
>       bInterfaceSubClass      0 Unused
>       bInterfaceProtocol      0 
>       iInterface              0 
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x86  EP 6 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     0x03  EP 3 OUT
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0040  1x 64 bytes
>         bInterval               0

A second OBEX interface.  I don't know if those userspace tools
will handle both of these, but I'd hope they would.


>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        8
>       bAlternateSetting       0
>       bNumEndpoints           1
>       bInterfaceClass         2 Communications
>       bInterfaceSubClass      2 Abstract (modem)
>       bInterfaceProtocol      1 AT-commands (v.25ter)
>       iInterface              8 CDC Comms Interface
>       CDC Header:
>         bcdCDC               1.00
>       CDC ACM:
>         bmCapabilities       0x0f
>           connection notifications
>           sends break
>           line coding and serial state
>           get/set/clear comm features
>       CDC Union:
>         bMasterInterface        8
>         bSlaveInterface         9 
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x81  EP 1 IN
>         bmAttributes            3
>           Transfer Type            Interrupt
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0040  1x 64 bytes
>         bInterval             128
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        9
>       bAlternateSetting       0
>       bNumEndpoints           2
>       bInterfaceClass        10 CDC Data
>       bInterfaceSubClass      0 Unused
>       bInterfaceProtocol      0 
>       iInterface              9 CDC Data Interface
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x87  EP 7 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     0x04  EP 4 OUT
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0040  1x 64 bytes
>         bInterval               0

That looks like a fairly generic CDC-ACM interface ... and it
says that it accepts v.25ter style AT-commands, so it "should"
be a real modem device.  (A followup note from you reported that
you had PPP working over that link...)


>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber       10
>       bAlternateSetting       0
>       bNumEndpoints           1
>       bInterfaceClass         2 Communications
>       bInterfaceSubClass      2 Abstract (modem)
>       bInterfaceProtocol    255 Vendor Specific (MSFT RNDIS?)
>       iInterface             10 CDC Comms Interface
>       CDC Header:
>         bcdCDC               1.00
>       CDC ACM:
>         bmCapabilities       0x0f
>           connection notifications
>           sends break
>           line coding and serial state
>           get/set/clear comm features

To be true RNDIS this should have capabilities "0x00".
It should also include a CDC "Call Management" descriptor.

>       CDC Union:
>         bMasterInterface        10
>         bSlaveInterface         11 
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x82  EP 2 IN
>         bmAttributes            3
>           Transfer Type            Interrupt
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0040  1x 64 bytes
>         bInterval             128
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber       11
>       bAlternateSetting       0
>       bNumEndpoints           2
>       bInterfaceClass        10 CDC Data
>       bInterfaceSubClass      0 Unused
>       bInterfaceProtocol      0 
>       iInterface             11 CDC Data Interface
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x88  EP 8 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     0x05  EP 5 OUT
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0040  1x 64 bytes
>         bInterval               0

I could imagine that being a real RNDIS interface ... except for
those two contrary-to-spec descriptors, and the fact that you
showed (above) that it doesn't respond to the funky RPC calls
that any real RNDIS device will handle.

Clearly this is not RNDIS; it's yet another proprietary
interface to this phone.  (And obviously, it's not CDC-Ether;
I don't know why you even bothered trying that.)


>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber       12
>       bAlternateSetting       0
>       bNumEndpoints           0
>       bInterfaceClass         2 Communications
>       bInterfaceSubClass    253 

Another subclass code not defined by current USB.org specs...

>       bInterfaceProtocol      0 
>       iInterface             12 LCIF_Alt0
>       CDC Header:
>         bcdCDC               1.10
>       UNRECOGNIZED CDC:  05 24 fc 00 01

... another descriptor type (0xfc) not defined by USB.org ...

>       CDC Union:
>         bMasterInterface        12
>         bSlaveInterface         13 
>       UNRECOGNIZED CDC:  04 24 fd 00

... another descriptor type (0xfd) not defined by USB.org ...

>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber       13
>       bAlternateSetting       0
>       bNumEndpoints           0
>       bInterfaceClass        10 CDC Data
>       bInterfaceSubClass      0 Unused
>       bInterfaceProtocol      0 
>       iInterface              0 
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber       13
>       bAlternateSetting       1
>       bNumEndpoints           2
>       bInterfaceClass        10 CDC Data
>       bInterfaceSubClass      0 Unused
>       bInterfaceProtocol      0 
>       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              32
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x06  EP 6 OUT
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0040  1x 64 bytes
>         bInterval              32

End of mysterious LCIF_Alt0 interface.


> Device Status:     0x0001
>   Self Powered
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.