Audio Overhaul

This commit is contained in:
Brad Stein 2025-06-29 23:36:01 -05:00
parent 6e384cca17
commit d8fb4e7e49

View File

@ -5,6 +5,8 @@
# • Stereo UAC2 speaker + microphone # • Stereo UAC2 speaker + microphone
set -euo pipefail set -euo pipefail
log() { printf '[lesavka-core] %s\n' "$*"; }
#────────────────────────────────────────────────── #──────────────────────────────────────────────────
# 1. Ensure overlay + kernel modules # 1. Ensure overlay + kernel modules
#────────────────────────────────────────────────── #──────────────────────────────────────────────────
@ -24,7 +26,7 @@ udevadm settle
#────────────────────────────────────────────────── #──────────────────────────────────────────────────
# 2. Wait for UDC device to appear (max 10s) # 2. Wait for UDC device to appear (max 10s)
#────────────────────────────────────────────────── #──────────────────────────────────────────────────
echo "[lesavka-core] ⏳ waiting for UDC to register ..." log "⏳ waiting for UDC to register ..."
UDC="" UDC=""
for _ in {1..100}; do # 100 × 100ms = 10s for _ in {1..100}; do # 100 × 100ms = 10s
UDC=$(ls /sys/class/udc 2>/dev/null | head -n1) && [[ -n $UDC ]] && break UDC=$(ls /sys/class/udc 2>/dev/null | head -n1) && [[ -n $UDC ]] && break
@ -32,12 +34,12 @@ for _ in {1..100}; do # 100 × 100ms = 10s
done done
if [[ -z $UDC ]]; then if [[ -z $UDC ]]; then
echo "[lesavka-core] ⚠️ UDC still absent - trying manual bind" log "⚠️ UDC still absent - trying manual bind"
for drv in dwc2 dwc3; do for drv in dwc2 dwc3; do
drv_root="/sys/bus/platform/drivers/$drv" drv_root="/sys/bus/platform/drivers/$drv"
[[ -d $drv_root ]] || continue [[ -d $drv_root ]] || continue
for node in /sys/bus/platform/devices/*usb*; do for node in /sys/bus/platform/devices/*usb*; do
node=${node##*/} # strip path → “1000480000.usb” node=${node##*/} # strip path
echo "$node" >"$drv_root/bind" 2>/dev/null || continue echo "$node" >"$drv_root/bind" 2>/dev/null || continue
done done
done done
@ -48,8 +50,8 @@ if [[ -z $UDC ]]; then
done done
fi fi
[[ -n $UDC ]] || { echo "❌ UDC not present after manual bind"; exit 1; } [[ -n $UDC ]] || { log "❌ UDC not present after manual bind"; exit 1; }
echo "[lesavka-core] ✅ UDC detected: $UDC" log "✅ UDC detected: $UDC"
#────────────────────────────────────────────────── #──────────────────────────────────────────────────
# 3. (Re)create gadget # 3. (Re)create gadget