IGNPAR INPCK ACTION:
0 0 Deliver all data to the user-level, as is.
0 1 Deliver nulls in place of erroneous bytes
1 0 Discard erroneous bytes, deliver the rest
1 1 Discard erroneous bytes, deliver the rest
IGNPAR gets processed before INPCK:
(from drivers/char/n_tty.c:488)
static inline void n_tty_receive_parity_error(struct tty_struct *tty,
unsigned char c)
{
if (I_IGNPAR(tty)) {
return; /* discard data */
}
if (I_PARMRK(tty)) {
put_tty_queue('\377', tty);
put_tty_queue('\0', tty);
put_tty_queue(c, tty);
} else if (I_INPCK(tty))
put_tty_queue('\0', tty); /* deliver null */
else
put_tty_queue(c, tty); /* deliver data */
wake_up_interruptible(&tty->read_wait);
}
>
> > > 5 - If the TTY knows the data status (PARITY, FRAMING,
> > > OVERRUN, NORMAL),
> > > why the driver has to deal with the flag IGNPAR. Shouldn't
> > > the TTY being
> > > doing it ?
> >
> > Not sure I understand the question. Received data does not carry any
> > information about errors with it after it leaves the driver, unless
> > PARMRK is set.
>
> When the driver copy the data from the controler to the flip buffer it
> copies the data to the buffer tty->flip.char_buf_ptr and it set a flag
> (TTY_NORMAL, TTY_PARITY, TTY_FRAME, etc) on the buffer
> tty->flip.flag_buf_ptr telling the TTY how this byte was received. So
> the TTY knows if certain byte was problematic or not. Did you
> understand my doubt know ?
Yes. I call that part a "line discipline". n_tty is the TTY line
discipline that implements termio(s) and some legacy functionality.
And yes, for received data with parity errors, the line discipline
handles IGNPAR, as well INPCK and PARMRK. See snippet of n_tty.c above.
>
> Thanks for your patience
> Henrique
>
Cheers,
Ed
----------------------------------------------------------------
Ed Vance edv (at) macrolink (dot) com
Macrolink, Inc. 1500 N. Kellogg Dr Anaheim, CA 92807
----------------------------------------------------------------
-
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/