I noticed bluetoothd throwing some errors in syslog related to uinput, a
module which wasn't loaded, so I added it to /etc/modules. This was
fortunate as soon after I realized I could use inotifywait to watch for
event devices created by uinput when a bluetooth device connects to the
system.
Code:
--------------------
apk add inotify-tools
--------------------
This is the first whack at a script to restart the alsaloop process when
my bluetooth headset connects. On disconnect I'm not doing anything,
just letting the alsaloop process error out and then restarting it via
the script next time it connects.
Code:
--------------------
#!/bin/sh
while :
do
if inotifywait -r -e create /dev/input/
then
pdevs=$(bluetoothctl paired-devices | cut -d' ' -f2)
for pdev in ${pdevs}
do
if bluetoothctl info "${pdev}" | tr -d '\n' | grep -Eq 'Connected: yes.*Audio
Sink'
then
if ! ps | grep "[D]EV=${pdev}"
then
for i in $(seq 0 7)
do
if ! ps | grep -q "[L]oopback,1,${i}"
then
break
fi
done
alsaloop -C hw:Loopback,1,${i} -P
bluealsa:SRV=org.bluealsa,DEV=${pdev},PROFILE=a2dp -t 500000
fi
fi
done
fi
done
--------------------
I think that's most of the hacky pieces in place?
------------------------------------------------------------------------
sodface's Profile: http://forums.slimdevices.com/member.php?userid=19057
View this thread: http://forums.slimdevices.com/showthread.php?t=112536
_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix