Skip to content

Commit 6b8f1ca

Browse files
wfp5pgregkh
authored andcommitted
USB: ssu100: set tty_flags in ssu100_process_packet
flag was never set in ssu100_process_packet. Add logic to set it before calling tty_insert_flip_* Signed-off-by: Bill Pemberton <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 85dee13 commit 6b8f1ca

File tree

1 file changed

+29
-9
lines changed

1 file changed

+29
-9
lines changed

drivers/usb/serial/ssu100.c

+29-9
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,8 @@ static void ssu100_update_msr(struct usb_serial_port *port, u8 msr)
602602
}
603603
}
604604

605-
static void ssu100_update_lsr(struct usb_serial_port *port, u8 lsr)
605+
static void ssu100_update_lsr(struct usb_serial_port *port, u8 lsr,
606+
char *tty_flag)
606607
{
607608
struct ssu100_port_private *priv = usb_get_serial_port_data(port);
608609
unsigned long flags;
@@ -611,16 +612,32 @@ static void ssu100_update_lsr(struct usb_serial_port *port, u8 lsr)
611612
priv->shadowLSR = lsr;
612613
spin_unlock_irqrestore(&priv->status_lock, flags);
613614

615+
*tty_flag = TTY_NORMAL;
614616
if (lsr & UART_LSR_BRK_ERROR_BITS) {
615-
if (lsr & UART_LSR_BI)
617+
/* we always want to update icount, but we only want to
618+
* update tty_flag for one case */
619+
if (lsr & UART_LSR_BI) {
616620
priv->icount.brk++;
617-
if (lsr & UART_LSR_FE)
618-
priv->icount.frame++;
619-
if (lsr & UART_LSR_PE)
621+
*tty_flag = TTY_BREAK;
622+
usb_serial_handle_break(port);
623+
}
624+
if (lsr & UART_LSR_PE) {
620625
priv->icount.parity++;
621-
if (lsr & UART_LSR_OE)
626+
if (*tty_flag == TTY_NORMAL)
627+
*tty_flag = TTY_PARITY;
628+
}
629+
if (lsr & UART_LSR_FE) {
630+
priv->icount.frame++;
631+
if (*tty_flag == TTY_NORMAL)
632+
*tty_flag = TTY_FRAME;
633+
}
634+
if (lsr & UART_LSR_OE){
622635
priv->icount.overrun++;
636+
if (*tty_flag == TTY_NORMAL)
637+
*tty_flag = TTY_OVERRUN;
638+
}
623639
}
640+
624641
}
625642

626643
static int ssu100_process_packet(struct tty_struct *tty,
@@ -629,16 +646,19 @@ static int ssu100_process_packet(struct tty_struct *tty,
629646
char *packet, int len)
630647
{
631648
int i;
632-
char flag;
649+
char flag = TTY_NORMAL;
633650
char *ch;
634651

635652
dbg("%s - port %d", __func__, port->number);
636653

637654
if ((len >= 4) &&
638655
(packet[0] == 0x1b) && (packet[1] == 0x1b) &&
639656
((packet[2] == 0x00) || (packet[2] == 0x01))) {
640-
if (packet[2] == 0x00)
641-
ssu100_update_lsr(port, packet[3]);
657+
if (packet[2] == 0x00) {
658+
ssu100_update_lsr(port, packet[3], &flag);
659+
if (flag == TTY_OVERRUN)
660+
tty_insert_flip_char(tty, 0, TTY_OVERRUN);
661+
}
642662
if (packet[2] == 0x01)
643663
ssu100_update_msr(port, packet[3]);
644664

0 commit comments

Comments
 (0)