Re: [PATCH] Combine two one-character CR-LF writes into one two-character write for O_ONLCR

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

 



> Good question. Right now, there are a number of USB serial devices that don't
> use the generic USB serial framework, but they generally seem to use the
> write_urb_busy flag the same way the generic code does. This makes it easier

They all suck, they all misimplement the interfaces. The proper way to do
this is to use a FIFO (kfifo makes it tiny amounts of code) and then
either fire off a new URB whenever one completes or if you are
constrained on urb counts but have over one implement Nagle on it.

> to mix and match generic and non-generic code. Going to a FIFO approach and
> doing away with the write_urb_busy flag seemed like a lot of change for very
> little benefit. In addition, I would argue that doing one two-character write()
> of two one-character writes() is a more logical way to output two characters,
> anyway.

The tty layer requires you can provide some buffering and that your
write_room function doesn't reduce by more than the bytes offered without
them being written. The sane way to do that is to use the kfifo API.

The ONLCR stuff is just a corner case example of where the USB serial
code breaks so the real bug wants fixing.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

  Powered by Linux