I am trying to work with a third party device that is not really intended to be modified by another party such as myself. I have tried using bluetoothctl to pair with the device but it results in the following error:
Failed to pair: org.bluez.Error.AuthenticationCanceled
Fun note: The error has a miss spelling.
While pairing seems to not be an option due to some authentication issue, I can connect using:
connect XX:XX:XX:XX:XX:XX
This can however yield the following error:
[bluetooth]# connect XX:XX:XX:XX:XX:XX
Attempting to connect to XX:XX:XX:XX:XX:XX
[CHG] Device XX:XX:XX:XX:XX:XX Connected: yes
Failed to connect: org.bluez.Error.Failed
[CHG] Device XX:XX:XX:XX:XX:XX Connected: no
Which can be resolved by retrying – sometimes.
I think the easiest solution is to just make some bash script which will do the manual commands on start up but I cannot figure out how to do this for the life of me. If I try to pipe the command into bluetoothctl using echo and reading the response like so:
response=$(echo "connect ${Device I am targeting}" | bluetoothctl)
I only get a partial response:
Agent registered
[Device I am targeting]# connect XX:XX:XX:XX:XX:XX
Attempting to connect to XX:XX:XX:XX:XX:XX
I am new to bash so if anyone could point me to some resources for doing what I want to do, or an alternative better way, I would be very thankful.
Thanks.