Re: Setting terminal baud-rate.

Theodore Y. Ts'o (tytso@mit.edu)
Sat, 23 Jan 1999 00:06:49 -0500 (EST)


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

There are no errors. A connected modem works fine. However, this
is a long-used call-back program which runs fine at speeds at and
below 38400. However when I set the speed to higher values, I noted
that the modem would only connect at 1200 baud!

Well, I can't duplicate it on my 2.2.0-pre7 machine, with RedHat 5.2,
and glibc 2.0.7. What do you get when you try the following procedure?

- Ted

<tytso@rsts-11.mit.edu> {/usr/rtmp}
1027% stty 38400 < /dev/ttyS0
<tytso@rsts-11.mit.edu> {/usr/rtmp}
1028% time cat /sbin/e2fsck > /dev/ttyS0
0.00user 0.02system 1:11.72elapsed 0%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (142major+11minor)pagefaults 0swaps
<tytso@rsts-11.mit.edu> {/usr/rtmp}
1029% cat foo.c
#include <unistd.h>
#include <termios.h>
#include <stdlib.h>
#include <ioctls.h>

main()
{
struct termios io_mod;

memset(&io_mod, 0x00, sizeof(io_mod));
io_mod.c_cflag = B57600|CS8|CREAD|CLOCAL;
io_mod.c_iflag = IGNBRK|IGNPAR;
io_mod.c_cc[VMIN] = (cc_t) 1;
io_mod.c_cc[VTIME] = (cc_t) 1;
if (ioctl(0, TCSETS, &io_mod) < 0)
perror("ioctl");
}

<tytso@rsts-11.mit.edu> {/usr/rtmp}
1030% cc -o /tmp/foo foo.c
<tytso@rsts-11.mit.edu> {/usr/rtmp}
1031% ./foo < /dev/ttyS0
<tytso@rsts-11.mit.edu> {/usr/rtmp}
1032% stty < /dev/ttyS0
speed 57600 baud; line = 0;
intr = <undef>; quit = <undef>; erase = <undef>; kill = <undef>; eof = <undef>;
start = <undef>; stop = <undef>; susp = <undef>; rprnt = <undef>;
werase = <undef>; lnext = <undef>; flush = <undef>; min = 1; time = 1;
ignbrk -brkint -icrnl -imaxbel
-opost -onlcr
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke
<tytso@rsts-11.mit.edu> {/usr/rtmp}
1033% time cat /sbin/e2fsck > /dev/ttyS0
0.01user 0.02system 0:47.79elapsed 0%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (74major+11minor)pagefaults 0swaps
<tytso@rsts-11.mit.edu> {/usr/rtmp}
1034% stty 115200 < /dev/ttyS0
<tytso@rsts-11.mit.edu> {/usr/rtmp}
0.01user 0.01system 0:23.90elapsed 0%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (74major+11minor)pagefaults 0swaps

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