onboard audio: JMISC HPH wiring, UCM fix, update scripts for git deploy
This commit is contained in:
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
# configure-usb-host.sh — Wait for USB audio interface in host mode.
|
||||
# Finds the first USB audio capture/playback device and writes device
|
||||
# info to /run/usb-audio-dev for Pd to use.
|
||||
#
|
||||
# When the Uno Q acts as USB host (MIDI controller + USB audio interface
|
||||
# connected via hub), the USB audio interface appears as a ALSA card
|
||||
# driven by snd-usb-audio.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
DEV_FILE="/run/usb-audio-dev"
|
||||
POLL_SECONDS=10
|
||||
|
||||
die() { echo "[USB-HOST] $*" >&2; exit 1; }
|
||||
info() { echo "[USB-HOST] $*"; }
|
||||
|
||||
info "Waiting for USB audio interface..."
|
||||
|
||||
for ((i = 0; i < POLL_SECONDS; i++)); do
|
||||
# Look for USB audio cards (not UAC1Gadget, not internal)
|
||||
cards=$(aplay -l 2>/dev/null | grep -i "usb" | grep -vi "gadget" || true)
|
||||
if [ -n "$cards" ]; then
|
||||
# Pick the first USB audio card
|
||||
card=$(echo "$cards" | head -1 | awk '{print $2}' | tr -d ':')
|
||||
info "Found USB audio card: $card"
|
||||
echo "hw:$card,0" > "$DEV_FILE"
|
||||
cat "$DEV_FILE"
|
||||
exit 0
|
||||
fi
|
||||
# Also check if any MIDI devices appeared
|
||||
if command -v aseqdump &>/dev/null; then
|
||||
midi_ports=$(aconnect -i -o -l 2>/dev/null | grep -i "usb" | head -1 || true)
|
||||
if [ -n "$midi_ports" ]; then
|
||||
info "Found USB MIDI device: $midi_ports"
|
||||
fi
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
die "No USB audio interface found after ${POLL_SECONDS}s (connect one and restart)"
|
||||
Reference in New Issue
Block a user