updated hardcoded pairlist via btctl paired-devices

This commit is contained in:
2020-07-04 20:46:36 +02:00
parent 01d0375225
commit 898ea9dc74
2 changed files with 14 additions and 3 deletions

11
bt
View File

@ -42,10 +42,21 @@ scan(){
fi
}
#Check bluetoothctl paired-devices for new devices to be hardcoded into pair list
update_pair_list(){
btctl_paired_devices="$(bluetoothctl paired-devices)"
if [ -n "$btctl_paired_devices" ]
then
btctl_not_in_list="$( echo "$btctl_paired_devices" | grep -vf "$PAIRLIST")"
[ -n "$btctl_not_in_list" ] && echo "$btctl_not_in_list" >> "$PAIRLIST"
fi
}
#start scanning as early as possible to speed up pairing process
#=> maybe use an option to do this? Otherwise ever invocation of bt powers on the controller.
power on
scan on
update_pair_list &
#Compile list of all Bluetooth IDS of paired devices (from bluetoothctl and from hardcoded list)
bt_IDS="$( ( bluetoothctl paired-devices && cat "$PAIRLIST" ) | sort -u | awk '{print $2}' )"