From: Markus Kolb <linux-201011@tower-net.de>
To: linux-kernel@vger.kernel.org
Cc: dbrownell@users.sourceforge.net
Subject: [PATCH] cdc_ether fix to support Samsung Galaxy S with Android 2.3.4 again
Date: Thu, 30 Jun 2011 21:20:32 +0200 [thread overview]
Message-ID: <4E0CCC80.4070701@tower-net.de> (raw)
[-- 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",
reply other threads:[~2011-06-30 19:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E0CCC80.4070701@tower-net.de \
--to=linux-201011@tower-net.de \
--cc=dbrownell@users.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.