Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bluetoothctl without any user interaction

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?

like image 200
Mark Avatar asked Jul 19 '16 11:07

Mark


People also ask

How do I turn off Bluetoothctl?

To exit the bluetoothctl interactive mode, simply type exit in the prompt.

What is Bluetoothctl agent?

Bluetoothctl is a client tool to interact with bluetoothd from the command line. It can be used also to create Agent objects with a specific capability interactively or using command line options.

What is BlueZ utils?

A set of tools to manage bluetooth devices for linux.


Video Answer


1 Answers

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/

like image 160
peter parker Avatar answered Sep 21 '22 02:09

peter parker