This code must be executed each time my Keychron K1 keyboard is about to be used:
echo 2 > /sys/module/hid_apple/parameters/fnmode
The code enables Fn keys as the Keychron suggests on Linux.
I put it in a script /home/me/k1add
After hours of desperation I successfully wrote this rule:
SUBSYSTEM=="hid", ENV{HID_PHYS}=="*input0", ACTION=="add",
ATTRS{idVendor}=="05ac", ATTRS{idProduct}=="024f", RUN="/home/me/k1add"
(I wrapped the rule text here for your convenient reading).
The rule goes to:
/etc/udev/rules.d/10-my.rules
Now if I unplug and plug back the keyboard the rule applies and I am happy.
But after I restart the PC nothing happens. So what is the way here to make it run on reboot? I know I can add this code to some of the rc
scripts, but then this code would execute even if I use another keyboard, which might not be a big problem but anyway I believe it's udev's work to run a script each time a device is ready.
I guessed there might be another ACTION
but man udev
does not list possible actions. I know I can see actions with udevadm monitor
but this command can only be executed after the system is fully booted, which is too late to detect the udev action.