Fix Bluetooth 5.x/6.x headsets, Android OBEX prompts, and refresh a1120 images

- Scope WirePlumber 50-bluetooth.conf roles to [ a2dp_sink hsp_hs hfp_hf ], lock HFP to 8 kHz CVSD for QDSP6 INTERNAL_BT_SCO, enable dummy AVRCP player, and set LDAC ABR quality.
- Select BR/EDR bearer and ConnectProfile fallback for Classic Audio headsets while preserving LE bearer for HOGP devices, forward AVRCP media keys to music.so, bound discoverability to 60 s, fix SCO keepalive teardown/readiness and ATA call state sync, and suppress nokia-sparkler speaker haptic audio during BT SCO.
- Advertise Smartphone Class of Device (0x5a020c / btmgmt class 2 3), handle OBEX over both L2CAP SOCK_SEQPACKET and RFCOMM SOCK_STREAM via ObexPacketReader, and add NeoUI incoming file Accept/Reject dialog and configurable target folder picker in networks.so.
- Add scripts/test-bluetooth-headset.py and scripts/test-bluetooth-obex.py, and rebuild/pin verified a1120 (cocojamboo) images and release archives for nokia-argon, nokia-beatles, nokia-coconut, and nokia-sparkler.
This commit is contained in:
Luxferre committed 2026-11-17 10:33:09 +02:00
1 parent 0030dc3910
commit 36a5f8cb8a
29 files changed
+2011 -190

No files matched your search

@@ -8,4 +8,5 @@ if [ "$(id -u)" -ne 0 ]; then
exit 1
fi
/usr/bin/btmgmt -i hci0 class 2 3 >/dev/null 2>&1 || true
exec /usr/bin/btmgmt -i hci0 le on
File diff suppressed because it is too large. Load diff
+83 -12
View File
@@ -70,28 +70,91 @@ is_bt_hfp() {
esac
}
start_bt_sco_keepalive() {
bt_sink="$(find_bt_sink)"
[ -z "$bt_sink" ] && return 0
launch_bt_sco_pacat() {
bt_sink="$1"
[ -n "$bt_sink" ] || return 1
if [ -r /tmp/sxmo_bt_sco_keepalive.pid ]; then
read -r kpid < /tmp/sxmo_bt_sco_keepalive.pid 2>/dev/null || kpid=""
if [ -n "$kpid" ] && kill -0 "$kpid" 2>/dev/null; then
if [ -n "$kpid" ] && kill -0 "$kpid" 2>/dev/null && \
grep -qa 'pacat' "/proc/$kpid/cmdline" 2>/dev/null; then
return 0
fi
fi
if command -v pacat >/dev/null 2>&1; then
pacat --playback --device="$bt_sink" --rate=8000 --channels=1 --format=s16le /dev/zero >/dev/null 2>&1 &
printf "%d\n" "$!" > /tmp/sxmo_bt_sco_keepalive.pid 2>/dev/null || true
command -v pacat >/dev/null 2>&1 || return 1
pacat --playback --device="$bt_sink" --rate=8000 --channels=1 --format=s16le /dev/zero >/dev/null 2>&1 &
printf "%d\n" "$!" > /tmp/sxmo_bt_sco_keepalive.pid 2>/dev/null || true
return 0
}
apply_bt_sink_volume() {
pct="$1"
bt_sink="$(find_bt_sink)"
if [ "$pct" -gt 0 ]; then
if [ -n "$bt_sink" ]; then
pactl set-sink-mute "$bt_sink" 0 >/dev/null 2>&1 || true
pactl set-sink-volume "$bt_sink" "${pct}%" >/dev/null 2>&1 || true
fi
pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1 || true
pactl set-sink-volume @DEFAULT_SINK@ "${pct}%" >/dev/null 2>&1 || true
else
if [ -n "$bt_sink" ]; then
if is_bt_hfp && [ -r /tmp/sxmo_bt_sco_keepalive.want ]; then
pactl set-sink-volume "$bt_sink" 0% >/dev/null 2>&1 || true
else
pactl set-sink-mute "$bt_sink" 1 >/dev/null 2>&1 || true
fi
fi
pactl set-sink-mute @DEFAULT_SINK@ 1 >/dev/null 2>&1 || true
fi
}
start_bt_sco_keepalive() {
printf "1\n" > /tmp/sxmo_bt_sco_keepalive.want 2>/dev/null || true
bt_sink="$(find_bt_sink)"
if [ -n "$bt_sink" ]; then
launch_bt_sco_pacat "$bt_sink" || true
return 0
fi
if [ -r /tmp/sxmo_bt_sco_wait.pid ]; then
read -r wpid < /tmp/sxmo_bt_sco_wait.pid 2>/dev/null || wpid=""
if [ -n "$wpid" ] && kill -0 "$wpid" 2>/dev/null; then
return 0
fi
fi
(
_n=0
while [ "$_n" -lt 25 ]; do
sleep 0.1
[ -r /tmp/sxmo_bt_sco_keepalive.want ] || break
_sink="$(find_bt_sink)"
if [ -n "$_sink" ]; then
launch_bt_sco_pacat "$_sink" || true
_v="$(read_dev_vol Bluetooth)"
apply_bt_sink_volume "$(clamp_pct "${_v:-80}" 80)"
break
fi
_n=$(( _n + 1 ))
done
rm -f /tmp/sxmo_bt_sco_wait.pid 2>/dev/null || true
) >/dev/null 2>&1 &
printf "%d\n" "$!" > /tmp/sxmo_bt_sco_wait.pid 2>/dev/null || true
}
stop_bt_sco_keepalive() {
rm -f /tmp/sxmo_bt_sco_keepalive.want 2>/dev/null || true
if [ -r /tmp/sxmo_bt_sco_wait.pid ]; then
read -r wpid < /tmp/sxmo_bt_sco_wait.pid 2>/dev/null || wpid=""
rm -f /tmp/sxmo_bt_sco_wait.pid 2>/dev/null || true
[ -n "$wpid" ] && kill -TERM "$wpid" 2>/dev/null || true
fi
if [ -r /tmp/sxmo_bt_sco_keepalive.pid ]; then
read -r kpid < /tmp/sxmo_bt_sco_keepalive.pid 2>/dev/null || kpid=""
rm -f /tmp/sxmo_bt_sco_keepalive.pid 2>/dev/null || true
[ -n "$kpid" ] && kill -TERM "$kpid" 2>/dev/null || true
fi
pkill -TERM -f "pacat --playback --device=bluez_output" 2>/dev/null || true
for _bpid in $(ps 2>/dev/null | awk '/pacat --playback --device=bluez_output/ && !/awk/ {print $1}'); do
kill -TERM "$_bpid" 2>/dev/null || true
done
}
find_bt_sink() {
@@ -467,6 +530,16 @@ EOF
esac
fi
if [ "$dev" = "Bluetooth" ]; then
if [ "$eff_pct" -gt 0 ]; then
printf "0\n" > /tmp/sxmo_pw_sink_muted 2>/dev/null || true
else
printf "1\n" > /tmp/sxmo_pw_sink_muted 2>/dev/null || true
fi
apply_bt_sink_volume "$eff_pct"
return 0
fi
if [ "$eff_pct" -gt 0 ]; then
printf "0\n" > /tmp/sxmo_pw_sink_muted 2>/dev/null || true
pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1 || true
@@ -523,15 +596,13 @@ apply_vol_out() {
if [ "$eff_pct" -gt 0 ]; then
if [ "$pw_muted" != "0" ]; then
printf "0\n" > /tmp/sxmo_pw_sink_muted 2>/dev/null || true
pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1 || true
fi
pactl set-sink-volume @DEFAULT_SINK@ "${eff_pct}%" >/dev/null 2>&1 || true
else
if [ "$pw_muted" != "1" ]; then
printf "1\n" > /tmp/sxmo_pw_sink_muted 2>/dev/null || true
fi
pactl set-sink-mute @DEFAULT_SINK@ 1 >/dev/null 2>&1 || true
fi
apply_bt_sink_volume "$eff_pct"
return 0
fi
@@ -706,7 +777,7 @@ sync_pipewire_profile() {
elif [ "$in_dev" = "Bluetooth" ] && is_bt_hfp; then
start_bt_sco_keepalive
[ ! -r /tmp/sxmo_in_call ] && want_sco_mm=1
elif [ ! -r /tmp/sxmo_in_call ]; then
else
stop_bt_sco_keepalive
fi
@@ -25,7 +25,9 @@ on() {
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 /usr/bin/btmgmt -i hci0 class 2 3 >/dev/null 2>&1 || true
timeout 2 bluetoothctl power on >/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
@@ -38,18 +40,18 @@ on() {
timeout 2 bluetoothctl system-alias "$bt_name" >/dev/null 2>&1 || true
fi
bt_disc="1"
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 discoverable-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
0|off|OFF|no|NO|false|FALSE)
timeout 2 bluetoothctl discoverable off >/dev/null 2>&1 || true
1|on|ON|yes|YES|true|TRUE)
timeout 2 bluetoothctl pairable on >/dev/null 2>&1 || true
timeout 2 bluetoothctl discoverable on >/dev/null 2>&1 || true
;;
*)
timeout 2 bluetoothctl discoverable on >/dev/null 2>&1 || true
timeout 2 bluetoothctl discoverable off >/dev/null 2>&1 || true
;;
esac
@@ -17,6 +17,14 @@ switch_bt_card_hfp() {
pactl set-card-profile "$bt_card" headset-head-unit-cvsd >/dev/null 2>&1 || \
pactl set-card-profile "$bt_card" headset-head-unit >/dev/null 2>&1 || \
pactl set-card-profile "$bt_card" headset-head-unit-msbc >/dev/null 2>&1 || return 1
_w=0
while [ "$_w" -lt 15 ]; do
if pactl list short sinks 2>/dev/null | grep -q 'bluez_output\.'; then
break
fi
sleep 0.1
_w=$(( _w + 1 ))
done
return 0
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -18,11 +18,15 @@ wireplumber.settings = {
}
monitor.bluez.properties = {
bluez5.roles = [ a2dp_sink a2dp_source bap_sink bap_source hsp_hs hsp_ag hfp_hf hfp_ag ]
bluez5.codecs = [ sbc sbc_xq aac ldac aptx aptx_hd aptx_ll aptx_ll_duplex faststream faststream_duplex opus_05 opus_05_51 opus_05_71 opus_05_dup opus_05_pro lc3 ]
bluez5.roles = [ a2dp_sink hsp_hs hfp_hf ]
bluez5.codecs = [ sbc sbc_xq aac ldac aptx aptx_hd aptx_ll aptx_ll_duplex faststream faststream_duplex opus_05 opus_05_duplex ]
bluez5.enable-sbc-xq = true
bluez5.enable-msbc = false
bluez5.enable-lc3-a127 = false
bluez5.enable-hw-volume = true
bluez5.dummy-avrcp-player = true
bluez5.a2dp.ldac.quality = "auto"
bluez5.a2dp.aac.bitratemode = 0
bluez5.hfphsp-backend = "native"
bluez5.hfphsp-backend-native-modem = "any"
}