Skip to contentSkip to conversation

Linux 2.6.0-test9

DISCUSSION [email protected] 2 participants 2 messages Oct 26, 2003 – Oct 27, 2003

lore
Share & tools
lore
#0 lore raw
Quoted 1 line

Pls forward.

Below a keyboard patch I sent to l-k 12 days ago.
Discussion:

Petr Vandrovec reported

Quoted 2 lines

got (twice, but yesterday I rebooted box hard, as I thought that it is dead) strange lockup, where box stopped reacting on keyboard.

and

Quoted 4 lines
Oct 14 19:59:18 ppc kernel: i8042.c: e0 <- i8042 (interrupt, kbd, 1) [30115341]
Oct 14 19:59:18 ppc kernel: i8042.c: ed -> i8042 (kbd-data) [30115342]
Oct 14 19:59:18 ppc kernel: i8042.c: fa <- i8042 (interrupt, kbd, 1) [30115346]
Oct 14 19:59:18 ppc kernel: atkbd.c: Unknown key released (translated set 2, code 0x165, data 0xfa, on isa0060/serio0).

What happens is that the kernel code does an untranslate on the 0xfa that is the ACK for 0xed (set LEDs) when 0xe0 preceded. Now the ACK is never seen and we hang waiting for it.

Now 0xfa can be a key scancode or it can be a protocol scancode. Only few keyboards use it as a key scancode, and if we always interpret it as a protocol scancode then these rare keyboards will have a dead key. If we interpret it as a key scancode then we have a dead keyboard in case it was protocol.

The below patch moves the test for ACK and NAK up, so that they are always seen as protocol.

This is just a minimal patch. What I did in 1.1.54 was to keep track of commands sent with a flag reply_expected, so that 0xfa could be taken as ACK when a reply is expected and as key scancode otherwise. That is the better solution, but requires larger surgery.

Andries

drivers/input/keyboard/atkbd.c +10 -11
diff -u --recursive --new-file -X /linux/dontdiff a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
@@ -184,11 +184,19 @@
 		atkbd->resend = 0;
 #endif
 
+	switch (code) {
+		case ATKBD_RET_ACK:
+			atkbd->ack = 1;
+			goto out;
+		case ATKBD_RET_NAK:
+			atkbd->ack = -1;
+			goto out;
+	}
+
 	if (atkbd->translated) do {
 
 		if (atkbd->emul != 1) {
-			if (code == ATKBD_RET_EMUL0 || code == ATKBD_RET_EMUL1 ||
-			    code == ATKBD_RET_ACK || code == ATKBD_RET_NAK)
+			if (code == ATKBD_RET_EMUL0 || code == ATKBD_RET_EMUL1)
 				break;
 			if (code == ATKBD_RET_BAT) {
 				if (!atkbd->bat_xl)
@@ -212,15 +220,6 @@
 
 	} while (0);
 
-	switch (code) {
-		case ATKBD_RET_ACK:
-			atkbd->ack = 1;
-			goto out;
-		case ATKBD_RET_NAK:
-			atkbd->ack = -1;
-			goto out;
-	}
-
 	if (atkbd->cmdcnt) {
 		atkbd->cmdbuf[--atkbd->cmdcnt] = code;
 		goto out;
#1 lore raw

In article <[email protected]>,
<[email protected]> wrote:

| > Pls forward.
| 
| Below a keyboard patch I sent to l-k 12 days ago.
| Discussion:
| 
| Petr Vandrovec reported
| 
| > got (twice, but yesterday I rebooted box hard, as I thought that it is dead)
| > strange lockup, where box stopped reacting on keyboard.
| 
| and
| 
| > Oct 14 19:59:18 ppc kernel: i8042.c: e0 <- i8042 (interrupt, kbd, 1) [30115341]
| > Oct 14 19:59:18 ppc kernel: i8042.c: ed -> i8042 (kbd-data) [30115342]
| > Oct 14 19:59:18 ppc kernel: i8042.c: fa <- i8042 (interrupt, kbd, 1) [30115346]
| > Oct 14 19:59:18 ppc kernel: atkbd.c: Unknown key released (translated set 2, code 0x165, data 0xfa, on isa0060/serio0).
| 
| What happens is that the kernel code does an untranslate on the 0xfa
| that is the ACK for 0xed (set LEDs) when 0xe0 preceded. Now the ACK
| is never seen and we hang waiting for it.
| 
| Now 0xfa can be a key scancode or it can be a protocol scancode.
| Only few keyboards use it as a key scancode, and if we always
| interpret it as a protocol scancode then these rare keyboards
| will have a dead key. If we interpret it as a key scancode then
| we have a dead keyboard in case it was protocol.
| 
| The below patch moves the test for ACK and NAK up, so that they
| are always seen as protocol.
| 
| This is just a minimal patch. What I did in 1.1.54 was to keep track of
| commands sent with a flag reply_expected, so that 0xfa could be taken
| as ACK when a reply is expected and as key scancode otherwise.
| That is the better solution, but requires larger surgery.

I would think that knowing when a reply was coming was very desirable, a keyboard with dead keys is kind of useless if an application uses them (like any editor which allows function to keystroke binding).

Since you have done the full fix already, is it practical to do it quickly now? And how does any fix for this map into "really major bugs?" If the fix is just going to be queued anyway, it might as well be done really right, assuming that you have the time and inclination, of course.

Signature · 3 lines
bill davidsen <[email protected]>
  CTO, TMR Associates, Inc
Doing interesting things with little computers since 1979.