Which system do you use? Android, Ubuntu, OOWOW or others?
Android
Which version of system do you use? Khadas official images, self built images, or others?
Self build based on v230621, modified to allow USB peripheral without prompt
Please describe your issue below:
We currently have a lot (around 20) VIM4s in service, they are running an in-house Android application which connect to an iPad over Bluetooth Low Energy. We’ve noticed a bug where the iPads will see multiple VIM4s advertising as a singular device, and making it impossible to know definitively which device the iPad is connecting to. We’ve tracking this down to some devices sharing a Bluetooth MAC address, which is included in the BLE advertising packets, and the iPad is unable to distinguish between different physical devices.
This isn’t a one off case, we’ve observed a handful of devices each sharing the same MAC address. My understanding is that Bluetooth MAC addresses should be unique to each device, but that some manufacturers do not follow this standard. These MAC address collisions are seriously harming our use case for the VIM4 because we’re unable to rely on being able to connect to the correct device.
Does anybody have any suggestions on how to resolve this? Even if we can trick Android into thinking the chip has a different MAC address, or if there’s a way to hijack the lower level advertising packet from the application layer? Are there places in the Android OS where we can modify the value? Is there a way to change it from U Boot?
@sqrtc View Bluetooth device address changes in the settings application. If the device is restored to its factory settings, the Bluetooth device address will also change after the settings are applied. The Bluetooth device address is randomly assigned. So you can try restoring the factory settings and see if the Bluetooth device address has changed on your end?
Hi @goenjoy. Thanks for this answer. The Bluetooth address does change when I reset the device which is helpful to know.
I currently have around 20 devices setup and configured, not in easy reach to reset and start again. Is there any other method to updating the MAC address without having to wipe each device?
@sqrtc Even if it is randomly assigned, the probability is almost non-existent. Can you take screenshots of the same address and take a look? How many other duplicates are there?
In addition, if you want to achieve uniqueness in your application, the final solution is to use Ethernet’s MAC Addr, which will be more reliable.
@goenjoy I was also surprised about the collisions. Attached are photos from two different devices, but I have observed this specific MAC address on at least 4 devices, including the one I reset earlier to generate a different MAC address.
I am using BLE in my application on the VIM4, so I’m under the assumption that the Ethernet MAC address wouldn’t be any use in this situation,
@sqrtc This is strange, as it is a random allocation, we are powerless. It can only be changed by restoring the factory settings. Perhaps you can filter out this special address in the application.
@goenjoy If it is generated randomly when the OS is initialised, there must be a file or config somewhere deep in the OS with this MAC Address. If it is changeable by factory reset, it must be changeable by other means. I have previously located this file at data/misc/bluedroid/bt_config.conf
Changing the device name in the Android settings updates the name in the file, however changing either the name or address in the file doesn’t have any effect.
There is also the settings CLI. settings get secure bluetooth_address will return 22:22:aa:6d:bf:fa, trying to set the BT address like settings put secure bluetooth_address 22:22:F4:51:21:97 will return the updated BT address but has no effect on the device.