aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2010-05-08 09:19:24 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-20 16:21:44 -0400
commit166ceb69075066cba196434482370f1e0318bc3e (patch)
treed401d8c4d3ee4df6d7ec42a94ae5f5bd5da3a12e /drivers
parentd45cc8df7f59eb4db28408076ce979cd5e18f2b7 (diff)
USB: ftdi_sio: clean up line-status handling
Reverse priority of errors reported to ldisc so that it matches that of other serial drivers (break takes precedence over parity, which takes precedence over framing errors). Also make sure overrun errors are handled as in other drivers, that is, an overrun error is always reported and is not associated with any received character (instead a NULL character with the TTY_OVERRUN flag set is inserted). Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/serial/ftdi_sio.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 6f1c05b2bdb7..00b938a81f33 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1767,6 +1767,8 @@ static int ftdi_prepare_write_buffer(struct usb_serial_port *port,
1767 return count; 1767 return count;
1768} 1768}
1769 1769
1770#define FTDI_RS_ERR_MASK (FTDI_RS_BI | FTDI_RS_PE | FTDI_RS_FE | FTDI_RS_OE)
1771
1770static int ftdi_process_packet(struct tty_struct *tty, 1772static int ftdi_process_packet(struct tty_struct *tty,
1771 struct usb_serial_port *port, struct ftdi_private *priv, 1773 struct usb_serial_port *port, struct ftdi_private *priv,
1772 char *packet, int len) 1774 char *packet, int len)
@@ -1793,28 +1795,21 @@ static int ftdi_process_packet(struct tty_struct *tty,
1793 priv->prev_status = status; 1795 priv->prev_status = status;
1794 } 1796 }
1795 1797
1796 /*
1797 * Although the device uses a bitmask and hence can have multiple
1798 * errors on a packet - the order here sets the priority the error is
1799 * returned to the tty layer.
1800 */
1801 flag = TTY_NORMAL; 1798 flag = TTY_NORMAL;
1802 if (packet[1] & FTDI_RS_OE) { 1799 if (packet[1] & FTDI_RS_ERR_MASK) {
1803 flag = TTY_OVERRUN; 1800 /* Break takes precedence over parity, which takes precedence
1804 dbg("OVERRRUN error"); 1801 * over framing errors */
1805 } 1802 if (packet[1] & FTDI_RS_BI) {
1806 if (packet[1] & FTDI_RS_BI) { 1803 flag = TTY_BREAK;
1807 flag = TTY_BREAK; 1804 usb_serial_handle_break(port);
1808 dbg("BREAK received"); 1805 } else if (packet[1] & FTDI_RS_PE) {
1809 usb_serial_handle_break(port); 1806 flag = TTY_PARITY;
1810 } 1807 } else if (packet[1] & FTDI_RS_FE) {
1811 if (packet[1] & FTDI_RS_PE) { 1808 flag = TTY_FRAME;
1812 flag = TTY_PARITY; 1809 }
1813 dbg("PARITY error"); 1810 /* Overrun is special, not associated with a char */
1814 } 1811 if (packet[1] & FTDI_RS_OE)
1815 if (packet[1] & FTDI_RS_FE) { 1812 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
1816 flag = TTY_FRAME;
1817 dbg("FRAMING error");
1818 } 1813 }
1819 1814
1820 len -= 2; 1815 len -= 2;