Re: [PATCH 1/3] Support for Quatech ESU2-100 USB 2.0 8-port serial adaptor

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

 



On Wed, 2009-08-19 at 15:21 +0100, Richard Ash wrote:
> This patch follows up on the complete set of 3, i.e. is additional
> rather than replacing the original patch.
It would help if I remembered to insert the patch.

Richard
Signed-off-by: Richard Ash <richard@xxxxxxxxxxxxxxxx>

---
Index: linux/drivers/staging/quatech_usb2/quatech_usb2.c
===================================================================
--- linux.orig/drivers/staging/quatech_usb2/quatech_usb2.c
+++ linux/drivers/staging/quatech_usb2/quatech_usb2.c
@@ -83,8 +83,8 @@ static int debug;
 #define QT2_SERIAL_6_DATA	0x01
 #define QT2_SERIAL_5_DATA	0x00
 
-#define QT2_SERIAL_ODD_PARITY	0X08
-#define QT2_SERIAL_EVEN_PARITY	0X18
+#define QT2_SERIAL_ODD_PARITY	0x08
+#define QT2_SERIAL_EVEN_PARITY	0x18
 #define QT2_SERIAL_TWO_STOPB	0x04
 #define QT2_SERIAL_ONE_STOPB	0x00
 
@@ -978,14 +978,8 @@ static void qt2_set_termios(struct tty_s
 
 	UartNumber = port->number;
 
-	if (old_termios) {
-		if ((tty->termios->c_cflag == old_termios->c_cflag) &&
-			(RELEVANT_IFLAG(tty->termios->c_iflag) ==
-			RELEVANT_IFLAG(old_termios->c_iflag))) {
-			dbg("%s(): Nothing to change", __func__);
-			return;
-		}
-	}
+	if (old_termios && !tty_termios_hw_change(old_termios, tty->termios))
+		return;
 
 	switch (tty->termios->c_cflag) {
 	case CS5:
@@ -1010,12 +1004,21 @@ static void qt2_set_termios(struct tty_s
 		else
 			LCR_change_to |= QT2_SERIAL_EVEN_PARITY;
 	}
+	/* Because LCR_change_to is initialised to zero, we don't have to worry
+	 * about the case where PARENB is not set or clearing bits, because by
+	 * default all of them are cleared, turning parity off.
+	 * as we don't support mark/space parity, we should clear the
+	 * mark/space parity bit in c_cflag, so the caller can tell we have
+	 * ignored the request */
+	tty->termios->c_cflag &= ~CMSPAR;
+
 	if (tty->termios->c_cflag & CSTOPB)
 		LCR_change_to |= QT2_SERIAL_TWO_STOPB;
 	else
 		LCR_change_to |= QT2_SERIAL_ONE_STOPB;
 
-	/* Thats the LCR stuff, go ahead and set it */
+	/* Thats the LCR stuff, next we need to work out the divisor as the
+	 * LCR and the divisor are set together */
 	baud = tty_get_baud_rate(tty);
 	if (!baud) {
 		/* pick a default, any default... */
@@ -1036,6 +1039,11 @@ static void qt2_set_termios(struct tty_s
 	if (status < 0)	{
 		dbg("qt2_boxsetuart() failed");
 		return;
+	} else {
+		/* now encode the baud rate we actually set, which may be
+		 * different to the request */
+		baud = QT2_MAX_BAUD_RATE / divisor;
+		tty_encode_baud_rate(tty, baud, baud);
 	}
 
 	/* Now determine flow control */
Index: linux/drivers/staging/quatech_usb2/TODO
===================================================================
--- /dev/null
+++ linux/drivers/staging/quatech_usb2/TODO
@@ -0,0 +1,8 @@
+Incomplete list of things that this driver does not yet implement completely or
+at all. some of these may not be possible to implement because the hardware
+support does not exist. Others may be possible, but the magic control codes to
+make them happen are unknown, and some may just need the driver support to
+implement them writing.
+
+* Mark/Space parity is not implemented (reported back correctly)
+* IXANY flow control mode is not implemented (flag ignored completely)


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