Whoa, this is fast-moving thread! I thought I was all caught up, and
suddenly there are another dozen messages! :-)
I'm pretty impressed by chill's script. Nice work. Keeping track of
all that statefulness, via multiple entry points to the script, is
tricky. The self-installation is a nice touch.
I found the thread while looking for something somewhat related, and
thought I'd share my (partial) solution to the USB audio detection
problem. I also happen to have a set of H-K Soundstick speakers, which
I've only recently hooked up to picoreplayer. Keeping things going when
the speakers are turned off or unplugged is an issue.
So... my script relies on polling (which doesn't worry me in the
least), and probably won't cover many corner cases, but it serves my
purposes. It relies on the USB audio device coming and going from
/proc/asound when it's un/plugged.
The script is invoked as one of the "user commands" on the Tweaks page.
The copy here is trimmed from the script I actually run, since mine does
some other unrelated stuff as well, but I don't think I've introduced
any new bugs. It's pretty simple -- hope it might help someone.
paul (another one)
Code:
--------------------
#!/bin/sh
watch_usb_audio()
{
# loop forever
while :
do
# loop while the device exists
while [ -e /proc/asound/$audiodev ]
do
# if it only just became available...
if [ "$prev_usbaudio" != "present" ]
then
alsactl restore
/usr/local/etc/init.d/squeezelite restart
fi
prev_usbaudio=present
sleep 4
done
# loop while the device doesn't exist
while [ ! -e /proc/asound/$audiodev ]
do
prev_usbaudio=notpresent
sleep 4
done
done
}
audiodev=SoundSticks
watch_usb_audio &
exit
--------------------
------------------------------------------------------------------------
pgf's Profile: http://forums.slimdevices.com/member.php?userid=58510
View this thread: http://forums.slimdevices.com/showthread.php?t=113661
_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix