Files
bananarchy/overlay/rootfs/usr/bin/sxmo_bluetoothtoggle.sh
T
Luxferre 5d427e39ab Implement 0014 keypad debouncer, Sparkler LRA filter, standby fixes, and stage a1125 (ampere)
- Extend 0012 standby optimizations with removable-SD-only MMC_CAP_AGGRESSIVE_PM | MMC_CAP2_FULL_PWR_CYCLE in sdhci-msm, proxy mem clock and BIMC XO re-parenting + 0x45000 BIT(2) early-vote clear in qcom_q6v5_mss / gcc-msm8909, 100 MHz opp-99999975 floor across qcom-msm8909.dtsi and all 6 device DTS/DTBs, disabled-by-default Bluetooth with bt_enabled persistence, NM ipv6.method=ignore + standby wlan0/disable_ipv6 muting, and post-park DSDS signal hysteresis

- Add ABI-preserving system-core keypad debouncer patch 0014 (drivers/input/input.c key_debounce_ms + pm8941-pwrkey press/release chatter holdoff), replace ignored col-scan-delay-ms with col-scan-delay-us = <0x32> and raise DT debounce intervals across all 6 DTS/DTBs, configure per-target key_debounce_ms at boot and xset r rate 300 25, and add C/DTS verification in scripts/test-keypad-debouncer.py

- Isolate Nokia 8000 4G (nokia-sparkler / nokia-leo) media playback from the shared 157 Hz SPK_DRV vibrator channel via dynamic Speaker-only filtering in music.so, files.so, and ringtones.so, explicit RX3/SPK mixer zeroing on Earpiece/Headphones/Bluetooth routes in sxmo_audio.sh and preview plugins, and Sparkler/Leo-only /etc/mpv/mpv.conf provisioning

- Register upcoming build a1125 (ampere) in scripts/version.sh, scripts/check-rebuild.sh, AGENTS.md, and CHANGELOG.md, fix --for-rebuild pre-rebuild stale output checks in check-rebuild.sh/test-cover-dt.py, rebuild vmlinuz/DTBs/plugins and all 4 --mkinitfs target images stamped a1125 (ampere), and pin their verified SHA-256 checksums
2026-11-23 15:26:56 +02:00

106 lines
3.2 KiB
Bash
Executable File

#!/bin/sh
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2022 Sxmo Contributors
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 af_alg algif_hash algif_skcipher algif_rng algif_aead 2>/dev/null || true
chgrp input /dev/uinput 2>/dev/null || true
chmod 0660 /dev/uinput 2>/dev/null || true
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
if [ -s /etc/bananarchy/bt_mac ] && [ -x /usr/bin/bananarchy-engmenu-ctl ]; then
/usr/bin/bananarchy-engmenu-ctl apply-boot >/dev/null 2>&1 || true
fi
timeout 2 bluetoothctl power on >/dev/null 2>&1 || true
/usr/bin/bananarchy-bt-le-enable.sh >/dev/null 2>&1 || true
timeout 2 /usr/bin/btmgmt -i hci0 class 2 3 >/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="0"
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 pairable-timeout 0 >/dev/null 2>&1 || true
timeout 2 bluetoothctl pairable on >/dev/null 2>&1 || true
timeout 2 bluetoothctl discoverable-timeout 60 >/dev/null 2>&1 || true
case "$bt_disc" in
1|on|ON|yes|YES|true|TRUE)
timeout 2 bluetoothctl discoverable on >/dev/null 2>&1 || true
;;
*)
timeout 2 bluetoothctl discoverable off >/dev/null 2>&1 || true
;;
esac
mkdir -p /home/user/.config/sxmo
printf '1\n' > /home/user/.config/sxmo/bt_enabled
chown 10000:10000 /home/user/.config/sxmo /home/user/.config/sxmo/bt_enabled 2>/dev/null || true
/usr/bin/bananarchy-bt-obex start >/dev/null 2>&1 || true
}
off() {
/usr/bin/bananarchy-bt-obex stop >/dev/null 2>&1 || true
timeout 2 bluetoothctl disconnect >/dev/null 2>&1 || true
timeout 2 /usr/bin/btmgmt -i hci0 power off >/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
btpid="$(pidof -s bluetoothd 2>/dev/null || true)"
if [ -n "$btpid" ]; then
kill -KILL $(pidof bluetoothd) 2>/dev/null || true
fi
rfkill block bluetooth
rm -f /home/user/.config/sxmo/bt_enabled /run/bananarchy/bt-obex/ctrl_ready /run/bananarchy/bt-obex/bt_state.tsv 2>/dev/null || true
}
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" && pidof -s bluetoothd >/dev/null 2>&1; then
off
else
on
fi
;;
esac