* Problem in writing to the serial port in 2.4.19
[not found] <20021021102622Z261330-32597+6184@vger.kernel.org>
@ 2002-10-21 12:32 ` Joosun Hahn
0 siblings, 0 replies; only message in thread
From: Joosun Hahn @ 2002-10-21 12:32 UTC (permalink / raw)
To: linux-kernel
Hello, all.
I wrote a linux loadable kernel module
that exchanges data with a device through /dev/ttyS0.
For this purpose, I set the serial tty's ldisc (tty->ldisc)
to my own line discipline and it worked well in the kernel 2.4.2.
But, when I upgrade the kernel to 2.4.19,
it does not seem to send data as it was before.
If I load the module and send some data in succession,
the device attached to the serial port becomes down shortly after.
The following is my routine to send data to /dev/ttyS0:
--
while (len > 0) {
int space, n_wr;
if (tty->driver.write_room)
space = tty->driver.write_room(tty);
n_wr = (len < space)? len: space;
if (tty->driver.flush_chars)
tty->driver.flush_chars(tty);
n_wr = tty->driver.write(tty, 0, buf, n_wr);
buf += n_wr;
len += n_wr;
}
--
In order to send data in succession, I call the above routine
within another while loop with different (buf, len) parameters.
The scheme worked well in 2.4.2, but does not work in 2.4.19.
So, I re-wrote the routine like this:
--
tty->flags |= (1 << TTY_DO_WRITE_WAKEUP);
while (len > 0) {
int space, n_wr;
if (tty->driver.write_room)
space = tty->driver.write_room(tty);
n_wr = (len < space)? len: space;
if (tty->driver.flush_chars)
tty->driver.flush_chars(tty);
n_wr = tty->driver.write(tty, 0, buf, n_wr);
buf += n_wr;
len += n_wr;
}
--
And, in the function void xx_write_wakeup (struct tty_struct *tty):
--
tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP);
/* and, re-send data */
--
The result is that both do not work. :-(
I believe the serial driver in 2.4.19 will work correctly.
If there is anything that I'm missing, please let me know.
Thank you in advance.
Joosun.
ps. UART(16550A), baudrate(115200), crtscts(ON).
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-10-21 12:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20021021102622Z261330-32597+6184@vger.kernel.org>
2002-10-21 12:32 ` Problem in writing to the serial port in 2.4.19 Joosun Hahn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®