smarter scanning period in re-pairing mode
This commit is contained in:
parent
1223574c2b
commit
2fb43032b7
10
bt
10
bt
@ -263,9 +263,15 @@ case $choice in
|
|||||||
all_devices="$(bluetoothctl devices | cut -d' ' -f2)"
|
all_devices="$(bluetoothctl devices | cut -d' ' -f2)"
|
||||||
if ! echo "$dev_id" | grep -q "$all_devices"; then
|
if ! echo "$dev_id" | grep -q "$all_devices"; then
|
||||||
scan on
|
scan on
|
||||||
|
start_scan="$(cat /tmp/bt_start_scan$$)"
|
||||||
echo "Scan on"
|
echo "Scan on"
|
||||||
notify-send "bt" "Scanning for new devices..."
|
notify-send "bt" "Scanning for new devices until wanted device has been found"
|
||||||
sleep "$SCAN_PERIOD"
|
while ! echo "$dev_id" | grep -q "$all_devices"; do
|
||||||
|
sleep 1
|
||||||
|
all_devices="$(bluetoothctl devices | cut -d' ' -f2)"
|
||||||
|
time_scanned="$(( $(date +'%s') - start_scan ))"
|
||||||
|
[ "$time_scanned" -gt 30 ] && exit 1
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
echo Attempting to pair...
|
echo Attempting to pair...
|
||||||
bluetoothctl pair "$dev_id"
|
bluetoothctl pair "$dev_id"
|
||||||
|
Loading…
Reference in New Issue
Block a user