Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
scripting_function_keys [2021/11/30 05:54] – major cleanup (wip) atari | scripting_function_keys [2022/07/10 07:48] (current) – [Create a custom mapping] atari | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Scripting Function Keys ====== | ====== 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' | + | 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 any key to any command, and includes most common function keys for various platforms. But it is possible that your device in particular doesn' |
===== Create a custom mapping ===== | ===== Create a custom mapping ===== | ||
- | You can create a custom | + | To create a custom |
+ | - Refer to the list of existing configurations at https:// | ||
+ | If you'd like to see these files on your local installation: | ||
- Connect to your Batocera machine either [[access_the_batocera_via_ssh|by SSH]] or by [[WinSCP]] (any method that lets you see the root of the system). | - Connect to your Batocera machine either [[access_the_batocera_via_ssh|by SSH]] or by [[WinSCP]] (any method that lets you see the root of the system). | ||
- Navigate to ''/ | - Navigate to ''/ | ||
- | | + | </ |
+ | | ||
- Make your appropriate edits to it and save it. | - Make your appropriate edits to it and save it. | ||
Your custom '' | Your custom '' | ||
- | ===== Create my own mapping ===== | + | For example: |
- | If you want to customize hotkeys, just create a file in your data here : | + | |
- | | + | <file bash multimedia_keys.conf> |
+ | BTN_TRIGGER_HAPPY3 1 batocera-brightness - 5 | ||
+ | BTN_TRIGGER_HAPPY4 1 batocera-brightness + 5 | ||
+ | KEY_MUTE 1 batocera-audio setSystemVolume mute-toggle | ||
+ | KEY_VOLUMEUP 1 batocera-audio setSystemVolume +5 | ||
+ | KEY_VOLUMEDOWN 1 batocera-audio setSystemVolume -5 | ||
+ | # power off, switch command to "/ | ||
+ | KEY_POWER | ||
+ | # display some information on X displays | ||
+ | KEY_F2 | ||
+ | </ | ||
- | It can be empty, but in this case, it will do nothing. | + | You could also check for various hardware states, such as if there is a device plugged into the headphone jack: |
- | 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, | + | <file bash multimedia_keys.conf> |
+ | SW_HEADPHONE_INSERT 0 | ||
+ | SW_HEADPHONE_INSERT 1 | ||
+ | </ | ||
- | * copy /etc/triggerhappy/triggers.d/ | + | Reboot the device to apply the new triggerhappy |
- | * then modify the line : | + | |
- | KEY_POWER | + | ===== Identifying key names ===== |
- | by | + | Open a terminal and type the following command: |
- | KEY_POWER | + | < |
+ | evtest | ||
+ | </code> | ||
- | * reboot. | + | Then select your intended controller and press the button on your controller. The detected input will then be displayed like so: |
- | ===== Find the mapping key name ===== | + | < |
- | How to guess which value correspond to which button ? | + | Event: time 1614795871.549381, |
+ | </ | ||
- | Easy. | + | Look for the key name in parenthesis and its value when depressed after the " |
- | * Run in a terminal the command | + | A list of most existing events can also be found in [[:evmapy# |
- | evtest | + | ===== What is the default mapping? ===== |
- | + | ||
- | * choose your controller | + | |
- | * press the button | + | |
- | + | ||
- | Event: time 1614795871.549381, | + | |
- | + | ||
- | * 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 : / | + | |
- | + | ||
- | There are several files, depending on your board, but only one is used at once. | + | |
- | + | ||
- | It is generally multimedia_keys.conf, | + | |
+ | All default configurations are at https:// | ||
- scripting_function_keys.1638248068.txt.gz
- Last modified: 2 years ago
- by atari