How to use the command line bluetoothctl to connect to a bluetooth device.
# Show controller status
bluetoothctl show
# if needed:
bluetoothctl power on
bluetoothctl discoverable on
bluetoothctl pairable on
# Scan for dersired device
bluetoothctl # to enter commandline app
scan on # to scan
# lots of scanning text scrolls by...
# ctrl-z to stop scanning
exit
# List them again nicely
mypc:~$ bluetoothctl devices
Device 5A:3B:A8:68:B0:58 LE-Bose QuietComfort 35
Device 0C:AE:BD:DB:46:CB EDIFIER R1280DB
Device 90:7A:58:95:DD:EA WI-C200
# Pair and connect
bluetoothctl pair 5A:3B:A8:68:B0:58
bluetoothctl connect 5A:3B:A8:68:B0:58
# Disconnect
bluetoothctl disconnect 5A:3B:A8:68:B0:58
script to connect to mouse:
bluetoothctl scan on
echo "Scanning for 12 seconds..."
sleep 12
bluetoothctl connect 12:34:57:48:87:E8
bluetoothctl scan off