Bluetoothctl without any user interaction
Asked Answered
R

1

12

Right now I can successfully pair and connect a phone to my machine without any user interaction in this way:

$bluetoothctl
#power on
#discoverable on
#pairable on
#agent NoInputNoOutput
#default-agent

from my phone I search for the BT device and it pairs and connectly automatically. Now I have two problems:

  1. it still asks to authorize services:

    Authorize service

    [agent] Authorize service 0000110e-0000-1000-8000-00805f9b34fb (yes/no):

but this is not good because I've specified NoInputNoOutput!

  1. how to trust a device? It's enough to type trust but I need to do this automatically for the same reason.

In general, is there any reliable C++ library to handle bluetooth connections and common profiles like A2DP and HFP?

Roxie answered 19/7, 2016 at 11:59 Comment(3)
I used the simple-agent test script and removed the ask confirmation.Roxie
Can you give us more details ? i have same problem tooDenning
I did try simple-agent , it works only once when I reboot the bluetooth device but it does not auto-trust other devices and I have to re-boot. any solution with bluetoothctl?Stutman
N
3

I used bt-agent with NoInputNoOutput capabilities and that didn't ask for any permissions for A2DP and HFPprofiles.

bt-agent --capability=NoInputNoOutput

check the link for more details. https://www.kynetics.com/docs/2018/pairing_agents_bluez/

Newish answered 18/4, 2021 at 3:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.