diff options
author | Colin Leitner <colin.leitner@googlemail.com> | 2014-01-06 15:33:54 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-01-07 19:28:43 -0500 |
commit | c1f15196ac3b541d084dc80a8fbd8a74c6a0bd44 (patch) | |
tree | 95af331f275796dc541045fae1ef00757bd40503 /drivers/usb | |
parent | 30666249eae3b04875d514dea557d1ab1468c006 (diff) |
USB: ftdi_sio: added CS5 quirk for broken smartcard readers
Genuine FTDI chips support only CS7/8. A previous fix in commit
8704211f65a2 ("USB: ftdi_sio: fixed handling of unsupported CSIZE
setting") enforced this limitation and reported it back to userspace.
However, certain types of smartcard readers depend on specific
driver behaviour that requests 0 data bits (not 5) to change into a
different operating mode if CS5 has been set.
This patch reenables this behaviour for all FTDI devices.
Tagged to be added to stable, because it affects a lot of users of
embedded systems which rely on these readers to work properly.
Cc: stable <stable@vger.kernel.org>
Reported-by: Heinrich Siebmanns <H.Siebmanns@t-online.de>
Tested-by: Heinrich Siebmanns <H.Siebmanns@t-online.de>
Signed-off-by: Colin Leitner <colin.leitner@gmail.com>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/serial/ftdi_sio.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index a4bebacc5cae..5057201bbba8 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -2121,10 +2121,20 @@ static void ftdi_set_termios(struct tty_struct *tty, | |||
2121 | } | 2121 | } |
2122 | 2122 | ||
2123 | /* | 2123 | /* |
2124 | * All FTDI UART chips are limited to CS7/8. We won't pretend to | 2124 | * All FTDI UART chips are limited to CS7/8. We shouldn't pretend to |
2125 | * support CS5/6 and revert the CSIZE setting instead. | 2125 | * support CS5/6 and revert the CSIZE setting instead. |
2126 | * | ||
2127 | * CS5 however is used to control some smartcard readers which abuse | ||
2128 | * this limitation to switch modes. Original FTDI chips fall back to | ||
2129 | * eight data bits. | ||
2130 | * | ||
2131 | * TODO: Implement a quirk to only allow this with mentioned | ||
2132 | * readers. One I know of (Argolis Smartreader V1) | ||
2133 | * returns "USB smartcard server" as iInterface string. | ||
2134 | * The vendor didn't bother with a custom VID/PID of | ||
2135 | * course. | ||
2126 | */ | 2136 | */ |
2127 | if ((C_CSIZE(tty) != CS8) && (C_CSIZE(tty) != CS7)) { | 2137 | if (C_CSIZE(tty) == CS6) { |
2128 | dev_warn(ddev, "requested CSIZE setting not supported\n"); | 2138 | dev_warn(ddev, "requested CSIZE setting not supported\n"); |
2129 | 2139 | ||
2130 | termios->c_cflag &= ~CSIZE; | 2140 | termios->c_cflag &= ~CSIZE; |
@@ -2171,6 +2181,9 @@ no_skip: | |||
2171 | urb_value |= FTDI_SIO_SET_DATA_PARITY_NONE; | 2181 | urb_value |= FTDI_SIO_SET_DATA_PARITY_NONE; |
2172 | } | 2182 | } |
2173 | switch (cflag & CSIZE) { | 2183 | switch (cflag & CSIZE) { |
2184 | case CS5: | ||
2185 | dev_dbg(ddev, "Setting CS5 quirk\n"); | ||
2186 | break; | ||
2174 | case CS7: | 2187 | case CS7: |
2175 | urb_value |= 7; | 2188 | urb_value |= 7; |
2176 | dev_dbg(ddev, "Setting CS7\n"); | 2189 | dev_dbg(ddev, "Setting CS7\n"); |