Skip to contentSkip to conversation

AT-Keyboard probing too strict in current bk?

PATCH Michael Gernoth 3 participants 4 messages Jan 27, 2005 – Jan 28, 2005 Input drivers

lore
Share & tools
lore
#0 lore raw

Hi,

since the introduction of libps2 in the mainline 2.6 kernel I had the issue that my keyboard[1] was no longer recognized.
The cause of this is that my "keyboard" responds to all commands with an acknowledgement (0xFA), even if the command is not implemented. One of those not implemented commands is 0xF2 (ATKBD_GETID_CMD).

In drivers/input/keyboard/atkbd.c ATKBD_GETID_CMD is used to probe for the keyboard, and if this fails, another method of detecting the keyboard is used. It seems that in 2.6.10 atkbd_command indicated that my keyboard did not successfully execute the command, but in the current bk-version ps2_command is used, which indicates a successfull execution, leaving behind invalid keyboard-ids. This leads to the kernel ignoring my keyboard.

I fixed the problem in my keyboard-converter, but I don't know if the checking in keyboard-probing shouldn't be changed to catch that case, too. I have included a patch which does that.

Regards,
Michael

[1] SUN Type 5 keyboard connected to a self-built sun->ps2 adapter

drivers/input/keyboard/atkbd.c +2 -1
@@ -512,7 +512,8 @@
  */
 
 	param[0] = param[1] = 0xa5;	/* initialize with invalid values */
-	if (ps2_command(ps2dev, param, ATKBD_CMD_GETID)) {
+	if (ps2_command(ps2dev, param, ATKBD_CMD_GETID) ||
+	    (param[0] == 0xa5 && param[1] == 0xa5)) {
 
 /*
  * If the get ID command failed, we check if we can at least set the LEDs on
#1 lore raw
Quoted 8 lines · Michael Gernoth

Hi,

since the introduction of libps2 in the mainline 2.6 kernel I had the issue that my keyboard[1] was no longer recognized.
The cause of this is that my "keyboard" responds to all commands with an acknowledgement (0xFA), even if the command is not implemented. One of those not implemented commands is 0xF2 (ATKBD_GETID_CMD).

Quoted 8 lines

In drivers/input/keyboard/atkbd.c ATKBD_GETID_CMD is used to probe for the keyboard, and if this fails, another method of detecting the keyboard is used. It seems that in 2.6.10 atkbd_command indicated that my keyboard did not successfully execute the command, but in the current bk-version ps2_command is used, which indicates a successfull execution, leaving behind invalid keyboard-ids. This leads to the kernel ignoring my keyboard.

Hi,

Thanks for noticing this. The following patch should fix timeout handling in libps2 and restore previous behavior:

===== drivers/input/serio/libps2.c 1.4 vs edited =====

drivers/input/serio/libps2.c +2 -2
@@ -115,8 +115,8 @@
 	 */
 	timeout = msecs_to_jiffies(command == PS2_CMD_RESET_BAT ? 4000 : 500);
 
-	wait_event_interruptible_timeout(ps2dev->wait,
-		!(ps2dev->flags & PS2_FLAG_CMD1), timeout);
+	timeout = wait_event_interruptible_timeout(ps2dev->wait,
+				!(ps2dev->flags & PS2_FLAG_CMD1), timeout);
 
 	if (ps2dev->cmdcnt && timeout > 0) {
 
Signature · 1 line
Dmitry
#2 lore raw
Quoted 2 lines · Dmitry Torokhov

Thanks for noticing this. The following patch should fix timeout handling in libps2 and restore previous behavior:

This fixes it for me. I tested it with an unmodified atkbd.c and the old firmware for my keyboard converter.

Thanks,
Michael

#3 lore raw
In reply to Michael Gernoth
Quoted 8 lines · Michael Gernoth

Hi,

since the introduction of libps2 in the mainline 2.6 kernel I had the issue that my keyboard[1] was no longer recognized.
The cause of this is that my "keyboard" responds to all commands with an acknowledgement (0xFA), even if the command is not implemented. One of those not implemented commands is 0xF2 (ATKBD_GETID_CMD).

Quoted 7 lines

In drivers/input/keyboard/atkbd.c ATKBD_GETID_CMD is used to probe for the keyboard, and if this fails, another method of detecting the keyboard is used. It seems that in 2.6.10 atkbd_command indicated that my keyboard did not successfully execute the command, but in the current bk-version ps2_command is used, which indicates a successfull execution, leaving behind invalid keyboard-ids. This leads to the kernel ignoring my keyboard.

This is a bug in libps2, that's been fixed and submitted for 2.6.11. Your keyboard should work again with 2.6.11, if the fix makes it there. If a keyboard doesn't report the ID on a GETID command, ps2_command should fail.

Old AT keyboards don't know the GETID command but at least they know the SETLEDS command, which is how they're identified.

As a temporary workaround you can use atkbd.dumbkbd=1, which will cause your LEDs not to work as a side effect, though.

Quoted 3 lines

I fixed the problem in my keyboard-converter, but I don't know if the checking in keyboard-probing shouldn't be changed to catch that case, too. I have included a patch which does that.

We don't need to check the values, since the ps2_command will return an error when the bug in libps2 is fixed.

Quoted 14 lines

[1] SUN Type 5 keyboard connected to a self-built sun->ps2 adapter

drivers/input/keyboard/atkbd.c +2 -1
@@ -512,7 +512,8 @@
  */
 
 	param[0] = param[1] = 0xa5;	/* initialize with invalid values */
-	if (ps2_command(ps2dev, param, ATKBD_CMD_GETID)) {
+	if (ps2_command(ps2dev, param, ATKBD_CMD_GETID) ||
+	    (param[0] == 0xa5 && param[1] == 0xa5)) {
 
 /*
  * If the get ID command failed, we check if we can at least set the LEDs on
Signature · 2 lines
Vojtech Pavlik
SuSE Labs, SuSE CR