public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Jason McCarty" <mccartyj@altsoftware.com>
To: <linux-kernel@vger.kernel.org>
Cc: "Linus Torvalds" <torvalds@transmeta.com>
Subject: [PATCH] linux/drivers/char/pc_keyb.c patch please
Date: Tue, 17 Jul 2001 14:49:44 -0400	[thread overview]
Message-ID: <007401c10ef1$3f317e80$7102a8c0@altsoftware.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1934 bytes --]

I think a change is needed in pc_keyb.c.
5 lines should be removed because they consume valid data.

patch is for linux-2.4.6/drivers/char/pc_keyb.c
kernel version 2.4.6 (also checked older kernels, they all have it)
Why this patch is needed:
because it messes up my hardware :(
Extensive testing was done on my machine and I found with lines removed my
hardware works fine in shell program and in X.

Details:

pc_keyb.c handles ps/2 input
Usually mouse sends 3 byte packets (4 bytes if wheel mouse) to ps/2 port.
1st byte is buttons/movement direction, 2nd byte is x displacement, 3rd byte
is y displacement.  The lines I want removed intercept any byte in this
packet that is 0xAA and eats it.
The reason for this is that according to ps/2 mouse specs the mouse sends
2bytes - 0xAA 0x00 after it is reset.

Why this is bad:  suppose the mouse moves170(0xAA) in the x direction (byte
2 of packet)... guess what happens?  That byte 2 is lost and the mouse is
sent an enable command.  The mouse receives that command, forgets about
whatever it was sending, and starts transmitting the next byte (which is now
the byte for the start of the next packet).  Sounds ok, except... in all
this someone
forgot to tell the driver(that was reading from /dev/psaux) that the byte 1
that it got previously is now garbage.  So the driver now reads another 2
bytes (byte 1 and 2 of next packet) and interpretes it as the bytes 2 and 3
of the previous packet, except that's wrong, and now look... your cursor
just flew half way across the screen!

This code has existed for some time due to the fact that it is extremely
difficult for a normal mouse to generate a move of 170.  But it can happen,
and with the input device i'm using, it happens often.

The simplest solution(and maybe the best) is to just remove the 5 lines of
code and let any software that reads from /dev/psaux handle the 0xAA acks
(this works fine for me, and seems fine in X).

[-- Attachment #2: my_patch --]
[-- Type: application/octet-stream, Size: 490 bytes --]

--- /home/mccartyj/linux-2.4.6/drivers/char/pc_keyb.c	Fri Apr  6 13:42:55 2001
+++ linux-2.4.6/drivers/char/pc_keyb.c	Tue Jul 17 13:29:45 2001
@@ -403,12 +403,13 @@
 		}
 		mouse_reply_expected = 0;
 	}
+#if 0
 	else if(scancode == AUX_RECONNECT){
 		queue->head = queue->tail = 0;  /* Flush input queue */
 		__aux_write_ack(AUX_ENABLE_DEV);  /* ping the mouse :) */
 		return;
 	}
-
+#endif
 	add_mouse_randomness(scancode);
 	if (aux_count) {
 		int head = queue->head;

                 reply	other threads:[~2001-07-17 18:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='007401c10ef1$3f317e80$7102a8c0@altsoftware.com' \
    --to=mccartyj@altsoftware.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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