Re: [PATCH] USB: ftdi_sio: added CS5 quirk for broken smartcard readers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 06, 2014 at 05:35:57PM +0100, Colin Leitner wrote:
> Genuine FTDI chips support only CS7/8. A previous fix enforced this
> limitation and reported it back to userspace.

Please include the commit id of the offending commit when fixing
regressions. In this case, you'd refer to commit 8704211f65a2 ("USB:
ftdi_sio: fixed handling of unsupported CSIZE setting").

> 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.

Makes sense.

> 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@xxxxxxxxxxxxxxx
> Tested-by: Heinrich Siebmanns <H.Siebmanns@xxxxxxxxxxx>

You should add a "Reported-by" tag as well.

> Signed-off-by: Colin Leitner <colin.leitner@xxxxxxxxx>
> ---
>  drivers/usb/serial/ftdi_sio.c |   18 ++++++++++++++++--
>  1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
> index fb0d537..f3def6bb 100644
> --- a/drivers/usb/serial/ftdi_sio.c
> +++ b/drivers/usb/serial/ftdi_sio.c
> @@ -2125,9 +2125,20 @@ static void ftdi_set_termios(struct tty_struct *tty,
> 
>  	/*
>  	 * All FTDI UART chips are limited to CS7/8. We won't pretend to
> -	 * support CS5/6 and revert the CSIZE setting instead.
> +	 * support CS6 and revert the CSIZE setting instead.
> +	 *
> +	 * Some smartcard readers abuse this limitation to switch modes.
> +	 * Original FTDI chips fall back to eight data bits.

Could you mention CS5 here? Are you sure we shouldn't just restore the
behaviour for CS6 as well?

> +	 *
> +	 * 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) != CS5)
> +	    && (C_CSIZE(tty) != CS8)
> +	    && (C_CSIZE(tty) != CS7)) {

Just do:

	if (C_CSIZE(tty) == CS6)

as CSIZE is two bits wide.

>  		dev_warn(ddev, "requested CSIZE setting not supported\n");
> 
>  		termios->c_cflag &= ~CSIZE;
> @@ -2174,6 +2185,9 @@ no_skip:
>  		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");

Thanks,
Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux