This is an old revision of the document!
Scripting Function Keys
Many input devices nowadays include dedicated function keys for particular (usually hardware-related) functions, such as volume adjustment, brightness adjustment, power off, etc. Batocera supports the scripting of these function keys to certain commands, and includes most common function keys for various platforms. But it is possible that your device in particular doesn't have these coded in yet, or you simply want to change what the function key does. This can be achieved via the configuration of triggerhappy.
Create a custom mapping
You can create a custom mapping that is overlaid on top of the default function keys.
- Navigate to
/etc/triggerhappy/triggers.d/and find themultimedia_key_<device name>.conffor your device. - Copy the contents of that to
/userdata/system/configs/multimedia_keys.conf. - Make your appropriate edits to it and save it.
Your custom multimedia_keys.conf file's configuration will be overlaid on top of the default profile. If there are conflicting settings, the one in /userdata/system/configs/multimedia_keys.conf will take priority.
Create my own mapping
If you want to customize hotkeys, just create a file in your data here :
/userdata/system/configs/multimedia_keys.conf
It can be empty, but in this case, it will do nothing. The best is to start for the current config and modifiying it.
So, for example on odroid go super, to copy the current configuration and modify it, for example to enable suspend mode,
- copy /etc/triggerhappy/triggers.d/multimedia_keys_Hardkernel_ODROID_GO3.conf to /userdata/system/configs/multimedia_keys.conf
- then modify the line :
KEY_POWER 1 /sbin/shutdown -h now
by
KEY_POWER 1 /usr/sbin/pm-suspend
- reboot.
Find the mapping key name
How to guess which value correspond to which button ?
Easy.
- Run in a terminal the command :
evtest
- choose your controller
- press the button
Event: time 1614795871.549381, type 1 (EV_KEY), code 99 (KEY_SYSRQ), value 0
- In this example, the button i pressed on my keyboard was : KEY_SYSRQ
What is the default mapping
Default multimedia keys mapping is configured in one file here : /etc/triggerhappy/triggers.d.
There are several files, depending on your board, but only one is used at once.
It is generally multimedia_keys.conf, but on some boards like odroid go advance or super, there is a specific file, mainly to manage the extra actions.
- scripting_function_keys.1638248068.txt.gz
- Last modified: 5 years ago
- by atari