Add Bluetooth OBEX file transfer helper and receiver daemon integration
This commit is contained in:
1 parent
80ec989b50
commit
51a1a91d42
2 files changed
+664
No files matched your search
+50
@@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
# Copyright 2022 Sxmo Contributors
|
||||
|
||||
# Must be run as root
|
||||
|
||||
. sxmo_common.sh
|
||||
|
||||
on() {
|
||||
rfkill unblock bluetooth
|
||||
|
||||
if [ -d /run/systemd/system ]; then
|
||||
systemctl start bluetooth
|
||||
systemctl enable bluetooth
|
||||
else
|
||||
rc-service bluetooth start
|
||||
rc-update add bluetooth
|
||||
fi
|
||||
sleep 0.4
|
||||
bluetoothctl power on >/dev/null 2>&1 || true
|
||||
/usr/bin/bananarchy-bt-obex start >/dev/null 2>&1 &
|
||||
}
|
||||
|
||||
off() {
|
||||
/usr/bin/bananarchy-bt-obex stop >/dev/null 2>&1 || true
|
||||
if [ -d /run/systemd/system ]; then
|
||||
systemctl stop bluetooth
|
||||
systemctl disable bluetooth
|
||||
else
|
||||
rc-service bluetooth stop
|
||||
rc-update del bluetooth
|
||||
fi
|
||||
rfkill block bluetooth
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
on)
|
||||
on
|
||||
;;
|
||||
off)
|
||||
off
|
||||
;;
|
||||
*) # toggle
|
||||
if rfkill list bluetooth -no ID,SOFT,HARD | grep -vq " blocked"; then
|
||||
off
|
||||
else
|
||||
on
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
Reference in new issue
Block a user