public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor@insightbb.com>
To: George Nychis <gnychis@cmu.edu>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: Re: thinkpad x60s: middle button doesn't work after hibernate
Date: Fri, 21 Jul 2006 13:00:17 -0400	[thread overview]
Message-ID: <200607211300.17660.dtor@insightbb.com> (raw)
In-Reply-To: <44C0EA85.30500@cmu.edu>

On Friday 21 July 2006 10:53, George Nychis wrote:
> 
> Dmitry Torokhov wrote:
> > On 7/20/06, George Nychis <gnychis@cmu.edu> wrote:
> >> Hey guys,
> >>
> >> I recently got the suspend to disk working and suspend to memory working
> >> thanks to many of you.  Whenever I suspend to disk and resume, the
> >> middle mouse button on my thinkpad x60s no longer works for scrolling or
> >> for pasting.  I either have to reboot, or suspend to memory and resume.
> >>  Therefore:
> >>
> >> Initial Boot: working
> >> Suspend to disk -> resume: not working
> >> Suspend to memory -> resume: working
> >>
> >> To fix it for now, i simply suspend to memory and resume after resuming
> >> a suspend to disk.
> >>
> > 
> > It sounds like psmouse resume method either not getting called or
> > fails during resume from disk. Could you do:
> > 
> > echo 1 > /sys/modules/i8042/parameters/debug
> > 
> > before suspending and send me dmesg after resuming. Make sure you have
> > big dmesg buffer.
> > 
> > Thanks!
> > 
> 
> Here it is:
> http://rafb.net/paste/results/hDJXzS85.html
> 
> thanks again :)
> 

Please try the patch below. If it still does not work try uncommenting call
to psmouse_reset() in trackpoint_resume().

-- 
Dmitry

Input: trackpoint - activate protocol when resuming

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
 drivers/input/mouse/trackpoint.c |   54 ++++++++++++++++++++++++++-------------
 1 file changed, 36 insertions(+), 18 deletions(-)

Index: linux/drivers/input/mouse/trackpoint.c
===================================================================
--- linux.orig/drivers/input/mouse/trackpoint.c
+++ linux/drivers/input/mouse/trackpoint.c
@@ -183,21 +183,26 @@ static struct attribute_group trackpoint
 	.attrs = trackpoint_attrs,
 };
 
-static void trackpoint_disconnect(struct psmouse *psmouse)
+static int trackpoint_start_protocol(struct psmouse *psmouse, unsigned char *firmware_id)
 {
-	sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, &trackpoint_attr_group);
+	unsigned char param[2] = { 0 };
 
-	kfree(psmouse->private);
-	psmouse->private = NULL;
+	if (ps2_command(&psmouse->ps2dev, param, MAKE_PS2_CMD(0, 2, TP_READ_ID)))
+		return -1;
+
+	if (param[0] != TP_MAGIC_IDENT)
+		return -1;
+
+	if (firmware_id)
+		*firmware_id = param[1];
+
+	return 0;
 }
 
 static int trackpoint_sync(struct psmouse *psmouse)
 {
-	unsigned char toggle;
 	struct trackpoint_data *tp = psmouse->private;
-
-	if (!tp)
-		return -1;
+	unsigned char toggle;
 
 	/* Disable features that may make device unusable with this driver */
 	trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_TWOHAND, &toggle);
@@ -263,27 +268,40 @@ static void trackpoint_defaults(struct t
 	tp->ext_dev = TP_DEF_EXT_DEV;
 }
 
+static void trackpoint_disconnect(struct psmouse *psmouse)
+{
+	sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, &trackpoint_attr_group);
+
+	kfree(psmouse->private);
+	psmouse->private = NULL;
+}
+
+static int trackpoint_reconnect(struct psmouse *psmouse)
+{
+	/* psmouse_reset(psmouse); */
+
+	if (trackpoint_start_protocol(psmouse, NULL))
+		return -1;
+
+	if (trackpoint_sync(psmouse))
+		return -1;
+
+	return 0;
+}
+
 int trackpoint_detect(struct psmouse *psmouse, int set_properties)
 {
 	struct trackpoint_data *priv;
 	struct ps2dev *ps2dev = &psmouse->ps2dev;
 	unsigned char firmware_id;
 	unsigned char button_info;
-	unsigned char param[2];
-
-	param[0] = param[1] = 0;
 
-	if (ps2_command(ps2dev, param, MAKE_PS2_CMD(0, 2, TP_READ_ID)))
-		return -1;
-
-	if (param[0] != TP_MAGIC_IDENT)
+	if (trackpoint_start_protocol(psmouse, &firmware_id))
 		return -1;
 
 	if (!set_properties)
 		return 0;
 
-	firmware_id = param[1];
-
 	if (trackpoint_read(&psmouse->ps2dev, TP_EXT_BTN, &button_info)) {
 		printk(KERN_WARNING "trackpoint.c: failed to get extended button data\n");
 		button_info = 0;
@@ -296,7 +314,7 @@ int trackpoint_detect(struct psmouse *ps
 	psmouse->vendor = "IBM";
 	psmouse->name = "TrackPoint";
 
-	psmouse->reconnect = trackpoint_sync;
+	psmouse->reconnect = trackpoint_reconnect;
 	psmouse->disconnect = trackpoint_disconnect;
 
 	trackpoint_defaults(priv);

  parent reply	other threads:[~2006-07-21 17:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-20 19:27 thinkpad x60s: middle button doesn't work after hibernate George Nychis
2006-07-20 19:46 ` Dmitry Torokhov
2006-07-21 14:53   ` George Nychis
2006-07-21 15:45     ` Dmitry Torokhov
2006-07-21 17:00     ` Dmitry Torokhov [this message]
2006-07-21 17:16       ` George Nychis
2006-07-21 17:59         ` Dmitry Torokhov
2006-07-21 19:45 ` Tino Keitel

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=200607211300.17660.dtor@insightbb.com \
    --to=dtor@insightbb.com \
    --cc=gnychis@cmu.edu \
    --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