es-menu: provide the missing set-audio, power LED and resolution backends

Three ES menu backends did not exist on ArchR, so the menus silently did
nothing and every ES start logged "command not found":

- set-audio (AUDIO OUTPUT menu): implemented for PipeWire via wpctl
  (list/get/set validated on hardware); card profiles are not exposed,
  so the profile row hides itself.
- batocera-gameforce (POWER LED COLOR menu): drives the gpio-led power
  indicator (blue by default, DEVICE_POWER_LED overrides; the red LED
  remains the charging indicator owned by powerstate). heartbeat/on/off
  validated on the Soysauce. A new 096-powerled autostart replays the
  persisted choice at boot.
- archr-resolution (archr-config lsoutputs): lists connected DRM
  connectors.

emulationstation: bump for the enhanced PowerSaver default (idle menu
CPU measured 25% to 10% on hardware).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Douglas Teles
2026-07-01 21:51:32 -03:00
parent 6a66a44a8e
commit 3cd958e549
5 changed files with 103 additions and 1 deletions
+11
View File
@@ -0,0 +1,11 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2026-present ArchR (https://github.com/archr-linux/Arch-R)
# Re-apply the user's POWER LED COLOR choice at boot. ES persists it as
# option_powerled but nothing replayed it, so the LED reverted to the DTS
# default on every boot.
. /etc/profile.d/001-functions
PWRLED=$(get_setting option_powerled)
[ -n "${PWRLED}" ] && /usr/bin/batocera-gameforce powerLed "${PWRLED}" &
@@ -0,0 +1,17 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2026-present ArchR (https://github.com/archr-linux/Arch-R)
#
# Minimal display-output helper. Only listOutputs is consumed today
# (archr-config lsoutputs); it was missing and logged "command not found"
# on every ES start. Lists connected DRM connectors (DSI-1 on the panels).
case "$1" in
listOutputs)
for st in /sys/class/drm/card*-*/status; do
[ -f "${st}" ] || continue
[ "$(cat "${st}" 2>/dev/null)" = "connected" ] && basename "$(dirname "${st}")" | sed 's/^card[0-9]*-//'
done
;;
esac
exit 0
@@ -0,0 +1,40 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2026-present ArchR (https://github.com/archr-linux/Arch-R)
#
# Compat backend for the ES "POWER LED COLOR" menu: ApiSystem hardcodes
# `batocera-gameforce powerLed <heartbeat|off|on>` (and buttonColorLed for
# the GameForce RGB buttons, which these boards do not have). The script
# did not exist, so the menu silently did nothing on RK3326.
#
# Drives the plain gpio-led power indicator: blue by default; the red LED
# stays owned by powerstate/ledcontrol as the charging indicator. Devices
# can override the LED name via DEVICE_POWER_LED in their quirk profile.
if [ -z "${DEVICE_POWER_LED}" ] && [ -f /storage/.config/profile.d/001-device_config ]; then
. /storage/.config/profile.d/001-device_config 2>/dev/null
fi
LEDPATH="/sys/class/leds/${DEVICE_POWER_LED:-blue}"
case "$1" in
powerLed)
[ -d "${LEDPATH}" ] || exit 0
case "$2" in
off)
echo none > "${LEDPATH}/trigger"
echo 0 > "${LEDPATH}/brightness"
;;
on)
echo none > "${LEDPATH}/trigger"
cat "${LEDPATH}/max_brightness" > "${LEDPATH}/brightness"
;;
heartbeat)
echo heartbeat > "${LEDPATH}/trigger"
;;
esac
;;
buttonColorLed)
exit 0
;;
esac
+34
View File
@@ -0,0 +1,34 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2026-present ArchR (https://github.com/archr-linux/Arch-R)
#
# Backend for the EmulationStation AUDIO OUTPUT menu. ApiSystem hardcodes
# these calls: list, get, set <name>, list-profiles, get-profile,
# set-profile <name>. The script was missing entirely, so the menu was dead
# and every ES start logged "set-audio: command not found".
#
# PipeWire/WirePlumber via wpctl. Card profiles are not exposed on these
# boards: the profile subcommands return nothing and ES hides that row.
sinks() {
wpctl status 2>/dev/null | sed -n '/Sinks:/,/Sources:/p'
}
case "$1" in
list)
sinks | grep -oE '[0-9]+\. .*\[vol' | sed -E 's/^[0-9]+\. //; s/ *\[vol$//' | sort -u
;;
get)
sinks | grep '\*' | grep -oE '[0-9]+\. .*\[vol' | sed -E 's/^[0-9]+\. //; s/ *\[vol$//' | head -1
;;
set)
ID=$(sinks | grep -F "$2" | grep -oE '[0-9]+\.' | tr -d '.' | head -1)
[ -n "${ID}" ] && wpctl set-default "${ID}"
;;
list-profiles|get-profile)
:
;;
set-profile)
exit 0
;;
esac
@@ -2,7 +2,7 @@
# Copyright (C) 2026 ArchR (https://github.com/archr-linux/Arch-R)
PKG_NAME="emulationstation"
PKG_VERSION="9cdb455f3b1449f3ca49571520e152adefaf6ac3"
PKG_VERSION="ca9587731a81191dd8391b842eb5f38c96515624"
PKG_GIT_CLONE_BRANCH="master"
PKG_LICENSE="GPL"
PKG_SITE="https://github.com/archr-linux/emulationstation-next"