[Debian] How could we set Bluetooth address BD_ADDR?

Hi All,

Is there any way to set Bluetooth address and don’t reset when device restart?
Base on the following topic Bluetooth Address same for all dragonboards - #3 by amirmamo
It seems we may need to add a script to do that.
Is there any way or file that we can set it by default?

Thanks.
Best regards,
Johnny

You can have a look at this thread:
https://bugs.96boards.org/show_bug.cgi?id=343

Nicolas provides a link to a systemd script.

Hi @Loic,

Thanks for the reply.
I have checked the bugs, it seems we need to change the property “local-mac-address”.
Sorry that I’m not that familiar with Debian.
For Android, I know we can add/modify some property in system.prop or somewhere else.
But I cannot find the path /proc/device-tree/soc/wcnss@a21b000/smd-edge/wcnss/bt/local-mac-address in my Debian source code.
Could you kindly help to hint again where can I set the property “local-mac-address”?

Thanks.

Best regards,
Johnny

Actually /proc is a virtual file system which does not contain ‘real’ files but virtual ones exposed by the Linux kernel.
/proc/device-tree contains an image of the Open Firmware device tree (DT), a description of the system hardware.

Having a unique BD address is critical, the board is provisioned with addresses in factory and the bootloader which has access to this provisioned data injects the ‘local-mac-address’ property in the device-tree which is then exported to the Linux kernel.

This is why you can see this property in:
/proc/device-tree/soc/wcnss@a21b000/smd-edge/wcnss/bt/local-mac-address

You don’t need to change this prop, but only read it (binary) to configure the Bluetooth controller with this unique address. Today you can use btmgmt tool to configure the controller address.
btmgmt public-addr 12:34:56:78:9A:BC

However we are currently working on a solution to integrate this in the driver in order to avoid relying on user/user-space to configure the Bluetooth address.

Hi @Loic,

Really thanks for your response.
So before the solution finished, it seems we can modify local-mac-address in device tree and re-build the image to change the BT address by default, right?
But I’m not sure which device tree is point to /wcnss/bt/local-mac-address.
Could you also help to give me a hint which device tree that I can add for BT?

Thanks.

Best regards,
Johnny

Yes but this is clearly not the recommended way since your device is already provisioned with a unique address.

You can add the following property in your DT inside the bt node:
local-mac-address = [00 12 34 56 78 9A];

You can find DT in kernel source:
kernel/arch/arm64/boot/dts/qcom/msm8916.dtsi

Please use this only for testing purpose, having a unique allocated BD address is critical.

Hi @Loic,

Thanks so much for your comment!!!
I’ll try it for testing purpose only.
BTW, do you have any idea when will solution may ready?

Thanks.

Best regards,
Johnny

Not really since this involves different people and depends on upstream acceptance, would like to have this closed before next month. You should be able to track the progress in bugzilla.

Hi @Loic,

Got it!
Thanks so much for your kindly support.

Best regards,
Johnny