All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cdc_ether fix to support Samsung Galaxy S with Android 2.3.4 again
@ 2011-06-30 19:20 Markus Kolb
  0 siblings, 0 replies; only message in thread
From: Markus Kolb @ 2011-06-30 19:20 UTC (permalink / raw)
  To: linux-kernel; +Cc: dbrownell

[-- Attachment #1: Type: text/plain, Size: 444 bytes --]

cdc_ether uses currently the wrong bInterfaceNumber(s).
It uses CDC Union information for bMasterInterface and bSlaveInterface 
which seems to be wrong. At least there isn't any relation.
I don't know what would be the correct way but with my patch the driver 
supports the mobile phone again and there should be no malfunction with 
already supported hardware.
For a bug report see
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/796006


[-- Attachment #2: Ubuntu_bug_796006.patch --]
[-- Type: text/x-patch, Size: 1440 bytes --]

diff -ru linux-2.6.38/drivers/net/usb/cdc_ether.c linux-2.6.38.patched/drivers/net/usb/cdc_ether.c
--- linux-2.6.38/drivers/net/usb/cdc_ether.c	2011-03-15 02:20:32.000000000 +0100
+++ linux-2.6.38.patched/drivers/net/usb/cdc_ether.c	2011-06-30 18:48:29.749287600 +0200
@@ -86,6 +86,8 @@
 	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 @@
 						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",

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-06-30 19:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-30 19:20 [PATCH] cdc_ether fix to support Samsung Galaxy S with Android 2.3.4 again Markus Kolb

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.