Last active
October 12, 2023 18:24
-
-
Save RamonGilabert/046727b302b4d9fb0055 to your computer and use it in GitHub Desktop.
Bluetoothctl automation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/expect -f | |
set prompt "#" | |
set address [lindex $argv 0] | |
spawn sudo bluetoothctl -a | |
expect -re $prompt | |
send "remove $address\r" | |
sleep 1 | |
expect -re $prompt | |
send "scan on\r" | |
send_user "\nSleeping\r" | |
sleep 5 | |
send_user "\nDone sleeping\r" | |
send "scan off\r" | |
expect "Controller" | |
send "trust $address\r" | |
sleep 2 | |
send "pair $address\r" | |
sleep 2 | |
send "0000\r" | |
sleep 3 | |
send_user "\nShould be paired now.\r" | |
send "quit\r" | |
expect eof |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i can't seem to use it. i get
": no such file or directory