Hi On 17-Mar-25 5:52 PM, Werner Sembach wrote: > Hi, > > Am 17.03.25 um 13:11 schrieb Hans de Goede: >> Hi Werner, >> >> On 13-Mar-25 15:03, Werner Sembach wrote: >>> The TUXEDO NB02 notebook keyboards touchpad toggle key sends the PS/2 >>> scancode sequence: >>> 0xe0, 0x5b, // Super down >>> 0x1d, // Control down >>> 0x76, // KEY_ZENKAKUHANKAKU down >>> 0xf6, // KEY_ZENKAKUHANKAKU up >>> 0x9d, // Control up >>> 0xe0, 0xdb // Super up >>> >>> This driver listens to the Control + Super + Hangaku/Zenkaku key sequence >>> to suppresses the Hangaku/Zenkaku keypress and sends a F21 keypress >>> afterwards 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. >>> >>> Signed-off-by: Werner Sembach <wse@xxxxxxxxxxxxxxxxxxx> >> I'm still not a fan of this approach. Your patch to atkbd.c to >> map scancode 0x5f to F24 + a xkeyboard-config change to add: >> >> key <FK24> { [ F24 ] }; >> >> to /usr/share/X11/xkb/symbols/fujitsu_vndr/inet >> >> + teach KDE and GNOME that Ctrl + Super + F24 = touchpad-toggle >> >> should work nicely and renders the whole need for this patch obsolete. > > Ok, but see my suggestion of doing it in xkeyboard-config only in the other mail-thread: [PATCH v2 2/2] Input: atkbd - Correctly map F13 - F24 Yes I just notices that, as I mentioned in the other thread, the xkeyboard-config only fix sounds like a good fix to me. Regards, Hans >>> --- >>> MAINTAINERS | 6 ++ >>> drivers/platform/x86/Kconfig | 2 + >>> drivers/platform/x86/Makefile | 3 + >>> drivers/platform/x86/tuxedo/Kbuild | 8 ++ >>> drivers/platform/x86/tuxedo/Kconfig | 8 ++ >>> drivers/platform/x86/tuxedo/nb02/Kbuild | 9 ++ >>> drivers/platform/x86/tuxedo/nb02/Kconfig | 17 ++++ >>> drivers/platform/x86/tuxedo/nb02/platform.c | 107 ++++++++++++++++++++ >>> 8 files changed, 160 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 >>> >>> diff --git a/MAINTAINERS b/MAINTAINERS >>> index 8e0736dc2ee0e..7139c32e96dc7 100644 >>> --- a/MAINTAINERS >>> +++ b/MAINTAINERS >>> @@ -24190,6 +24190,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 <wse@xxxxxxxxxxxxxxxxxxx> >>> +L: platform-driver-x86@xxxxxxxxxxxxxxx >>> +S: Supported >>> +F: drivers/platform/x86/tuxedo/ >>> + >>> TW5864 VIDEO4LINUX DRIVER >>> M: Bluecherry Maintainers <maintainers@xxxxxxxxxxxxxxxxx> >>> M: Andrey Utkin <andrey.utkin@xxxxxxxxxxxxxxxxxxx> >>> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig >>> index 0258dd879d64b..9b78a1255c08e 100644 >>> --- a/drivers/platform/x86/Kconfig >>> +++ b/drivers/platform/x86/Kconfig >>> @@ -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" >>> diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile >>> index e1b1429470674..1562dcd7ad9a5 100644 >>> --- a/drivers/platform/x86/Makefile >>> +++ b/drivers/platform/x86/Makefile >>> @@ -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/ >>> diff --git a/drivers/platform/x86/tuxedo/Kbuild b/drivers/platform/x86/tuxedo/Kbuild >>> new file mode 100644 >>> index 0000000000000..1c79b80744d1b >>> --- /dev/null >>> +++ b/drivers/platform/x86/tuxedo/Kbuild >>> @@ -0,0 +1,8 @@ >>> +# SPDX-License-Identifier: GPL-2.0-or-later >>> +# >>> +# Copyright (C) 2025 Werner Sembach wse@xxxxxxxxxxxxxxxxxxx >>> +# >>> +# TUXEDO X86 Platform Specific Drivers >>> +# >>> + >>> +obj-y += nb02/ >>> diff --git a/drivers/platform/x86/tuxedo/Kconfig b/drivers/platform/x86/tuxedo/Kconfig >>> new file mode 100644 >>> index 0000000000000..13b484999e333 >>> --- /dev/null >>> +++ b/drivers/platform/x86/tuxedo/Kconfig >>> @@ -0,0 +1,8 @@ >>> +# SPDX-License-Identifier: GPL-2.0-or-later >>> +# >>> +# Copyright (C) 2025 Werner Sembach wse@xxxxxxxxxxxxxxxxxxx >>> +# >>> +# TUXEDO X86 Platform Specific Drivers >>> +# >>> + >>> +source "drivers/platform/x86/tuxedo/nb02/Kconfig" >>> diff --git a/drivers/platform/x86/tuxedo/nb02/Kbuild b/drivers/platform/x86/tuxedo/nb02/Kbuild >>> new file mode 100644 >>> index 0000000000000..f56629c8b9dd8 >>> --- /dev/null >>> +++ b/drivers/platform/x86/tuxedo/nb02/Kbuild >>> @@ -0,0 +1,9 @@ >>> +# SPDX-License-Identifier: GPL-2.0-or-later >>> +# >>> +# Copyright (C) 2025 Werner Sembach wse@xxxxxxxxxxxxxxxxxxx >>> +# >>> +# TUXEDO X86 Platform Specific Drivers >>> +# >>> + >>> +tuxedo_nb02_platform-y := platform.o >>> +obj-$(CONFIG_TUXEDO_NB02_PLATFORM) += tuxedo_nb02_platform.o >>> diff --git a/drivers/platform/x86/tuxedo/nb02/Kconfig b/drivers/platform/x86/tuxedo/nb02/Kconfig >>> new file mode 100644 >>> index 0000000000000..38cd60c9d4f03 >>> --- /dev/null >>> +++ b/drivers/platform/x86/tuxedo/nb02/Kconfig >>> @@ -0,0 +1,17 @@ >>> +# SPDX-License-Identifier: GPL-2.0-or-later >>> +# >>> +# Copyright (C) 2025 Werner Sembach wse@xxxxxxxxxxxxxxxxxxx >>> +# >>> +# 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. >>> diff --git a/drivers/platform/x86/tuxedo/nb02/platform.c b/drivers/platform/x86/tuxedo/nb02/platform.c >>> new file mode 100644 >>> index 0000000000000..da67a91a4a129 >>> --- /dev/null >>> +++ b/drivers/platform/x86/tuxedo/nb02/platform.c >>> @@ -0,0 +1,107 @@ >>> +// SPDX-License-Identifier: GPL-2.0-or-later >>> +/* >>> + * Copyright (C) 2025 Werner Sembach wse@xxxxxxxxxxxxxxxxxxx >>> + */ >>> + >>> +#include <linux/cleanup.h> >>> +#include <linux/container_of.h> >>> +#include <linux/dmi.h> >>> +#include <linux/i8042.h> >>> +#include <linux/input.h> >>> +#include <linux/kernel.h> >>> +#include <linux/module.h> >>> +#include <linux/serio.h> >>> + >>> +struct input_dev *idev; >>> + >>> +static void tux_nb02_f21(struct work_struct *work __always_unused) >>> +{ >>> + input_report_key(idev, KEY_F21, 1); >>> + input_report_key(idev, KEY_F21, 0); >>> + input_sync(idev); >>> +} >>> +DECLARE_WORK(tux_nb02_f21_work, tux_nb02_f21); >>> + >>> +static const u8 tux_nb02_touchp_toggle_seq[] = { >>> + 0xe0, 0x5b, // Super down >>> + 0x1d, // Control down >>> + 0x76, // KEY_ZENKAKUHANKAKU down >>> + 0xf6, // KEY_ZENKAKUHANKAKU 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 __always_unused) >>> +{ >>> + static u8 seq_pos; >>> + >>> + if (unlikely(str & I8042_STR_AUXDATA)) >>> + return false; >>> + >>> + if (unlikely(data == tux_nb02_touchp_toggle_seq[seq_pos])) { >>> + ++seq_pos; >>> + if (unlikely(data == 0x76 || data == 0xf6)) { >>> + return true; >>> + } else if (unlikely(seq_pos == ARRAY_SIZE(tux_nb02_touchp_toggle_seq))) { >>> + schedule_work(&tux_nb02_f21_work); >>> + seq_pos = 0; >>> + } >>> + return false; >>> + } >>> + >>> + 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"), >>> + }, >>> + }, >>> + { } >>> +}; >>> +MODULE_DEVICE_TABLE(dmi, tux_nb02_dmi_string_match); >>> + >>> +static int __init tux_nb02_plat_init(void) >>> +{ >>> + int ret; >>> + >>> + if (!dmi_check_system(tux_nb02_dmi_string_match)) >>> + return -ENODEV; >>> + >>> + idev = input_allocate_device(); >>> + if (!idev) >>> + return -ENOMEM; >>> + >>> + idev->name = "TUXEDO NB02 Platform Keyboard"; >>> + set_bit(EV_KEY, idev->evbit); >>> + set_bit(KEY_F21, idev->keybit); >>> + >>> + ret = input_register_device(idev); >>> + if (ret) { >>> + input_free_device(idev); >>> + return ret; >>> + } >>> + >>> + i8042_install_filter(tux_nb02_i8042_filter, NULL); >>> + >>> + return 0; >>> +} >>> + >>> +static void __exit tux_nb02_plat_exit(void) >>> +{ >>> + i8042_remove_filter(tux_nb02_i8042_filter); >>> + input_unregister_device(idev); >>> +} >>> + >>> +module_init(tux_nb02_plat_init); >>> +module_exit(tux_nb02_plat_exit); >>> + >>> +MODULE_DESCRIPTION("Keyboard fix for TUXEDO NB02 devices"); >>> +MODULE_AUTHOR("Werner Sembach <wse@xxxxxxxxxxxxxxxxxxx>"); >>> +MODULE_LICENSE("GPL"); >