#!/bin/bash
#
# 8E:D7:2C:F8:32:6C HW-BT
MAC="8E:D7:2C:F8:32:6C"
IN=$1
if [ -z "$IN" ]; then
# default
IN=1
fi
if [ $IN -ge 6 ]; then
vim /etc/bluetooth/main.conf
elif [ $IN -ge 5 ]; then
# restart service
sudo systemctl restart bluetooth
elif [ $IN -ge 2 ]; then
# disconnect device
bluetoothctl disconnect $MAC
if [ $IN -ge 3 ]; then
# and reset device
bluetoothctl untrust $MAC
bluetoothctl remove $MAC
fi
else
# IN -eq 1 or default --
# scan devices;
bluetoothctl scan on
# use ctrl-c to stop scan and cont connect
if [ $IN -le 0 ]; then
# setup new device
bluetoothctl pair $MAC
fi
#while true; do
# connect device
bluetoothctl connect $MAC
# echo "trying again in 1..."
# sleep 1
#done
fi
Top