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 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html