NRF BLE chip, with bonding - bt-agent in NoInputNoOutput mode can't "forget" device

446 Views Asked by At

First little project at a new place and I'm having some trouble - hoping I can get some ideas. We have a BLE device using an NRF chip one which we've just enabled security and bonding. We're hoping to get our linux test fixtures set up so that the devices can be paired and bonded without the operator needing to accept the bonding request for every device. In the field, the end user will need to bond a device to a smartphone at least once.

I set up an agent using bt-agent --compatibility=NoInputNoOutput as described here: https://www.kynetics.com/docs/2018/pairing_agents_bluez/

The bonding worked wonderfully without user interaction on my linux desktop (Ubuntu 20.10). Problem is, when I remove the agent, I had hoped that the bonding process would return to normal. It does not - it still doesn't require user interaction to establish the bonding. A similar operation completed from my Android phone works as expected after I "forget" the device.

I'm looking for more ideas as to how to reset the bonding/pairing of this device on my linux computer such that I can easily trade back and forth between needing user input and not (for testing and demonstration purposes). I've tried the following:

  • Remove the cache entry for my device in /var/lib/bluetooth//cache
  • Remove the device using bluetoothctl => remove aa:bb:cc:dd:ee:ff
  • Remove all agents using bluetoothctl => agent off (until no more agents remain)
  • probably some other things that aren't coming to mind right now

Regardless, the device automatically bonds when I click it in my Bluetooth list (or choose to connect in bluetoothctl). Any other thoughts on how I can return my linux box to a state where it's requiring user interaction for the bonding process?

thanks a million

1

There are 1 best solutions below

1
On

I would expect Remove the device using bluetoothctl => remove aa:bb:cc:dd:ee:ff to have removed the device and the bond information. Which leads me to suspect that your agent is still running in the background and being triggered on the request to do the pairing/bonding. My assumptions is that the agent registered by bt-agent would be unregistered when bt-agent exits. Could the bt-agent script still running in the background? Is the agent not unregistered on exit?

I don't have bt-agent on my system as it doesn't seem to be part of the standard BlueZ offering so I can't reproduce the issue. To get more debug information when pairing and exiting bt-agent, have separate terminals open with the following running to get more visibility of what is happening:

  • bluetootctl
  • journalctl -f -u bluetooth
  • sudo busctl monitor org.bluez
  • sudo btmon