Skip to content

Commit f0dd2af

Browse files
committed
atkbd: Fix first keystroke force reset
Some i8042 falsely return KBD_ACK for ECHO command which cause the keyboard echo test to fail. Without passing echo test, the keyboard is considered as unconfigured. Although this is incorrect behavior, we still consider it correct to prevent the forced reset (a step to configure a keyboard) of the entire keyboard when the first key interrupt is reached. This should fix keyboard probing at least for Framework Laptop [1]. Taken-from: FreeBSD [2] (minus typos) [1]: https://reviews.freebsd.org/D50498 [2]: freebsd/freebsd-src@cba5d7a
1 parent 930ae25 commit f0dd2af

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

sys/dev/misc/kbd/atkbd.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1305,14 +1305,26 @@ setup_kbd_port(KBDC kbdc, int port, int intr)
13051305
static int
13061306
get_kbd_echo(KBDC kbdc)
13071307
{
1308+
int data;
13081309
/* enable the keyboard port, but disable the keyboard intr. */
13091310
if (setup_kbd_port(kbdc, TRUE, FALSE))
13101311
/* CONTROLLER ERROR: there is very little we can do... */
13111312
return ENXIO;
13121313

13131314
/* see if something is present */
13141315
write_kbd_command(kbdc, KBDC_ECHO);
1315-
if (read_kbd_data(kbdc) != KBD_ECHO) {
1316+
data = read_kbd_data(kbdc);
1317+
1318+
/*
1319+
* Some i8042 falsely return KBD_ACK for ECHO command.
1320+
* Though it is not correct behavior for AT keyboards, we accept
1321+
* and consume it to prevent resetting the whole keyboard after the
1322+
* first interrupt.
1323+
*/
1324+
if (data == KBD_ACK)
1325+
data = read_kbd_data(kbdc);
1326+
1327+
if (data != KBD_ECHO) {
13161328
empty_both_buffers(kbdc, 10);
13171329
test_controller(kbdc);
13181330
test_kbd_port(kbdc);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy