Skip to content

Commit

Permalink
USB: serial: ftdi_sio: add space/mark parity
Browse files Browse the repository at this point in the history
Add mark and space parity, since the device supports it.

Signed-off-by: Roland Koebler <r.koebler@yahoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Roland Koebler authored and Greg Kroah-Hartman committed Dec 11, 2009
1 parent d71cb81 commit 38fcb83
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions drivers/usb/serial/ftdi_sio.c
Original file line number Diff line number Diff line change
Expand Up @@ -2195,15 +2195,21 @@ static void ftdi_set_termios(struct tty_struct *tty,

/* Set number of data bits, parity, stop bits */

termios->c_cflag &= ~CMSPAR;

urb_value = 0;
urb_value |= (cflag & CSTOPB ? FTDI_SIO_SET_DATA_STOP_BITS_2 :
FTDI_SIO_SET_DATA_STOP_BITS_1);
urb_value |= (cflag & PARENB ?
(cflag & PARODD ? FTDI_SIO_SET_DATA_PARITY_ODD :
FTDI_SIO_SET_DATA_PARITY_EVEN) :
FTDI_SIO_SET_DATA_PARITY_NONE);
if (cflag & PARENB) {
if (cflag & CMSPAR)
urb_value |= cflag & PARODD ?
FTDI_SIO_SET_DATA_PARITY_MARK :
FTDI_SIO_SET_DATA_PARITY_SPACE;
else
urb_value |= cflag & PARODD ?
FTDI_SIO_SET_DATA_PARITY_ODD :
FTDI_SIO_SET_DATA_PARITY_EVEN;
} else {
urb_value |= FTDI_SIO_SET_DATA_PARITY_NONE;
}
if (cflag & CSIZE) {
switch (cflag & CSIZE) {
case CS5: urb_value |= 5; dbg("Setting CS5"); break;
Expand Down

0 comments on commit 38fcb83

Please sign in to comment.