Add Bluetooth audio/HID/discoverability/alias support, fix SD card hotplug & caller ID matching, and expand ReMEdy J2ME JSRs + 64MB GC
This commit is contained in:
1 parent
456d3fbc42
commit
471916424e
51 files changed
+2961
-305
No files matched your search
@@ -2,12 +2,15 @@
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
# Copyright 2022 Sxmo Contributors
|
||||
|
||||
# Must be run as root
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
exec doas -n /usr/bin/sxmo_bluetoothtoggle.sh "$@"
|
||||
fi
|
||||
|
||||
. sxmo_common.sh
|
||||
|
||||
on() {
|
||||
rfkill unblock bluetooth
|
||||
modprobe -q uhid hidp uinput rfcomm bnep xpad 2>/dev/null || true
|
||||
|
||||
if [ -d /run/systemd/system ]; then
|
||||
systemctl start bluetooth
|
||||
@@ -17,7 +20,34 @@ on() {
|
||||
rc-update add bluetooth
|
||||
fi
|
||||
sleep 0.4
|
||||
bluetoothctl power on >/dev/null 2>&1 || true
|
||||
timeout 2 bluetoothctl power on >/dev/null 2>&1 || true
|
||||
|
||||
bt_name=""
|
||||
if [ -r /home/user/.config/sxmo/bt_name ]; then
|
||||
IFS= read -r bt_name < /home/user/.config/sxmo/bt_name 2>/dev/null || true
|
||||
fi
|
||||
if [ -z "$bt_name" ]; then
|
||||
bt_name="$(hostname 2>/dev/null || cat /etc/hostname 2>/dev/null || printf "Bananarchy")"
|
||||
fi
|
||||
if [ -n "$bt_name" ]; then
|
||||
timeout 2 bluetoothctl system-alias "$bt_name" >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
bt_disc="1"
|
||||
if [ -r /home/user/.config/sxmo/bt_discoverable ]; then
|
||||
IFS= read -r bt_disc < /home/user/.config/sxmo/bt_discoverable 2>/dev/null || true
|
||||
fi
|
||||
timeout 2 bluetoothctl discoverable-timeout 0 >/dev/null 2>&1 || true
|
||||
timeout 2 bluetoothctl pairable on >/dev/null 2>&1 || true
|
||||
case "$bt_disc" in
|
||||
0|off|OFF|no|NO|false|FALSE)
|
||||
timeout 2 bluetoothctl discoverable off >/dev/null 2>&1 || true
|
||||
;;
|
||||
*)
|
||||
timeout 2 bluetoothctl discoverable on >/dev/null 2>&1 || true
|
||||
;;
|
||||
esac
|
||||
|
||||
/usr/bin/bananarchy-bt-obex start >/dev/null 2>&1 &
|
||||
}
|
||||
|
||||
@@ -33,15 +63,22 @@ off() {
|
||||
rfkill block bluetooth
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
case "${1:-toggle}" in
|
||||
on)
|
||||
on
|
||||
;;
|
||||
off)
|
||||
off
|
||||
;;
|
||||
status)
|
||||
if rfkill list bluetooth -no ID,SOFT,HARD | grep -vq " blocked" && pidof -s bluetoothd >/dev/null 2>&1; then
|
||||
echo "on"
|
||||
else
|
||||
echo "off"
|
||||
fi
|
||||
;;
|
||||
*) # toggle
|
||||
if rfkill list bluetooth -no ID,SOFT,HARD | grep -vq " blocked"; then
|
||||
if rfkill list bluetooth -no ID,SOFT,HARD | grep -vq " blocked" && pidof -s bluetoothd >/dev/null 2>&1; then
|
||||
off
|
||||
else
|
||||
on
|
||||
|
||||
Reference in new issue
Block a user