[PATCH] usb/serial/ftdi_sio: mark+space parity

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

 



Hi,

some time ago (in October 2007) I suggested to either extend the
usb-serial-drivers to support mark/space parity, or fix the drivers
so they reject the mark/space parity setting.
It seems that they now reject mark/space parity.

But since most (if not all) of the usb-serial-converters do support
mark+space parity, here's a patch for the ftdi_sio-driver (for kernel
2.6.31), which adds support for mark+space parity.

It would be probably good to add this mark+space parity support also to
the other usb-serial-drivers, and I think patches for the other drivers
would look *very* similar, but I don't know them in detail.

Please tell me if there are any problems with this patch or if you have
any questions.


regards,
Roland

diff -Naur linux-2.6.31/drivers/usb/serial/ftdi_sio.c linux-2.6.31_ftdi-markspace/drivers/usb/serial/ftdi_sio.c
--- linux-2.6.31/drivers/usb/serial/ftdi_sio.c	2009-09-10 00:13:59.000000000 +0200
+++ linux-2.6.31_ftdi-markspace/drivers/usb/serial/ftdi_sio.c	2009-09-17 18:33:00.000000000 +0200
@@ -2353,14 +2353,15 @@
 
 	/* 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 & CMSPAR ?
+		      (cflag & PARODD ? FTDI_SIO_SET_DATA_PARITY_MARK :
+		       FTDI_SIO_SET_DATA_PARITY_SPACE) :
 		      (cflag & PARODD ? FTDI_SIO_SET_DATA_PARITY_ODD :
-		       FTDI_SIO_SET_DATA_PARITY_EVEN) :
+		       FTDI_SIO_SET_DATA_PARITY_EVEN)) :
 		      FTDI_SIO_SET_DATA_PARITY_NONE);
 	if (cflag & CSIZE) {
 		switch (cflag & CSIZE) {

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

  Powered by Linux