public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Osterlund <petero2@telia.com>
To: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] Improve error recovery in serial mouse driver
Date: 15 Mar 2007 20:16:42 +0100	[thread overview]
Message-ID: <m3k5xiqput.fsf@telia.com> (raw)

If bytes get lost in the communication with a serial mouse using the
MS protocol, the kernel driver could do a better job getting back in
sync. The first byte in a packet has bit 6 set, and no other bytes
have that bit set. Therefore, if a byte is received with bit 6 cleared
when the driver thinks it is at byte 0 in the packet, the driver thinks
wrong and the byte should just be ignored.

This fix prevents spurious left/right button events when the serial
communication is disturbed by a CPU-hungry real-time process.

Signed-off-by: Peter Osterlund <petero2@telia.com>
---

 drivers/input/mouse/sermouse.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/input/mouse/sermouse.c b/drivers/input/mouse/sermouse.c
index a85d747..24bed4b 100644
--- a/drivers/input/mouse/sermouse.c
+++ b/drivers/input/mouse/sermouse.c
@@ -108,6 +108,7 @@ static void sermouse_process_ms(struct sermouse *sermouse, signed char data)
 	signed char *buf = sermouse->buf;
 
 	if (data & 0x40) sermouse->count = 0;
+	else if (sermouse->count == 0) return;
 
 	switch (sermouse->count) {
 

-- 
Peter Osterlund - petero2@telia.com
http://web.telia.com/~u89404340

             reply	other threads:[~2007-03-15 20:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-15 19:16 Peter Osterlund [this message]
2007-03-16  5:01 ` [PATCH] Improve error recovery in serial mouse driver Dmitry Torokhov
2007-03-16 19:22 ` Chuck Ebbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3k5xiqput.fsf@telia.com \
    --to=petero2@telia.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox