Files
david d4856804ff
Validate and Test / validate-patches (push) Failing after 13s
Fix onboard audio: apply ALSA UCM HiFi verb before Pd start
- Add alsaucm -c hw:0 set _verb HiFi to start-synth.sh (onboard mode)
- Add UCM verb to install.sh
- Add UCM verb to justfile fix-ucm recipe
- Without this, the DSP audio routing is not configured and no sound
  reaches the headphone output
2026-06-24 17:31:00 -07:00

55 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
# install-services.sh — Deploy systemd services to board
set -euo pipefail
REPO="/home/arduino/uno-q-audio-synth"
SERVICES=(synth-diagnostic midi-bridge pd-synth-onboard led-matrix-viz prometheus-exporter)
for svc in "${SERVICES[@]}"; do
sudo cp "$REPO/system/$svc.service" /etc/systemd/system/
done
# Apply UCM HiFi verb to configure DSP audio routing
if command -v alsaucm &>/dev/null; then
alsaucm -c hw:0 set _verb HiFi && echo "[OK] UCM HiFi verb applied"
fi
# Fix UCM bug (must survive OS updates)
FILE=/usr/share/alsa/ucm2/codecs/qcom-lpass/rx-macro/HeadphoneEnableSeq.conf
NEED_FIX=0
# Remove invalid RX HPH Mode line
if grep -q "RX HPH Mode" "$FILE" 2>/dev/null; then
sudo sed -i '/RX HPH Mode/d' "$FILE"
NEED_FIX=1
fi
# Add missing RX INT0_1/INT1_1 INTERP controls (blocks audio on some boards)
if ! grep -q "RX INT0_1 INTERP" "$FILE" 2>/dev/null; then
echo ' cset "name=RX INT0_1 INTERP" "RX INT0_1 MIX1"' | sudo tee -a "$FILE" >/dev/null
NEED_FIX=1
fi
if ! grep -q "RX INT1_1 INTERP" "$FILE" 2>/dev/null; then
echo ' cset "name=RX INT1_1 INTERP" "RX INT1_1 MIX1"' | sudo tee -a "$FILE" >/dev/null
NEED_FIX=1
fi
if [ "$NEED_FIX" = "1" ]; then
echo "[OK] UCM HeadphoneEnableSeq patched"
fi
sudo systemctl daemon-reload
# Stop/mask old conflicting services
sudo systemctl stop pd-synth pd-synth-auto pd-synth-i2s 2>/dev/null || true
sudo systemctl disable pd-synth pd-synth-auto pd-synth-i2s 2>/dev/null || true
sudo systemctl mask pd-synth pd-synth-auto pd-synth-i2s 2>/dev/null || true
for svc in "${SERVICES[@]}"; do
sudo systemctl enable "$svc"
done
# Install git hooks: point to repo's .githooks so post-merge auto-restarts services
git config core.hooksPath "$REPO/.githooks"
# Add pull-clean alias: stash local changes, pull fresh, discard stashed
git config alias.pull-clean '!git stash && git pull'
echo "[OK] Services installed and enabled"