[PATCH] Input: atkbd - Skip ATKBD_CMD_GETID in translated mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There have been multiple reports of keyboard issues on recent laptop models
which can be worked around by setting i8042.dumbkbd, with the downside
being this breaks the capslock LED.

It seems that these issues are caused by recent laptops getting confused by
ATKBD_CMD_GETID. Rather then adding and endless growing list of quirks for
this, lets just skip ATKBD_CMD_GETID alltogether when in translated mode.

The main goal of sending ATKBD_CMD_GETID is to skip binding to ps/2
mice/touchpads and those are never used in translated mode.

Examples of laptop models which benefit from skipping ATKBD_CMD_GETID:

* "HP Laptop 15s-fq2xxx", "HP laptop 15s-fq4xxx" and "HP Laptop 15-dy2xxx"
  models the kbd stops working for the first 2 - 5 minutes after boot
  (waiting for EC watchdog reset?)

* On "HP Spectre x360 13-aw2xxx" atkbd fails to probe the keyboard

* At least 9 different Lenovo models have issues with ATKBD_CMD_GETID, see:
  https://github.com/yaescallop/atkbd-nogetid

Note this also removes the "NCD terminal keyboards are only supported on
non-translating controllers." warning since that code is now unreachable.

This has been tested on:

1. A MSI B550M PRO-VDH WIFI desktop, where the i8042 controller is not
   in translated mode when no keyboard is plugged in and with a ps/2 kbd
   a "AT Translated Set 2 keyboard" /dev/input/event# node shows up

2. A Dell Latitude 9420 (always has a "AT Translated Set 2 keyboard")

3. A Lenovo ThinkPad X1 Yoga gen 8 (idem)

Reported-by: Shang Ye <yesh25@xxxxxxxxxxxxxxxxx>
Closes: https://lore.kernel.org/linux-input/886D6167733841AE+20231017135318.11142-1-yesh25@xxxxxxxxxxxxxxxxx/
Closes: https://github.com/yaescallop/atkbd-nogetid
Reported-by: gurevitch <mail@xxxxxxxxxx>
Closes: https://lore.kernel.org/linux-input/2iAJTwqZV6lQs26cTb38RNYqxvsink6SRmrZ5h0cBUSuf9NT0tZTsf9fEAbbto2maavHJEOP8GA1evlKa6xjKOsaskDhtJWxjcnrgPigzVo=@gurevit.ch/
Reported-by: Egor Ignatov <egori@xxxxxxxxxxxx>
Closes: https://lore.kernel.org/all/20210609073333.8425-1-egori@xxxxxxxxxxxx/
Reported-by: Anton Zhilyaev <anton@xxxxxx>
Closes: https://lore.kernel.org/linux-input/20210201160336.16008-1-anton@xxxxxx/
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2086156
Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
---
Note this supersedes my previous atkbd series:
https://lore.kernel.org/linux-input/20231005201544.26983-1-hdegoede@xxxxxxxxxx/
---
 drivers/input/keyboard/atkbd.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index c92e544c792d..c5ffa79548d5 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -786,6 +786,20 @@ static int atkbd_probe(struct atkbd *atkbd)
 				 "keyboard reset failed on %s\n",
 				 ps2dev->serio->phys);
 
+/*
+ * On many modern laptops ATKBD_CMD_GETID may cause problems, on these laptops
+ * the controller is always in translated mode. In this mode mice/touchpads will
+ * not work. So in this case simply assume a keyboard is connected to avoid
+ * confusing some laptop keyboards.
+ *
+ * Using a fake keyboard id is ok in translated mode. Only atkbd_select_set()
+ * checks atkbd->id and in translated mode that is a no-op.
+ */
+	if (atkbd->translated) {
+		atkbd->id = 0xabba;
+		goto deactivate;
+	}
+
 /*
  * Then we check the keyboard ID. We should get 0xab83 under normal conditions.
  * Some keyboards report different values, but the first byte is always 0xab or
@@ -813,13 +827,7 @@ static int atkbd_probe(struct atkbd *atkbd)
 
 	atkbd->id = (param[0] << 8) | param[1];
 
-	if (atkbd->id == 0xaca1 && atkbd->translated) {
-		dev_err(&ps2dev->serio->dev,
-			"NCD terminal keyboards are only supported on non-translating controllers. "
-			"Use i8042.direct=1 to disable translation.\n");
-		return -1;
-	}
-
+deactivate:
 /*
  * Make sure nothing is coming from the keyboard and disturbs our
  * internal state.
-- 
2.41.0




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux