2

Previously we had an issue: if there is a change of characteristics in the new build of our firmware, then the app will get the wrong data. By saying changed characteristics, it can be an added or removed characteristic, or adding notification to an existing characteristic. In order to keep the pairing information, the "/var/lib/bluetooth" folder is copied over to the new build's partition. We realized that there is no "service changed indication". The app can't handle the changed services. So we disabled the bluetooth cache by set this in "/etc/bluetooth/main.conf":

[GATT]
Cache = no

But recently, we saw the problem again even if the bluetooth cache is disabled: in the build number 101, a characteristic is removed. But when we upgrade the build from 100 to 101, the app gets the wrong data. We looked at the log. When the app tries to read temperature by using the temperature UUID, somehow the bluetooth service we created received the request to read the "device name"(device name UUID). So the "device name" is returned to the app as the temperature. This looks like the same behavior as the bluetooth cache is not disabled. I looked at the "/var/lib/bluetooth/[BT_MAC]/cache" folder. There is no "[Attributes]" section in the files in the folder. That means the disabled cache seems working.

The only way to fix this issue is to force exit the app and "Forget This Device" in iOS or "Unpair" in Android.

I looked at the btmon log. For the working btmon log, there is "Attribute group list: XX entries" under "ACL Data TX". But there is no "Attribute group list: XX entries" under "ACL Data TX" in the problematic btmon log.

Questions:

  1. How is it possible that this still happens even if the bluetooth cache is disabled?
  2. Is this the problem on the Linux side which runs the GATT server or on the mobile side?
  3. Is there anything else we should look into?

We're going to release our product soon. This is a critical issue for us. Please help if you have any suggestions.

Thanks!

user1556331
  • 345
  • 2
  • 12
  • This is most certainly a problem on the mobile side. iOS does cache every BLE device unless it has implemented the Service Changed Characteristic. If an android device cached a BLE device it needs to receive a Service Changed indication. – Michael Kotzjan Apr 13 '21 at 07:47
  • We'd like to support "Service Changed Indication" on GATT server side, but don't know how to do it. Our GATT server is based on https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-gatt-server. Someone mentioned "if you are registering the services with Bluetoothd then it should generate the service change". Does it mean we need to call RegisterApplication()? We did. But we never saw "[ServiceChanged]" secion(https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/settings-storage.txt#n321). Do you know how to add "Service Changed Indication" on the GATT server side? – user1556331 Apr 13 '21 at 17:47

0 Answers0