lkml.org 
[lkml]   [2002]   [Oct]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectProblem in writing to the serial port in 2.4.19
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).
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:30    [W:0.026 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site