Alan Cox wrote:
> In a waiting case the driver will get
>
> ->chars_in_buffer
> until it returns zero
> ->wait_until_sent
> ->change_termios
>
> which serializes with respect to the one writer. If you have a writer
> during a termios change by another well tough luck, you lose and I've
> no intention of changing that behaviour unless someone cites a standard
> requiring it.
Right, of course.
My comments about TCSETAW just muddled the issue. Scratch those.
The problem is that a non-sleeping USB serial set_termios has to
return before it can be sure the termios settings have taken effect.
With USB we can send an urb to the device telling it to change termios
settings, but without waiting for the urb callback we don't know
that the device has received the command and actually changed the
settings.
So data written immediately following the set_termios, in the same
process, might possibly be sent out the serial port before the
termios changes have taken effect.
There are several solutions:
* The tty layer could use a semaphore so the USB serial set_termios could
sleep until the new termios settings have taken effect before returning.
* The USB serial driver could hold off sending data to the device after a
non-sleeping set_termios until it knew the settings had taken effect in
the device.
* Maybe in practice this is not a problem--we can just say "set_termios
for USB serial devices will change the termios settings as soon as
possible, but there is a slight chance data written immediately after
set termios might go out under the previous termios settings".
* Or ... other suggestions?
-- Al
On Gwe, 2004-10-01 at 19:14, Al Borchers wrote:
> * The tty layer could use a semaphore so the USB serial set_termios could
> sleep until the new termios settings have taken effect before returning.
This seems to be the right choice and is the change I will implement.