set_termios can now be used for setting the parity and the stopbits. This is needed to use with cards which use a different parity then the parity used at start (even). Signed-off-by: Olivier Bornet <Olivier.Bornet@xxxxxxx> --- drivers/usb/serial/iuu_phoenix.c | 41 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 41 insertions(+), 0 deletions(-) diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index 9424d4b..a776ee9 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c @@ -948,6 +948,46 @@ static int set_control_lines(struct usb_device *dev, u8 value) return 0; } +static void iuu_set_termios(struct tty_struct *tty, + struct usb_serial_port *port, struct ktermios *old_termios) +{ + /* FIXME: the current implementation of termios is very minimal... */ + unsigned int cflag = tty->termios->c_cflag; + int status; + u32 actual; + u32 parity; + + /* compute the parity parameter */ + parity = 0; + parity |= (cflag & PARENB ? + (cflag & PARODD ? IUU_PARITY_ODD : + IUU_PARITY_EVEN) : + IUU_PARITY_NONE); + parity |= (cflag & CSTOPB ? IUU_TWO_STOP_BITS : IUU_ONE_STOP_BIT); + + /* set it */ + status = iuu_uart_baud(port, + (clockmode == 2) ? 16457 : 9600 * boost / 100, + &actual, parity); + + /* set the termios value to the real one, so the user now what has + * changed */ + if (old_termios) { + int i; + /* copy the old value... */ + tty->termios->c_iflag = old_termios->c_iflag; + tty->termios->c_oflag = old_termios->c_oflag; + tty->termios->c_cflag = old_termios->c_cflag; + tty->termios->c_lflag = old_termios->c_lflag; + tty->termios->c_line = old_termios->c_line; + for (i = 0; i < NCCS; i++) + tty->termios->c_cc[i] = old_termios->c_cc[i]; + + /* update what we have changed */ + tty->termios->c_cflag |= cflag & (PARENB | PARODD | CSTOPB); + } +} + static void iuu_close(struct tty_struct *tty, struct usb_serial_port *port, struct file *filp) { @@ -1172,6 +1212,7 @@ static struct usb_serial_driver iuu_device = { .read_bulk_callback = iuu_uart_read_callback, .tiocmget = iuu_tiocmget, .tiocmset = iuu_tiocmset, + .set_termios = iuu_set_termios, .attach = iuu_startup, .shutdown = iuu_shutdown, }; -- 1.6.2.4 -- 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