public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor_core@ameritech.net>
To: Kris Karas <ktk@enterprise.bidmc.harvard.edu>
Cc: linux-kernel@vger.kernel.org, Greg Stark <gsstark@mit.edu>
Subject: Re: Problem report: 2.6.12-rc4 ps2 keyboard being misdetected as /dev/input/mouse0
Date: Mon, 16 May 2005 23:58:14 -0500	[thread overview]
Message-ID: <200505162358.15099.dtor_core@ameritech.net> (raw)
In-Reply-To: <4289682B.8060403@enterprise.bidmc.harvard.edu>

On Monday 16 May 2005 22:42, Kris Karas wrote:
> Dmitry Torokhov wrote:
> 
> >On Monday 16 May 2005 00:12, Greg Stark wrote:
> >  
> >
> >>I just updated to 2.6.12-rc4 and now /dev/input/mouse0 seems to be my ps2
> >>keyboard.
> >>
> >Please use /dev/input/mice for accessing your mouse.
> >
> 
> One possibly interesting mouse issue in 2.6.12-rc[1..4] is that when 
> using /dev/psaux, I have found that my mouse cursor under GPM seems to 
> be triggered into un-hiding when I issue some random number of 
> non-hiding key-down events.  That is, press and release the keyboard 
> shift key say 3 or 5 or 10 times, and the console mouse cursor will 
> appear, just as if the mouse had been moved.  This bug is not in 2.6.11 
> (nor Alan's 2.6.11-ac7, fwiw).
> 

This is caused by atkbd's scrolling support + GPM not expecting to see a
0-motion packets from devices... I'd say we need to fix GPM not to set
GPM_MOVE in these cases; I have looked into adjusting mousedev but it is
too ugly for words to suppress them there.

Although... maybe the patch below is not too ugly.

-- 
Dmitry

Input: mousedev - try not to report 0-motion 0-button mouse events
       to userspace. GPM considers such packets motion data and
       starts displaying selection cursor.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
--

 mousedev.c |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

Index: dtor/drivers/input/mousedev.c
===================================================================
--- dtor.orig/drivers/input/mousedev.c
+++ dtor/drivers/input/mousedev.c
@@ -9,7 +9,7 @@
  * the Free Software Foundation.
  */
 
-#define MOUSEDEV_MINOR_BASE 	32
+#define MOUSEDEV_MINOR_BASE	32
 #define MOUSEDEV_MINORS		32
 #define MOUSEDEV_MIX		31
 
@@ -101,6 +101,7 @@ struct mousedev_list {
 	unsigned char ready, buffer, bufsiz;
 	unsigned char imexseq, impsseq;
 	enum mousedev_emul mode;
+	unsigned long last_buttons;
 };
 
 #define MOUSEDEV_SEQ_LEN	6
@@ -202,7 +203,7 @@ static void mousedev_key_event(struct mo
 		case BTN_SIDE:		index = 3; break;
 		case BTN_4:
 		case BTN_EXTRA:		index = 4; break;
-		default: 		return;
+		default:		return;
 	}
 
 	if (value) {
@@ -224,7 +225,7 @@ static void mousedev_notify_readers(stru
 		spin_lock_irqsave(&list->packet_lock, flags);
 
 		p = &list->packets[list->head];
-		if (list->ready && p->buttons != packet->buttons) {
+		if (list->ready && p->buttons != mousedev->packet.buttons) {
 			unsigned int new_head = (list->head + 1) % PACKET_QUEUE_LEN;
 			if (new_head != list->tail) {
 				p = &list->packets[list->head = new_head];
@@ -249,10 +250,13 @@ static void mousedev_notify_readers(stru
 		p->dz += packet->dz;
 		p->buttons = mousedev->packet.buttons;
 
-		list->ready = 1;
+		if (p->dx || p->dy || p->dz || p->buttons != list->last_buttons)
+			list->ready = 1;
 
 		spin_unlock_irqrestore(&list->packet_lock, flags);
-		kill_fasync(&list->fasync, SIGIO, POLL_IN);
+
+		if (list->ready)
+			kill_fasync(&list->fasync, SIGIO, POLL_IN);
 	}
 
 	wake_up_interruptible(&mousedev->wait);
@@ -320,7 +324,7 @@ static void mousedev_event(struct input_
 					mousedev->pkt_count++;
 					/* Input system eats duplicate events, but we need all of them
 					 * to do correct averaging so apply present one forward
-			 		 */
+					 */
 					fx(0) = fx(1);
 					fy(0) = fy(1);
 				}
@@ -477,9 +481,10 @@ static void mousedev_packet(struct mouse
 	}
 
 	if (!p->dx && !p->dy && !p->dz) {
-		if (list->tail == list->head)
+		if (list->tail == list->head) {
 			list->ready = 0;
-		else
+			list->last_buttons = p->buttons;
+		} else
 			list->tail = (list->tail + 1) % PACKET_QUEUE_LEN;
 	}
 
@@ -695,7 +700,7 @@ static struct input_device_id mousedev_i
 		.absbit = { BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE) | BIT(ABS_TOOL_WIDTH) },
 	},	/* A touchpad */
 
-	{ }, 	/* Terminating entry */
+	{ },	/* Terminating entry */
 };
 
 MODULE_DEVICE_TABLE(input, mousedev_ids);

  reply	other threads:[~2005-05-17  5:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-16  5:12 Problem report: 2.6.12-rc4 ps2 keyboard being misdetected as /dev/input/mouse0 Greg Stark
2005-05-16  5:36 ` Dmitry Torokhov
2005-05-17  3:42   ` Kris Karas
2005-05-17  4:58     ` Dmitry Torokhov [this message]
2005-05-18 11:13       ` Pavel Machek
2005-05-18 13:39         ` Dmitry Torokhov
2005-05-18 22:17           ` Kris Karas
2005-05-23  5:27             ` Dmitry Torokhov
2005-05-18 11:12   ` 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=200505162358.15099.dtor_core@ameritech.net \
    --to=dtor_core@ameritech.net \
    --cc=gsstark@mit.edu \
    --cc=ktk@enterprise.bidmc.harvard.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