We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5506 - SDL Events not triggered for KeyDown/KeyUp for F-keys, when using 2nd keyboard
Summary: SDL Events not triggered for KeyDown/KeyUp for F-keys, when using 2nd keyboard
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: 2.0.14
Hardware: ARM Linux
: P2 major
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-27 17:37 UTC by midwan
Modified: 2021-01-29 10:10 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description midwan 2021-01-27 17:37:12 UTC
Tested this on a Pi400 running Manjaro Linux latest version (as of 2021-01-27), which comes with SDL2 2.0.14.

The Pi400 comes with an embedded keyboard, which works normally in SDL2.
I connected an external mechanical keyboard using a USB cable, which also worked normally under Linux.

However, under an SDL2 application I'm testing (specifically: Amiberry - https://github.com/midwan/amiberry), the keyboard events KEYDOWN and KEYUP are not triggered for the F1-F12 keys of the second keyboard. They are triggered from the 1st/embedded keyboard correctly.

All other keys trigger the events as expected, from what I could test. It seems that only the F-keys (?) are ignored, for some reason.

Considering they do function normally under the host OS, I assume that this is some kind of bug in the SDL2 event subsystem?
Comment 1 midwan 2021-01-29 09:42:03 UTC
I did some more tests, and I'd like to offer some more context on this case:

It appears the problem is not exactly as I originally thought. It's not about having a 2nd keyboard, but the specific keyboard I was testing with.
I tried with a few other keyboards and the events were triggered correctly, and I tried the same keyboard on another device (RockPro64) also using Manjaro Linux, and the same problem occurred there.

Which means that for some reason, SDL2 does not trigger the F1-F12 events when using this specific keyboard (it's a Keychron K3: https://www.keychron.com/pages/keychron-k3-wireless-mechanical-keyboard).

Remember it still works normally on the Linux desktop (e.g. you can press F5 and it will refresh the webbrowser).

While testing, I also discovered something that is interesting and perhaps helps: When pressing the F3 and F4 keys, SDL printed out that "The key you just pressed is not recognized by SDL".

Specifically, this is the message for the F3 key:
The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list <https://discourse.libsdl.org/> X11 KeyCode 128 (120), X11 KeySym 0x1008FF4A (XF86LaunchA).

And this is the message for the F4 key:
The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list <https://discourse.libsdl.org/> X11 KeyCode 212 (204), X11 KeySym 0x1008FF4B (XF86LaunchB).

No other F-keys trigger any kind of response in SDL2.

Is there anything else you'd like me to do, in order to assist further?
Comment 2 midwan 2021-01-29 09:58:05 UTC
A bit more context, sorry.

If I use SDL2 under KMSDRM using the console, instead of X11, I get different keyboard events triggered with the same keyboard.

Instead of the F-keys, I get the "special" actions (e.g. VolumeUp, VolumeDown, etc), which are normally triggered in combination with the Fn key.

The keyboard has a firmware toggle to use normal F-Keys or the special actions, and although that works normally under Windows, it doesn't seem to change it under Linux.

At this point, I'm not sure this is an SDL2 problem even, I'll reach out to the keyboard manufacturer for some feedback and see.
Comment 3 midwan 2021-01-29 10:10:05 UTC
Sorry for spamming. :)

I managed to find a workaround on Linux, by switching the keyboard to iOS/Mac mode - that made it show the F-keys when using the Fn key, under SDL2 as well.

We can close this bug report.