* Add a mechanism for providing configuration on a per device basis.

* Supported via fresh flash and during the first post-install reboot.
  * Add configurations to packages/hardware/quirks/devices/(DEVICE)/config/ in the same format it would be found in /storage/.config.
  * System generic configs are copied first, and device specific configs are copied over them.
* Tweak audio so it works on boot.
This commit is contained in:
fewtarius 2023-07-01 18:46:51 +00:00
parent e7eedb844d
commit 8c08cdbfe9
No known key found for this signature in database
GPG key ID: F4AE55305D1B8C1A
7 changed files with 43 additions and 16 deletions

View file

@ -0,0 +1,13 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2023-present Fewtarius (https://github.com/fewtarius)
. /etc/profile
if [ -d "/usr/lib/autostart/quirks/${QUIRK_DEVICE}/config" ] && \
[ ! -f ".quirkconfigs" ]
then
tocon "Applying ${QUIRK_DEVICE} specific configuration..."
rsync -a --exclude={es_features.cfg,es_systems.cfg} /usr/lib/autostart/quirks/"${QUIRK_DEVICE}"/config/* /storage/.config/ 2>/dev/null
touch /storage/.quirkconfigs
fi

View file

@ -8,10 +8,6 @@
set-audio set "CUSTOM (UNMANAGED)"
set-audio esset "Master"
amixer sset 'FRDDR_A SINK 1 SEL' 'OUT 1'
amixer sset 'FRDDR_A SRC 1 EN' 'on'
amixer sset 'TDMOUT_B SRC SEL' 'IN 0'
cat <<EOF >/storage/.config/asound.conf
pcm.!default {
type plug
@ -258,3 +254,10 @@ state.Ultra {
EOF
fi
alsactl restore -f /storage/.config/asound.state
amixer sset 'FRDDR_A SINK 1 SEL' 'OUT 1'
amixer sset 'FRDDR_A SRC 1 EN' 'on'
amixer sset 'TDMOUT_B SRC SEL' 'IN 0'
amixer -c0 sset "Playback Mux" "${DEVICE_PLAYBACK_PATH_SPK}"
alsactl store -f /storage/.config/asound.state

View file

@ -7,7 +7,7 @@ PKG_ARCH="any"
PKG_LICENSE="apache2"
PKG_SITE=""
PKG_URL=""
PKG_DEPENDS_TARGET="toolchain"
PKG_DEPENDS_TARGET="toolchain systemd"
PKG_SHORTDESC="Autostart is a systemd helper that starts/configures device specific services and parameters."
PKG_IS_ADDON="no"
PKG_AUTORECONF="no"

View file

@ -0,0 +1,12 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2021-present Fewtarius (https://github.com/fewtarius)
### Apply device quirks
if [ -e "/sys/firmware/devicetree/base/model" ]
then
export QUIRK_DEVICE="$(tr -d '\0' </sys/firmware/devicetree/base/model 2>/dev/null)"
else
export QUIRK_DEVICE="$(tr -d '\0' </sys/class/dmi/id/sys_vendor 2>/dev/null) $(tr -d '\0' </sys/class/dmi/id/product_name 2>/dev/null)"
fi
export QUIRK_DEVICE="$(echo ${QUIRK_DEVICE} | sed -e "s#[/]#-#g")"

View file

@ -10,15 +10,6 @@ performance 2>&1 >${BOOTLOG}
date 2>&1 >>${BOOTLOG}
### Apply device quirks
if [ -e "/sys/firmware/devicetree/base/model" ]
then
QUIRK_DEVICE=$(cat /sys/firmware/devicetree/base/model 2>/dev/null)
else
QUIRK_DEVICE="$(cat /sys/class/dmi/id/sys_vendor 2>/dev/null) $(cat /sys/class/dmi/id/product_name 2>/dev/null)"
fi
QUIRK_DEVICE="$(echo ${QUIRK_DEVICE} | sed -e "s#[/]#-#g")"
if [ -d "/usr/lib/autostart/quirks/${QUIRK_DEVICE}" ]
then
echo "Executing ${QUIRK_DEVICE} quirks." 2>&1 >>${BOOTLOG}
@ -26,7 +17,10 @@ then
for script in "/usr/lib/autostart/quirks/${QUIRK_DEVICE}"/*
do
echo "Executing ${script}" 2>&1 >>${BOOTLOG}
"${script}" 2>&1 >>${BOOTLOG}
if [ -f "${script}" ]
then
"${script}" 2>&1 >>${BOOTLOG}
fi
done
fi

View file

@ -12,6 +12,11 @@ then
# Copy config files, but don't overwrite. Only run if /storage is fresh
rsync -a --ignore-existing --exclude={es_features.cfg,es_systems.cfg} /usr/config/* /storage/.config/ >/var/log/configure.log 2>&1
if [ -d "/usr/lib/autostart/quirks/"${QUIRK_DEVICE}"/config" ]
then
rsync -a --exclude={es_features.cfg,es_systems.cfg} /usr/lib/autostart/quirks/"${QUIRK_DEVICE}"/config/* /storage/.config/ >>/var/log/configure.log 2>&1
fi
if [ -e "/usr/bin/emulationstation" ]
then
tocon "Installing themes..."

View file

@ -3,7 +3,7 @@
# Copyright (C) 2020-present Fewtarius
PKG_NAME="emulationstation"
PKG_VERSION="43acab1"
PKG_VERSION="909cd19"
PKG_GIT_CLONE_BRANCH="main"
PKG_REV="1"
PKG_ARCH="any"