On 2/24/21 12:04 PM, Johan Hovold wrote: > Perhaps you can even figure out how to poll for an empty TX FIFO from > it, unless Charles is able to provide some details on that separate > matter? > I presume from the code below, that when the device is closed, all data waiting to send is clobbered (if so, so the problem is the driver and not the device) I would have thought that the driver should drain the buffers. I can see that this might be a problem if there is flow control (it may never drain) but the current method seems pretty brutal. 119 void usb_serial_generic_close(struct usb_serial_port *port) 120 { 121 unsigned long flags; 122 int i; 123 124 if (port->bulk_out_size) { 125 for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i) 126 usb_kill_urb(port->write_urbs[i]); 127 128 spin_lock_irqsave(&port->lock, flags); 129 kfifo_reset_out(&port->write_fifo); 130 spin_unlock_irqrestore(&port->lock, flags); 131 } 132 if (port->bulk_in_size) { 133 for (i = 0; i < ARRAY_SIZE(port->read_urbs); ++i) 134 usb_kill_urb(port->read_urbs[i]); 135 } 136 }