Re: [PATCH] serio: allow registered drivers to get status flag

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

 



Am 18.01.2011 20:57, schrieb Dmitry Torokhov:
On Tue, Jan 18, 2011 at 01:57:21PM +0100, David Engraf wrote:
Parse the status byte information to the registered serio drivers as
well as the character bytes.

Signed-off-by: David Engraf<david.engraf@xxxxxxxxx>


--- linux-2.6.37/drivers/input/serio/serport.c.orig	2011-01-18 12:33:41.421709232 +0100
+++ linux-2.6.37/drivers/input/serio/serport.c	2011-01-18 13:33:24.521711214 +0100
@@ -116,8 +116,8 @@ static void serport_ldisc_close(struct t

  /*
   * serport_ldisc_receive() is called by the low level tty driver when characters
- * are ready for us. We forward the characters, one by one to the 'interrupt'
- * routine.
+ * are ready for us. We forward the characters and flags, one by one to the
+ * 'interrupt' routine.
   */

  static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, int count)
@@ -132,7 +132,7 @@ static void serport_ldisc_receive(struct
  		goto out;

  	for (i = 0; i<  count; i++)
-		serio_interrupt(serport->serio, cp[i], 0);
+		serio_interrupt(serport->serio, cp[i], fp[i]);


Hi David,

The flags argument that serio_interrupt() accepts not the raw protocol
data, but sanitized, protocol-independent SERIO_TIMEOUT, SERIO_PARITY
and SERIO_FRAME bits.

Thanks.


Hi Dmitry,

I've updated the patch so that the raw protocol is converted to the SERIO_ bits. The raw protocol can parse only one flag, so I don't need to store multiple SERIO_ bits in the character flag variable.

Thanks
- David


Signed-off-by: David Engraf<david.engraf@xxxxxxxxx>

--- linux-2.6.37/drivers/input/serio/serport.c.orig	2011-01-18 12:33:41.421709232 +0100
+++ linux-2.6.37/drivers/input/serio/serport.c	2011-01-20 09:55:53.849550065 +0100
@@ -116,14 +116,15 @@ static void serport_ldisc_close(struct t
 
 /*
  * serport_ldisc_receive() is called by the low level tty driver when characters
- * are ready for us. We forward the characters, one by one to the 'interrupt'
- * routine.
+ * are ready for us. We forward the characters and flags, one by one to the 
+ * 'interrupt' routine.
  */
 
 static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, int count)
 {
 	struct serport *serport = (struct serport*) tty->disc_data;
 	unsigned long flags;
+	unsigned int ch_flags;
 	int i;
 
 	spin_lock_irqsave(&serport->lock, flags);
@@ -131,8 +132,15 @@ static void serport_ldisc_receive(struct
 	if (!test_bit(SERPORT_ACTIVE, &serport->flags))
 		goto out;
 
-	for (i = 0; i < count; i++)
-		serio_interrupt(serport->serio, cp[i], 0);
+	for (i = 0; i < count; i++) {
+		ch_flags = 0;
+		if (fp[i] == TTY_FRAME)
+			ch_flags = SERIO_FRAME;
+		else if (fp[i] == TTY_PARITY)
+			ch_flags = SERIO_PARITY;
+
+		serio_interrupt(serport->serio, cp[i], ch_flags);
+	}
 
 out:
 	spin_unlock_irqrestore(&serport->lock, flags);

[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux