[parisc-linux] The final patch for the keyboard problem

Richard Hirst rhirst@linuxcare.com
Tue, 7 Aug 2001 22:36:50 +0100


On Tue, Aug 07, 2001 at 01:14:19PM +0100, Richard Hirst wrote:
> Went back to the HP keyboard, and CapsLock hangs the machine there also.


I've fixed the lockup on CapsLock, using an analyser to monitor what happened
on the PS/2 cable:

(fw=firmware, kb=keyboard, li=linux)

B180, HP keyboard, this is what the firmware does on reset:

fw F5	disable scanning
kb FA	ack

fw F2	???
kb FA	ack
kb AB
kb 83

fw FF	reset
kb FA	ack
kb AA	power-on reset

fw F0	???
kb FA	ack

fw 02	???
kb FA	ack

fw F0	???
kb FA	ack

fw 00	???
kb FA	ack
kb 02

fw ED	set leds
kb FA	ack

fw 02	NumLock
kb FA	ack

fw F4	enable scanning
kb FA	ack

Now CapsLock pressed and released:

kb 58	keypress

fw ED	set leds
kb FA	ack

fw 06	CapsLock + NumLock
kb FA	ack

kb F0	keyrelease
kb 58

Now we boot Linux:

li ED	set leds
kb FA	ack

li 00	No LEDs
kb FA	ack

li F4	enable scanning
kb FA	ack

Now we press and release '1':

kb 16	keypress

kb F0	keyrelease
kb 16

Now we press CapsLock:

kb 58	keypress

li ED	set leds
li ED	set leds
kb FA	ack

System is hung.

The problem was that the driver retried the 'set leds' every 1ms, but the data rate
on the serial PS/2 cable is such that it takes at least 1ms for the command to reach
the keyboard, and a further 1ms for the ack to return.

I changed the driver to allow 5ms rather than 1ms, and it works now.  In fact, for
my keyboard, the time from command being written to ack being received is about
2.5ms.

Can't say I like the idea of mdelay(5) being called 3 times every time I press
CapsLock though.

Richard