summaryrefslogtreecommitdiff
path: root/sys/dev/pckbc
diff options
context:
space:
mode:
authorJoshua Stein <jcs@cvs.openbsd.org>2018-01-06 18:51:21 +0000
committerJoshua Stein <jcs@cvs.openbsd.org>2018-01-06 18:51:21 +0000
commit46d396b96ae6907e8ee10b7e9c9d844762f52999 (patch)
tree09ba6ca01c03302948e7909b9f4f030b55c55659 /sys/dev/pckbc
parentc08a8d775d9ec66e3999e2e512ee8ae5b69b826f (diff)
pckbd: don't change translation mode if controller is in table 2
This was changed a decade ago to forcibly try table 3 first in order to make some now-long-gone hardware work. Newer Lenovo machines seem to have trouble being asked to change modes which manifests as a long boot delay as it waits for each request to timeout, or by causing the keyboard to generate junk when typing. Assume table 2 by default and just leave it alone if it's already there. This is how Linux has operated for quite a while and seems to help on these Lenovo machines. Tested by a few with these machines and has been in snaps for a bit.
Diffstat (limited to 'sys/dev/pckbc')
-rw-r--r--sys/dev/pckbc/pckbd.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/sys/dev/pckbc/pckbd.c b/sys/dev/pckbc/pckbd.c
index 4b9bdfedde4..100f28c06f5 100644
--- a/sys/dev/pckbc/pckbd.c
+++ b/sys/dev/pckbc/pckbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pckbd.c,v 1.43 2016/04/14 07:06:03 mlarkin Exp $ */
+/* $OpenBSD: pckbd.c,v 1.44 2018/01/06 18:51:20 jcs Exp $ */
/* $NetBSD: pckbd.c,v 1.24 2000/06/05 22:20:57 sommerfeld Exp $ */
/*-
@@ -214,8 +214,7 @@ int
pckbd_set_xtscancode(pckbc_tag_t kbctag, pckbc_slot_t kbcslot,
struct pckbd_internal *id)
{
- /* default to have the 8042 translate the keyboard with table 3. */
- int table = 3;
+ int table;
if (pckbc_xt_translation(kbctag)) {
#ifdef DEBUG
@@ -234,12 +233,21 @@ pckbd_set_xtscancode(pckbc_tag_t kbctag, pckbc_slot_t kbcslot,
if (id != NULL)
id->t_translating = 0;
} else {
- if (id != NULL)
+ if (id != NULL) {
id->t_translating = 1;
+ if (id->t_table == 0) {
+ /*
+ * Don't bother explicitly setting into set 2,
+ * it's the default.
+ */
+ id->t_table = 2;
+ return (0);
+ }
+ }
}
/* keep falling back until we hit a table that looks usable. */
- for (; table >= 1; table--) {
+ for (table = 3; table >= 1; table--) {
u_char cmd[2];
#ifdef DEBUG
printf("pckbd: trying table %d\n", table);