fixed pairing crash

This commit is contained in:
Alexander Bocken 2021-04-17 15:45:40 +02:00
parent 2726f0c0fd
commit 65e57ca2da
Signed by: Alexander
GPG Key ID: 1D237BE83F9B05E8

4
bt
View File

@ -118,8 +118,8 @@ pair(){
scan on scan on
#check whether $SCAN_PERIOD seconds has already passed since starting scanning, if not, wait for the rest of that time. #check whether $SCAN_PERIOD seconds has already passed since starting scanning, if not, wait for the rest of that time.
start_scan="$(cat /tmp/bt_start_scan$$)" start_scan="$(cat /tmp/bt_start_scan$$)"
if [ $((( "$(date +'%s')" - "$start_scan" ))) -lt $SCAN_PERIOD ]; then if [ $(( $(date +'%s') - $start_scan )) -lt $SCAN_PERIOD ]; then
sleep_period="$((( "$SCAN_PERIOD" - "$( date +'%s')" + "$start_scan" )))" sleep_period="$(( $SCAN_PERIOD - $( date +'%s') + $start_scan ))"
[ "$sleep_period" -gt 1 ] && plural="s" [ "$sleep_period" -gt 1 ] && plural="s"
notify-send "Bluetooth" "Searching for devices, please wait $sleep_period second$plural" notify-send "Bluetooth" "Searching for devices, please wait $sleep_period second$plural"
sleep "$sleep_period" sleep "$sleep_period"