Linux guests wait ~30 seconds when closing the emulated /dev/ttyUSB0.
During that time, the kernel driver is sending many control URBs
requesting GetModemStat (5). Real hardware returns a status with
FTDI_THRE (Transmitter Holding Register) and FTDI_TEMT (Transmitter
Empty) set. QEMU leaves them clear, and it seems Linux is waiting for
FTDI_TEMT to be set to indicate the tx queue is empty before closing.
Set the bits when responding to a GetModemStat query and avoid the
shutdown delay.
Signed-off-by: Jason Andryuk <[email protected]>
Reviewed-by: Samuel Thibault <[email protected]>
Message-id:
20200316174610[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
break;
case DeviceInVendor | FTDI_GET_MDM_ST:
data[0] = usb_get_modem_lines(s) | 1;
- data[1] = 0;
+ data[1] = FTDI_THRE | FTDI_TEMT;
p->actual_length = 2;
break;
case DeviceOutVendor | FTDI_SET_EVENT_CHR: