29 lines
571 B
Bash
Executable File
29 lines
571 B
Bash
Executable File
#!/bin/bash
|
|
|
|
MAC_ADDRESS=""
|
|
read -p "Please enter MAC BT address: " MAC_ADDRESS
|
|
|
|
# Write the address into config file before
|
|
sed -i "s/MAC_ADDRESS/$MAC_ADDRESS/" config/agent.yaml
|
|
|
|
|
|
bluetoothctl -- power on
|
|
bluetoothctl -- agent on
|
|
sleep 10 # Time to give BT to start
|
|
|
|
bluetoothctl -- default-agent
|
|
bluetoothctl -- discoverable on
|
|
bluetoothctl -- pairable on
|
|
bluetoothctl -- scan on
|
|
|
|
# Try to pair now
|
|
bluetoothctl -- pair ${MAC_ADDRESS}
|
|
sleep 10
|
|
|
|
# Trust to device
|
|
bluetoothctl -- trust ${MAC_ADDRESS}
|
|
|
|
# Connect to device
|
|
bluetoothctl -- connect ${MAC_ADDRESS}
|
|
sleep 5
|