Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| usage_of_batocera-settings [2022/09/28 12:03] – add mention of batocera-settings-get-master atari | usage_of_batocera-settings [2023/10/09 18:41] (current) – python example works now crcerror | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| <WRAP center round info> | <WRAP center round info> | ||
| - | This command is a bit out of date to use now, most if not all things can be adjusted within Batocera EmulationStation itself or through manually editing the text file. Certain commands may no longer be functional. | + | This command is a bit out of date to use now, most if not all things can be adjusted within Batocera EmulationStation itself or through manually editing the text file. Certain commands may no longer be functional. |
| </ | </ | ||
| Line 35: | Line 35: | ||
| ===== Recommended commands and expressions ===== | ===== Recommended commands and expressions ===== | ||
| - | batocera-setting | + | The commands are called with '' |
| - | As batocera-settings | + | Syntax for reading setting values: |
| + | < | ||
| + | batocera-settings-get -f [CONFIG_FILE] [KEY] | ||
| + | batocera-settings-get [KEY] | ||
| + | </code> | ||
| - | * BATOCERA Basic usage | + | This will read the KEY setting |
| - | * **'' | + | |
| - | * **'' | + | |
| - | * **'' | + | |
| - | * BATOCERA board-specific usage (added in Batocera **v36**) | + | |
| - | * **'' | + | |
| - | * BATCOERA Extended usage FIXME This flag no longer exists, was it moved or outright deleted? | + | |
| - | * **'' | + | |
| - | * **'' | + | |
| - | <WRAP center round tip> | + | Syntax for setting those values: |
| - | **Basic usage:** //batocera-settings-set -f [CONFIG_FILE] [KEY] [VALUE]\\ | + | <code> |
| - | **Extended usage:** //batocera-settings-set | + | batocera-settings-set -f [CONFIG_FILE] [KEY] [VALUE] |
| - | **-f** -- Specifies the config file to read from. Defaults to ''/ | + | batocera-settings-set [KEY] [VALUE] |
| - | **-v** -- Set value to selected ' | + | </code> |
| - | **-e** -- Activate extended mode, needed for parsing game/system specific keys FIXME This flag no longer exists, was it moved or outright deleted? | + | |
| - | **-g** -- Filename of the specified game, enclose in double-quotes ("" | + | |
| - | **-s** -- Shortname of specified system FIXME This flag no longer exists, was it moved or outright deleted?\\ | + | |
| - | </WRAP> | + | |
| - | <WRAP center round alert> | + | This will search for the key in the config file and then replace its value with the new specified one. If the key doesn't already exist in the config file, a new line with that key will be created. |
| - | FIXME This flag no longer exists, was it moved or outright deleted? | + | |
| - | If '' | + | In Batocera **v36** |
| - | Use the errorlevels for scripts!\\ | + | |
| - | Always use quotes if you use arguments containing blanks!\\ | + | < |
| - | </WRAP> | + | batocera-settings-get-master [key] |
| + | </code> | ||
| + | |||
| + | This will read the key from ''/ | ||
| ===== Error code handling ====== | ===== Error code handling ====== | ||
| Line 74: | Line 69: | ||
| |EC 0 |No Error, value found | 8-) You made it! | | |EC 0 |No Error, value found | 8-) You made it! | | ||
| |EC 1 |General error, e.g. command line error | 8-o Check your command line for correct parameters | | |EC 1 |General error, e.g. command line error | 8-o Check your command line for correct parameters | | ||
| - | |EC 2 |File error, e.g. the config file is not available | m( Check file path and r/w access to it | | ||
| - | |EC 10 | ||
| - | |EC 11 | ||
| - | |EC 12 |Key not found | m( Add the key by manual or check your command line for typos | | ||
| ===== Handling in scripts ===== | ===== Handling in scripts ===== | ||
| Line 112: | Line 103: | ||
| #This is an example file how batocera-settings-set can be utilized | #This is an example file how batocera-settings-set can be utilized | ||
| #to activate UART in / | #to activate UART in / | ||
| + | |||
| + | # Check status of file and make it writeable | ||
| + | [[ -w / | ||
| batocera-settings-set -f / | batocera-settings-set -f / | ||
| Line 117: | Line 111: | ||
| if [[ $ret -eq 0 ]]; then | if [[ $ret -eq 0 ]]; then | ||
| echo "UART activated, uncommented enable_uart" | echo "UART activated, uncommented enable_uart" | ||
| - | elif [[ $ret -eq 2 ]]; then | ||
| - | echo "File is write protected!" | ||
| - | echo " | ||
| - | mount -o remount, rw /boot | ||
| batocera-settings-set -f / | batocera-settings-set -f / | ||
| - | if [[ $ret -eq 0 ]]; then | ||
| - | echo "UART activated, uncommented enable_uart" | ||
| - | fi | ||
| else | else | ||
| echo "Key: enable_uart not found" | echo "Key: enable_uart not found" | ||
| Line 138: | Line 125: | ||
| #to set a new key in / | #to set a new key in / | ||
| - | value=$(batocera-settings-set core.PS5.emulator SONY5EVER | + | value=$(batocera-settings-set core.PS5.emulator SONY5EVER) |
| ret=$? | ret=$? | ||
| if [[ $ret -eq 0 ]]; then | if [[ $ret -eq 0 ]]; then | ||
| Line 148: | Line 135: | ||
| === 4. python: Obtain a key === | === 4. python: Obtain a key === | ||
| - | |||
| - | FIXME | ||
| <code python| obtain_value.py> | <code python| obtain_value.py> | ||
| + | |||
| # | # | ||
| - | # -*- coding: utf-8 -*- | ||
| #This is an example file how batocera-settings-get can be utilized | #This is an example file how batocera-settings-get can be utilized | ||
| #to read a value out from / | #to read a value out from / | ||
| import subprocess | import subprocess | ||
| - | + | command=(["batocera-settings-get", " | |
| - | value = (subprocess.check_output(['batocera-settings-get', 'power.switch.device' | + | rc = subprocess.call(command, |
| - | if value: | + | if rc == 0: |
| - | print "Power Switch Detected: ", value | + | value = subprocess.check_output(command).decode(" |
| + | print ("Power Switch Detected: ", value) | ||
| else: | else: | ||
| - | print "No power switch detected!" | + | print ("No power switch detected!" |
| </ | </ | ||
| + | |||
| + | |||
- usage_of_batocera-settings.1664366594.txt.gz
- Last modified: 4 years ago
- by atari