Skip to content

fix: decouple from DietPi, HDMI stability, real CamillaDSP tests#45

Open
thomaseleff wants to merge 19 commits into
v0.1.0-beta.1from
v0.1.0-beta.1-43
Open

fix: decouple from DietPi, HDMI stability, real CamillaDSP tests#45
thomaseleff wants to merge 19 commits into
v0.1.0-beta.1from
v0.1.0-beta.1-43

Conversation

@thomaseleff

@thomaseleff thomaseleff commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Task 1: Replace DietPi-internal autostart hooks and dietpi-set_hardware calls with standard systemd service units (audera-player.service oneshot, audera-streamer.service long-running)
  • Task 2: Disable WiFi power save globally via /etc/NetworkManager/conf.d/wifi-powersave.conf and per-connection via nmcli in netifaces.py
  • Task 3: Set silence_threshold: null, silence_timeout: null, stop_on_rate_change: false in both CamillaDSP configs to keep the ALSA device open and prevent HDMI audio dropout
  • Task 4: Append HDMI firmware settings to /boot/firmware/config.txt and add a camilladsp-hdmi-wait.path unit that delays CamillaDSP until /dev/snd/pcmC0D0p exists
  • Task 5: Write /etc/profile.d/50-audera-banner.sh boot banner warning against dietpi-config usage
  • Task 6: Replace in-process CamillaDSP WebSocket mock with a real binary running in a testcontainer (Debian Trixie, no audio hardware required). Both the CamillaDSP and snapserver testcontainers now build from a Dockerfile under tests/docker/ via DockerImage — no manual pre-build step required.
  • Task 7: Make the dtoverlay write in setup.sh explicit and opt-in via a new -a, --audio-device flag on provision.sh (hdmi, digiamp-plus, dac-plus, hifiberry-dac-plus). Previously setup.sh unconditionally wrote dtoverlay=vc4-kms-v3d on every re-provision run, silently overwriting the dtoverlay DietPi wrote at flash-time for non-HDMI hardware (e.g. rpi-digiampplus). When the flag is omitted, the existing dtoverlay is left untouched.

Test plan

  • uv run ruff check --fix && uv run ruff format && uv run ty check passes clean
  • uv run pytest tests/dal/ -v passes (no Docker)
  • uv run pytest tests/clients/ -v passes (requires Docker)
  • Provision setup.sh on a plain Debian Trixie system (no DietPi) completes without errors
  • bash -n all three modified provisioning scripts; provision.sh --dry-run confirms --audio-device is correctly included/omitted in the remote command
  • HDMI audio does not drop out after silence
  • Re-provision a live DigiAMP+ device with no --audio-device flag and confirm config.txt's existing dtoverlay=rpi-digiampplus line is untouched
  • Test --audio-device digiamp-plus on a spare device and confirm config.txt gets dtoverlay=rpi-digiampplus + dtparam=audio=off, then reboot and confirm aplay -l shows the HAT as card 0

🤖 Generated with Claude Code

thomaseleff and others added 7 commits June 22, 2026 15:54
Replace DietPi-only autostart hook and dietpi-set_hardware soundcard
call with a proper systemd service unit per role (audera-player as
oneshot, audera-streamer as long-running). Write streamer asound.conf
unconditionally without reading /boot/dietpi.txt.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Write a global NetworkManager policy (wifi.powersave = 2) in both
provision scripts and pass 802-11-wireless.powersave=2 to every
nmcli connection add call in netifaces.connect() to prevent the
driver from dropping the link during silence.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Set silence_threshold and silence_timeout to null and
stop_on_rate_change to false so the ALSA device stays open
continuously. Closing the device after 10s of silence causes
the HDMI sink to de-clock, resulting in audio dropout.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Append hdmi_force_hotplug, hdmi_drive, and related overlays to
/boot/firmware/config.txt to stabilise the HDMI audio output at
boot. Add a camilladsp-hdmi-wait.path unit that holds CamillaDSP
until /dev/snd/pcmC0D0p exists so it never races the HDMI device.
camilladsp.service is no longer directly enabled; the path unit
activates it once the device node appears.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Write /etc/profile.d/50-audera-banner.sh on both player and streamer
to display the Audera logo and remind operators to use nmcli and
/boot/firmware/config.txt instead of dietpi-config for WiFi and
audio hardware management.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add tests/docker/camilladsp/ with a Dockerfile (Dummy ALSA backend,
port 1234) and a minimal config.yml. Replace the in-process websocket
mock fixtures with a session-scoped camilladsp_container fixture that
waits for the real binary to accept WebSocket connections. Pure unit
tests (percent_to_db, db_to_percent, error path) no longer require a
live connection and use a locally constructed client instead. Update
tests/AGENTS.md with the Docker build prerequisite.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@thomaseleff thomaseleff changed the base branch from main to v0.1.0-beta.1 June 24, 2026 02:06
thomaseleff and others added 12 commits June 23, 2026 21:08
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces the pre-built image approach with DockerImage so the fixture
is self-contained. Removes the manual docker build step from CI and
the pre-build instruction from tests/AGENTS.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces the inline bash-c install command with a proper Dockerfile
and entrypoint script under tests/docker/snapserver/, matching the
CamillaDSP testcontainer pattern.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Mirror the setup.sh approach: wget to /tmp first, then tar, matching
the pattern used in the player and streamer provision scripts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Release assets use 'amd64' not 'x86_64'. test_error_response_raises
needs a live CamillaDSP instance to return an error response — connect
to localhost:0 raises a connection error, not RuntimeError.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… responses

Bind CamillaDSP WebSocket to 0.0.0.0 so Docker port forwarding can reach it
(default 127.0.0.1 loopback is unreachable via bridge NAT). Fix _call to detect
{'Invalid': ...} error responses for unknown commands. Fix test_set_config to
send a complete config with the devices section and assert only the changed keys.
Harden _wait_for_websocket against Windows named pipe timeouts on get_logs().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
vc4-fkms-v3d never creates the vc4-hdmi platform device that
snd_soc_hdmi_codec needs, so no HDMI ALSA soundcard ever appeared.
Switch to vc4-kms-v3d (confirmed working across Zero 2W, Pi 4, and
Pi 5) and add vc4.force_hotplug=3 so HDMI comes up even headless.

Extract the config-injection logic into a shared os/dietpi/lib/config.sh,
fetched by both setup.sh scripts the same way they already fetch
themselves, and make each setting idempotent per-key (replaces an
active or commented-out line, appends if absent) instead of relying
on a block-comment header.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…rvice directly

The path unit was the only thing triggering CamillaDSP at boot since the
service itself was never enabled. Restart=always already retries on
failure, so enabling the service directly and letting it fail-and-retry
until the sound card is ready achieves the same result without a
hardcoded /dev/snd/pcmC0D0p path that only matched the DigiAMP+ default.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
setup.sh unconditionally wrote dtoverlay=vc4-kms-v3d on every
provision/re-provision run, silently overwriting the dtoverlay DietPi wrote
at flash-time for non-HDMI hardware (e.g. rpi-digiampplus). Add an optional
--audio-device flag to provision.sh (hdmi, digiamp-plus, dac-plus,
hifiberry-dac-plus) that is passed through to setup.sh; when omitted, the
existing dtoverlay is left untouched.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Player and streamer setup.sh scripts duplicated root check, ALSA loopback
setup, dtoverlay config, CamillaDSP install, uv/audera CLI install,
ifupdown purge, NetworkManager setup, WiFi power-save, the ASCII logo,
boot banner, and camilladsp.service unit. Move these into lib/config.sh
and a new lib/common.sh so future fixes only need to land in one place.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant