Re: linux raw serio driver 32 byte maximum
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2011-08-30 22:50:24
Hi Joey, On Tue, Aug 30, 2011 at 05:59:49PM -0400, Joey Oravec wrote:
Dmitry - In serio_raw.c function serio_raw_write() there's a check: if (count > 32) count = 32; which coerces any call to write a maximum of 32 bytes. Do you know why this limitation is in the code? Characters get written one-by-one to the tty layer so I don't understand why it's there.
The driver was trying to mimic behavior of 2.4 psaux device as close as possible so 32 bytes limit came from there. Besides I think it is a good idea to not allow one process hog serio port for too long...
I'm not sure which section of the manpage defines write for a serial port. In the ordinary case I expected this function to keep transmitting until complete or an error occurs. If O_NONBLOCK was specified then I might expect EAGAIN. Right now my calling code doesn't expect a successful partial write. Do you think this module is doing the right thing? Can you comment on what the caller must expect?
I think you should handle partial writes. Even if driver honored O_NONBLOCK you could get a partial write and not necessarily EAGAIN. May I ask you what you are using serio_raw for? Thanks. -- Dmitry