I have an Asus Zephyrus S laptop (GX502GW), and I am aware that support won't be great because it has newer hardware. Currently, I have Kubuntu 20.04 installed alongside Win 10 and I have been setting it up as my workstation. This problem is not present with Windows.
I noticed that around half of the fn keys are completely ignored by the system. I have used showkey with a TTY console to identify that these keys do not do anything:
- Fan speed
- Screen off
- Brightness Down
- Brightness up
- KB Brightness Down
- KB Brightness Up
- KB Profile Previous (meant for backlight profile)
- KB Profile Next (Meant for backlight profile)
- Touchpad Disable/Enable
- Sleep
- Airplane mode
- Microphone mute
- custom Asus ROG Key (I am aware the ROG software is windows-only. I would like to manually keybind this.)
Whenever I press one of those keys I can see it show up with showkey. With the unresponsive backlight keys, or the sleep/touchpad/airplane-mode keys, I don't see anything in showkey.
I've tried modifying my grub file with different vendor boot profiles, none seemed to work.
How can I go about getting the keys properly mapped? I am familiar with the Keyboard subsystem on Windows but not so much with Linux. I don't mind manually adding in the missing keys for this device and providing the mapping to Ubuntu.
1 Answer
Many/Most Multimedia Keys aren't set up by default to perform any action. There are many posts that help explain a few different ways to identify and set up commands or scripts to perform when these keys are pressed.
I've found that xbindkeys_config, the GUI for xbindkeys, is one of the easiest ways to bind keys. To have xbindkeys start with your Desktop Manager, add xbindkeys to your ~/.xinitrc file. More detailed instructions can be found here.
If these keys aren't showing up as keycodes, you can use udev or evtest to find the scancode, and map it to the correct keycode. You can create custom hwdb entries for udev to correct this problem. Map scancodes to keycodes.
The wiki describes creating .hwdb files, and restarting udev:
$ cat /etc/udev/hwdb.d/10-my-modifiers.hwdb
evdev:input:b0003v05AFp8277* # was tested on Kensington Slim Type USB (with old ABI) KEYBOARD_KEY_70039=leftalt # bind capslock to leftalt KEYBOARD_KEY_700e2=leftctrl # bind leftalt to leftctrl
evdev:atkbd:dmi:* # built-in keyboard: match all AT keyboards for now KEYBOARD_KEY_3a=leftalt # bind capslock to leftalt KEYBOARD_KEY_38=leftctrl # bind leftalt to leftctrl
$ sudo systemd-hwdb updateThis question, and these details are described in this wonderful answer from Unix & Linux. These details were very useful for me with a fully programmable keyboard, when I added new HID/scancodes, otherwise they wouldn't be detected properly.
There is also a way to re-query the device for these details, which is easier when it works properly, but I'm at a loss as to where my notes on this topic are located.
1