diff options
author | Jason Andryuk <jandryuk@gmail.com> | 2020-03-16 13:46:10 -0400 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2020-03-17 09:05:34 +0100 |
commit | 647ee9877272d4359659e2595262db0e062c8ffc (patch) | |
tree | 922bf0353aa1b648dd7fe84cb08b1c4598000ef4 /hw/usb | |
parent | 30ad5fdd34d9cfc9f16e73e0229c133d7317a42a (diff) |
usb-serial: Fix timeout closing the device
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 <jandryuk@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Message-id: 20200316174610.115820-5-jandryuk@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb')
-rw-r--r-- | hw/usb/dev-serial.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c index 77b964588b..d2c03681b7 100644 --- a/hw/usb/dev-serial.c +++ b/hw/usb/dev-serial.c @@ -332,7 +332,7 @@ static void usb_serial_handle_control(USBDevice *dev, USBPacket *p, 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: |