set termios from within line discipline

From: Pieter Grimmerink
Date: Thu Apr 22 2004 - 09:58:44 EST


I am porting a 9bit serial protocol that requires the 9th bit to be high on
the last transmitted byte, and low on the others.

What I tried to do was implement a line discipline that changes parity before
each byte is transmitted, to get the proper 9th bit value.

But the problem is changing the parity from a line discipline.
This is what I do, when a parity change has to be made:

tty_wait_until_sent(dev->tty, 0);
if (signal_pending(current)) return -EINTR;

if (odd)
{
tty->termios->c_cflag |= PARODD;
}
else
{
tty->termios->c_cflag &= ~PARODD;
}

if (tty->driver.set_termios)
tty->driver.set_termios(tty, &oldterm);
if (tty->ldisc.set_termios)
tty->ldisc.set_termios(tty, &oldterm);

tty->driver.write(tty, 0, &byte, 1);

Two things,
1. when I use 'tcgetattr' from userspace, I don't see the changes made from
within the line discipline
2. though I see that the parity changes now and then, the transmitted bytes
don't always have the correct parity

What would be the preferred way to change termios flags from a line
discipline?

Please also reply to my email address, since I'm not subscribed to the list.

Best regards,

Pieter

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/