4

I have a very strange issue with BlueZ (stock version 5.37 in Ubuntu 16.04). I am developing bluetooth periphery and I have just one development kit. In its firmware, I have changed name that is broadcasted. When I use:

hcitool lescan

,updated name for my device is shown. But when i use Qt5 library, old name is scanned. And looking in DBUS is showing that old name is cached. Is there any way to force DBUS to reload all paramaters? Or somehow dump everything?

janstepan
  • 246
  • 3
  • 9
  • In your firmware did you write into "Alias" property from org.bluez.Adapter1 interface ? – François Dupont Apr 18 '17 at 13:34
  • It’s worth noting that this is not a D-Bus issue, it’s an issue with BlueZ (or the way you’re using BlueZ). D-Bus is just an IPC protocol, and isn’t what’s doing the caching here. – Philip Withnall Apr 26 '17 at 13:06

1 Answers1

11

As it turned out, BlueZ is indeed keeping Bluetooth devices cache. It can be found in

/var/lib/blueooth

in folders named by MAC addresses. Deleting their content and restarting bluetooth service solves the issue for me.

janstepan
  • 246
  • 3
  • 9
  • 1
    Oh my gosh I thought I was going mad until I found this, Created new characteristics in my embedded device and neither my Qt app nor Bluez would see the new characteristics despite an older version of Bluez and my Android phone seeing the said characteristics. I also had to delete some information in the cache directory (of the computer's BT MAC address directory) pertaining to the MAC address of my embedded BLE device. Thanks a million for the answer. – DiBosco Aug 06 '19 at 17:16
  • I deduced that this must be what's happening, and here is the answer to confirm it. Strange "cache" behavior. Thanks! – PizzaBeer Sep 02 '21 at 10:07
  • 1
    BTW to disable this caching, editing /etc/bluetooth/main.conf did work for me. https://www.spinics.net/lists/linux-bluetooth/msg90150.html – PizzaBeer Sep 02 '21 at 10:14
  • I lost 5 hours of my life because of this. I encountered voodoo behavior with BlueZ when a device changes his characteristics table. Must disable cache AND clear cache once. – Pierre Oct 20 '22 at 21:28