]> git.proxmox.com Git - mirror_qemu.git/commit
usb-serial: Fix timeout closing the device
authorJason Andryuk <jandryuk@gmail.com>
Mon, 16 Mar 2020 17:46:10 +0000 (13:46 -0400)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 17 Mar 2020 08:05:34 +0000 (09:05 +0100)
commit647ee9877272d4359659e2595262db0e062c8ffc
tree922bf0353aa1b648dd7fe84cb08b1c4598000ef4
parent30ad5fdd34d9cfc9f16e73e0229c133d7317a42a
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>
hw/usb/dev-serial.c