[bug?] Samsung Galaxy S won't tether through USB due to bad CDC descriptors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(Oliver, Iker: resending with correct addresses, though Markus's is
 still a guess.  Sorry for the duplicate message)
Hi Oliver et al,

Iker Salmón San Millán wrote[1]:

> If you connect the samsung galaxy S (i know also SII is affected) to the
> usb hub and activate usb tethering it won't create usb0 interface and dmesg
> shows this:
>
> [  509.033511] usb 2-2: USB disconnect, device number 5
> [  509.304059] usb 2-2: new high-speed USB device number 6 using ehci_hcd
> [  509.438155] usb 2-2: New USB device found, idVendor=04e8, idProduct=6881
> [  509.438165] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
> [  509.438172] usb 2-2: Product: SAMSUNG_Android
> [  509.438178] usb 2-2: Manufacturer: SAMSUNG
> [  509.438183] usb 2-2: SerialNumber: 353271BC9D8400EC
> [  509.743606] usbcore: registered new interface driver cdc_ether
> [  509.745205] usb 2-2: bad CDC descriptors
> [  509.745231] usbcore: registered new interface driver rndis_host
> [  509.753788] usb 2-2: bad CDC descriptors
> [  509.753821] usbcore: registered new interface driver rndis_wlan

It is reproducible in 3.2-rc7 and current 3.1.y kernels for him.

Markus Kolb wrote[2]:

> Consider this patch as a workaround.
>
> My knowledge of coding for Linux kernel, USB and the tether hardware
> is close to be zero.
>
> It works currently but it is no real solution. There should be a
> "correct" way to get the true interface numbers of master and slave.
>
> E.g. there is a bFirstInterface. I think this might be the
> information to start with. But how to get this from the USB stack? I
> don't know up to now.
[...]
> I don't know if this is really a bug in Linux kernel driver. Maybe the
> USB standard says the master interface need to start with 0.
>
> Then the bug is in Android OS.
>
> Newer Android versions >= 2.3.7 has switched back the master
> interface nr to 0 and there it works again...

Iker tried Markus's patch[*] and it works for him.  Known problem?  Any
advice for these two?

Thanks,
Jonathan

[1] http://bugs.debian.org/655387
[2] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/796006
[*]

 drivers/net/usb/cdc_ether.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 41a61efc331e..df36cb513e51 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -86,6 +86,8 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
 	struct usb_driver		*driver = driver_of(intf);
 	struct usb_cdc_mdlm_desc	*desc = NULL;
 	struct usb_cdc_mdlm_detail_desc *detail = NULL;
+	int				mapped_master;
+	int				mapped_slave;
 
 	if (sizeof dev->data < sizeof *info)
 		return -EDOM;
@@ -188,6 +190,24 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
 						info->u->bMasterInterface0);
 			info->data = usb_ifnum_to_if(dev->udev,
 						info->u->bSlaveInterface0);
+			if ((!info->control || !info->data)
+					&& (info->u->bMasterInterface0 > 0)) {
+				// try with mapping to start with 0
+				mapped_master = (info->u->bMasterInterface0
+						- ((info->u->bSlaveInterface0 >
+						info->u->bMasterInterface0) ?
+						info->u->bMasterInterface0 :
+						info->u->bSlaveInterface0));
+				mapped_slave = (info->u->bSlaveInterface0
+						- ((info->u->bSlaveInterface0 >
+						info->u->bMasterInterface0) ?
+						info->u->bMasterInterface0 :
+						info->u->bSlaveInterface0));
+				info->control = usb_ifnum_to_if(dev->udev,
+						mapped_master);
+				info->data = usb_ifnum_to_if(dev->udev,
+						mapped_slave);
+			}
 			if (!info->control || !info->data) {
 				dev_dbg(&intf->dev,
 					"master #%u/%p slave #%u/%p\n",
-- 
1.7.8.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux