Commit 3b8a7019 authored by Johan Hovold's avatar Johan Hovold Committed by Zefan Li

USB: keyspan: fix tty line-status reporting

commit 5d1678a3 upstream.

Fix handling of TTY error flags, which are not bitmasks and must
specifically not be ORed together as this prevents the line discipline
from recognising them.

Also insert null characters when reporting overrun errors as these are
not associated with the received character.

Fixes: 1da177e4 ("Linux-2.6.12-rc2")
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
[lizf: Backported to 3.4:
 - s/&port->port/tty/
 - adjust context
 - adjust indentation]
Signed-off-by: default avatarZefan Li <lizefan@huawei.com>
parent 0ff23ffd
......@@ -333,14 +333,19 @@ static void usa26_indat_callback(struct urb *urb)
/* some bytes had errors, every byte has status */
dbg("%s - RX error!!!!", __func__);
for (i = 0; i + 1 < urb->actual_length; i += 2) {
int stat = data[i], flag = 0;
if (stat & RXERROR_OVERRUN)
flag |= TTY_OVERRUN;
if (stat & RXERROR_FRAMING)
flag |= TTY_FRAME;
if (stat & RXERROR_PARITY)
flag |= TTY_PARITY;
int stat = data[i];
int flag = TTY_NORMAL;
if (stat & RXERROR_OVERRUN) {
tty_insert_flip_char(tty, 0,
TTY_OVERRUN);
}
/* XXX should handle break (0x10) */
if (stat & RXERROR_PARITY)
flag = TTY_PARITY;
else if (stat & RXERROR_FRAMING)
flag = TTY_FRAME;
tty_insert_flip_char(tty, data[i+1], flag);
}
}
......@@ -712,14 +717,19 @@ static void usa49_indat_callback(struct urb *urb)
} else {
/* some bytes had errors, every byte has status */
for (i = 0; i + 1 < urb->actual_length; i += 2) {
int stat = data[i], flag = 0;
if (stat & RXERROR_OVERRUN)
flag |= TTY_OVERRUN;
if (stat & RXERROR_FRAMING)
flag |= TTY_FRAME;
if (stat & RXERROR_PARITY)
flag |= TTY_PARITY;
int stat = data[i];
int flag = TTY_NORMAL;
if (stat & RXERROR_OVERRUN) {
tty_insert_flip_char(tty, 0,
TTY_OVERRUN);
}
/* XXX should handle break (0x10) */
if (stat & RXERROR_PARITY)
flag = TTY_PARITY;
else if (stat & RXERROR_FRAMING)
flag = TTY_FRAME;
tty_insert_flip_char(tty, data[i+1], flag);
}
}
......@@ -779,14 +789,19 @@ static void usa49wg_indat_callback(struct urb *urb)
* some bytes had errors, every byte has status
*/
for (x = 0; x + 1 < len; x += 2) {
int stat = data[i], flag = 0;
if (stat & RXERROR_OVERRUN)
flag |= TTY_OVERRUN;
if (stat & RXERROR_FRAMING)
flag |= TTY_FRAME;
if (stat & RXERROR_PARITY)
flag |= TTY_PARITY;
int stat = data[i];
int flag = TTY_NORMAL;
if (stat & RXERROR_OVERRUN) {
tty_insert_flip_char(tty, 0,
TTY_OVERRUN);
}
/* XXX should handle break (0x10) */
if (stat & RXERROR_PARITY)
flag = TTY_PARITY;
else if (stat & RXERROR_FRAMING)
flag = TTY_FRAME;
tty_insert_flip_char(tty,
data[i+1], flag);
i += 2;
......@@ -855,14 +870,21 @@ static void usa90_indat_callback(struct urb *urb)
/* some bytes had errors, every byte has status */
dbg("%s - RX error!!!!", __func__);
for (i = 0; i + 1 < urb->actual_length; i += 2) {
int stat = data[i], flag = 0;
if (stat & RXERROR_OVERRUN)
flag |= TTY_OVERRUN;
if (stat & RXERROR_FRAMING)
flag |= TTY_FRAME;
if (stat & RXERROR_PARITY)
flag |= TTY_PARITY;
int stat = data[i];
int flag = TTY_NORMAL;
if (stat & RXERROR_OVERRUN) {
tty_insert_flip_char(
tty, 0,
TTY_OVERRUN);
}
/* XXX should handle break (0x10) */
if (stat & RXERROR_PARITY)
flag = TTY_PARITY;
else if (stat & RXERROR_FRAMING)
flag = TTY_FRAME;
tty_insert_flip_char(tty, data[i+1],
flag);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment