| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #!/bin/sh
- state=""
- while :; do
- alsa_four=0
- for stream in /proc/asound/card*/stream0; do
- [ -r "$stream" ] || continue
- grep -q '^BEHRINGER UMC404HD' "$stream" || continue
- if awk '
- /^Capture:/ { capture=1; next }
- capture && /Channels: 4/ { found=1 }
- END { exit !found }
- ' "$stream"; then
- alsa_four=1
- fi
- break
- done
- if [ "$alsa_four" -ne 1 ]; then
- if [ "$state" != "usb" ]; then
- echo "UMC absente ou moins de 4 canaux ALSA : pas de redémarrage WirePlumber"
- fi
- state="usb"
- sleep 20
- continue
- fi
- ports=$(pw-link -o 2>/dev/null |
- grep -c '^alsa_input\.usb-BEHRINGER_UMC404HD_192k-00\..*:capture_')
- if [ "$ports" -ne 4 ]; then
- echo "UMC : 4 canaux ALSA, mais $ports ports de capture PipeWire ; redémarrage WirePlumber"
- state="pipewire"
- systemctl --user restart wireplumber.service
- sleep 60
- else
- if [ "$state" != "ok" ]; then
- echo "UMC : 4 canaux de capture disponibles dans PipeWire"
- fi
- state="ok"
- sleep 20
- fi
- if systemctl --user is-active --quiet sooperlooper.service && pw-link -i | grep -Fqx 'sooperlooper:loop0_in_4'; then
- links=$(pw-link -l 2>/dev/null) || links=''
- if ! printf '%s\n' "$links" |
- grep -Fq '|-> sooperlooper:loop0_in_1'; then
- echo "Liens SooperLooper absents : lancement de do-plugs.sh"
- bash /home/olimex/config-looper/do-plugs.sh
- fi
- fi
- done
|