Skip to content

Commit 58f65f9

Browse files
jwrdegoededtor
authored andcommitted
Input: atkbd - use ab83 as id when skipping the getid command
Barnabás reported that the change to skip the getid command when the controller is in translated mode on laptops caused the Version field of his "AT Translated Set 2 keyboard" input device to change from ab83 to abba, breaking a custom hwdb entry for this keyboard. Use the standard ab83 id for keyboards when getid is skipped (rather then that getid fails) to avoid reporting a different Version to userspace then before skipping the getid. Fixes: 936e4d4 ("Input: atkbd - skip ATKBD_CMD_GETID in translated mode") Reported-by: Barnabás Pőcze <pobrn@protonmail.com> Closes: https://lore.kernel.org/linux-input/W1ydwoG2fYv85Z3C3yfDOJcVpilEvGge6UGa9kZh8zI2-qkHXp7WLnl2hSkFz63j-c7WupUWI5TLL6n7Lt8DjRuU-yJBwLYWrreb1hbnd6A=@protonmail.com/ Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20240116204325.7719-1-hdegoede@redhat.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent e2a2501 commit 58f65f9

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

drivers/input/keyboard/atkbd.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -791,9 +791,9 @@ static bool atkbd_is_portable_device(void)
791791
* not work. So in this case simply assume a keyboard is connected to avoid
792792
* confusing some laptop keyboards.
793793
*
794-
* Skipping ATKBD_CMD_GETID ends up using a fake keyboard id. Using a fake id is
795-
* ok in translated mode, only atkbd_select_set() checks atkbd->id and in
796-
* translated mode that is a no-op.
794+
* Skipping ATKBD_CMD_GETID ends up using a fake keyboard id. Using the standard
795+
* 0xab83 id is ok in translated mode, only atkbd_select_set() checks atkbd->id
796+
* and in translated mode that is a no-op.
797797
*/
798798
static bool atkbd_skip_getid(struct atkbd *atkbd)
799799
{
@@ -811,6 +811,7 @@ static int atkbd_probe(struct atkbd *atkbd)
811811
{
812812
struct ps2dev *ps2dev = &atkbd->ps2dev;
813813
unsigned char param[2];
814+
bool skip_getid;
814815

815816
/*
816817
* Some systems, where the bit-twiddling when testing the io-lines of the
@@ -832,7 +833,8 @@ static int atkbd_probe(struct atkbd *atkbd)
832833
*/
833834

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

837839
/*
838840
* If the get ID command was skipped or failed, we check if we can at least set
@@ -842,7 +844,7 @@ static int atkbd_probe(struct atkbd *atkbd)
842844
param[0] = 0;
843845
if (ps2_command(ps2dev, param, ATKBD_CMD_SETLEDS))
844846
return -1;
845-
atkbd->id = 0xabba;
847+
atkbd->id = skip_getid ? 0xab83 : 0xabba;
846848
return 0;
847849
}
848850

0 commit comments

Comments
 (0)