Re: Setting terminal baud-rate.

Richard B. Johnson (root@chaos.analogic.com)
Fri, 22 Jan 1999 23:31:39 -0500 (EST)


On Fri, 22 Jan 1999, Richard B. Johnson wrote:

> On Fri, 22 Jan 1999, Theodore Y. Ts'o wrote:
[SNIPPED]
>
> I am using a fairly recent version of glibc. I'm directly making
> an ioctl(TCSETS, &struct_termios) with the above shown parameters
> set.
>
> 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!
>
> Therefore I got out my scope and timed it. (cat /dev/zero /dev/modem).
> I measured the time between start-bits (zeros are only start-bits).
> Assuming 10-bits/baud (1 stop, 1 start, and 8 data), the speeds are
> as shown. Everything works fine if I use 38400 and set the SPD flag
> with setserial.

I found the problem, but I don't know how it happends. Your ioctl()
works fine if I make a simple 10-line program to set the speed.

The problem is that after a fork(), the termios structure somehow
gets modified. I don't know how because the structure is never used
again by the parent. In fact, if I move it off the stack, out of
local data, into global, everything works fine.

This is weird because everything works fine anywhere if the speed is
38400 or less. There are also no local variables larger than an `int`
(no string buffers or longs) that could be overwriting the termios
structure on the stack.

Cheers,
Dick Johnson
***** FILE SYSTEM WAS MODIFIED *****
Penguin : Linux version 2.1.131 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.
Wisdom : It's not a Y2K problem. It's a Y2Day problem.

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