Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyboard function keys recognized as media keys - Keychron K5 SE #10

Open
Raging-Flame opened this issue Jul 12, 2023 · 5 comments
Open

Comments

@Raging-Flame
Copy link

Raging-Flame commented Jul 12, 2023

After using USB4VC with different keyboards (USB, BT, combined mouse and KB dongles) and all of them working perfectly, I just got a Keychron K5 SE keyboard, which has the following issue.

Function keys do not work and using the option "Show Event Codes" shows, that they are recognized as media keys (volume controls and so on) instead of as function keys. Pressing the FN key and then any of the function keys still shows them as media key via Show Event Codes.
The keyboard has an option to switch its standard function key behaviour between function keys and media keys but this doesn't help as the USB4VC doesn't recognize button presses at all when switching the keyboard to the other mode.

I guess, normally keyboards "hardmap" function keys as said function keys but this keyboard (an maybe others too) might hardmap them as media keys.

Is there a way to manually map the keys like it is for gamepads? If not, maybe the USB4VC Configurator app for gamepads could be expanded to also offer this functionality for keyboards.

@megatog615
Copy link

Yeah... happens with Keychron C1 as well.

@megatog615
Copy link

megatog615 commented Nov 8, 2023

Add this to a new file called /etc/modprobe.d/hid_apple.conf :
options hid_apple fnmode=2

This changes the behavior of the hid_apple driver(which non-QMK Keychron boards use regardless if they're in Mac or Windows mode) so that the function keys are read as function keys first. Use FN + function keys to restore the media key behavior. I already had this fix on my Linux PC but I forgot that USB4VC is technically a Linux box 😅.

@Raging-Flame
Copy link
Author

Raging-Flame commented Nov 10, 2023

Add this to a new file called /etc/modprobe.d/hid_apple.conf : options hid_apple fnmode=2

This changes the behavior of the hid_apple driver(which non-QMK Keychron boards use regardless if they're in Mac or Windows mode) so that the function keys are read as function keys first. Use FN + function keys to restore the media key behavior. I already had this fix on my Linux PC but I forgot that USB4VC is technically a Linux box 😅.

While connected to the USB4VC, the K5 SE in Windows mode causes the function keys behave only as media keys (backlight brightness for example) if FN is held down, while in Mac mode it's reversed. The problem, that the F1 to F12 keys aren't recognized as such remains, even if I add the hid_apple.conf to the boot partitions on the USB4VC microSD card. This file also doesn't change FN-key behaviour.

Also with the K5 SE in Windows mode, you can keep FN+X+L pressed for 4 seconds to change FN-key behaviour, which also works for USB4VC, but doesn't help with the issue of not getting F1 to F12 to work. Very odd that the keyboard always sends media key events to the USB4VC, while it works fine under Windows and Linux.

@megatog615
Copy link

You need to add it to /etc/modprobe.d/ in the rootfs partition not boot.

@Raging-Flame
Copy link
Author

You need to add it to /etc/modprobe.d/ in the rootfs partition not boot.

Just did this now and it indeed works, yay! Thanks for the solution. :D

Under Linux Mint 21.2 the keyboard worked out of the box the way it should. I wonder if they accounted for these problems with Keychron keyboards already, even though it runs kernel 5.15 and I read only 5.19 resolved (to a dregree at least) issues with Keychron keyboards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants