mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joosun Hahn <jshan@zeen.snu.ac.kr>
To: linux-kernel@vger.kernel.org
Subject: Problem in writing to the serial port in 2.4.19
Date: Mon, 21 Oct 2002 21:32:55 +0900	[thread overview]
Message-ID: <3DB3F3F7.5E195B9F@zeen.snu.ac.kr> (raw)
In-Reply-To: <20021021102622Z261330-32597+6184@vger.kernel.org>

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).

           reply	other threads:[~2002-10-21 12:26 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20021021102622Z261330-32597+6184@vger.kernel.org>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3DB3F3F7.5E195B9F@zeen.snu.ac.kr \
    --to=jshan@zeen.snu.ac.kr \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®