Bug 10590 - rndis_host fails to register HTC P3600 device
Summary: rndis_host fails to register HTC P3600 device
Status: CLOSED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Network (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Jeff Garzik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-02 06:56 UTC by Pierre Ynard
Modified: 2008-08-12 01:15 UTC (History)
0 users

See Also:
Kernel Version: 2.6.25
Subsystem:
Regression: ---
Bisected commit-id:


Attachments
Patch from the SynCE rndis_host driver code (943 bytes, patch)
2008-05-02 06:58 UTC, Pierre Ynard
Details | Diff

Description Pierre Ynard 2008-05-02 06:56:35 UTC
Latest working kernel version: ???
Earliest failing kernel version: ???, but fails with 2.6.24 too
Distribution: Debian unstable
Hardware Environment: AMD64 Sempron on a VIA board, HTC P3600 "phone" with Samsung SC32442B processor
Software Environment: SynCE 0.11 (host), Microsoft® Windows Mobile® 5.0 (phone)

Problem Description: When I connect my hype phone thingy to my computer, the rdnis_host driver is loaded, but registration of the device fails, with the following logs:

[17069.106611] usb 2-1: new full speed USB device using uhci_hcd and address 7
[17069.228636] usb 2-1: configuration #1 chosen from 1 choice
[17069.232878] usb 2-1: New USB device found, idVendor=0bb4, idProduct=0b05
[17069.232884] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[17069.232887] usb 2-1: Product: Generic RNDIS
[17069.232890] usb 2-1: Manufacturer: HTC
[17069.232892] usb 2-1: SerialNumber: ********-****-****-****-************
[17069.367902] usbcore: registered new interface driver cdc_ether
[17069.446807] rndis_host 2-1:1.0: RNDIS_MSG_QUERY(0x00010202) failed, -110
[17069.511717] rndis_host 2-1:1.0: RNDIS_MSG_QUERY(0x01010101) failed, -110
[17069.511725] rndis_host 2-1:1.0: rndis get ethaddr, -110
[17069.513247] rndis_host: probe of 2-1:1.0 failed with error -110
[17069.513290] usbcore: registered new interface driver rndis_host
[17069.613383] rndis_wlan 2-1:1.0: RNDIS_MSG_QUERY(0x00010202) failed, -47
[17069.614388] usbcore: registered new interface driver rndis_wlan

However, the SynCE project provides an alternative patched rndis_host driver, which does work. I narrowed down the diff to the relevant bits, and when patched with those bits, the mainline kernel driver works, with the following logs:

[17039.548771] usb 2-1: new full speed USB device using uhci_hcd and address 6
[17039.668976] usb 2-1: configuration #1 chosen from 1 choice
[17039.672000] usb 2-1: New USB device found, idVendor=0bb4, idProduct=0b05
[17039.672006] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[17039.672009] usb 2-1: Product: Generic RNDIS
[17039.672012] usb 2-1: Manufacturer: HTC
[17039.672014] usb 2-1: SerialNumber: ********-****-****-****-************
[17039.808935] usbcore: registered new interface driver cdc_ether
[17040.343229] rndis_host 2-1:1.0: RNDIS_MSG_QUERY(0x00010202) failed, -47
[17040.915682] eth2: register 'rndis_host' at usb-0000:00:10.0-1, RNDIS device 80:00:60:0f:e8:00
[17040.915721] usbcore: registered new interface driver rndis_host
[17040.931986] usbcore: registered new interface driver rndis_wlan
[17048.027188] eth2: no IPv6 routers present

The "RNDIS_MSG_QUERY(0x00010202) failed, -47" didn't show up with the 2.6.24 driver. (However, 2.6.24 had a packet reception problem, fixed by some other bits of the SynCE driver, but this doesn't appear on 2.6.25 anymore).

Steps to reproduce: Just turn on the device and plug it into the USB port.

At least, the patch makes things work...
Comment 1 Pierre Ynard 2008-05-02 06:58:16 UTC
Created attachment 16009 [details]
Patch from the SynCE rndis_host driver code
Comment 2 Anonymous Emailer 2008-05-02 07:06:33 UTC
Reply-To: akpm@linux-foundation.org

(switched to email.  Please respond via emailed reply-to-all, not via the
bugzilla web interface).

On Fri,  2 May 2008 06:56:37 -0700 (PDT) bugme-daemon@bugzilla.kernel.org wrote:

> http://bugzilla.kernel.org/show_bug.cgi?id=10590
> 
>            Summary: rndis_host fails to register HTC P3600 device
>            Product: Drivers
>            Version: 2.5
>      KernelVersion: 2.6.25
>           Platform: All
>         OS/Version: Linux
>               Tree: Mainline
>             Status: NEW
>           Severity: normal
>           Priority: P1
>          Component: Network
>         AssignedTo: jgarzik@pobox.com
>         ReportedBy: linkfanel@yahoo.fr
> 
> 
> Latest working kernel version: ???
> Earliest failing kernel version: ???, but fails with 2.6.24 too
> Distribution: Debian unstable
> Hardware Environment: AMD64 Sempron on a VIA board, HTC P3600 "phone" with
> Samsung SC32442B processor
> Software Environment: SynCE 0.11 (host), Microsoft__ Windows Mobile__ 5.0
> (phone)
> 
> Problem Description: When I connect my hype phone thingy to my computer, the
> rdnis_host driver is loaded, but registration of the device fails, with the
> following logs:
> 
> [17069.106611] usb 2-1: new full speed USB device using uhci_hcd and address
> 7
> [17069.228636] usb 2-1: configuration #1 chosen from 1 choice
> [17069.232878] usb 2-1: New USB device found, idVendor=0bb4, idProduct=0b05
> [17069.232884] usb 2-1: New USB device strings: Mfr=1, Product=2,
> SerialNumber=3
> [17069.232887] usb 2-1: Product: Generic RNDIS
> [17069.232890] usb 2-1: Manufacturer: HTC
> [17069.232892] usb 2-1: SerialNumber: ********-****-****-****-************
> [17069.367902] usbcore: registered new interface driver cdc_ether
> [17069.446807] rndis_host 2-1:1.0: RNDIS_MSG_QUERY(0x00010202) failed, -110
> [17069.511717] rndis_host 2-1:1.0: RNDIS_MSG_QUERY(0x01010101) failed, -110
> [17069.511725] rndis_host 2-1:1.0: rndis get ethaddr, -110
> [17069.513247] rndis_host: probe of 2-1:1.0 failed with error -110
> [17069.513290] usbcore: registered new interface driver rndis_host
> [17069.613383] rndis_wlan 2-1:1.0: RNDIS_MSG_QUERY(0x00010202) failed, -47
> [17069.614388] usbcore: registered new interface driver rndis_wlan
> 
> However, the SynCE project provides an alternative patched rndis_host driver,
> which does work. I narrowed down the diff to the relevant bits, and when
> patched with those bits, the mainline kernel driver works, with the following
> logs:
> 
> [17039.548771] usb 2-1: new full speed USB device using uhci_hcd and address
> 6
> [17039.668976] usb 2-1: configuration #1 chosen from 1 choice
> [17039.672000] usb 2-1: New USB device found, idVendor=0bb4, idProduct=0b05
> [17039.672006] usb 2-1: New USB device strings: Mfr=1, Product=2,
> SerialNumber=3
> [17039.672009] usb 2-1: Product: Generic RNDIS
> [17039.672012] usb 2-1: Manufacturer: HTC
> [17039.672014] usb 2-1: SerialNumber: ********-****-****-****-************
> [17039.808935] usbcore: registered new interface driver cdc_ether
> [17040.343229] rndis_host 2-1:1.0: RNDIS_MSG_QUERY(0x00010202) failed, -47
> [17040.915682] eth2: register 'rndis_host' at usb-0000:00:10.0-1, RNDIS
> device
> 80:00:60:0f:e8:00
> [17040.915721] usbcore: registered new interface driver rndis_host
> [17040.931986] usbcore: registered new interface driver rndis_wlan
> [17048.027188] eth2: no IPv6 routers present
> 
> The "RNDIS_MSG_QUERY(0x00010202) failed, -47" didn't show up with the 2.6.24
> driver. (However, 2.6.24 had a packet reception problem, fixed by some other
> bits of the SynCE driver, but this doesn't appear on 2.6.25 anymore).
> 
> Steps to reproduce: Just turn on the device and plug it into the USB port.
> 
> At least, the patch makes things work...
> 

Where exactly is this patch?

Thanks.
Comment 3 Pierre Ynard 2008-05-02 07:23:38 UTC
> Where exactly is this patch?

http://bugzilla.kernel.org/attachment.cgi?id=16009 or for convenience:

--- a/drivers/net/usb/rndis_host.c	2008-04-17 04:49:44.000000000 +0200
+++ b/drivers/net/usb/rndis_host.c	2008-05-02 13:49:12.000000000 +0200
@@ -51,6 +51,9 @@
  * currently rare) "Ethernet Emulation Model" (EEM).
  */
 
+/* SC_* Samsung processors needs an extra timeout */
+#define SC_SLEEP_TIMEOUT		20
+
 /*
  * RNDIS notifications from device: command completion; "reverse"
  * keepalives; etc
@@ -116,6 +119,7 @@
 	rsp = buf->msg_type | RNDIS_MSG_COMPLETION;
 	for (count = 0; count < 10; count++) {
 		memset(buf, 0, CONTROL_BUFFER_SIZE);
+		msleep(SC_SLEEP_TIMEOUT * 10);
 		retval = usb_control_msg(dev->udev,
 			usb_rcvctrlpipe(dev->udev, 0),
 			USB_CDC_GET_ENCAPSULATED_RESPONSE,
@@ -123,6 +127,7 @@
 			0, master_ifnum,
 			buf, CONTROL_BUFFER_SIZE,
 			RNDIS_CONTROL_TIMEOUT_MS);
+		msleep(SC_SLEEP_TIMEOUT * 10);
 		if (likely(retval >= 8)) {
 			msg_len = le32_to_cpu(buf->msg_len);
 			request_id = (__force u32) buf->request_id;
Comment 4 Anonymous Emailer 2008-05-02 11:25:50 UTC
Reply-To: david-b@pacbell.net

On Friday 02 May 2008, Andrew Morton wrote:
> (switched to email.  Please respond via emailed reply-to-all, not via the
> bugzilla web interface).
> 
> On Fri,  2 May 2008 06:56:37 -0700 (PDT) bugme-daemon@bugzilla.kernel.org
> wrote:
> 
> > http://bugzilla.kernel.org/show_bug.cgi?id=10590
> > 
> >            Summary: rndis_host fails to register HTC P3600 device
> >            Product: Drivers
> >            Version: 2.5
> >      KernelVersion: 2.6.25
> >                             ...
> > 
> > Latest working kernel version: ???
> > Earliest failing kernel version: ???, but fails with 2.6.24 too

If it never worked, that's relevant too.  Remember that this
driver is not just experimental, but it's coping with proprietary
Microsoft protocols that are neither correctly nor completely
documented.  And vendor firmware with its own bizarre behavior.
So unfortunately it's not necessarily going to talk to random
not-seen-before WinCE firmware.


> > Distribution: Debian unstable
> > Hardware Environment: AMD64 Sempron on a VIA board, HTC P3600 "phone" with
> > Samsung SC32442B processor
> > Software Environment: SynCE 0.11 (host), Microsoft__ Windows Mobile__ 5.0
> > (phone)
> > 
> > Problem Description: When I connect my hype phone thingy to my computer,
> the
> > rdnis_host driver is loaded, but registration of the device fails, with the
> > following logs:
> > 
> > [17069.106611] usb 2-1: new full speed USB device using uhci_hcd and
> address 7
> > [17069.228636] usb 2-1: configuration #1 chosen from 1 choice
> > [17069.232878] usb 2-1: New USB device found, idVendor=0bb4, idProduct=0b05
> > [17069.232884] usb 2-1: New USB device strings: Mfr=1, Product=2,
> > SerialNumber=3
> > [17069.232887] usb 2-1: Product: Generic RNDIS
> > [17069.232890] usb 2-1: Manufacturer: HTC
> > [17069.232892] usb 2-1: SerialNumber: ********-****-****-****-************
> > [17069.367902] usbcore: registered new interface driver cdc_ether
> > [17069.446807] rndis_host 2-1:1.0: RNDIS_MSG_QUERY(0x00010202) failed, -110
> > [17069.511717] rndis_host 2-1:1.0: RNDIS_MSG_QUERY(0x01010101) failed, -110

So the requests for OID_GEN_PHYSICAL_MEDIUM (to support rndis_wlan)
and OID_802_3_PERMANENT_ADDRESS failed ... the former is fine, the
latter means it doesn't conform to the RNDIS spec at all.
 

> > [17069.511725] rndis_host 2-1:1.0: rndis get ethaddr, -110
> > [17069.513247] rndis_host: probe of 2-1:1.0 failed with error -110

... so it's no wonder it (politely) refuses to talk to that device.


> > However, the SynCE project provides an alternative patched rndis_host
> driver,
> > which does work. I narrowed down the diff to the relevant bits, and when
> > patched with those bits, the mainline kernel driver works, with the
> following
> > logs:
> > 
> > [17039.548771] usb 2-1: new full speed USB device using uhci_hcd and
> address 6
> > [17039.668976] usb 2-1: configuration #1 chosen from 1 choice
> > [17039.672000] usb 2-1: New USB device found, idVendor=0bb4, idProduct=0b05
> > [17039.672006] usb 2-1: New USB device strings: Mfr=1, Product=2,
> > SerialNumber=3
> > [17039.672009] usb 2-1: Product: Generic RNDIS
> > [17039.672012] usb 2-1: Manufacturer: HTC
> > [17039.672014] usb 2-1: SerialNumber: ********-****-****-****-************
> > [17039.808935] usbcore: registered new interface driver cdc_ether
> > [17040.343229] rndis_host 2-1:1.0: RNDIS_MSG_QUERY(0x00010202) failed, -47
> > [17040.915682] eth2: register 'rndis_host' at usb-0000:00:10.0-1, RNDIS
> device
> > 80:00:60:0f:e8:00

The interesting thing being:  where did that ethernet address come
from, for this firmware which explicitly violates the RNDIS spec by
not returning it when asked for OID_802_3_PERMANENT_ADDRESS ??


> > At least, the patch makes things work...
> 
> Where exactly is this patch?

It's in bugzilla.  Just adds some msleep(200) calls around
every RNDIS request ... ugly hack.

Can the submitter please just try increasing the existing
msleep() at the end of that loop, to msleep(20) from msleep(2)?

- Dave
Comment 5 Pierre Ynard 2008-05-02 14:13:35 UTC
> Can the submitter please just try increasing the existing
> msleep() at the end of that loop, to msleep(20) from msleep(2)?

Sure, I'll do that when I go back to work on Monday.
Comment 6 Anonymous Emailer 2008-05-03 03:57:07 UTC
Reply-To: jussi.kivilinna@mbnet.fi

Quoting David Brownell <david-b@pacbell.net>:
>
> If it never worked, that's relevant too.  Remember that this
> driver is not just experimental, but it's coping with proprietary
> Microsoft protocols that are neither correctly nor completely
> documented.  And vendor firmware with its own bizarre behavior.
> So unfortunately it's not necessarily going to talk to random
> not-seen-before WinCE firmware.
>

Maybe rndis_host should be changed to wait for responce notification  
before trying to get response. That's what documents say should be  
done. I'm extremely busy next few weeks but after that I can try do  
this change to rndis_host.

  - Jussi
Comment 7 Anonymous Emailer 2008-05-03 08:25:40 UTC
Reply-To: david-b@pacbell.net

On Saturday 03 May 2008, Jussi Kivilinna wrote:
> Quoting David Brownell <david-b@pacbell.net>:
> >
> > If it never worked, that's relevant too.  Remember that this
> > driver is not just experimental, but it's coping with proprietary
> > Microsoft protocols that are neither correctly nor completely
> > documented.  And vendor firmware with its own bizarre behavior.
> > So unfortunately it's not necessarily going to talk to random
> > not-seen-before WinCE firmware.
> >
> 
> Maybe rndis_host should be changed to wait for responce notification  
> before trying to get response.

Maybe; I had that thought too.  For the record, the reason
it doesn't do that was to simplify the original code, and
have it be more robust.  Each new mechanis that it depends
on is one more opportunity for broken WinCE firmware to
cause trouble for Linux hosts, after all!


> That's what documents say should be done.

The ones I said just described the mechanism, and said
nothing about "should".  ;)


> I'm extremely busy next few weeks but after that I can try do   
> this change to rndis_host.

Sure.  I'd be glad to hand that rndis_host code over to
someone more actively involved in working with WinCE
devices that need it, by the way...

- Dave
Comment 8 Pierre Ynard 2008-05-05 02:59:01 UTC
> > Can the submitter please just try increasing the existing
> > msleep() at the end of that loop, to msleep(20) from msleep(2)?
> 
> Sure, I'll do that when I go back to work on Monday.


Apparently it does the trick, changing to msleep(20) makes it
work with my device.
Comment 9 Anonymous Emailer 2008-05-06 12:46:09 UTC
Reply-To: akpm@linux-foundation.org

On Mon, 5 May 2008 09:58:50 +0000 (GMT)
Pierre Ynard <linkfanel@yahoo.fr> wrote:

> > > Can the submitter please just try increasing the existing
> > > msleep() at the end of that loop, to msleep(20) from msleep(2)?
> > 
> > Sure, I'll do that when I go back to work on Monday.
> 
> 
> Apparently it does the trick, changing to msleep(20) makes it
> work with my device.

I don't think we ever saw a final patch for this?
Comment 10 Pierre Ynard 2008-05-10 21:23:00 UTC
Andrew Morton wrote:
> I don't think we ever saw a final patch for this?

Some devices running some WinCE firmware (with SC_* Samsung processors
according to the SynCE project, verified on a HTC P3600 device) fail to
register because they apparently need extra time to respond correctly
to requests. Increase the existing delay to satisfy them. Based on code
from the SynCE project, on a suggestion of David Brownell.

This patch Works For Me(tm).

Signed-off-by: Pierre Ynard <linkfanel@yahoo.fr>

diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index 21a7785..e1177cc 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -194,7 +194,7 @@ int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf)
 			dev_dbg(&info->control->dev,
 				"rndis response error, code %d\n", retval);
 		}
-		msleep(2);
+		msleep(20);
 	}
 	dev_dbg(&info->control->dev, "rndis response timeout\n");
 	return -ETIMEDOUT;


Regards,
Comment 11 Pierre Ynard 2008-08-12 01:15:47 UTC
This was fixed as commit 74ef5c5025fed5ad6a1cbdfb5c2e831acdbbd2fe

Note You need to log in before you can comment on or make changes to this bug.