Exposing vendor-specific ACM channels to userspace as tty devices

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

 



Hi,

Nokia S60 phones expose two CDC ACM channels. The first is a modem and
is properly detected by the current cdc-acm driver. The second has a
protocol ID of 0xff ('vendor specific') and /dev/ttyACM* is NOT
currently created for it.

This second channel is useful, since it's freely usable by third-party
S60 application developers. It's sometimes used for debuggers or, in our
case, remote control tools. At the S60 end, it just acts as a serial
port (as it does on Windows and MacOS X). We should expose it as
a /dev/ttyACM* device so that user-space tools can use it on Linux, too.

I attach a simple patch which does just that.

However! It's not that simple.

The reason is that some Windows Mobile/Windows CE devices support a
remote ethernet protocol called RNDIS, which is build atop CDC ACM. This
sadly uses the same class, subclass and protocol IDs.

So currently drivers/net/usb/rndis_host.c tries to register for exactly
the same devices. It eventually fails (when usbnet_generic_cdc_bind
determines that it's not a suitable ethernet interface after all). But,
if we create a serial port in cdc-acm, rndis_host doesn't even get a
chance to try.

What's the best way to allow each driver to have a crack at this
particular interface?

My plan would be:
      * No longer attempt to bind to this sort of interface from
        rndis_host.
      * Export a function from the rndis_host driver to request for it
        to try to bind to a particular interface.
      * Call that function from cdc-acm, for the relevant interfaces.
      * If it fails, fall back to exposing it as a tty device.

But this would introduce a dependency from cdc-acm on rndis_host, which
doesn't sound right. Can anyone suggest a better way?

Many thanks for your time,

Adrian

PS this is my first attempt at a kernel change so apologies for whatever
large parts of this e-mail are completely stupid.



Patch below:

This change causes the cdc-acm driver to create /dev/ttyACM*
files even for devices which do not claim to be modems.

This is useful, for example, with Nokia S60 devices where
the second ("vendor-specific") ACM channel is the approved
way for S60 applications to communicate with a host PC.
---
 drivers/usb/class/cdc-acm.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 4878528..a332104 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1390,7 +1390,16 @@ static struct usb_device_id acm_ids[] = {
    { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,
        USB_CDC_ACM_PROTO_AT_CDMA) },

-   /* NOTE:  COMM/ACM/0xff is likely MSFT RNDIS ... NOT a modem!! */
+   /* vendor-specific channels. These are sometimes useful to
+    * expose as tty devices, e.g. for Nokia S60 phones where
+    * this second ACM channel can be used by phone application
+    * developers.
+    * Sadly sometimes Microsoft RNDIS interfaces also look like
+    * this; they should be claimed by the rndis_host driver. */
+   { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,
+       USB_CDC_ACM_PROTO_VENDOR),
+   },
+
    { }
 };

-- 
1.6.0.4


--
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