updated hardcoded pairlist via btctl paired-devices

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

View File

@ -43,7 +43,7 @@ make uninstall
Here's a growing list of features that are not yet actively worked on but might be nice in the future. Currently I'm more concerned with reliability than fulfilling feature requests, but I'm still open to put some on this list.
- start scanning for new devices immediately at execution to save time when pairing new devices -> Implemented (I think, seems to be working at least)
- auto-trust newly paired devices/trust device via dmenu -> Implemented changeable via the AUTOTRUST variable in the beginning of bt, menu display adjusts accordingly
- start scanning for new devices immediately at execution to save time when pairing new devices -> *Implemented*
- auto-trust newly paired devices/trust device via dmenu -> *Implemented changeable via the AUTOTRUST variable in the beginning of bt, menu display adjusts accordingly*
- blacklist devices via dmenu
- update bthandler internal paired devices list if something new shows up via `bluetoothctl paired-devices` not already listed in the paired devices file
- update bthandler internal paired devices list if something new shows up via `bluetoothctl paired-devices` not already listed in the paired devices file -> *Implemented*

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}' )"