Re: Setting terminal baud-rate.

Theodore Y. Ts'o (tytso@mit.edu)
Fri, 22 Jan 1999 18:06:27 -0500 (EST)


Date: Fri, 22 Jan 1999 10:12:57 -0500 (EST)
From: "Richard B. Johnson" <root@chaos.analogic.com>

Using version 2.1.131, I cannot set the baud rate of a terminal
to a speed higher than 38400 baud without cheating and using the
`setserial spd_hi` function. This function now results in a
warning message that it has been deprecated.

>From termbits.h

#define B38400 0000017 Works and everything below.
#define B57600 0010001 Sets baud-rate to about 600 baud
#define B115200 0010002 Sets baud-rate to about 1240 baud
#define B230400 0010003 Sets baud-rate to about 800 baud
#define B460800 0010004 Sets baud-rate to about 900 baud

Is this a bug or have I forgotten to set some magic high-speed
bit?

What version of libc do you have on your machine, and what application
and what version are you using to set the speed? Furthermore, how are
you measuring the speed?

I just timed the amount of time it took to send a largish file out the
serial port, which was configured with flow-control off, and which had
nothing attached to it. (i.e., "time cat large-file > /dev/ttyS0").
When I increased the speed from 38400 to 57600, the time it took to
transmit the file dropped in half. When I further increased the speed
to 115200 bps, the time to transmit the file dropped in half again.

If you are getting the higher speeds using setserial spd_hi, but it's
not working via directly setting the baud rate, my guess is that you
have an out-of-date libc, which doesn't know about speeds faster than
38400; that must be a *really* ancient libc though, which is rather
curious. Kernel support for 57600 and 115200 have been around since at
least the 2.0 kernel, and possibly even the 1.2 kernel. There hasn't
been real need to use setserial spd_hi for years, assuming an up-to-date
libc.

- Ted

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