bluez/bluetooth-check

31 lines
684 B
Plaintext
Raw Normal View History

#!/bin/sh
# Run "initctl log-priority info" to get debug from
# upstart about events being processed, or pass
# --debug to your kernel arguments
emit_event()
{
/sbin/initctl emit --no-wait $1
}
# If any of those paths are read-only, bail
if `mount | grep "on / type" | grep -q ro` ; then
return 1;
fi
# If the action is add, we always have an adapter
if test "x$ACTION" = "xadd" ; then
emit_event fedora.bluetooth-adapter-available
exit 0
fi
# Check whether any devices are available
if `udevadm info --export-db | grep -q -e '/devices/.*/bluetooth/.*'` ; then
emit_event fedora.bluetooth-adapter-available
else
emit_event fedora.bluetooth-adapter-not-available
fi
exit 0