On Tue, 2021-03-02 at 18:07 +0100, Mihai Emilian wrote: > Dear bluetooth community, > > I am trying to create a pairing agent using bluez API in C. > > The problem that I am trying to solve is autopairing from a known list > of MAC addresses (i.e auto-accept pairing for known devices in the > list). > > I tried registering a bluetooth agent with NoInputNoOutput capability. > However, when I try to access Pair, I receive Authentication Failed > error. > > Another problem here is that even if I call RequestDefaultAgent after > registration, it seems that the bluetooth settings agent (UI) is still > called and prompts me to yes/no. > > I have the following questions: > > From the api doc: > "Special permission might be required to become the default agent" > > - Is there anything else I have to do to acquire these permissions? > - The return value from RequestDefaultAgent and RegisterAgent is void. > How can I check whether my agent has been registered/became default? > - I also tried trusting the discovered device after registering the > agent and trying to make it default, which didn't make any difference > - is this required? You might want to look at ready made pairing tools, such as bt-agent in bluez-tools: https://github.com/khvzak/bluez-tools This is an example of using static pincode with unattended pairing: https://github.com/hadess/CHIP-bluetooth-speaker/blob/master/setup.sh#L73 The bt-agent pin code file can accommodate using bluetooth addresses, so something like: AA:BB:CC:DD:EE:FF * in the pin code file should work. Cheers > > Here's my source code: > https://pastebin.com/Wj3rdHy3 > > Thank you for your time. > > Best regards, > Mihai