[PATCH] linux/drivers/char/pc_keyb.c patch please

From: Jason McCarty (mccartyj@altsoftware.com)
Date: Tue Jul 17 2001 - 13:49:44 EST

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.


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).

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

This archive was generated by hypermail 2b29 : Mon Jul 23 2001 - 21:00:09 EST