Re: non-standard baud rates with Prolific 2303 USB-serial

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 24, 2021 at 01:13:39PM -0500, Michael G. Katzmann wrote:
> 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.

We do; the code below isn't called until after we've waited for the
buffers to drain (driver buffers + device FIFO).

I'll provide a patch so that you can extend the timeout for draining the
driver buffers (defaults to 30 s), but the main problem is that we don't
know how to query the PL2303 FIFO fill level.

> 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 }

Johan



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux