public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor_core@ameritech.net>
To: Vojtech Pavlik <vojtech@suse.cz>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 8/8] New set of input patches
Date: Thu, 8 Jul 2004 01:59:04 -0500	[thread overview]
Message-ID: <200407080159.06311.dtor_core@ameritech.net> (raw)
In-Reply-To: <200407080158.32258.dtor_core@ameritech.net>


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


ChangeSet@1.1827, 2004-07-08 01:29:31-05:00, dtor_core@ameritech.net
  Input: rearrange activation/children probe sequence in psmouse so
         reconnect on children ports works even after parent port is
         fully activated:
         - when connecting/reconnecting a port always activate it
         - when connecting/reconnecting a pass-throgh port deactivate
           parent first and activate it after connect is done
  
  Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


 psmouse-base.c |   55 +++++++++++++++++++++++++++++++++++++------------------
 psmouse.h      |    1 +
 2 files changed, 38 insertions(+), 18 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-07-08 01:35:50 -05:00
+++ b/drivers/input/mouse/psmouse-base.c	2004-07-08 01:35:50 -05:00
@@ -655,6 +655,21 @@
 	psmouse_set_state(psmouse, PSMOUSE_ACTIVATED);
 }
 
+
+/*
+ * psmouse_deactivate() puts the mouse into poll mode so that we don't get motion
+ * reports from it unless we explicitely request it.
+ */
+
+static void psmouse_deactivate(struct psmouse *psmouse)
+{
+	if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_DISABLE))
+		printk(KERN_WARNING "psmouse.c: Failed to deactivate mouse on %s\n", psmouse->serio->phys);
+
+	psmouse_set_state(psmouse, PSMOUSE_CMD_MODE);
+}
+
+
 /*
  * psmouse_cleanup() resets the mouse into power-on state.
  */
@@ -705,8 +720,14 @@
 	    (serio->type & SERIO_TYPE) != SERIO_PS_PSTHRU)
 		return;
 
-	if (serio->parent && (serio->type & SERIO_TYPE) == SERIO_PS_PSTHRU)
+	/*
+	 * If this is a pass-through port deactivate parent so the device
+	 * connected to this port can be successfully identified
+	 */
+	if (serio->parent && (serio->type & SERIO_TYPE) == SERIO_PS_PSTHRU) {
 		parent = serio->parent->private;
+		psmouse_deactivate(parent);
+	}
 
 	if (!(psmouse = kmalloc(sizeof(struct psmouse), GFP_KERNEL)))
 		goto out;
@@ -766,21 +787,15 @@
 	if (parent && parent->pt_activate)
 		parent->pt_activate(parent);
 
-	/*
-	 * OK, the device is ready, we just need to activate it (turn the
-	 * stream mode on). But if mouse has a pass-through port we don't
-	 * want to do it yet to not disturb child detection.
-	 * The child will activate this port when it's ready.
-	 */
-
 	if (serio->child) {
 		/*
 		 * Nothing to be done here, serio core will detect that
 		 * the driver set serio->child and will register it for us.
 		 */
 		printk(KERN_INFO "serio: %s port at %s\n", serio->child->name, psmouse->phys);
-	} else
-		psmouse_activate(psmouse);
+	}
+
+	psmouse_activate(psmouse);
 
 out:
 	/* If this is a pass-through port the parent awaits to be activated */
@@ -794,20 +809,26 @@
 	struct psmouse *psmouse = serio->private;
 	struct psmouse *parent = NULL;
 	struct serio_driver *drv = serio->drv;
+	int rc = -1;
 
 	if (!drv || !psmouse) {
 		printk(KERN_DEBUG "psmouse: reconnect request, but serio is disconnected, ignoring...\n");
 		return -1;
 	}
 
+	if (serio->parent && (serio->type & SERIO_TYPE) == SERIO_PS_PSTHRU) {
+		parent = serio->parent->private;
+		psmouse_deactivate(parent);
+	}
+
 	psmouse_set_state(psmouse, PSMOUSE_INITIALIZING);
 
 	if (psmouse->reconnect) {
 	       if (psmouse->reconnect(psmouse))
-			return -1;
+			goto out;
 	} else if (psmouse_probe(psmouse) < 0 ||
 		   psmouse->type != psmouse_extensions(psmouse, psmouse_max_proto, 0))
-		return -1;
+		goto out;
 
 	/* ok, the device type (and capabilities) match the old one,
 	 * we can continue using it, complete intialization
@@ -816,20 +837,18 @@
 
 	psmouse_initialize(psmouse);
 
-	if (serio->parent && (serio->type & SERIO_TYPE) == SERIO_PS_PSTHRU)
-		parent = serio->parent->private;
-
 	if (parent && parent->pt_activate)
 		parent->pt_activate(parent);
 
-	if (!serio->child)
-		psmouse_activate(psmouse);
+	psmouse_activate(psmouse);
+	rc = 0;
 
+out:
 	/* If this is a pass-through port the parent waits to be activated */
 	if (parent)
 		psmouse_activate(parent);
 
-	return 0;
+	return rc;
 }
 
 
diff -Nru a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h
--- a/drivers/input/mouse/psmouse.h	2004-07-08 01:35:50 -05:00
+++ b/drivers/input/mouse/psmouse.h	2004-07-08 01:35:50 -05:00
@@ -9,6 +9,7 @@
 #define PSMOUSE_CMD_GETID	0x02f2
 #define PSMOUSE_CMD_SETRATE	0x10f3
 #define PSMOUSE_CMD_ENABLE	0x00f4
+#define PSMOUSE_CMD_DISABLE	0x00f5
 #define PSMOUSE_CMD_RESET_DIS	0x00f6
 #define PSMOUSE_CMD_RESET_BAT	0x02ff
 

  reply	other threads:[~2004-07-08  7:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-08  6:55 [PATCH 0/8] New set of input patches Dmitry Torokhov
2004-07-08  6:55 ` [PATCH 1/8] " Dmitry Torokhov
2004-07-08  6:56   ` [PATCH 2/8] " Dmitry Torokhov
2004-07-08  6:56     ` [PATCH 3/8] " Dmitry Torokhov
2004-07-08  6:57       ` [PATCH 4/8] " Dmitry Torokhov
2004-07-08  6:57         ` [PATCH 5/8] " Dmitry Torokhov
2004-07-08  6:58           ` [PATCH 6/8] " Dmitry Torokhov
2004-07-08  6:58             ` [PATCH 7/8] " Dmitry Torokhov
2004-07-08  6:59               ` Dmitry Torokhov [this message]
2004-07-12  3:17   ` synaptics driver Ari Pollak
2004-07-12  3:41     ` Dmitry Torokhov
2004-07-08 20:32 ` [PATCH 0/8] New set of input patches Pavel Machek
2004-07-09  3:48   ` Dmitry Torokhov
2004-07-09  5:06     ` Pavel Machek

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=200407080159.06311.dtor_core@ameritech.net \
    --to=dtor_core@ameritech.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vojtech@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox