usbip-server

CDC Serial Port

A CDC ACM (Abstract Control Model) device, the USB class of virtual serial ports. Linux binds its cdc_acm driver to it and the device shows up as /dev/ttyACMx.

   
Program out/usb_cdc_device
Source src/usb_cdc/
USB id fa00:0001
Interfaces communication interface (class 0x02, ACM), data interface (class 0x0a)
Endpoints 0x82 interrupt IN for notifications, 0x01 bulk OUT and 0x81 bulk IN for data, 512 byte packets

Try It

$ make
$ out/usb_cdc_device &
$ sudo usbip attach -r localhost -b 1-1
$ ls /dev/ttyACM*
/dev/ttyACM0

Open the port with any terminal program, for example picocom (quit with Ctrl-A Ctrl-X):

$ picocom -b 115200 /dev/ttyACM0
Tick 0
Tick 1
...

What you type is printed by the device. Writing from a script works too:

$ echo "hi!" > /dev/ttyACM0

The port belongs to the dialout group, add yourself to it to open it without root.

Detach with sudo usbip detach -p 0.

What You See

USB CDC Device Activated
USBIPServer: Connected
USBIPProtocol: USBIP_CMD_REQ_DEV_IMPORT '1-1'
USB Reset
Linecoding: Baud=115200 CharFormat=0 Parity=0 DataBits=8
Linestate: DTR: HIGH RTS: HIGH
Input: 0x68, 0x69, 0x21, 0x0a,
Linestate: DTR: LOW  RTS: LOW

How It Works

Prototyping

Start here for any device that should look like a serial port: a debug console, a modem, a GPS receiver or a microcontroller bridge. The host side needs no special software, every terminal program and serial library works with it.

Troubleshooting