Thanks Bastien for your brief, but leading answer. Still, I feel like I'm missing something :( I've read the links carefully. The "CHIP-bluetooth-speaker" uses bluez-tools' bt-agent with parameters set so that it's using NoInputNoOutput capabilitiy, but requiring Passkey at the same time. This is exactly what I want! No having bluez-tools in my setup, I tried to make my own programmed agent behave similarly, i.e. according to your hint, implement the RequestPasskey method in my agent. However, this method is never called! When pairing a phone, BlueZ only calls the AuthorizeService method of my agent. How can I force BlueZ to call the RequestPasskey method of my agent? I tried to analyze how bluez-tools do it, but I haven't find anything in their code. They seem to simply work... Thanks much! Libor -----Original Message----- From: Bastien Nocera [mailto:hadess@xxxxxxxxxx] Sent: Mittwoch, 8. August 2018 17:15 To: Libor Peltan <lpeltan@xxxxxxxxxxxx>; linux-bluetooth@xxxxxxxxxxxxxxx Subject: Re: bt "server" how to configure requiring passkey from connecting clients On Wed, 2018-08-08 at 14:31 +0000, Libor Peltan wrote: > Hi Bastien, > Thanks much for your answer. > > Even if programmed my own pairing agent, I can't see how I could > achieve having fixed PIN for incomming requests. > > When I register my agent, I can choose one of following capability > options [accorging to BlueZ Agent API]: > - NoInputNoOutput, DisplayYesNo, KeyboardOnly: I can just > programatically decide based on the client's BD address if I accept > the pairing or not > - DisplayOnly, KeyboardDisplay: at the time of pairing, the agent > receives already the PIN, and can just decide if it's accepted. But > this PIN is not entered by the mobile phone (client) user, it's just > fabriqued (randomly?) somewhere inside the pairing process. Actually, > the mobile phone user is queried with the same PIN and can only accept > it too. > > All in all, my agent is never asked to return the PIN. > > The agents built-in in bluetoothctl or the bluez-tools you pointed to, > behave rouhly the same. > > Am I missing something, some other usecase of pairing agent? > > It seems weird to me that for old version of BlueZ (4?), I have found > something like 'bluetooth-agent 1234' command instantly doing what I > need... But I don't know exactly. This, up to line 100: https://github.com/hadess/CHIP-bluetooth-speaker/blob/master/setup.sh#L73 is the example of a script that creates a fixed PIN, for all clients, with bluez-tools' bt-agent running as a service. Ideally, you would start this after some sort of physical interaction with your device, or have an "uncommon" pincode (a password of sorts, eg. not 0000 or 1111), otherwise your neighbours will be able to pair with your device. If you want to use a fixed pin code in your agent, you'd need to use the NoInputNoOutput capability, and implement the RequestPasskey function so that you can provide the passkey to be used. Cheers