For the following USB serial device:
umodem0: <STMicroelectronics STM32 Virtual ComPort, class 2/2, rev 2.00/2.00, addr 1> on usbus0
Attached via the following USB 3.0 controller:
xhci0: <AMD Starship USB 3.0 controller> mem 0xa0000000-0xa00fffff irq 103 at device 0.3 numa-domain 2 on pci18
A usage model that behaves as follows always fails to receive the response on the second iteration:
- open("/dev/cuaU0", ...);
- write(fd, cmd, sizeof(cmd));
- read(fd, response, sizeof(response);
- close(fd);
The first attempt after a boot will succeed; the second will fail to receive the response,
The third will succeed, the fourth fail, ....
Preceeding each open(2) with the following command is a workaround:
usbconfig -d <bus>.<address> reset
A better solution is to enable usb/serial/umodem.c to clear stall on ucom_cfg_open().
In order for this to work 100%, usb/serial/usb_serial.c@ucom_queue_command() must
wait for ucom_cfg_open() to execute as it does for ucom_cfg_close().