All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor_core@ameritech.net>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@osdl.org>, Vojtech Pavlik <vojtech@suse.cz>,
	vojtech@ucw.cz
Subject: [PATCH 1/11] psmouse resync for KVM users
Date: Fri, 18 Jun 2004 03:37:15 -0500	[thread overview]
Message-ID: <200406180337.17457.dtor_core@ameritech.net> (raw)
In-Reply-To: <200406180335.52843.dtor_core@ameritech.net>


===================================================================


ChangeSet@1.1790, 2004-06-16 18:13:33-05:00, dtor_core@ameritech.net
  Input: psmouse sync. changes
         - when a partial packet is received (more than HZ/2 jiffies
           has passed since last byte was received) increment
           out-of-sync counter. It should help users with KVMs that
           reset mice to bare PS/2 protocol but do not send 0xAA 0x00
           init sequence - after 'resetafter' bad packets psmouse
           will try reconnecting and reestablishing proper protcol.
         - change default value for 'resetafter' parameter from
           0 (never) to 20.
  
  Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


 psmouse-base.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)


===================================================================



diff -Nru a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
--- a/drivers/input/mouse/psmouse-base.c	2004-06-18 03:14:22 -05:00
+++ b/drivers/input/mouse/psmouse-base.c	2004-06-18 03:14:22 -05:00
@@ -43,7 +43,7 @@
 module_param_named(smartscroll, psmouse_smartscroll, bool, 0);
 MODULE_PARM_DESC(smartscroll, "Logitech Smartscroll autorepeat, 1 = enabled (default), 0 = disabled.");
 
-static unsigned int psmouse_resetafter;
+static unsigned int psmouse_resetafter = 20;
 module_param_named(resetafter, psmouse_resetafter, uint, 0);
 MODULE_PARM_DESC(resetafter, "Reset device after so many bad packets (0 = never).");
 
@@ -189,6 +189,7 @@
 		printk(KERN_WARNING "psmouse.c: %s at %s lost synchronization, throwing %d bytes away.\n",
 		       psmouse->name, psmouse->phys, psmouse->pktcnt);
 		psmouse->pktcnt = 0;
+		psmouse->out_of_sync++;
 	}
 
 	psmouse->last = jiffies;
@@ -221,12 +222,7 @@
 			printk(KERN_WARNING "psmouse.c: %s at %s lost sync at byte %d\n",
 				psmouse->name, psmouse->phys, psmouse->pktcnt);
 			psmouse->pktcnt = 0;
-
-			if (++psmouse->out_of_sync == psmouse_resetafter) {
-				psmouse->state = PSMOUSE_IGNORE;
-				printk(KERN_NOTICE "psmouse.c: issuing reconnect request\n");
-				serio_reconnect(psmouse->serio);
-			}
+			psmouse->out_of_sync++;
 			break;
 
 		case PSMOUSE_FULL_PACKET:
@@ -241,6 +237,13 @@
 		case PSMOUSE_GOOD_DATA:
 			break;
 	}
+
+	if (psmouse->out_of_sync && psmouse->out_of_sync == psmouse_resetafter) {
+		psmouse->state = PSMOUSE_IGNORE;
+		printk(KERN_NOTICE "psmouse.c: issuing reconnect request\n");
+		serio_reconnect(psmouse->serio);
+	}
+
 out:
 	return IRQ_HANDLED;
 }
@@ -306,7 +309,7 @@
 	while (test_bit(PSMOUSE_FLAG_CMD, &psmouse->flags) && timeout--) {
 
 		if (!test_bit(PSMOUSE_FLAG_CMD1, &psmouse->flags)) {
-		    
+
 			if (command == PSMOUSE_CMD_RESET_BAT && timeout > 100000)
 				timeout = 100000;
 

       reply	other threads:[~2004-06-18  8:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200406180335.52843.dtor_core@ameritech.net>
2004-06-18  8:37 ` Dmitry Torokhov [this message]
2004-06-18  8:37   ` [PATCH 2/11] psmouse state locking Dmitry Torokhov
2004-06-18  8:38     ` [PATCH 3/11] serio connect/disconnect mandatory Dmitry Torokhov
2004-06-18  8:39       ` [PATCH 4/11] serio renames 1 Dmitry Torokhov
2004-06-18  8:39         ` [PATCH 5/11] serio renames 2 Dmitry Torokhov
2004-06-18  8:40           ` [PATCH 6/11] serio dynamic allocation Dmitry Torokhov
2004-06-18  8:41             ` [PATCH 7/11] serio no recursion Dmitry Torokhov
2004-06-18  8:42               ` [PATCH 8/11] serio sysfs integration Dmitry Torokhov
2004-06-18  8:42                 ` [PATCH 9/11] serio allow rebinding Dmitry Torokhov
2004-06-18  8:43                   ` [PATCH 10/11] serio manual bind Dmitry Torokhov
2004-06-18  8:43                     ` [PATCH 11/11] serio_raw driver Dmitry Torokhov
2004-06-18  9:19                   ` [PATCH 9/11] serio allow rebinding Jan-Benedict Glaw
2004-06-18  9:38                 ` [PATCH 8/11] serio sysfs integration Andrew Morton
2004-06-18 12:50                   ` Dmitry Torokhov
2004-06-18 19:43                     ` Andrew Morton
2004-06-20  5:07             ` [PATCH 6/11] serio dynamic allocation Andrew Morton
2004-06-20  5:30               ` Dmitry Torokhov
2004-06-20  6:27                 ` Andrew Morton
2004-06-20  6:28                   ` Andrew Morton

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=200406180337.17457.dtor_core@ameritech.net \
    --to=dtor_core@ameritech.net \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vojtech@suse.cz \
    --cc=vojtech@ucw.cz \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.