mbed-os/TESTS/usb_device/serial
Filip Jagodzinski 7db3a8a34a Tests: USB: DTR fix for Linux hosts
A DTR line is used to signal that the host has configured a terminal and
is ready to transmit and receive data from the USB CDC/Serial device.
When this test suite is run with the use of a Linux host, a workaround has
to be used to overcome some platform specific DTR line behavior.
Every time the serial port file descriptor is opened, the DTR line is
asserted until the terminal attributes are set.
As a consequence, the device receives a premature DTR signal with a
duration of 200-500 us before the correct, long-lasting DTR signal set by
the host-side test script. (tested on the Linux kernel 4.15.0)

The solution is to wait for the first DTR spike, ignore it, and wait for
the correct DTR signal again.
2019-02-22 10:53:21 -06:00
..
README.md Tests: USB: Add tests for CDC class. 2019-02-22 10:53:20 -06:00
main.cpp Tests: USB: DTR fix for Linux hosts 2019-02-22 10:53:21 -06:00

README.md

udev rules for Mbed USB CDC device

Before running tests-usb_device-serial test suite on Debian-based Linux distros, make sure to update the udev rules as follows:

sudo tee /etc/udev/rules.d/99-ttyacms.rules >/dev/null <<EOF
ATTRS{idVendor}=="1f00" ATTRS{idProduct}=="2013", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idVendor}=="1f00" ATTRS{idProduct}=="2012", ENV{ID_MM_DEVICE_IGNORE}="1"
EOF
sudo udevadm control --reload-rules

This will prevent the ModemManager daemon from automatically opening the port and sending the AT commands, which it does for every new /dev/ttyACM device registered in system.