Skip to content

Commit

Permalink
USB: ftdi_sio: added CS5 quirk for broken smartcard readers
Browse files Browse the repository at this point in the history
Genuine FTDI chips support only CS7/8. A previous fix in commit
8704211 ("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>
  • Loading branch information
Colin Leitner authored and Greg Kroah-Hartman committed Jan 8, 2014
1 parent 3066624 commit c1f1519
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions drivers/usb/serial/ftdi_sio.c
Original file line number Diff line number Diff line change
Expand Up @@ -2121,10 +2121,20 @@ static void ftdi_set_termios(struct tty_struct *tty,
}

/*
* All FTDI UART chips are limited to CS7/8. We won't pretend to
* All FTDI UART chips are limited to CS7/8. We shouldn't pretend to
* support CS5/6 and revert the CSIZE setting instead.
*
* CS5 however is used to control some smartcard readers which abuse
* this limitation to switch modes. Original FTDI chips fall back to
* eight data bits.
*
* TODO: Implement a quirk to only allow this with mentioned
* readers. One I know of (Argolis Smartreader V1)
* returns "USB smartcard server" as iInterface string.
* The vendor didn't bother with a custom VID/PID of
* course.
*/
if ((C_CSIZE(tty) != CS8) && (C_CSIZE(tty) != CS7)) {
if (C_CSIZE(tty) == CS6) {
dev_warn(ddev, "requested CSIZE setting not supported\n");

termios->c_cflag &= ~CSIZE;
Expand Down Expand Up @@ -2171,6 +2181,9 @@ static void ftdi_set_termios(struct tty_struct *tty,
urb_value |= FTDI_SIO_SET_DATA_PARITY_NONE;
}
switch (cflag & CSIZE) {
case CS5:
dev_dbg(ddev, "Setting CS5 quirk\n");
break;
case CS7:
urb_value |= 7;
dev_dbg(ddev, "Setting CS7\n");
Expand Down

0 comments on commit c1f1519

Please sign in to comment.