From 898ea9dc742a1563f7bc5fb73dfd8305fbdbcdcf Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Sat, 4 Jul 2020 20:46:36 +0200 Subject: [PATCH] updated hardcoded pairlist via btctl paired-devices --- README.md | 6 +++--- bt | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bcecfea..6442b23 100644 --- a/README.md +++ b/README.md @@ -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* diff --git a/bt b/bt index d46e13a..8523ea6 100755 --- a/bt +++ b/bt @@ -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}' )"