Skip to content

Commit 683cd82

Browse files
jwrdegoededtor
authored andcommitted
Input: atkbd - skip ATKBD_CMD_SETLEDS when skipping ATKBD_CMD_GETID
After commit 936e4d4 ("Input: atkbd - skip ATKBD_CMD_GETID in translated mode") the keyboard on Dell XPS 13 9350 / 9360 / 9370 models has stopped working after a suspend/resume. The problem appears to be that atkbd_probe() fails when called from atkbd_reconnect() on resume, which on systems where ATKBD_CMD_GETID is skipped can only happen by ATKBD_CMD_SETLEDS failing. ATKBD_CMD_SETLEDS failing because ATKBD_CMD_GETID was skipped is weird, but apparently that is what is happening. Fix this by also skipping ATKBD_CMD_SETLEDS when skipping ATKBD_CMD_GETID. Fixes: 936e4d4 ("Input: atkbd - skip ATKBD_CMD_GETID in translated mode") Reported-by: Paul Menzel <pmenzel@molgen.mpg.de> Closes: https://lore.kernel.org/linux-input/0aa4a61f-c939-46fe-a572-08022e8931c7@molgen.mpg.de/ Closes: https://bbs.archlinux.org/viewtopic.php?pid=2146300 Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218424 Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2260517 Tested-by: Paul Menzel <pmenzel@molgen.mpg.de> Cc: stable@vger.kernel.org Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20240126160724.13278-2-hdegoede@redhat.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 2b9c3eb commit 683cd82

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

drivers/input/keyboard/atkbd.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,6 @@ static int atkbd_probe(struct atkbd *atkbd)
811811
{
812812
struct ps2dev *ps2dev = &atkbd->ps2dev;
813813
unsigned char param[2];
814-
bool skip_getid;
815814

816815
/*
817816
* Some systems, where the bit-twiddling when testing the io-lines of the
@@ -825,6 +824,11 @@ static int atkbd_probe(struct atkbd *atkbd)
825824
"keyboard reset failed on %s\n",
826825
ps2dev->serio->phys);
827826

827+
if (atkbd_skip_getid(atkbd)) {
828+
atkbd->id = 0xab83;
829+
return 0;
830+
}
831+
828832
/*
829833
* Then we check the keyboard ID. We should get 0xab83 under normal conditions.
830834
* Some keyboards report different values, but the first byte is always 0xab or
@@ -833,18 +837,17 @@ static int atkbd_probe(struct atkbd *atkbd)
833837
*/
834838

835839
param[0] = param[1] = 0xa5; /* initialize with invalid values */
836-
skip_getid = atkbd_skip_getid(atkbd);
837-
if (skip_getid || ps2_command(ps2dev, param, ATKBD_CMD_GETID)) {
840+
if (ps2_command(ps2dev, param, ATKBD_CMD_GETID)) {
838841

839842
/*
840-
* If the get ID command was skipped or failed, we check if we can at least set
843+
* If the get ID command failed, we check if we can at least set
841844
* the LEDs on the keyboard. This should work on every keyboard out there.
842845
* It also turns the LEDs off, which we want anyway.
843846
*/
844847
param[0] = 0;
845848
if (ps2_command(ps2dev, param, ATKBD_CMD_SETLEDS))
846849
return -1;
847-
atkbd->id = skip_getid ? 0xab83 : 0xabba;
850+
atkbd->id = 0xabba;
848851
return 0;
849852
}
850853

0 commit comments

Comments
 (0)