Input: atkbd - map F21 key to support touchpad toggle keys
Subsystems (4)
Werner Sembach
maintainerPATCH v2 1/2 Input: atkbd - map F21 key to support touchpad toggle keys
In the default xkeyboard-config used by both X11 and wayland touchpad toggle is assigned to F21.
This patch is in preparation for i8042 filter patches to be able to remap bogus scancode(-combinations), produced by notebooks uppon pressing a touchpad toggle key.
--- drivers/input/keyboard/atkbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/keyboard/atkbd.c +1 -1
@@ -88,7 +88,7 @@ static const unsigned short atkbd_set2_keycode[ATKBD_KEYMAP_SIZE] = {0 ,56 ,42 ,93 ,29 ,16 ,2 ,0 ,0 ,0 ,44 ,31 ,30 ,17 ,3 ,0 ,0 ,46 ,45 ,32 ,18 ,5 ,4 ,95 ,0 ,57 ,47 ,33 ,20 ,19 ,6 ,183 ,0 ,49 ,48 ,35 ,34 ,21 ,7 ,184 ,0 ,0 ,50 ,36 ,22 ,8 ,9 ,185 , -0 ,51 ,37 ,23 ,24 ,11 ,10 ,0 ,0 ,52 ,53 ,38 ,39 ,25 ,12 ,0 , +0 ,51 ,37 ,23 ,24 ,11 ,10 ,0 ,191 ,52 ,53 ,38 ,39 ,25 ,12 ,0 ,0 ,89 ,40 ,0 ,26 ,13 ,0 ,193 ,58 ,54 ,28 ,27 ,0 ,43 ,0 ,85 ,0 ,86 ,91 ,90 ,92 ,0 ,14 ,94 ,0 ,79 ,124 ,75 ,71 ,121 ,0 ,0 , 82, 83, 80, 76, 77, 72, 1, 69, 87, 78, 81, 74, 55, 73, 70, 99,
Signature · 1 line
2.43.0
Werner Sembach
maintainerPATCH v2 2/2 Input: atkbd - Fix TUXEDO NB02 notebook keyboards FN-keys
This small driver does 2 things:
It remaps the touchpad toggle key from Control + Super + Hangaku/Zenkaku to F21 to conform with established userspace defaults. Note that the Hangaku/Zenkaku scancode used here is usually unused, with real Hangaku/Zenkaku keys using the tilde scancode.
It suppresses the reserved scancode produced by pressing the FN-key on its own, which fixes a warning spamming the dmesg log otherwise.
--- MAINTAINERS | 6 ++ drivers/platform/x86/Kconfig | 2 + drivers/platform/x86/Makefile | 3 + drivers/platform/x86/tuxedo/Kbuild | 6 ++ drivers/platform/x86/tuxedo/Kconfig | 6 ++ drivers/platform/x86/tuxedo/nb02/Kbuild | 7 ++ drivers/platform/x86/tuxedo/nb02/Kconfig | 15 ++++ drivers/platform/x86/tuxedo/nb02/platform.c | 94 +++++++++++++++++++++ 8 files changed, 139 insertions(+) create mode 100644 drivers/platform/x86/tuxedo/Kbuild create mode 100644 drivers/platform/x86/tuxedo/Kconfig create mode 100644 drivers/platform/x86/tuxedo/nb02/Kbuild create mode 100644 drivers/platform/x86/tuxedo/nb02/Kconfig create mode 100644 drivers/platform/x86/tuxedo/nb02/platform.c
MAINTAINERS +6 -0
@@ -24178,6 +24178,12 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux.git turbostat F: tools/power/x86/turbostat/ F: tools/testing/selftests/turbostat/ +TUXEDO DRIVERS +M: Werner Sembach <[email protected]> +L: [email protected] +S: Supported +F: drivers/platform/x86/tuxedo/ + TW5864 VIDEO4LINUX DRIVER M: Bluecherry Maintainers <[email protected]> M: Andrey Utkin <[email protected]>
drivers/platform/x86/Kconfig +2 -0
@@ -1199,3 +1199,5 @@ config P2SB The main purpose of this library is to unhide P2SB device in case firmware kept it hidden on some platforms in order to access devices behind it. + +source "drivers/platform/x86/tuxedo/Kconfig"
drivers/platform/x86/Makefile +3 -0
@@ -153,3 +153,6 @@ obj-$(CONFIG_WINMATE_FM07_KEYS) += winmate-fm07-keys.o # SEL obj-$(CONFIG_SEL3350_PLATFORM) += sel3350-platform.o + +# TUXEDO +obj-y += tuxedo/
drivers/platform/x86/tuxedo/Kbuild new file +6 -0
@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# TUXEDO X86 Platform Specific Drivers +# + +obj-y += nb02/
drivers/platform/x86/tuxedo/Kconfig new file +6 -0
@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# TUXEDO X86 Platform Specific Drivers +# + +source "drivers/platform/x86/tuxedo/nb02/Kconfig"
drivers/platform/x86/tuxedo/nb02/Kbuild new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# TUXEDO X86 Platform Specific Drivers +# + +tuxedo_nb02_platform-y := platform.o +obj-$(CONFIG_TUXEDO_NB02_PLATFORM) += tuxedo_nb02_platform.o
drivers/platform/x86/tuxedo/nb02/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# TUXEDO X86 Platform Specific Drivers +# + +menuconfig TUXEDO_NB02_PLATFORM + tristate "TUXEDO NB02 Platform Driver" + help + This driver implements miscellaneous things found on TUXEDO Notebooks + with board vendor NB02. For the time being this is only remapping the + touchpad toggle key to something supported by most Linux distros + out-of-the-box and suppressing an unsupported scancode from the + FN-key. + + When compiled as a module it will be called tuxedo_nb02_platform.
drivers/platform/x86/tuxedo/nb02/platform.c new file +94 -0
94 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH v2 2/2] Input: atkbd - Fix TUXEDO NB02 notebook keyboards FN-keys
drivers/platform/x86/tuxedo/nb02/Kbuild
Quoted 92 lines · Werner Sembach
This small driver does 2 things:
It remaps the touchpad toggle key from Control + Super + Hangaku/Zenkaku to F21 to conform with established userspace defaults. Note that the Hangaku/Zenkaku scancode used here is usually unused, with real Hangaku/Zenkaku keys using the tilde scancode.
It suppresses the reserved scancode produced by pressing the FN-key on its own, which fixes a warning spamming the dmesg log otherwise.
Signed-off-by Werner Sembach <[email protected]>--- MAINTAINERS | 6 ++ drivers/platform/x86/Kconfig | 2 + drivers/platform/x86/Makefile | 3 + drivers/platform/x86/tuxedo/Kbuild | 6 ++ drivers/platform/x86/tuxedo/Kconfig | 6 ++ drivers/platform/x86/tuxedo/nb02/Kbuild | 7 ++ drivers/platform/x86/tuxedo/nb02/Kconfig | 15 ++++ drivers/platform/x86/tuxedo/nb02/platform.c | 94 +++++++++++++++++++++ 8 files changed, 139 insertions(+)create mode 100644
drivers/platform/x86/tuxedo/Kbuildcreate mode 100644drivers/platform/x86/tuxedo/Kconfigcreate mode 100644drivers/platform/x86/tuxedo/nb02/Kbuildcreate mode 100644drivers/platform/x86/tuxedo/nb02/Kconfigcreate mode 100644drivers/platform/x86/tuxedo/nb02/platform.cMAINTAINERS +6
-0@@ -24178,6 +24178,12 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux.git turbostat F: tools/power/x86/turbostat/ F: tools/testing/selftests/turbostat/ +TUXEDO DRIVERS +M: Werner Sembach <[email protected]> +L: [email protected] +S: Supported +F: drivers/platform/x86/tuxedo/ + TW5864 VIDEO4LINUX DRIVER M: Bluecherry Maintainers <[email protected]> M: Andrey Utkin <[email protected]>drivers/platform/x86/Kconfig +2
-0@@ -1199,3 +1199,5 @@ config P2SB The main purpose of this library is to unhide P2SB device in case firmware kept it hidden on some platforms in order to access devices behind it. + +source "drivers/platform/x86/tuxedo/Kconfig"drivers/platform/x86/Makefile +3
-0@@ -153,3 +153,6 @@ obj-$(CONFIG_WINMATE_FM07_KEYS) += winmate-fm07-keys.o # SEL obj-$(CONFIG_SEL3350_PLATFORM) += sel3350-platform.o + +# TUXEDO +obj-y += tuxedo/drivers/platform/x86/tuxedo/Kbuild new file +6
-0@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# TUXEDO X86 Platform Specific Drivers +# + +obj-y += nb02/drivers/platform/x86/tuxedo/Kconfig new file +6
-0@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# TUXEDO X86 Platform Specific Drivers +# + +source "drivers/platform/x86/tuxedo/nb02/Kconfig"drivers/platform/x86/tuxedo/nb02/Kbuild new file +0
-0
For a brand new directory isn't this structure a bit heavy handed for a single source file?
Or are you envisioning a lot more coming to this structure and just want to be ready?
Why not just d/p/x86/tuxedo?
And within there you can have exactly 3 files: nb02.c, Kconfig and Kbuild.
Quoted 131 lines
drivers/platform/x86/tuxedo/nb02/Kbuild new file +7
-0@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# TUXEDO X86 Platform Specific Drivers +# + +tuxedo_nb02_platform-y := platform.o +obj-$(CONFIG_TUXEDO_NB02_PLATFORM) += tuxedo_nb02_platform.odrivers/platform/x86/tuxedo/nb02/Kconfig new file +15
-0@@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# TUXEDO X86 Platform Specific Drivers +# + +menuconfig TUXEDO_NB02_PLATFORM + tristate "TUXEDO NB02 Platform Driver" + help + This driver implements miscellaneous things found on TUXEDO Notebooks + with board vendor NB02. For the time being this is only remapping the + touchpad toggle key to something supported by most Linux distros + out-of-the-box and suppressing an unsupported scancode from the + FN-key. + + When compiled as a module it will be called tuxedo_nb02_platform.drivers/platform/x86/tuxedo/nb02/platform.c new file +94
-0@@ -0,0 +1,94 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (C) 2025 Werner Sembach [email protected] +*/ + +#include <linux/dmi.h> +#include <linux/i8042.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/serio.h> + +static u8 tux_nb02_touchp_toggle_seq[] = { +0xe0 ,0x5b ,// Super down +0x1d ,// Control down +0x76 ,// Zenkaku/Hankaku down +0xf6 ,// Zenkaku/Hankaku up +0x9d ,// Control up +0xe0 ,0xdb // Super up +}; + +static bool tux_nb02_i8042_filter (unsigned char data, +unsigned char str, +struct serio *port, +__always_unused void *context) +{ +static u8 seq_pos; + +if (unlikely (str &I8042_STR_AUXDATA )) +return false; + +/* Replace touchpad toggle key sequence with a singular press of the +* F21-key. +*/ +if (unlikely (data == tux_nb02_touchp_toggle_seq[seq_pos])) { + ++seq_pos; +if (seq_pos ==ARRAY_SIZE (tux_nb02_touchp_toggle_seq)) { + seq_pos =0 ; +serio_interrupt (port,0x6c ,0 );// F21 down +serio_interrupt (port,0xec ,0 );// F21 up + } +return true; + } + +/* Ignore bogus scancode produced by the FN-key. Reuse seq_pos as first +* byte of that is just the "extended"-byte. +*/ +if (unlikely (seq_pos ==1 && (data ==0x78 || data ==0xf8 ))) { + seq_pos =0 ; +return true; + } + +/* Replay skipped sequence bytes if it did not finish and it was not a +* FN-key press. +*/ +if (unlikely (seq_pos)) { +for (u8 i; i < seq_pos; ++i) +serio_interrupt (port, tux_nb02_touchp_toggle_seq[i],0 ); + seq_pos =0 ; + } + +return false; +} + +static const struct dmi_system_id tux_nb02_dmi_string_match[]__initconst = { + { + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), +DMI_EXACT_MATCH (DMI_BOARD_VENDOR ,"NB02" ), + }, + }, + { } +}; + +static int __init tux_nb02_plat_init (void ) +{ +if (!dmi_check_system (tux_nb02_dmi_string_match)) +return -ENODEV ; + +return i8042_install_filter (tux_nb02_i8042_filter,NULL ); +} + +static void __exit tux_nb02_plat_exit(void) +{ +i8042_remove_filter (tux_nb02_i8042_filter); +} + +module_init (tux_nb02_plat_init); +module_exit (tux_nb02_plat_exit); + +MODULE_ALIAS ("dmi:*:svnTUXEDO:*:rvnNB02:*" ); + +MODULE_DESCRIPTION ("TUXEDO NB02 Platform" ); +MODULE_AUTHOR ("Werner Sembach <[email protected]>" ); +MODULE_LICENSE ("GPL" );
Werner Sembach
maintainerRe: [PATCH v2 2/2] Input: atkbd - Fix TUXEDO NB02 notebook keyboards FN-keys
Am 04.03.25 um 19:53 schrieb Mario Limonciello:
Quoted 96 lines · Werner Sembach
drivers/platform/x86/tuxedo/nb02/Kbuild
Quoted 92 lines
This small driver does 2 things:
It remaps the touchpad toggle key from Control + Super + Hangaku/Zenkaku to F21 to conform with established userspace defaults. Note that the Hangaku/Zenkaku scancode used here is usually unused, with real Hangaku/Zenkaku keys using the tilde scancode.
It suppresses the reserved scancode produced by pressing the FN-key on its own, which fixes a warning spamming the dmesg log otherwise.
Signed-off-by Werner Sembach <[email protected]>---
MAINTAINERS | 6 ++ drivers/platform/x86/Kconfig | 2 + drivers/platform/x86/Makefile | 3 + drivers/platform/x86/tuxedo/Kbuild | 6 ++ drivers/platform/x86/tuxedo/Kconfig | 6 ++ drivers/platform/x86/tuxedo/nb02/Kbuild | 7 ++ drivers/platform/x86/tuxedo/nb02/Kconfig | 15 ++++drivers/platform/x86/tuxedo/nb02/platform.c| 94 +++++++++++++++++++++8 files changed, 139 insertions(+)create mode 100644
drivers/platform/x86/tuxedo/Kbuildcreate mode 100644drivers/platform/x86/tuxedo/Kconfigcreate mode 100644drivers/platform/x86/tuxedo/nb02/Kbuildcreate mode 100644drivers/platform/x86/tuxedo/nb02/Kconfigcreate mode 100644drivers/platform/x86/tuxedo/nb02/platform.cMAINTAINERS +0
-0@@ -24178,6 +24178,12 @@ T: git
git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux.gitturbostat F:tools/power/x86/turbostat/
F:tools/testing/selftests/turbostat/
+TUXEDO DRIVERSMAINTAINERS +5
-0+M: Werner Sembach <[email protected]> +L: [email protected] +S: Supported +F: drivers/platform/x86/tuxedo/ +TW5864 VIDEO4LINUX DRIVER
M: Bluecherry Maintainers <[email protected]> M: Andrey Utkin <[email protected]>drivers/platform/x86/Kconfig +0
-0@@ -1199,3 +1199,5 @@ config P2SBThe main purpose of this library is to unhide P2SB device in case firmware kept it hidden on some platforms in order to access devices behind it.
drivers/platform/x86/Kconfig +2
-0+ +source "drivers/platform/x86/tuxedo/Kconfig"drivers/platform/x86/Makefile +0
-0@@ -153,3 +153,6 @@ obj-$(CONFIG_WINMATE_FM07_KEYS) +=winmate-fm07-keys.o
# SEL
obj-$(CONFIG_SEL3350_PLATFORM) += sel3350-platform.odrivers/platform/x86/Makefile +3
-0+ +# TUXEDO +obj-y += tuxedo/drivers/platform/x86/tuxedo/Kbuild new file +6
-0@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# TUXEDO X86 Platform Specific Drivers +# + +obj-y += nb02/drivers/platform/x86/tuxedo/Kconfig new file +6
-0@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# TUXEDO X86 Platform Specific Drivers +# + +source "drivers/platform/x86/tuxedo/nb02/Kconfig"drivers/platform/x86/tuxedo/nb02/Kbuild new file +0
-0For a brand new directory isn't this structure a bit heavy handed for a single source file?
Quoted 1 line
Or are you envisioning a lot more coming to this structure and just want to be ready?
Exactly.
A rewrite and upstream of all of this is (eventually) planned: https://gitlab.com/tuxedocomputers/development/packages/tuxedo-drivers/-/tree/67b781fbe0498fa6acba5b926d0083e00c287011/src
And already in progress: https://lore.kernel.org/all/[email protected]/ and https://lore.kernel.org/all/[email protected]/
The folder structure I envision is:
tuxedo/
nb01/
nb02/
nb04/
nb05/
nbxx/
NB03 doesn't exist as a DMI board_vendor string on TUXEDO devices for historic reasons.
The different firmwares of the different board_vendor devices have very little in common and so do their drivers.
nbxx is for the TUXI driver, an ACPI interface we plan on eventually getting on more firmwares (currently only on the nb04 devices).
For nb02 there is also a WMI interface to control fans and NVIDIA cTGP and stuff that I plan to implement in a separate driver, that would go in the same folder.
Quoted 143 lines
Why not just d/p/x86/tuxedo?
And within there you can have exactly 3 files:
nb02.c,KconfigandKbuild.Quoted 137 lines
drivers/platform/x86/tuxedo/nb02/Kbuild new file +7
-0@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# TUXEDO X86 Platform Specific Drivers +# + +tuxedo_nb02_platform-y := platform.o +obj-$(CONFIG_TUXEDO_NB02_PLATFORM) += tuxedo_nb02_platform.odrivers/platform/x86/tuxedo/nb02/Kconfig new file +9
-0@@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# TUXEDO X86 Platform Specific Drivers +# + +menuconfig TUXEDO_NB02_PLATFORM + tristate "TUXEDO NB02 Platform Driver" + help + This driver implements miscellaneous things found on TUXEDONotebooks
+ with board vendor NB02. For the time being this is only remapping the
+ touchpad toggle key to something supported by most Linux distros + out-of-the-box and suppressing an unsupported scancode from the + FN-key.drivers/platform/x86/tuxedo/nb02/Kconfig new file +2
-0+ + When compiled as a module it will be called tuxedo_nb02_platform.drivers/platform/x86/tuxedo/nb02/platform.c new file +31
-0@@ -0,0 +1,94 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (C) 2025 Werner Sembach [email protected] +*/ + +#include <linux/dmi.h> +#include <linux/i8042.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/serio.h> + +static u8 tux_nb02_touchp_toggle_seq[] = { + 0xe0, 0x5b, // Super down + 0x1d, // Control down + 0x76, // Zenkaku/Hankaku down + 0xf6, // Zenkaku/Hankaku up + 0x9d, // Control up + 0xe0, 0xdb // Super up +}; + +static bool tux_nb02_i8042_filter (unsigned char data, + unsigned char str, + struct serio *port, + __always_unused void *context) +{ + static u8 seq_pos; + + if (unlikely(str & I8042_STR_AUXDATA)) + return false; + + /* Replace touchpad toggle key sequence with a singular press ofthe
+ * F21-key.
+ */
+ if (unlikely(data == tux_nb02_touchp_toggle_seq[seq_pos])) { + ++seq_pos;
+ if (seq_pos==ARRAY_SIZE(tux_nb02_touchp_toggle_seq)) { +seq_pos= 0;
+serio_interrupt(port, 0x6c, 0); // F21 down
+serio_interrupt(port, 0xec, 0); // F21 up
+ }
+ return true;
+ }
+
+ /* Ignore bogus scancode produced by the FN-key. Reuseseq_posas first
+ * byte of that is just the "extended"-byte.
+ */
+ if (unlikely(seq_pos == 1 && (data == 0x78 || data == 0xf8))) { +seq_pos= 0;
+ return true;
+ }
+
+ /* Replay skipped sequence bytes if it did not finish and it was not a
+ * FN-key press.
+ */
+ if (unlikely(seq_pos)) {
+ for (u8 i; i <seq_pos; ++i)
+serio_interrupt(port, tux_nb02_touchp_toggle_seq[i], 0); +seq_pos= 0;
+ }drivers/platform/x86/tuxedo/nb02/platform.c new file +5
-0+ + return false; +} + +static const struct dmi_system_id tux_nb02_dmi_string_match[]
__initconst= {
+ {
+ .matches = {
+DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TUXEDO"), +DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "NB02"), + },
+ },
+ { }drivers/platform/x86/tuxedo/nb02/platform.c new file +23
-0+}; + +static int __init tux_nb02_plat_init (void ) +{ + if (!dmi_check_system(tux_nb02_dmi_string_match)) + return -ENODEV; + + return i8042_install_filter(tux_nb02_i8042_filter, NULL); +} + +static void __exit tux_nb02_plat_exit(void) +{ + i8042_remove_filter(tux_nb02_i8042_filter); +} + +module_init (tux_nb02_plat_init); +module_exit (tux_nb02_plat_exit); + +MODULE_ALIAS ("dmi:*:svnTUXEDO:*:rvnNB02:*" ); + +MODULE_DESCRIPTION ("TUXEDO NB02 Platform" ); +MODULE_AUTHOR ("Werner Sembach <[email protected]>" ); +MODULE_LICENSE ("GPL" );
Re: [PATCH v2 2/2] Input: atkbd - Fix TUXEDO NB02 notebook keyboards FN-keys
In reply to Werner SembachAm 03.03.25 um 20:04 schrieb Werner Sembach:
Quoted 131 lines
This small driver does 2 things:
It remaps the touchpad toggle key from Control + Super + Hangaku/Zenkaku to F21 to conform with established userspace defaults. Note that the Hangaku/Zenkaku scancode used here is usually unused, with real Hangaku/Zenkaku keys using the tilde scancode.
It suppresses the reserved scancode produced by pressing the FN-key on its own, which fixes a warning spamming the dmesg log otherwise.
Signed-off-by Werner Sembach <[email protected]>--- MAINTAINERS | 6 ++ drivers/platform/x86/Kconfig | 2 + drivers/platform/x86/Makefile | 3 + drivers/platform/x86/tuxedo/Kbuild | 6 ++ drivers/platform/x86/tuxedo/Kconfig | 6 ++ drivers/platform/x86/tuxedo/nb02/Kbuild | 7 ++ drivers/platform/x86/tuxedo/nb02/Kconfig | 15 ++++ drivers/platform/x86/tuxedo/nb02/platform.c | 94 +++++++++++++++++++++ 8 files changed, 139 insertions(+)create mode 100644
drivers/platform/x86/tuxedo/Kbuildcreate mode 100644drivers/platform/x86/tuxedo/Kconfigcreate mode 100644drivers/platform/x86/tuxedo/nb02/Kbuildcreate mode 100644drivers/platform/x86/tuxedo/nb02/Kconfigcreate mode 100644drivers/platform/x86/tuxedo/nb02/platform.cMAINTAINERS +6
-0@@ -24178,6 +24178,12 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux.git turbostat F: tools/power/x86/turbostat/ F: tools/testing/selftests/turbostat/ +TUXEDO DRIVERS +M: Werner Sembach <[email protected]> +L: [email protected] +S: Supported +F: drivers/platform/x86/tuxedo/ + TW5864 VIDEO4LINUX DRIVER M: Bluecherry Maintainers <[email protected]> M: Andrey Utkin <[email protected]>drivers/platform/x86/Kconfig +2
-0@@ -1199,3 +1199,5 @@ config P2SB The main purpose of this library is to unhide P2SB device in case firmware kept it hidden on some platforms in order to access devices behind it. + +source "drivers/platform/x86/tuxedo/Kconfig"drivers/platform/x86/Makefile +3
-0@@ -153,3 +153,6 @@ obj-$(CONFIG_WINMATE_FM07_KEYS) += winmate-fm07-keys.o # SEL obj-$(CONFIG_SEL3350_PLATFORM) += sel3350-platform.o + +# TUXEDO +obj-y += tuxedo/drivers/platform/x86/tuxedo/Kbuild new file +6
-0@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# TUXEDO X86 Platform Specific Drivers +# + +obj-y += nb02/drivers/platform/x86/tuxedo/Kconfig new file +6
-0@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# TUXEDO X86 Platform Specific Drivers +# + +source "drivers/platform/x86/tuxedo/nb02/Kconfig"drivers/platform/x86/tuxedo/nb02/Kbuild new file +7
-0@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# TUXEDO X86 Platform Specific Drivers +# + +tuxedo_nb02_platform-y := platform.o +obj-$(CONFIG_TUXEDO_NB02_PLATFORM) += tuxedo_nb02_platform.odrivers/platform/x86/tuxedo/nb02/Kconfig new file +15
-0@@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# TUXEDO X86 Platform Specific Drivers +# + +menuconfig TUXEDO_NB02_PLATFORM + tristate "TUXEDO NB02 Platform Driver" + help + This driver implements miscellaneous things found on TUXEDO Notebooks + with board vendor NB02. For the time being this is only remapping the + touchpad toggle key to something supported by most Linux distros + out-of-the-box and suppressing an unsupported scancode from the + FN-key. + + When compiled as a module it will be called tuxedo_nb02_platform.drivers/platform/x86/tuxedo/nb02/platform.c new file +2
-0@@ -0,0 +1,94 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/*
drivers/platform/x86/tuxedo/nb02/platform.c line 12
Quoted 10 lines
drivers/platform/x86/tuxedo/nb02/platform.c new file +10
-0+* Copyright (C) 2025 Werner Sembach [email protected] +*/ + +#include <linux/dmi.h> +#include <linux/i8042.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/serio.h> + +static u8 tux_nb02_touchp_toggle_seq[] = {
Hi,
please make this const.
Quoted 68 lines
drivers/platform/x86/tuxedo/nb02/platform.c new file +68
-0+0xe0 ,0x5b ,// Super down +0x1d ,// Control down +0x76 ,// Zenkaku/Hankaku down +0xf6 ,// Zenkaku/Hankaku up +0x9d ,// Control up +0xe0 ,0xdb // Super up +}; + +static bool tux_nb02_i8042_filter (unsigned char data, +unsigned char str, +struct serio *port, +__always_unused void *context) +{ +static u8 seq_pos; + +if (unlikely (str &I8042_STR_AUXDATA )) +return false; + +/* Replace touchpad toggle key sequence with a singular press of the +* F21-key. +*/ +if (unlikely (data == tux_nb02_touchp_toggle_seq[seq_pos])) { + ++seq_pos; +if (seq_pos ==ARRAY_SIZE (tux_nb02_touchp_toggle_seq)) { + seq_pos =0 ; +serio_interrupt (port,0x6c ,0 );// F21 down +serio_interrupt (port,0xec ,0 );// F21 up + } +return true; + } + +/* Ignore bogus scancode produced by the FN-key. Reuse seq_pos as first +* byte of that is just the "extended"-byte. +*/ +if (unlikely (seq_pos ==1 && (data ==0x78 || data ==0xf8 ))) { + seq_pos =0 ; +return true; + } + +/* Replay skipped sequence bytes if it did not finish and it was not a +* FN-key press. +*/ +if (unlikely (seq_pos)) { +for (u8 i; i < seq_pos; ++i) +serio_interrupt (port, tux_nb02_touchp_toggle_seq[i],0 ); + seq_pos =0 ; + } + +return false; +} + +static const struct dmi_system_id tux_nb02_dmi_string_match[]__initconst = { + { + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), +DMI_EXACT_MATCH (DMI_BOARD_VENDOR ,"NB02" ), + }, + }, + { } +}; + +static int __init tux_nb02_plat_init (void ) +{ +if (!dmi_check_system (tux_nb02_dmi_string_match)) +return -ENODEV ; + +return i8042_install_filter (tux_nb02_i8042_filter,NULL ); +}
drivers/platform/x86/tuxedo/nb02/platform.c line 90
Quoted 10 lines
drivers/platform/x86/tuxedo/nb02/platform.c new file +10
-0+ +static void __exit tux_nb02_plat_exit(void) +{ +i8042_remove_filter (tux_nb02_i8042_filter); +} + +module_init (tux_nb02_plat_init); +module_exit (tux_nb02_plat_exit); + +MODULE_ALIAS ("dmi:*:svnTUXEDO:*:rvnNB02:*" );
Please use MODULE_DEVICE_TABLE(dmi, tux_nb02_dmi_string_match) instead.
Otherwise the driver seems to be OK to me.
Thanks,
Armin Wolf
Quoted 4 lines
drivers/platform/x86/tuxedo/nb02/platform.c new file +4
-0+ +MODULE_DESCRIPTION ("TUXEDO NB02 Platform" ); +MODULE_AUTHOR ("Werner Sembach <[email protected]>" ); +MODULE_LICENSE ("GPL" );
Werner Sembach
maintainerRe: [PATCH v2 2/2] Input: atkbd - Fix TUXEDO NB02 notebook keyboards FN-keys
Am 05.03.25 um 02:01 schrieb Armin Wolf:
Quoted 148 lines
Am 03.03.25 um 20:04 schrieb Werner Sembach:
Quoted 133 lines
This small driver does 2 things:
It remaps the touchpad toggle key from Control + Super + Hangaku/Zenkaku to F21 to conform with established userspace defaults. Note that the Hangaku/Zenkaku scancode used here is usually unused, with real Hangaku/Zenkaku keys using the tilde scancode.
It suppresses the reserved scancode produced by pressing the FN-key on its own, which fixes a warning spamming the dmesg log otherwise.
Signed-off-by Werner Sembach <[email protected]>---
MAINTAINERS | 6 ++ drivers/platform/x86/Kconfig | 2 + drivers/platform/x86/Makefile | 3 + drivers/platform/x86/tuxedo/Kbuild | 6 ++ drivers/platform/x86/tuxedo/Kconfig | 6 ++ drivers/platform/x86/tuxedo/nb02/Kbuild | 7 ++ drivers/platform/x86/tuxedo/nb02/Kconfig | 15 ++++drivers/platform/x86/tuxedo/nb02/platform.c| 94 +++++++++++++++++++++8 files changed, 139 insertions(+)create mode 100644
drivers/platform/x86/tuxedo/Kbuildcreate mode 100644drivers/platform/x86/tuxedo/Kconfigcreate mode 100644drivers/platform/x86/tuxedo/nb02/Kbuildcreate mode 100644drivers/platform/x86/tuxedo/nb02/Kconfigcreate mode 100644drivers/platform/x86/tuxedo/nb02/platform.cMAINTAINERS +0
-0@@ -24178,6 +24178,12 @@ T: git
git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux.gitturbostat F:tools/power/x86/turbostat/
F:tools/testing/selftests/turbostat/MAINTAINERS +6
-0+TUXEDO DRIVERS +M: Werner Sembach <[email protected]> +L: [email protected] +S: Supported +F: drivers/platform/x86/tuxedo/ +TW5864 VIDEO4LINUX DRIVER
M: Bluecherry Maintainers <[email protected]> M: Andrey Utkin <[email protected]>drivers/platform/x86/Kconfig +0
-0@@ -1199,3 +1199,5 @@ config P2SBThe main purpose of this library is to unhide P2SB device in case firmware kept it hidden on some platforms in order to access devices behind it.
drivers/platform/x86/Kconfig +2
-0+ +source "drivers/platform/x86/tuxedo/Kconfig"drivers/platform/x86/Makefile +0
-0@@ -153,3 +153,6 @@ obj-$(CONFIG_WINMATE_FM07_KEYS) +=winmate-fm07-keys.o
# SEL
obj-$(CONFIG_SEL3350_PLATFORM) += sel3350-platform.odrivers/platform/x86/Makefile +3
-0+ +# TUXEDO +obj-y += tuxedo/drivers/platform/x86/tuxedo/Kbuild new file +6
-0@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# TUXEDO X86 Platform Specific Drivers +# + +obj-y += nb02/drivers/platform/x86/tuxedo/Kconfig new file +6
-0@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# TUXEDO X86 Platform Specific Drivers +# + +source "drivers/platform/x86/tuxedo/nb02/Kconfig"drivers/platform/x86/tuxedo/nb02/Kbuild new file +7
-0@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# TUXEDO X86 Platform Specific Drivers +# + +tuxedo_nb02_platform-y := platform.o +obj-$(CONFIG_TUXEDO_NB02_PLATFORM) += tuxedo_nb02_platform.odrivers/platform/x86/tuxedo/nb02/Kconfig new file +15
-0@@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# TUXEDO X86 Platform Specific Drivers +# + +menuconfig TUXEDO_NB02_PLATFORM + tristate "TUXEDO NB02 Platform Driver" + help + This driver implements miscellaneous things found on TUXEDO Notebooks + with board vendor NB02. For the time being this is only remapping the + touchpad toggle key to something supported by most Linux distros + out-of-the-box and suppressing an unsupported scancode from the + FN-key. + + When compiled as a module it will be called tuxedo_nb02_platform.drivers/platform/x86/tuxedo/nb02/platform.c new file +2
-0@@ -0,0 +1,94 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* drivers/platform/x86/tuxedo/nb02/platform.c line 12
Quoted 10 lines
drivers/platform/x86/tuxedo/nb02/platform.c new file +10
-0+* Copyright (C) 2025 Werner Sembach [email protected] +*/ + +#include <linux/dmi.h> +#include <linux/i8042.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/serio.h> + +static u8 tux_nb02_touchp_toggle_seq[] = {Hi,
Quoted 1 line
please make this const.
kk
Quoted 73 lines
Quoted 73 lines
drivers/platform/x86/tuxedo/nb02/platform.c new file +72
-0+ 0xe0, 0x5b, // Super down + 0x1d, // Control down + 0x76, // Zenkaku/Hankaku down + 0xf6, // Zenkaku/Hankaku up + 0x9d, // Control up + 0xe0, 0xdb // Super up +}; + +static bool tux_nb02_i8042_filter (unsigned char data, + unsigned char str, + struct serio *port, + __always_unused void *context) +{ + static u8 seq_pos; + + if (unlikely(str & I8042_STR_AUXDATA)) + return false; + + /* Replace touchpad toggle key sequence with a singular press of the + * F21-key. + */ + if (unlikely(data == tux_nb02_touchp_toggle_seq[seq_pos])) { + ++seq_pos; + if (seq_pos == ARRAY_SIZE(tux_nb02_touchp_toggle_seq)) { + seq_pos = 0; + serio_interrupt(port, 0x6c, 0); // F21 down + serio_interrupt(port, 0xec, 0); // F21 up + } + return true; + } + + /* Ignore bogus scancode produced by the FN-key. Reuse seq_pos as first + * byte of that is just the "extended"-byte. + */ + if (unlikely(seq_pos == 1 && (data == 0x78 || data == 0xf8))) { + seq_pos = 0; + return true; + } + + /* Replay skipped sequence bytes if it did not finish and it was not a + * FN-key press. + */ + if (unlikely(seq_pos)) { + for (u8 i; i < seq_pos; ++i) + serio_interrupt(port, tux_nb02_touchp_toggle_seq[i], 0); + seq_pos = 0; + } + + return false; +} + +static const struct dmi_system_id tux_nb02_dmi_string_match[]__initconst = { + { + .matches = { + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TUXEDO"), + DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "NB02"), + }, + }, + { } +}; + +static int __init tux_nb02_plat_init (void ) +{ + if (!dmi_check_system(tux_nb02_dmi_string_match)) + return -ENODEV; + + return i8042_install_filter(tux_nb02_i8042_filter, NULL); +} + +static void __exit tux_nb02_plat_exit(void) +{ + i8042_remove_filter(tux_nb02_i8042_filter);
Quoted 8 lines
drivers/platform/x86/tuxedo/nb02/platform.c line 90
Quoted 6 lines
drivers/platform/x86/tuxedo/nb02/platform.c new file +6
-0+} + +module_init (tux_nb02_plat_init); +module_exit (tux_nb02_plat_exit); + +MODULE_ALIAS ("dmi:*:svnTUXEDO:*:rvnNB02:*" );Please use
MODULE_DEVICE_TABLE(dmi, tux_nb02_dmi_string_match)instead.
kk
Quoted 10 lines
Otherwise the driver seems to be OK to me.
Thanks,
Armin WolfQuoted 4 lines
drivers/platform/x86/tuxedo/nb02/platform.c new file +4
-0+ +MODULE_DESCRIPTION ("TUXEDO NB02 Platform" ); +MODULE_AUTHOR ("Werner Sembach <[email protected]>" ); +MODULE_LICENSE ("GPL" );
Re: [PATCH v2 2/2] Input: atkbd - Fix TUXEDO NB02 notebook keyboards FN-keys
In reply to Werner SembachHi Werner,
Quoted 6 lines · Werner Sembach
This small driver does 2 things:
It remaps the touchpad toggle key from Control + Super + Hangaku/Zenkaku to F21 to conform with established userspace defaults. Note that the Hangaku/Zenkaku scancode used here is usually unused, with real Hangaku/Zenkaku keys using the tilde scancode.
So this control + super + scancode 0x76 sending is also seen on quite a few other laptops and I think we need a generic fix for this.
I recently noticed that KDE's keyboard-shortcut settings actually has a control + super + Hangaku/Zenkaku -> touchpad-toggle key binding in its default bindings (IIRC). But that cannot work because xkb actually has no mapping for evdev code 85 / KEY_ZENKAKUHANKAKU if you look in:
/usr/share/X11/xkb/keycodes/evdev and then look for 93 (*) you will find no mapping. I think this KDE default binding may be from a long time ago when this did work. Or maybe KDE uses the FOO part of KEY_FOO as symbolic when there is no xkb mapping ?
*) 85 + 8 all codes there are shifted up 8 compared to the KEY_FOO defines because codes 0-7 are reserved for modifier.
I hit the same issue years ago on "T-boa Tbook air" laptop and their I fixed this by mapping Hangaku/Zenkaku -> f21 in /lib/udev/hwdb.d/60-keyboard.hwdb :
###########################################################
# T-bao
###########################################################
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnT-bao:pnTbookair:*
KEYBOARD_KEY_76=f21 # Touchpad toggle
+ teaching GNOME to also accept Ctrl + Super + XF86TouchpadToggle as touchpad-toggle:
Notice that system76 has the same hwdb key mapping for their Pangolin 12 model which I presume also has something like e.g. a clevo as base model.
So for now to fix the touchpad on this TUXEDO NB02 you should simply add a hwdb entry like the above entries.
Longer term I think the right fix for the touchpad toggle for all laptops which do this would be to make GNOME do what KDE does and change the touchpad-toggle-static keybinding list which currently is:
['XF86TouchpadToggle', '<Ctrl><Super>XF86TouchpadToggle']
to:
['XF86TouchpadToggle', '<Ctrl><Super>XF86TouchpadToggle', '<Ctrl><Super>"Something"']
Where "Something" would then be the new mapping. Or maybe just teach atkbd or xkb or hwdb to map scancode 0x76 to TouchpadToggle by default then at least in GNOME this will work OOTB and for KDE a default binding of '<Ctrl><Super>XF86TouchpadToggle'] -> touchpad-toggle should probably be added there.
Quoted 2 lines
It suppresses the reserved scancode produced by pressing the FN-key on its own, which fixes a warning spamming the dmesg log otherwise.
Can you not also suppress this by mapping the key to "unknown" in hwdb?
Regards,
Hans
Werner Sembach
maintainerRe: [PATCH v2 2/2] Input: atkbd - Fix TUXEDO NB02 notebook keyboards FN-keys
Am 05.03.25 um 12:25 schrieb Hans de Goede:
Quoted 17 lines
Hi Werner,
Quoted 6 lines · Werner Sembach
This small driver does 2 things:
It remaps the touchpad toggle key from Control + Super + Hangaku/Zenkaku to F21 to conform with established userspace defaults. Note that the Hangaku/Zenkaku scancode used here is usually unused, with real Hangaku/Zenkaku keys using the tilde scancode.
So this control + super + scancode
0x76sending is also seen on quite a few other laptops and I think we need a generic fix for this.I recently noticed that KDE's keyboard-shortcut settings actually has a control + super + Hangaku/Zenkaku -> touchpad-toggle key binding in its default bindings (IIRC). But that cannot work because xkb actually has no mapping for evdev code 85 /
KEY_ZENKAKUHANKAKUif you look in:
Quoted 4 lines
/usr/share/X11/xkb/keycodes/evdevand then look for 93 (*) you will find no mapping. I think this KDE default binding may be from a long time ago when this did work. Or maybe KDE uses the FOO part ofKEY_FOOas symbolic when there is no xkb mapping ?
It does not work on X11, but it does work on Wayland (there xev also sees the Zenkaku/Hankaku keypress). Don't ask me why.
Also: Other DEs don't have this binding.
Quoted 12 lines
*) 85 + 8 all codes there are shifted up 8 compared to the
KEY_FOOdefines because codes 0-7 are reserved for modifier.I hit the same issue years ago on "T-boa Tbook air" laptop and their I fixed this by mapping Hangaku/Zenkaku -> f21 in
/lib/udev/hwdb.d/60-keyboard.hwdb:###########################################################
# T-bao
###########################################################
Quoted 7 lines
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnT-bao:pnTbookair:*
KEYBOARD_KEY_76=f21 # Touchpad toggle+ teaching GNOME to also accept Ctrl + Super + XF86TouchpadToggle as touchpad-toggle:
Yeah KDE would need a similar fix and other DEs probably too. I hoped for a generic fix that does not need adjustments in so many projects.
My first try was to do it on the XKB level but on Wayland the RedirectKey action is not implemented https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/merge_requests/794#note_2803713 (and probably wont be even in the future https://github.com/xkbcommon/libxkbcommon/issues/18#issuecomment-72728366) so I can't "unpress" control and super.
If it is a more general issue, why not fix it on a more general level in the kernel? Maybe a generic filter applyable via a command line quirk and/or a quirk list?
Quoted 25 lines
Notice that system76 has the same hwdb key mapping for their Pangolin 12 model which I presume also has something like e.g. a clevo as base model.
So for now to fix the touchpad on this TUXEDO NB02 you should simply add a hwdb entry like the above entries.
Longer term I think the right fix for the touchpad toggle for all laptops which do this would be to make GNOME do what KDE does and change the touchpad-toggle-static keybinding list which currently is:
['XF86TouchpadToggle', '<Ctrl><Super>XF86TouchpadToggle']
to:
['XF86TouchpadToggle', '<Ctrl><Super>XF86TouchpadToggle', '<Ctrl><Super>"Something"']
Where "Something" would then be the new mapping. Or maybe just teach atkbd or xkb or hwdb to map scancode
0x76to TouchpadToggle by default then at least in GNOME this will work OOTB and for KDE a default binding of '<Ctrl><Super>XF86TouchpadToggle'] -> touchpad-toggle should probably be added there.
Quoted 3 lines
Quoted 2 lines
It suppresses the reserved scancode produced by pressing the FN-key on its own, which fixes a warning spamming the dmesg log otherwise.
Can you not also suppress this by mapping the key to "unknown" in hwdb?
Maybe, I didn't try. Was convenient to just do it here since I already had the filter. Will look into it once it is decided what to do with the touchpad toggle issue.
Quoted 6 lines
Regards,
Hans
Re: [PATCH v2 2/2] Input: atkbd - Fix TUXEDO NB02 notebook keyboards FN-keys
Hi Werner,
Quoted 19 lines · Werner Sembach
Am 05.03.25 um 12:25 schrieb Hans de Goede:
Quoted 17 lines
Hi Werner,
Quoted 6 lines · Werner Sembach
This small driver does 2 things:
It remaps the touchpad toggle key from Control + Super + Hangaku/Zenkaku to F21 to conform with established userspace defaults. Note that the Hangaku/Zenkaku scancode used here is usually unused, with real Hangaku/Zenkaku keys using the tilde scancode.
So this control + super + scancode
0x76sending is also seen on quite a few other laptops and I think we need a generic fix for this.I recently noticed that KDE's keyboard-shortcut settings actually has a control + super + Hangaku/Zenkaku -> touchpad-toggle key binding in its default bindings (IIRC). But that cannot work because xkb actually has no mapping for evdev code 85 /
KEY_ZENKAKUHANKAKUif you look in:
Quoted 6 lines
Quoted 4 lines
/usr/share/X11/xkb/keycodes/evdevand then look for 93 (*) you will find no mapping. I think this KDE default binding may be from a long time ago when this did work. Or maybe KDE uses the FOO part ofKEY_FOOas symbolic when there is no xkb mapping ?It does not work on X11, but it does work on Wayland (there xev also sees the Zenkaku/Hankaku keypress). Don't ask me why.
Interesting, so in xev under Wayland you see something like this on release:
state 0x0, keycode 38 (keysym 0x61, a), same_screen YES,
With there actually being a keysym of "Zenkaku_Hankaku" there ?
Because that is not working on Wayland on my laptop with the same issue (after disabling the hwdb mapping) and I don't understand how that could work at all given that /usr/share/X11/xkb/keycodes/evdev has no mapping for EV keycode 85 (93 in that file) ?
Quoted 1 line
Also: Other DEs don't have this binding.
Yes that is an issue, but see below.
Quoted 17 lines
Quoted 17 lines
*) 85 + 8 all codes there are shifted up 8 compared to the
KEY_FOOdefines because codes 0-7 are reserved for modifier.I hit the same issue years ago on "T-boa Tbook air" laptop and their I fixed this by mapping Hangaku/Zenkaku -> f21 in
/lib/udev/hwdb.d/60-keyboard.hwdb:###########################################################
# T-bao
###########################################################evdev:atkbd:dmi:bvn*:bvr*:bd*:svnT-bao:pnTbookair:* KEYBOARD_KEY_76=f21 # Touchpad toggle
+ teaching GNOME to also accept Ctrl + Super + XF86TouchpadToggle as touchpad-toggle:
Quoted 7 lines
Yeah KDE would need a similar fix and other DEs probably too. I hoped for a generic fix that does not need adjustments in so many projects.
My first try was to do it on the XKB level but on Wayland the RedirectKey action is not implemented https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/merge_requests/794#note_2803713 (and probably wont be even in the future https://github.com/xkbcommon/libxkbcommon/issues/18#issuecomment-72728366) so I can't "unpress" control and super.
If it is a more general issue, why not fix it on a more general level in the kernel? Maybe a generic filter applyable via a command line quirk and/or a quirk list?
The problem is that filtering keys with modifiers like you are doing here just does not work.
Your filter is seriously messing with the timing of the keypresses which can be a real issue when not actually using the toggle touchpad hotkey.
Lets say the user is playing a game and has mapped super to one of the fire buttons and is using an in game weapon with some sort of auto-repeat firing.
And your seqpos variable likely is 0 when super gets pressed, now the keyboard sends 0xe0, 0x5b which your filter filters out, and the user keeps super pressed because they expect the weapon to start firing on auto-repeat. But the super press is never send until super is released or another key is pressed so things don't work.
Likewise if the DE, an app or accessibility settings want to differentiate between a short and a long super press all presses now become super (pun not intended) short because you insert the press directly in front of the release, losing any timing information about how long the key was pressed.
This is why using an i8042 filter for filtering key-combinations (and the EC emulates a key-combination here) can never work reliably.
OTOH desktop environments already allow having Ctrl+Super+something keybindings for DE actions. So we can re-use the tried and trusted modifier handling in the DE to deal with combi part leaving just the issue of mapping PS/2 scancode 0x76 aka evdev code 85 / KEY_ZENKAKUHANKAKU to something usable by the DE.
ATM both GNOME and KDE already have support for Ctrl+Super+something for touchpad-toggle except that KDE expects a "Zenkaku_Hankaku" keysym where as GNOME expects "XF86TouchpadToggle" arguably the GNOME solution is slightly better because Japanese keyboard layouts already use/send the "Zenkaku_Hankaku" keysym unrelated to touchpad-toggle use. And I don't know what happens when pressing ctrl+super+Zenkaku_Hankaku while using a Japanese layout.
I think maybe we just need to patch atkbd.c at the kernel to map scancode 0x76 -> KEY_TOUCHPAD_TOGGLE since normal PS/2 keyboards never generate 0x76, this would lose the mapping to KEY_ZENKAKUHANKAKU but since /usr/share/X11/xkb/keycodes/evdev does not even map KEY_ZENKAKUHANKAKU I don't think loosing that mapping will do a big deal.
So I think that going with the evdev mapping + teaching KDE that Ctrl+Super+XF86TouchpadToggle is just XF86TouchpadToggle is the best way forward to solve this once and for all.
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
It suppresses the reserved scancode produced by pressing the FN-key on its own, which fixes a warning spamming the dmesg log otherwise.
Can you not also suppress this by mapping the key to "unknown" in hwdb?
Maybe, I didn't try. Was convenient to just do it here since I already had the filter. Will look into it once it is decided what to do with the touchpad toggle issue.
Please give using hwdb for this a try.
Regards,
Hans
Werner Sembach
maintainerRe: [PATCH v2 2/2] Input: atkbd - Fix TUXEDO NB02 notebook keyboards FN-keys
Hi Hans,
Am 05.03.25 um 15:18 schrieb Hans de Goede:
Quoted 25 lines
Hi Werner,
Quoted 22 lines · Werner Sembach
Am 05.03.25 um 12:25 schrieb Hans de Goede:
Quoted 21 lines
Hi Werner,
Quoted 6 lines · Werner Sembach
This small driver does 2 things:
It remaps the touchpad toggle key from Control + Super + Hangaku/Zenkaku to F21 to conform with established userspace defaults. Note that the Hangaku/Zenkaku scancode used here is usually unused, with real Hangaku/Zenkaku keys using the tilde scancode.
So this control + super + scancode
0x76sending is also seen on quite a few other laptops and I think we need a generic fix for this.I recently noticed that KDE's keyboard-shortcut settings actually has a control + super + Hangaku/Zenkaku -> touchpad-toggle key binding in its default bindings (IIRC). But that cannot work because xkb actually has no mapping for evdev code 85 /
KEY_ZENKAKUHANKAKUif you look in:
/usr/share/X11/xkb/keycodes/evdevand then look for 93 (*) you will find no mapping. I think this KDE default binding may be from a long time ago when this did work. Or maybe KDE uses the FOO part ofKEY_FOOas symbolic when there is no xkb mapping ?
Quoted 7 lines
Quoted 1 line
It does not work on X11, but it does work on Wayland (there xev also sees the Zenkaku/Hankaku keypress). Don't ask me why.
Interesting, so in xev under Wayland you see something like this on release:
state 0x0, keycode 38 (keysym 0x61, a), same_screen YES,With there actually being a keysym of "
Zenkaku_Hankaku" there ?
No. Sorry I got it a little bit wrong above, I didn't know it exactly anymore and had to retest:
With the keyboard shortcut deactivated, xev on wayland shows this:
KeyPress event, serial 39, synthetic NO, window 0x1200001, root 0x4f7, subw 0x0, time 246681, (83,3), root:(1273,701), state 0x0, keycode 133 (keysym 0xffeb, Super_L), same_screen YES, XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 39, synthetic NO, window 0x1200001, root 0x4f7, subw 0x0, time 246682, (83,3), root:(1273,701), state 0x40, keycode 37 (keysym 0xffe3, Control_L), same_screen YES, XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 39, synthetic NO, window 0x1200001, root 0x4f7, subw 0x0, time 246686, (83,3), root:(1273,701), state 0x44, keycode 93 (keysym 0x0, NoSymbol), same_screen YES, XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 39, synthetic NO, window 0x1200001, root 0x4f7, subw 0x0, time 246690, (83,3), root:(1273,701), state 0x44, keycode 93 (keysym 0x0, NoSymbol), same_screen YES, XLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 39, synthetic NO, window 0x1200001, root 0x4f7, subw 0x0, time 246696, (83,3), root:(1273,701), state 0x44, keycode 37 (keysym 0xffe3, Control_L), same_screen YES, XLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 39, synthetic NO, window 0x1200001, root 0x4f7, subw 0x0, time 246703, (83,3), root:(1273,701), state 0x40, keycode 133 (keysym 0xffeb, Super_L), same_screen YES, XLookupString gives 0 bytes:
XFilterEvent returns: False
With the shortcut active, xev on wayland shows this (and the shortcut works):
KeyPress event, serial 39, synthetic NO, window 0x1200001, root 0x4f7, subw 0x0, time 365034, (83,3), root:(1273,701), state 0x0, keycode 133 (keysym 0xffeb, Super_L), same_screen YES, XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 39, synthetic NO, window 0x1200001, root 0x4f7, subw 0x0, time 365036, (83,3), root:(1273,701), state 0x40, keycode 37 (keysym 0xffe3, Control_L), same_screen YES, XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 39, synthetic NO, window 0x1200001, root 0x4f7, subw 0x0, time 365060, (83,3), root:(1273,701), state 0x44, keycode 37 (keysym 0xffe3, Control_L), same_screen YES, XLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 39, synthetic NO, window 0x1200001, root 0x4f7, subw 0x0, time 365060, (83,3), root:(1273,701), state 0x40, keycode 133 (keysym 0xffeb, Super_L), same_screen YES, XLookupString gives 0 bytes:
XFilterEvent returns: False
Quoted 50 lines
Because that is not working on Wayland on my laptop with the same issue (after disabling the hwdb mapping) and I don't understand how that could work at all given that
/usr/share/X11/xkb/keycodes/evdevhas no mapping for EV keycode 85 (93 in that file) ?Quoted 1 line
Also: Other DEs don't have this binding.
Yes that is an issue, but see below.
Quoted 17 lines
Quoted 17 lines
*) 85 + 8 all codes there are shifted up 8 compared to the
KEY_FOOdefines because codes 0-7 are reserved for modifier.I hit the same issue years ago on "T-boa Tbook air" laptop and their I fixed this by mapping Hangaku/Zenkaku -> f21 in
/lib/udev/hwdb.d/60-keyboard.hwdb:###########################################################
# T-bao
###########################################################evdev:atkbd:dmi:bvn*:bvr*:bd*:svnT-bao:pnTbookair:*
KEYBOARD_KEY_76=f21 # Touchpad toggle+ teaching GNOME to also accept Ctrl + Super + XF86TouchpadToggle as touchpad-toggle:
Quoted 6 lines
Yeah KDE would need a similar fix and other DEs probably too. I hoped for a generic fix that does not need adjustments in so many projects.
My first try was to do it on the XKB level but on Wayland the RedirectKey action is not implemented https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/merge_requests/794#note_2803713 (and probably wont be even in the future https://github.com/xkbcommon/libxkbcommon/issues/18#issuecomment-72728366) so I can't "unpress" control and super.
If it is a more general issue, why not fix it on a more general level in the kernel? Maybe a generic filter applyable via a command line quirk and/or a quirk list?
The problem is that filtering keys with modifiers like you are doing here just does not work.
Your filter is seriously messing with the timing of the keypresses which can be a real issue when not actually using the toggle touchpad hotkey.
Lets say the user is playing a game and has mapped super to one of the fire buttons and is using an in game weapon with some sort of auto-repeat firing.
And your seqpos variable likely is 0 when super gets pressed, now the keyboard sends
0xe0,0x5bwhich your filter filters out, and the user keeps super pressed because they expect the weapon to start firing on auto-repeat. But the super press is never send until super is released or another key is pressed so things don't work.
Quoted 8 lines
Likewise if the DE, an app or accessibility settings want to differentiate between a short and a long super press all presses now become super (pun not intended) short because you insert the press directly in front of the release, losing any timing information about how long the key was pressed.
This is why using an i8042 filter for filtering key-combinations (and the EC emulates a key-combination here) can never work reliably.
Ok, thought I had a clean solution, but doesn't seems so xD.
Quoted 7 lines
OTOH desktop environments already allow having Ctrl+Super+something keybindings for DE actions. So we can re-use the tried and trusted modifier handling in the DE to deal with combi part leaving just the issue of mapping PS/2 scancode
0x76aka evdev code 85 /KEY_ZENKAKUHANKAKUto something usable by the DE.
Quoted 8 lines
ATM both GNOME and KDE already have support for Ctrl+Super+something for touchpad-toggle except that KDE expects a "
Zenkaku_Hankaku" keysym where as GNOME expects "XF86TouchpadToggle" arguably the GNOME solution is slightly better because Japanese keyboard layouts already use/send the "Zenkaku_Hankaku" keysym unrelated to touchpad-toggle use. And I don't know what happens when pressing ctrl+super+Zenkaku_Hankaku while using a Japanese layout.
When I interpret the xkb-config correctly, JIS keyboards use the tilde scancode/keycode for the physical zenkaku/hankaku keys, at least in the default config HZTG (henkaku/zankaku toggle) is aliased to TLDE
Quoted 7 lines
I think maybe we just need to patch
atkbd.cat the kernel to map scancode0x76->KEY_TOUCHPAD_TOGGLEsince normal PS/2 keyboards never generate0x76, this would lose the mapping toKEY_ZENKAKUHANKAKUbut since/usr/share/X11/xkb/keycodes/evdevdoes not even mapKEY_ZENKAKUHANKAKUI don't think loosing that mapping will do a big deal.
At least from kernel side this would be a very small patch, are there any objections to it?
If not I make a patch for it and create a KDE issue.
Quoted 10 lines
So I think that going with the evdev mapping + teaching KDE that Ctrl+Super+XF86TouchpadToggle is just XF86TouchpadToggle is the best way forward to solve this once and for all.
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
It suppresses the reserved scancode produced by pressing the FN-key on its own, which fixes a warning spamming the dmesg log otherwise.
Can you not also suppress this by mapping the key to "unknown" in hwdb?
Maybe, I didn't try. Was convenient to just do it here since I already had the filter. Will look into it once it is decided what to do with the touchpad toggle issue.
Please give using hwdb for this a try.
kk will do later
Best regards,
Werner
Quoted 6 lines
Regards,
Hans
Re: [PATCH v2 2/2] Input: atkbd - Fix TUXEDO NB02 notebook keyboards FN-keys
Hi Werner,
Quoted 103 lines · Werner Sembach
Hi Hans,
Am 05.03.25 um 15:18 schrieb Hans de Goede:
Quoted 25 lines
Hi Werner,
Quoted 22 lines · Werner Sembach
Am 05.03.25 um 12:25 schrieb Hans de Goede:
Quoted 21 lines
Hi Werner,
Quoted 6 lines · Werner Sembach
This small driver does 2 things:
It remaps the touchpad toggle key from Control + Super + Hangaku/Zenkaku to F21 to conform with established userspace defaults. Note that the Hangaku/Zenkaku scancode used here is usually unused, with real Hangaku/Zenkaku keys using the tilde scancode.
So this control + super + scancode
0x76sending is also seen on quite a few other laptops and I think we need a generic fix for this.I recently noticed that KDE's keyboard-shortcut settings actually has a control + super + Hangaku/Zenkaku -> touchpad-toggle key binding in its default bindings (IIRC). But that cannot work because xkb actually has no mapping for evdev code 85 /
KEY_ZENKAKUHANKAKUif you look in:
/usr/share/X11/xkb/keycodes/evdevand then look for 93 (*) you will find no mapping. I think this KDE default binding may be from a long time ago when this did work. Or maybe KDE uses the FOO part ofKEY_FOOas symbolic when there is no xkb mapping ?Quoted 7 lines
Quoted 1 line
It does not work on X11, but it does work on Wayland (there xev also sees the Zenkaku/Hankaku keypress). Don't ask me why.
Interesting, so in xev under Wayland you see something like this on release:
state
0x0, keycode 38 (keysym0x61, a),same_screenYES,With there actually being a keysym of "
Zenkaku_Hankaku" there ?No. Sorry I got it a little bit wrong above, I didn't know it exactly anymore and had to retest:
With the keyboard shortcut deactivated, xev on wayland shows this:
KeyPress event, serial 39, synthetic NO, window
0x1200001, root0x4f7, subw0x0, time 246681, (83,3), root:(1273,701), state0x0, keycode 133 (keysym0xffeb,Super_L),same_screenYES, XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: FalseKeyPress event, serial 39, synthetic NO, window
0x1200001, root0x4f7, subw0x0, time 246682, (83,3), root:(1273,701), state0x40, keycode 37 (keysym0xffe3,Control_L),same_screenYES, XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: FalseKeyPress event, serial 39, synthetic NO, window
0x1200001, root0x4f7, subw0x0, time 246686, (83,3), root:(1273,701), state0x44, keycode 93 (keysym0x0, NoSymbol),same_screenYES, XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: FalseKeyRelease event, serial 39, synthetic NO, window
0x1200001, root0x4f7, subw0x0, time 246690, (83,3), root:(1273,701), state0x44, keycode 93 (keysym0x0, NoSymbol),same_screenYES, XLookupString gives 0 bytes:
XFilterEvent returns: FalseKeyRelease event, serial 39, synthetic NO, window
0x1200001, root0x4f7, subw0x0, time 246696, (83,3), root:(1273,701), state0x44, keycode 37 (keysym0xffe3,Control_L),same_screenYES, XLookupString gives 0 bytes:
XFilterEvent returns: FalseKeyRelease event, serial 39, synthetic NO, window
0x1200001, root0x4f7, subw0x0, time 246703, (83,3), root:(1273,701), state0x40, keycode 133 (keysym0xffeb,Super_L),same_screenYES, XLookupString gives 0 bytes:
XFilterEvent returns: FalseWith the shortcut active, xev on wayland shows this (and the shortcut works):
KeyPress event, serial 39, synthetic NO, window
0x1200001, root0x4f7, subw0x0, time 365034, (83,3), root:(1273,701), state0x0, keycode 133 (keysym0xffeb,Super_L),same_screenYES, XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: FalseKeyPress event, serial 39, synthetic NO, window
0x1200001, root0x4f7, subw0x0, time 365036, (83,3), root:(1273,701), state0x40, keycode 37 (keysym0xffe3,Control_L),same_screenYES, XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: FalseKeyRelease event, serial 39, synthetic NO, window
0x1200001, root0x4f7, subw0x0, time 365060, (83,3), root:(1273,701), state0x44, keycode 37 (keysym0xffe3,Control_L),same_screenYES, XLookupString gives 0 bytes:
XFilterEvent returns: False
Quoted 5 lines
KeyRelease event, serial 39, synthetic NO, window
0x1200001, root0x4f7, subw0x0, time 365060, (83,3), root:(1273,701), state0x40, keycode 133 (keysym0xffeb,Super_L),same_screenYES, XLookupString gives 0 bytes:
XFilterEvent returns: False
Ah ok, so in KDE the shortcut somehow works under Wayland despite the lack of xkb keysym mapping (maybe match on keycode?) and then the compositor absorbs / eats the Zenkaku_Hankaku key-press + release as it does with other compositor handled hotkeys leaving apps like xev to just see the modifier press/release events (which the compositor cannot delay / filter for the same reasons as why an i8042 kbd filter won't work).
Quoted 55 lines
Quoted 55 lines
Because that is not working on Wayland on my laptop with the same issue (after disabling the hwdb mapping) and I don't understand how that could work at all given that
/usr/share/X11/xkb/keycodes/evdevhas no mapping for EV keycode 85 (93 in that file) ?Quoted 1 line
Also: Other DEs don't have this binding.
Yes that is an issue, but see below.
Quoted 17 lines
Quoted 17 lines
*) 85 + 8 all codes there are shifted up 8 compared to the
KEY_FOOdefines because codes 0-7 are reserved for modifier.I hit the same issue years ago on "T-boa Tbook air" laptop and their I fixed this by mapping Hangaku/Zenkaku -> f21 in
/lib/udev/hwdb.d/60-keyboard.hwdb:###########################################################
# T-bao
###########################################################evdev:atkbd:dmi:bvn*:bvr*:bd*:svnT-bao:pnTbookair:* KEYBOARD_KEY_76=f21 # Touchpad toggle
+ teaching GNOME to also accept Ctrl + Super + XF86TouchpadToggle as touchpad-toggle:
Quoted 6 lines
Yeah KDE would need a similar fix and other DEs probably too. I hoped for a generic fix that does not need adjustments in so many projects.
My first try was to do it on the XKB level but on Wayland the RedirectKey action is not implemented https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/merge_requests/794#note_2803713 (and probably wont be even in the future https://github.com/xkbcommon/libxkbcommon/issues/18#issuecomment-72728366) so I can't "unpress" control and super.
If it is a more general issue, why not fix it on a more general level in the kernel? Maybe a generic filter applyable via a command line quirk and/or a quirk list?
The problem is that filtering keys with modifiers like you are doing here just does not work.
Your filter is seriously messing with the timing of the keypresses which can be a real issue when not actually using the toggle touchpad hotkey.
Lets say the user is playing a game and has mapped super to one of the fire buttons and is using an in game weapon with some sort of auto-repeat firing.
And your seqpos variable likely is 0 when super gets pressed, now the keyboard sends
0xe0,0x5bwhich your filter filters out, and the user keeps super pressed because they expect the weapon to start firing on auto-repeat. But the super press is never send until super is released or another key is pressed so things don't work.Likewise if the DE, an app or accessibility settings want to differentiate between a short and a long super press all presses now become super (pun not intended) short because you insert the press directly in front of the release, losing any timing information about how long the key was pressed.
Quoted 3 lines
Quoted 2 lines
This is why using an i8042 filter for filtering key-combinations (and the EC emulates a key-combination here) can never work reliably.
Ok, thought I had a clean solution, but doesn't seems so xD.
Yeah these single key which the EC makes send a whole key sequence EC level key-bindings are a pain to deal with. Some for some other keys emulating Windows hotkey presses like "Super + P", but those are simply send unmodified to the DE to let the DE deal with them.
Sending these unmodified to the DE pretty much is the only thing we can do.
Quoted 14 lines
Quoted 6 lines
OTOH desktop environments already allow having Ctrl+Super+something keybindings for DE actions. So we can re-use the tried and trusted modifier handling in the DE to deal with combi part leaving just the issue of mapping PS/2 scancode
0x76aka evdev code 85 /KEY_ZENKAKUHANKAKUto something usable by the DE.Quoted 8 lines
ATM both GNOME and KDE already have support for Ctrl+Super+something for touchpad-toggle except that KDE expects a "
Zenkaku_Hankaku" keysym where as GNOME expects "XF86TouchpadToggle" arguably the GNOME solution is slightly better because Japanese keyboard layouts already use/send the "Zenkaku_Hankaku" keysym unrelated to touchpad-toggle use. And I don't know what happens when pressing ctrl+super+Zenkaku_Hankaku while using a Japanese layout.
Quoted 1 line
When I interpret the xkb-config correctly, JIS keyboards use the tilde scancode/keycode for the physical zenkaku/hankaku keys, at least in the default config HZTG (henkaku/zankaku toggle) is aliased to TLDE
Yes I don't think the 0x76 ps/2 scancode is used on any actual keyboards other then for this toggle touchpad key thing.
Quoted 8 lines
Quoted 6 lines
I think maybe we just need to patch
atkbd.cat the kernel to map scancode0x76->KEY_TOUCHPAD_TOGGLEsince normal PS/2 keyboards never generate0x76, this would lose the mapping toKEY_ZENKAKUHANKAKUbut since/usr/share/X11/xkb/keycodes/evdevdoes not even mapKEY_ZENKAKUHANKAKUI don't think loosing that mapping will do a big deal.At least from kernel side this would be a very small patch, are there any objections to it?
Well it would break the currently working touchpad toggle in KDE, but the same applies to doing the mapping in hwdb.
I think it would be best to just post the patch + create a KDE issue and then see from there.
Regards,
Hans
Werner Sembach
maintainerRe: [PATCH v2 2/2] Input: atkbd - Fix TUXEDO NB02 notebook keyboards FN-keys
Hi Hans,
Am 06.03.25 um 15:46 schrieb Hans de Goede:
Quoted 208 lines
Hi Werner,
Quoted 102 lines · Werner Sembach
Hi Hans,
Am 05.03.25 um 15:18 schrieb Hans de Goede:
Quoted 25 lines
Hi Werner,
Quoted 22 lines · Werner Sembach
Am 05.03.25 um 12:25 schrieb Hans de Goede:
Quoted 21 lines
Hi Werner,
Quoted 6 lines · Werner Sembach
This small driver does 2 things:
It remaps the touchpad toggle key from Control + Super + Hangaku/Zenkaku to F21 to conform with established userspace defaults. Note that the Hangaku/Zenkaku scancode used here is usually unused, with real Hangaku/Zenkaku keys using the tilde scancode.
So this control + super + scancode
0x76sending is also seen on quite a few other laptops and I think we need a generic fix for this.I recently noticed that KDE's keyboard-shortcut settings actually has a control + super + Hangaku/Zenkaku -> touchpad-toggle key binding in its default bindings (IIRC). But that cannot work because xkb actually has no mapping for evdev code 85 /
KEY_ZENKAKUHANKAKUif you look in:
/usr/share/X11/xkb/keycodes/evdevand then look for 93 (*) you will find no mapping. I think this KDE default binding may be from a long time ago when this did work. Or maybe KDE uses the FOO part ofKEY_FOOas symbolic when there is no xkb mapping ?Quoted 7 lines
Quoted 1 line
It does not work on X11, but it does work on Wayland (there xev also sees the Zenkaku/Hankaku keypress). Don't ask me why.
Interesting, so in xev under Wayland you see something like this on release:
state
0x0, keycode 38 (keysym0x61, a),same_screenYES,With there actually being a keysym of "
Zenkaku_Hankaku" there ?No. Sorry I got it a little bit wrong above, I didn't know it exactly anymore and had to retest:
With the keyboard shortcut deactivated, xev on wayland shows this:
KeyPress event, serial 39, synthetic NO, window
0x1200001,
root0x4f7, subw0x0, time 246681, (83,3), root:(1273,701), state0x0, keycode 133 (keysym0xffeb,Super_L),same_screenYES, XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: FalseKeyPress event, serial 39, synthetic NO, window
0x1200001,
root0x4f7, subw0x0, time 246682, (83,3), root:(1273,701), state0x40, keycode 37 (keysym0xffe3,Control_L),same_screenYES, XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: FalseKeyPress event, serial 39, synthetic NO, window
0x1200001,
root0x4f7, subw0x0, time 246686, (83,3), root:(1273,701), state0x44, keycode 93 (keysym0x0, NoSymbol),same_screenYES, XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: FalseKeyRelease event, serial 39, synthetic NO, window
0x1200001,
root0x4f7, subw0x0, time 246690, (83,3), root:(1273,701), state0x44, keycode 93 (keysym0x0, NoSymbol),same_screenYES, XLookupString gives 0 bytes:
XFilterEvent returns: FalseKeyRelease event, serial 39, synthetic NO, window
0x1200001,
root0x4f7, subw0x0, time 246696, (83,3), root:(1273,701), state0x44, keycode 37 (keysym0xffe3,Control_L),same_screenYES, XLookupString gives 0 bytes:
XFilterEvent returns: FalseKeyRelease event, serial 39, synthetic NO, window
0x1200001,
root0x4f7, subw0x0, time 246703, (83,3), root:(1273,701), state0x40, keycode 133 (keysym0xffeb,Super_L),same_screenYES, XLookupString gives 0 bytes:
XFilterEvent returns: FalseWith the shortcut active, xev on wayland shows this (and the shortcut works):
KeyPress event, serial 39, synthetic NO, window
0x1200001,
root0x4f7, subw0x0, time 365034, (83,3), root:(1273,701), state0x0, keycode 133 (keysym0xffeb,Super_L),same_screenYES, XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: FalseKeyPress event, serial 39, synthetic NO, window
0x1200001,
root0x4f7, subw0x0, time 365036, (83,3), root:(1273,701), state0x40, keycode 37 (keysym0xffe3,Control_L),same_screenYES, XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: FalseKeyRelease event, serial 39, synthetic NO, window
0x1200001,
root0x4f7, subw0x0, time 365060, (83,3), root:(1273,701), state0x44, keycode 37 (keysym0xffe3,Control_L),same_screenYES, XLookupString gives 0 bytes:
XFilterEvent returns: FalseQuoted 5 lines
KeyRelease event, serial 39, synthetic NO, window
0x1200001,
root0x4f7, subw0x0, time 365060, (83,3), root:(1273,701), state0x40, keycode 133 (keysym0xffeb,Super_L),same_screenYES, XLookupString gives 0 bytes:
XFilterEvent returns: FalseAh ok, so in KDE the shortcut somehow works under Wayland despite the lack of xkb keysym mapping (maybe match on keycode?) and then the compositor absorbs / eats the
Zenkaku_Hankakukey-press + release as it does with other compositor handled hotkeys leaving apps like xev to just see the modifier press/release events (which the compositor cannot delay / filter for the same reasons as why an i8042 kbd filter won't work).Quoted 55 lines
Quoted 55 lines
Because that is not working on Wayland on my laptop with the same issue (after disabling the hwdb mapping) and I don't understand how that could work at all given that
/usr/share/X11/xkb/keycodes/evdevhas no mapping for EV keycode 85 (93 in that file) ?Quoted 1 line
Also: Other DEs don't have this binding.
Yes that is an issue, but see below.
Quoted 17 lines
Quoted 17 lines
*) 85 + 8 all codes there are shifted up 8 compared to the
KEY_FOOdefines because codes 0-7 are reserved for modifier.I hit the same issue years ago on "T-boa Tbook air" laptop and their I fixed this by mapping Hangaku/Zenkaku -> f21 in
/lib/udev/hwdb.d/60-keyboard.hwdb:###########################################################
# T-bao
###########################################################evdev:atkbd:dmi:bvn*:bvr*:bd*:svnT-bao:pnTbookair:*
KEYBOARD_KEY_76=f21 # Touchpad toggle+ teaching GNOME to also accept Ctrl + Super + XF86TouchpadToggle as touchpad-toggle:
Quoted 6 lines
Yeah KDE would need a similar fix and other DEs probably too. I hoped for a generic fix that does not need adjustments in so many projects.
My first try was to do it on the XKB level but on Wayland the RedirectKey action is not implemented https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/merge_requests/794#note_2803713 (and probably wont be even in the future https://github.com/xkbcommon/libxkbcommon/issues/18#issuecomment-72728366) so I can't "unpress" control and super.
If it is a more general issue, why not fix it on a more general level in the kernel? Maybe a generic filter applyable via a command line quirk and/or a quirk list?
The problem is that filtering keys with modifiers like you are doing here just does not work.
Your filter is seriously messing with the timing of the keypresses which can be a real issue when not actually using the toggle touchpad hotkey.
Lets say the user is playing a game and has mapped super to one of the fire buttons and is using an in game weapon with some sort of auto-repeat firing.
And your seqpos variable likely is 0 when super gets pressed, now the keyboard sends
0xe0,0x5bwhich your filter filters out, and the user keeps super pressed because they expect the weapon to start firing on auto-repeat. But the super press is never send until super is released or another key is pressed so things don't work.Likewise if the DE, an app or accessibility settings want to differentiate between a short and a long super press all presses now become super (pun not intended) short because you insert the press directly in front of the release, losing any timing information about how long the key was pressed.
Quoted 3 lines
Quoted 2 lines
This is why using an i8042 filter for filtering key-combinations (and the EC emulates a key-combination here) can never work reliably.
Ok, thought I had a clean solution, but doesn't seems so xD.
Yeah these single key which the EC makes send a whole key sequence EC level key-bindings are a pain to deal with. Some for some other keys emulating Windows hotkey presses like "Super + P", but those are simply send unmodified to the DE to let the DE deal with them.
Sending these unmodified to the DE pretty much is the only thing we can do.
Quoted 14 lines
Quoted 6 lines
OTOH desktop environments already allow having Ctrl+Super+something keybindings for DE actions. So we can re-use the tried and trusted modifier handling in the DE to deal with combi part leaving just the issue of mapping PS/2 scancode
0x76aka evdev code 85 /KEY_ZENKAKUHANKAKUto something usable by the DE.Quoted 8 lines
ATM both GNOME and KDE already have support for Ctrl+Super+something for touchpad-toggle except that KDE expects a "
Zenkaku_Hankaku" keysym where as GNOME expects "XF86TouchpadToggle" arguably the GNOME solution is slightly better because Japanese keyboard layouts already use/send the "Zenkaku_Hankaku" keysym unrelated to touchpad-toggle use. And I don't know what happens when pressing ctrl+super+Zenkaku_Hankaku while using a Japanese layout.Quoted 1 line
When I interpret the xkb-config correctly, JIS keyboards use the tilde scancode/keycode for the physical zenkaku/hankaku keys, at least in the default config HZTG (henkaku/zankaku toggle) is aliased to TLDE
Yes I don't think the
0x76ps/2 scancode is used on any actual keyboards other then for this toggle touchpad key thing.Quoted 6 lines
Quoted 6 lines
I think maybe we just need to patch
atkbd.cat the kernel to map scancode0x76->KEY_TOUCHPAD_TOGGLEsince normal PS/2 keyboards never generate0x76, this would lose the mapping toKEY_ZENKAKUHANKAKUbut since/usr/share/X11/xkb/keycodes/evdevdoes not even mapKEY_ZENKAKUHANKAKUI don't think loosing that mapping will do a big deal.
Quoted 3 lines
Quoted 1 line
At least from kernel side this would be a very small patch, are there any objections to it?
Well it would break the currently working touchpad toggle in KDE, but the same applies to doing the mapping in hwdb.
So I looked into KDE: They use whatever Qt is doing: https://invent.kde.org/plasma/kwin/-/blob/be91df80ef44386f98a831a5f4dfdfd4a3b6e83e/src/plugins/touchpadshortcuts/touchpadshortcuts.cpp#L41
After thinking about it a little bit: If we need to touch multiple userspace projects anyway, I tend to not touch the kernel at all. After all: From kernel side the key is mapped in a way that both X11 and Wayland can see it (given the right xkeyboard-config).
Thought dump below for userspace only solutions:
- Map KEY_ZENKAKUHANKAKU to XF86TouchpadToggle using xkeyboard-config
- Add Qt::ControlModifier | Qt::MetaModifier | Qt::Key_TouchpadToggle to KDE
- Possible regression: If user updates xkb without updating KDE the formerly working shortcut stops working
or
- Map KEY_ZENKAKUHANKAKU to Zenkaku_Hankaku using xkeyboard-config
- See if that fixes the X11 binding of KDE
- Add Control + Super + Zenkaku_Hankaku to GNOME
- If user updates xkb without updating GNOME the formerly working shortcut stops working
- Possible regression: I tend to the first version as there might be at least a change that other DEs work out of the box with it.
Best regards,
Werner
Quoted 9 lines
I think it would be best to just post the patch + create a KDE issue and then see from there.
Regards,
Hans
Werner Sembach
maintainerRe: [PATCH v2 2/2] Input: atkbd - Fix TUXEDO NB02 notebook keyboards FN-keys
In reply to Hans de GoedeHi Hans,
Am 05.03.25 um 15:18 schrieb Hans de Goede:
Quoted 82 lines
Hi Werner,
Quoted 18 lines · Werner Sembach
Am 05.03.25 um 12:25 schrieb Hans de Goede:
Quoted 17 lines
Hi Werner,
Quoted 6 lines · Werner Sembach
This small driver does 2 things:
It remaps the touchpad toggle key from Control + Super + Hangaku/Zenkaku to F21 to conform with established userspace defaults. Note that the Hangaku/Zenkaku scancode used here is usually unused, with real Hangaku/Zenkaku keys using the tilde scancode.
So this control + super + scancode
0x76sending is also seen on quite a few other laptops and I think we need a generic fix for this.I recently noticed that KDE's keyboard-shortcut settings actually has a control + super + Hangaku/Zenkaku -> touchpad-toggle key binding in its default bindings (IIRC). But that cannot work because xkb actually has no mapping for evdev code 85 /
KEY_ZENKAKUHANKAKUif you look in:Quoted 5 lines
Quoted 4 lines
/usr/share/X11/xkb/keycodes/evdevand then look for 93 (*) you will find no mapping. I think this KDE default binding may be from a long time ago when this did work. Or maybe KDE uses the FOO part ofKEY_FOOas symbolic when there is no xkb mapping ?It does not work on X11, but it does work on Wayland (there xev also sees the Zenkaku/Hankaku keypress). Don't ask me why.
Interesting, so in xev under Wayland you see something like this on release:
state 0x0, keycode 38 (keysym 0x61, a), same_screen YES,With there actually being a keysym of "
Zenkaku_Hankaku" there ?Because that is not working on Wayland on my laptop with the same issue (after disabling the hwdb mapping) and I don't understand how that could work at all given that
/usr/share/X11/xkb/keycodes/evdevhas no mapping for EV keycode 85 (93 in that file) ?Quoted 1 line
Also: Other DEs don't have this binding.
Yes that is an issue, but see below.
Quoted 17 lines
Quoted 17 lines
*) 85 + 8 all codes there are shifted up 8 compared to the
KEY_FOOdefines because codes 0-7 are reserved for modifier.I hit the same issue years ago on "T-boa Tbook air" laptop and their I fixed this by mapping Hangaku/Zenkaku -> f21 in
/lib/udev/hwdb.d/60-keyboard.hwdb:###########################################################
# T-bao
###########################################################evdev:atkbd:dmi:bvn*:bvr*:bd*:svnT-bao:pnTbookair:*
KEYBOARD_KEY_76=f21 # Touchpad toggle+ teaching GNOME to also accept Ctrl + Super + XF86TouchpadToggle as touchpad-toggle:
Quoted 6 lines
Yeah KDE would need a similar fix and other DEs probably too. I hoped for a generic fix that does not need adjustments in so many projects.
My first try was to do it on the XKB level but on Wayland the RedirectKey action is not implemented https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/merge_requests/794#note_2803713 (and probably wont be even in the future https://github.com/xkbcommon/libxkbcommon/issues/18#issuecomment-72728366) so I can't "unpress" control and super.
If it is a more general issue, why not fix it on a more general level in the kernel? Maybe a generic filter applyable via a command line quirk and/or a quirk list?
The problem is that filtering keys with modifiers like you are doing here just does not work.
Your filter is seriously messing with the timing of the keypresses which can be a real issue when not actually using the toggle touchpad hotkey.
Lets say the user is playing a game and has mapped super to one of the fire buttons and is using an in game weapon with some sort of auto-repeat firing.
And your seqpos variable likely is 0 when super gets pressed, now the keyboard sends
0xe0,0x5bwhich your filter filters out, and the user keeps super pressed because they expect the weapon to start firing on auto-repeat. But the super press is never send until super is released or another key is pressed so things don't work.
Quoted 8 lines
Likewise if the DE, an app or accessibility settings want to differentiate between a short and a long super press all presses now become super (pun not intended) short because you insert the press directly in front of the release, losing any timing information about how long the key was pressed.
This is why using an i8042 filter for filtering key-combinations (and the EC emulates a key-combination here) can never work reliably.
I just had an idea how this filter could work without running into these issues:
Still listen to the whole key sequence and just suppress the 0x76 and 0xf6. Then after the sequence has finished issue a F21 keypress.
Would this fly?
Best regards,
Werner
Quoted 38 lines
OTOH desktop environments already allow having Ctrl+Super+something keybindings for DE actions. So we can re-use the tried and trusted modifier handling in the DE to deal with combi part leaving just the issue of mapping PS/2 scancode
0x76aka evdev code 85 /KEY_ZENKAKUHANKAKUto something usable by the DE.ATM both GNOME and KDE already have support for Ctrl+Super+something for touchpad-toggle except that KDE expects a "
Zenkaku_Hankaku" keysym where as GNOME expects "XF86TouchpadToggle" arguably the GNOME solution is slightly better because Japanese keyboard layouts already use/send the "Zenkaku_Hankaku" keysym unrelated to touchpad-toggle use. And I don't know what happens when pressing ctrl+super+Zenkaku_Hankaku while using a Japanese layout.I think maybe we just need to patch
atkbd.cat the kernel to map scancode0x76->KEY_TOUCHPAD_TOGGLEsince normal PS/2 keyboards never generate0x76, this would lose the mapping toKEY_ZENKAKUHANKAKUbut since/usr/share/X11/xkb/keycodes/evdevdoes not even mapKEY_ZENKAKUHANKAKUI don't think loosing that mapping will do a big deal.So I think that going with the evdev mapping + teaching KDE that Ctrl+Super+XF86TouchpadToggle is just XF86TouchpadToggle is the best way forward to solve this once and for all.
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
It suppresses the reserved scancode produced by pressing the FN-key on its own, which fixes a warning spamming the dmesg log otherwise.
Can you not also suppress this by mapping the key to "unknown" in hwdb?
Maybe, I didn't try. Was convenient to just do it here since I already had the filter. Will look into it once it is decided what to do with the touchpad toggle issue.
Please give using hwdb for this a try.
Regards,
Hans
Werner Sembach
maintainerRe: [PATCH v2 2/2] Input: atkbd - Fix TUXEDO NB02 notebook keyboards FN-keys
In reply to Hans de GoedeAm 05.03.25 um 12:25 schrieb Hans de Goede:
Quoted 65 lines
Hi Werner,
Quoted 6 lines · Werner Sembach
This small driver does 2 things:
It remaps the touchpad toggle key from Control + Super + Hangaku/Zenkaku to F21 to conform with established userspace defaults. Note that the Hangaku/Zenkaku scancode used here is usually unused, with real Hangaku/Zenkaku keys using the tilde scancode.
So this control + super + scancode
0x76sending is also seen on quite a few other laptops and I think we need a generic fix for this.I recently noticed that KDE's keyboard-shortcut settings actually has a control + super + Hangaku/Zenkaku -> touchpad-toggle key binding in its default bindings (IIRC). But that cannot work because xkb actually has no mapping for evdev code 85 /
KEY_ZENKAKUHANKAKUif you look in:
/usr/share/X11/xkb/keycodes/evdevand then look for 93 (*) you will find no mapping. I think this KDE default binding may be from a long time ago when this did work. Or maybe KDE uses the FOO part ofKEY_FOOas symbolic when there is no xkb mapping ?*) 85 + 8 all codes there are shifted up 8 compared to the
KEY_FOOdefines because codes 0-7 are reserved for modifier.I hit the same issue years ago on "T-boa Tbook air" laptop and their I fixed this by mapping Hangaku/Zenkaku -> f21 in
/lib/udev/hwdb.d/60-keyboard.hwdb:###########################################################
# T-bao
###########################################################evdev:atkbd:dmi:bvn*:bvr*:bd*:svnT-bao:pnTbookair:*
KEYBOARD_KEY_76=f21 # Touchpad toggle+ teaching GNOME to also accept Ctrl + Super + XF86TouchpadToggle as touchpad-toggle:
Notice that system76 has the same hwdb key mapping for their Pangolin 12 model which I presume also has something like e.g. a clevo as base model.
So for now to fix the touchpad on this TUXEDO NB02 you should simply add a hwdb entry like the above entries.
Longer term I think the right fix for the touchpad toggle for all laptops which do this would be to make GNOME do what KDE does and change the touchpad-toggle-static keybinding list which currently is:
['XF86TouchpadToggle', '<Ctrl><Super>XF86TouchpadToggle']
to:
['XF86TouchpadToggle', '<Ctrl><Super>XF86TouchpadToggle', '<Ctrl><Super>"Something"']
Where "Something" would then be the new mapping. Or maybe just teach atkbd or xkb or hwdb to map scancode
0x76to TouchpadToggle by default then at least in GNOME this will work OOTB and for KDE a default binding of '<Ctrl><Super>XF86TouchpadToggle'] -> touchpad-toggle should probably be added there.
Quoted 3 lines
Quoted 2 lines
It suppresses the reserved scancode produced by pressing the FN-key on its own, which fixes a warning spamming the dmesg log otherwise.
Can you not also suppress this by mapping the key to "unknown" in hwdb?
Coming back to this: this doesn't work because hwdb handles keycodes, but the message in dmesg is produces because the scancode is not mapped to any keycode by default (it is mapped to 0 in atkbd.c).
Quoted 6 lines
Regards,
Hans
Dmitry Torokhov
maintainerHi Werner,
Quoted 2 lines · Werner Sembach
In the default xkeyboard-config used by both X11 and wayland touchpad toggle is assigned to F21.
We have dedicated KEY_TOUCHPAD_TOGGLE that is being used by several platform drivers:
dtor@dtor-ws:~/kernel/work $ git grep -l KEY_TOUCHPAD_TOGGLE -- drivers/platform/x86/drivers/platform/x86/acer-wmi.c drivers/platform/x86/asus-laptop.c drivers/platform/x86/asus-nb-wmi.c drivers/platform/x86/eeepc-wmi.c drivers/platform/x86/fujitsu-laptop.c drivers/platform/x86/ideapad-laptop.c drivers/platform/x86/msi-wmi.c drivers/platform/x86/toshiba_acpi.c
Instead of piling on F21 hacks we should be using it.
Quoted 4 lines
This patch is in preparation for i8042 filter patches to be able to remap bogus scancode(-combinations), produced by notebooks uppon pressing a touchpad toggle key.
Since you already creating a vendor-specific platform driver I think it would be better for it to register a separate input device and have it emit KEY_TOUCHPAD_TOGGLE instead of involving atkbd.
Quoted 23 lines
Signed-off-by Werner Sembach <[email protected]>Cc <[email protected]>--- drivers/input/keyboard/atkbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/input/keyboard/atkbd.c +1
-1@@ -88,7 +88,7 @@ static const unsigned short atkbd_set2_keycode[ATKBD_KEYMAP_SIZE] = {0 ,56 ,42 ,93 ,29 ,16 ,2 ,0 ,0 ,0 ,44 ,31 ,30 ,17 ,3 ,0 ,0 ,46 ,45 ,32 ,18 ,5 ,4 ,95 ,0 ,57 ,47 ,33 ,20 ,19 ,6 ,183 ,0 ,49 ,48 ,35 ,34 ,21 ,7 ,184 ,0 ,0 ,50 ,36 ,22 ,8 ,9 ,185 , -0 ,51 ,37 ,23 ,24 ,11 ,10 ,0 ,0 ,52 ,53 ,38 ,39 ,25 ,12 ,0 , +0 ,51 ,37 ,23 ,24 ,11 ,10 ,0 ,191 ,52 ,53 ,38 ,39 ,25 ,12 ,0 ,0 ,89 ,40 ,0 ,26 ,13 ,0 ,193 ,58 ,54 ,28 ,27 ,0 ,43 ,0 ,85 ,0 ,86 ,91 ,90 ,92 ,0 ,14 ,94 ,0 ,79 ,124 ,75 ,71 ,121 ,0 ,0 , 82, 83, 80, 76, 77, 72, 1, 69, 87, 78, 81, 74, 55, 73, 70, 99,Signature · 1 line
2.43.0
Thanks.
Signature · 1 line
Dmitry
Werner Sembach
maintainerHi Dmitry,
Am 05.03.25 um 07:54 schrieb Dmitry Torokhov:
Quoted 19 lines
Hi Werner,
Quoted 2 lines · Werner Sembach
In the default xkeyboard-config used by both X11 and wayland touchpad toggle is assigned to F21.
We have dedicated
KEY_TOUCHPAD_TOGGLEthat is being used by several platform drivers:dtor@dtor-ws:~/kernel/work $ git grep -l
KEY_TOUCHPAD_TOGGLE--drivers/platform/x86/drivers/platform/x86/acer-wmi.cdrivers/platform/x86/asus-laptop.cdrivers/platform/x86/asus-nb-wmi.cdrivers/platform/x86/eeepc-wmi.cdrivers/platform/x86/fujitsu-laptop.cdrivers/platform/x86/ideapad-laptop.cdrivers/platform/x86/msi-wmi.cdrivers/platform/x86/toshiba_acpi.c
Quoted 1 line
Instead of piling on F21 hacks we should be using it.
Afaik KEY_TOUCHPAD_TOGGLE is not implemented in userspace, but a patch for xkeboard-configs could probably be enough to change that ... have to look into it.
Quoted 7 lines
Quoted 4 lines
This patch is in preparation for i8042 filter patches to be able to remap bogus scancode(-combinations), produced by notebooks uppon pressing a touchpad toggle key.
Since you already creating a vendor-specific platform driver I think it would be better for it to register a separate input device and have it emit
KEY_TOUCHPAD_TOGGLEinstead of involving atkbd.
Thought of that also, but since the scancode was unmapped and unused anyway I thought this could be a much simpler and therefore more elegant solution.
Learning question: What actually is the reason why F13-F24 are not fully mapped in the default config?
Best regards,
Werner
Quoted 25 lines
Quoted 23 lines
Signed-off-by Werner Sembach <[email protected]>Cc <[email protected]>--- drivers/input/keyboard/atkbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/input/keyboard/atkbd.c +1
-1@@ -88,7 +88,7 @@ static const unsigned short atkbd_set2_keycode[ATKBD_KEYMAP_SIZE] = {0 ,56 ,42 ,93 ,29 ,16 ,2 ,0 ,0 ,0 ,44 ,31 ,30 ,17 ,3 ,0 ,0 ,46 ,45 ,32 ,18 ,5 ,4 ,95 ,0 ,57 ,47 ,33 ,20 ,19 ,6 ,183 ,0 ,49 ,48 ,35 ,34 ,21 ,7 ,184 ,0 ,0 ,50 ,36 ,22 ,8 ,9 ,185 , -0 ,51 ,37 ,23 ,24 ,11 ,10 ,0 ,0 ,52 ,53 ,38 ,39 ,25 ,12 ,0 , +0 ,51 ,37 ,23 ,24 ,11 ,10 ,0 ,191 ,52 ,53 ,38 ,39 ,25 ,12 ,0 ,0 ,89 ,40 ,0 ,26 ,13 ,0 ,193 ,58 ,54 ,28 ,27 ,0 ,43 ,0 ,85 ,0 ,86 ,91 ,90 ,92 ,0 ,14 ,94 ,0 ,79 ,124 ,75 ,71 ,121 ,0 ,0 , 82, 83, 80, 76, 77, 72, 1, 69, 87, 78, 81, 74, 55, 73, 70, 99,Signature · 1 line
2.43.0Thanks.
Hi Werner,
Quoted 22 lines · Werner Sembach
Hi Dmitry,
Am 05.03.25 um 07:54 schrieb Dmitry Torokhov:
Quoted 19 lines
Hi Werner,
Quoted 2 lines · Werner Sembach
In the default xkeyboard-config used by both X11 and wayland touchpad toggle is assigned to F21.
We have dedicated
KEY_TOUCHPAD_TOGGLEthat is being used by several platform drivers:dtor@dtor-ws:~/kernel/work $ git grep -l
KEY_TOUCHPAD_TOGGLE--drivers/platform/x86/drivers/platform/x86/acer-wmi.cdrivers/platform/x86/asus-laptop.cdrivers/platform/x86/asus-nb-wmi.cdrivers/platform/x86/eeepc-wmi.cdrivers/platform/x86/fujitsu-laptop.cdrivers/platform/x86/ideapad-laptop.cdrivers/platform/x86/msi-wmi.cdrivers/platform/x86/toshiba_acpi.c
Quoted 2 lines
Quoted 1 line
Instead of piling on F21 hacks we should be using it.
Afaik
KEY_TOUCHPAD_TOGGLEis not implemented in userspace, but a patch for xkeboard-configs could probably be enough to change that ... have to look into it.
Quoting from the other reply in this thread I just send (our email crossed):
Werner, we were using F21 in the past because we could not use evdev keycodes >= 248 (256 - 8 modifier keys) because of Xorg limitations.
But recently the mapping of things like KEY_TOUCHPAD_TOGGLE / KEY_TOUCHPAD_ON / KEY_TOUCHPAD_OFF to F2x keys has been moved to xorg-x11-drv-libinput which gets the full range key-codes from libinput and can then do this mapping before passing the keys to the X-server.
So it is no longer necessary to use KEY_F21 and even in the past we used to do the mapping in udev / hwdb rules not in the kernel in the kernel we've always (with a few exceptions which are my fault) used KEY_TOUCHPAD_TOGGLE as that is the correct keycode.
Regards,
Hans
Hi,
Quoted 8 lines · Dmitry Torokhov
Hi Werner,
Quoted 2 lines · Werner Sembach
In the default xkeyboard-config used by both X11 and wayland touchpad toggle is assigned to F21.
We have dedicated
KEY_TOUCHPAD_TOGGLEthat is being used by several platform drivers:
Ah right that is a good point.
Werner, we were using F21 in the past because we could not use evdev keycodes >= 248 (256 - 8 modifier keys) because of Xorg limitations.
But recently the mapping of things like KEY_TOUCHPAD_TOGGLE / KEY_TOUCHPAD_ON / KEY_TOUCHPAD_OFF to F2x keys has been moved to xorg-x11-drv-libinput which gets the full range key-codes from libinput and can then do this mapping before passing the keys to the X-server.
So it is no longer necessary to use KEY_F21 and even in the past we used to do the mapping in udev / hwdb rules not in the kernel in the kernel we've always (with a few exceptions which are my fault) used KEY_TOUCHPAD_TOGGLE as that is the correct keycode.
Regards,
Hans