If we need to update libc and the kernel anyway, could we please
do this right this time? Let's define a new libc interface:
int tcsetspeed(int filedes, unsigned long speed);
unsigned long tcgetspeed(int filedes);
[Or, if we want to allow independent input and output rates:
int tcsetspeed(int filedes, unsigned long ispeed, unsigned long ospeed);
unsigned long tcgetispeed(int filedes);
unsigned long tcgetospeed(int filedes);
]
[Hmmm... The "unsigned long" should probably be something like "bps_t".]
These can be supported in the kernel with new TIOSETBPS (with the
bps rate as a parameter) and TIOGETBPS ioctl()s in the serial driver.
I leave it up to the serial driver gurus to determine how far off the
clock division can be from an integer before they decide to return -1
(EINVAL?), and of course it will have to be an error to request a
rate beyond the capabilities of the device.
This allows an application to use whatever arbritrary bps rate it
thinks it needs (provided the device can support the rate), and
allows for rates up to 4,294,967,295 bps on a 32-bit machine,
and 2**64-1 bps on a 64-bit machine, which should exceed any
possible need for quite some time to come ;-).
Comments?
--Ken Pizzini
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/