From 0edc5b51fb5e20f5ff299a71a66f49463df974f5 Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Mon, 29 Jun 2020 15:19:25 +0200 Subject: [PATCH] fix scanning for devices broke pairing --- bt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bt b/bt index 4fb1562..7e0ac8a 100755 --- a/bt +++ b/bt @@ -28,7 +28,9 @@ power(){ } scan(){ scanstatus="$( bluetoothctl show | grep Discovering | awk '{print $2}' )" - if [ "$1" = on ]; then + if [ "$1" = "on" ]; then + #sets variable in case scanning was already on before the start of bt + [ "$start_scan" = "" ] && start_scan="$( date +'%s' )" if [ "$scanstatus" = "no" ]; then bluetoothctl scan on & start_scan="$( date +'%s' )" @@ -36,7 +38,6 @@ scan(){ elif [ "$1" = off ]; then if [ "$scanstatus" = "yes" ]; then bluetoothctl scan off - start_scan="$( date +'%s' )" fi fi }