onboard audio: JMISC HPH wiring, UCM fix, update scripts for git deploy

This commit is contained in:
2026-06-23 21:25:51 -07:00
parent a135dc4452
commit d239d58c44
22 changed files with 227 additions and 77 deletions
+26
View File
@@ -0,0 +1,26 @@
#!/bin/bash
# on-usb-role-change.sh — Called by udev on USB role/connect events.
# Re-detects role, stops/restarts Pd with appropriate config.
set -euo pipefail
ROLE_FILE="/run/usb-role"
LOG_TAG="[USB-HOTPLUG]"
# Debounce: skip if we just ran (within 3s)
LOCK="/tmp/usb-role-change.lock"
if [ -f "$LOCK" ]; then
age=$(($(date +%s) - $(stat -c %Y "$LOCK" 2>/dev/null || echo 0)))
[ "$age" -lt 3 ] && exit 0
fi
touch "$LOCK"
logger -t "$LOG_TAG" "USB role change event — re-detecting..."
/usr/local/bin/detect-usb-role.sh
# Restart Pd if it's running
if systemctl is-active pd-synth-auto &>/dev/null; then
logger -t "$LOG_TAG" "Restarting Pd with new role"
systemctl restart pd-synth-auto
fi