Bug 475574 - [Wayland] Unable to bind keys with keycodes above 255
Summary: [Wayland] Unable to bind keys with keycodes above 255
Status: CONFIRMED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_keys (show other bugs)
Version: 5.93.0
Platform: Arch Linux Linux
: NOR wishlist
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords: wayland
Depends on:
Blocks: 481142
  Show dependency treegraph
 
Reported: 2023-10-13 15:58 UTC by sidpranjale127
Modified: 2024-03-28 17:10 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sidpranjale127 2023-10-13 15:58:25 UTC
SUMMARY

Plasma Wayland session doesn't accept keycodes higher than 255 for keybinds/custom shortcuts.
I'm aware of it being a limitation on x11, but there's no reason it shouldn't work on wayland: wev, evtest, and showkey can all detect it (xev can't), it has a keysym, and even is usable for binds in sway and hyprland, though I know wlroots and kwin are very different.

The key in question is a laptop vendor specific key, equivalent to the "PredatorSense" key on Acer Predator series, except it's NitroSense because I have an Acer Nitro. The keysym is XF86Presentation, according to wev.

STEPS TO REPRODUCE
1. Have a keyboard with a non-standard key.
2. Attempt to use it for a custom shortcut.

OBSERVED RESULT
The key does not register.

EXPECTED RESULT
They key registers.

SOFTWARE/OS VERSIONS
Linux: Kernel 6.5.6
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.11

ADDITIONAL INFORMATION
evtest output:
Event: time 1697206386.162660, -------------- SYN_REPORT ------------
Event: time 1697206387.304843, type 4 (EV_MSC), code 4 (MSC_SCAN), value f5
Event: time 1697206387.304843, type 1 (EV_KEY), code 425 (KEY_PRESENTATION), value 1
Event: time 1697206387.304843, -------------- SYN_REPORT ------------
Event: time 1697206387.408437, type 4 (EV_MSC), code 4 (MSC_SCAN), value f5
Event: time 1697206387.408437, type 1 (EV_KEY), code 425 (KEY_PRESENTATION), value 0
Comment 1 Parker Reed 2024-01-30 19:07:51 UTC
Seeing same thing here with Chromecast remote. Half of the buttons are way above 255 and won't map in KWin.

Event: time 1706641635.753398, -------------- SYN_REPORT ------------
Event: time 1706641641.873435, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0089
Event: time 1706641641.873435, type 1 (EV_KEY), code 377 (KEY_TV), value 1
Event: time 1706641641.873435, -------------- SYN_REPORT ------------
Event: time 1706641642.013353, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0089
Event: time 1706641642.013353, type 1 (EV_KEY), code 377 (KEY_TV), value 0
Event: time 1706641642.013353, -------------- SYN_REPORT ------------
Event: time 1706641643.873390, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0078
Event: time 1706641643.873390, type 1 (EV_KEY), code 589 (?), value 1
Event: time 1706641643.873390, -------------- SYN_REPORT ------------
Event: time 1706641643.973367, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0078
Event: time 1706641643.973367, type 1 (EV_KEY), code 589 (?), value 0
Event: time 1706641643.973367, -------------- SYN_REPORT ------------
Event: time 1706641644.453419, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0077
Event: time 1706641644.453419, type 1 (EV_KEY), code 588 (?), value 1
Event: time 1706641644.453419, -------------- SYN_REPORT ------------
Event: time 1706641644.533424, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0077
Event: time 1706641644.533424, type 1 (EV_KEY), code 588 (?), value 0
Event: time 1706641644.533424, -------------- SYN_REPORT ------------
Event: time 1706641645.313474, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0041
Event: time 1706641645.313474, type 1 (EV_KEY), code 353 (KEY_SELECT), value 1
Event: time 1706641645.313474, -------------- SYN_REPORT ------------
Event: time 1706641645.453442, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0041
Event: time 1706641645.453442, type 1 (EV_KEY), code 353 (KEY_SELECT), value 0
Event: time 1706641645.453442, -------------- SYN_REPORT ------------
Comment 2 fanzhuyifan 2024-02-01 04:26:41 UTC
Unfortunately it seems that these keys are neither defined in XFree86 keysym or Qt, so I guess there isn't much KDE can do about those without big changes to the existing code.

As a workaround, you could use udev to remap these keys to keys that KDE recognize: https://wiki.archlinux.org/title/Map_scancodes_to_keycodes.
Comment 3 fanzhuyifan 2024-02-01 04:31:11 UTC
To support this feature, maybe we can use this: https://doc.qt.io/qt-6/qkeyevent.html#nativeVirtualKey
Comment 4 Parker Reed 2024-02-01 04:50:28 UTC
These keys are defined in evdev and I can use them perfectly remapping them to other keys so this shouldn't be an issue.

https://github.com/philipl/evdevremapkeys/commit/e5f251720c470f047549b59acff16ef701e28120

devices:
- input_name: 'Chromecast Remote'
  output_name: remap-kbd
  remappings:
    KEY_SELECT:
    - KEY_ENTER
    588:
    - KEY_PHONE
    KEY_SCREENLOCK:
    - KEY_POWER
    KEY_TV:
    - KEY_LEFTALT
    - KEY_F4
    589:
    - KEY_MEDIA
    KEY_BACK:
    - KEY_BACKSPACE
    KEY_HOMEPAGE:
    - KEY_LEFTMETA
Comment 5 fanzhuyifan 2024-02-01 05:03:30 UTC
(In reply to Parker Reed from comment #4)
> These keys are defined in evdev and I can use them perfectly remapping them
> to other keys so this shouldn't be an issue.


Yes, I know that they are defined in evdev. Unfortunately KDE uses Qt::Key to handle these stuff, and since Qt::Key doesn't define these Keys, KDE is having trouble handling these.
Comment 6 sidpranjale127 2024-02-01 09:02:00 UTC
ok, fair, and I'm guessing we use the evdevkeyboard backend for Qt::Key? or would that be the lbinput backend
https://invent.kde.org/qt/qt/qtbase/-/tree/dev/src/platformsupport/input