Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

USB Communications device with multiple serial ports, working on all platforms

We have an embedded device that connects to the PC via USB, and it has multiple virtual serial ports (CDC-ACM).

We have this working on Windows. On the embedded device, we have multiple CDC-ACM interfaces. The USB descriptors declare it as a composite device (class=0xEF, sub-class=2, protocol=1), and it has an "Interface Association Descriptor" for each virtual serial port. On Windows, we use an INF file that installs usbser.sys for each CDC-ACM control interface (MI_00, MI_02, etc).

However, as we've found, this method doesn't seem to work for Mac. I've found that I can get it to work for the Mac and Linux, by changing it to a "Communications" class (class=2, sub-class=0, protocol=0), and removing the IADs. (For Linux, testing with Ubuntu, I found that this worked with the Ubuntu Linux kernel 2.6.35-28 or newer. With earlier kernels, only the first serial port worked.) But then, this method doesn't work for Windows.

What method can be used to make a USB device with multiple virtual serial ports, that works on Windows, Mac, and Linux? I think I'd prefer a solution that uses the CDC-ACM standard as much as possible, and avoids the write-your-own-drivers option as much as possible.

like image 402
Craig McQueen Avatar asked Apr 01 '11 01:04

Craig McQueen


People also ask

What is serial communication USB?

A serial port USB is intended to interface with a modem or with a similar communication device. This USB gateway usually identifies hardware that is more or less compliant to RS-232 standard.

Can I use USB for serial communication?

USB has become the preferred serial communication protocol between digital products like computers and peripheral devices as it can transmit data across longer cables and offers higher transmission rates. UART, however, is still is used today for certain applications and is often seen in older devices.

What is USB ACM device?

USB Host functions to support Communication Device Class (CDC) Abstract Control Model (ACM) USB Devices. The CDC ACM class in the USB Host Component is used for attaching communication devices to your system.

Are all USB ports serial?

In strict theory, any port using serial communications (almost any modern bus - including USB, which stands for "Universal Serial Bus", if my memory serves me) is a "serial port". However, in most cases, when people refer to "the serial port", they actually refer to a port that complies to RS-232. Save this answer.

What advantage does a USB port have over serial ports?

USB allows data to travel on the average of ten times the speed of the normal parallel port. It is also faster than a serial port. The average serial port transfer rate is 150 kbps; the USB port is up to 12 Mbps. USB 2 is forty times faster, with a maximum transfer rate of 480 Mbps.


2 Answers

The one way I can think of off top of my head would be the device presents itself as an USB hub with multiple separate single-serial-port devices attached to it. This isn't pretty but very bulletproof.

like image 171
SF. Avatar answered Jun 05 '23 04:06

SF.


As Apple's drivers don't support composite CDC devices, I'd suggest either making your device reconfigure somehow and making your alternate descriptors plain CDC, or sticking with the composite and using a third party driver (my company makes CDC ACM drivers for OS X which will probably support your device).

It may also be possible to force the issue with a codeless kext.

like image 27
Hasturkun Avatar answered Jun 05 '23 05:06

Hasturkun