bluetooth-init: get the BT MAC address from the DT node

Retrieve the Bluetooth MAC address from the device tree (DT) node
rather than from the environment.
U-Boot will populate this address by default, but it can be
overridden with a custom MAC address specified directly in the DT,
which then takes priority.

Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
This commit is contained in:
Isaac Hermida 2025-12-02 12:27:49 +01:00
parent 052cd63529
commit cf27d3e201
3 changed files with 9 additions and 3 deletions

View File

@ -33,7 +33,9 @@ power() {
set_btaddr() {
hciconfig ${HCI_IFACE} up
sleep 0.2
bt_addr=$(echo "$(fw_printenv -n btaddr)" | awk -F ":" '{ for(i=NF;i>=1;i--) printf "0x%s ", $i }')
bt_addr=$(hexdump -v -e '1/1 "%02X "' /proc/device-tree/bluetooth/mac-address \
| awk '{ for(i=NF; i>0; i--) printf "0x%s ", $i }' \
| sed 's/ $//')
hcitool -i ${HCI_IFACE} cmd 0x3f 0x0022 0xfe 0x06 ${bt_addr}
hciconfig ${HCI_IFACE} down
sleep 0.2

View File

@ -43,7 +43,9 @@ bt_power() {
set_btaddr() {
hciconfig hci0 up
sleep 0.2
bt_addr=$(echo "$(fw_printenv -n btaddr)" | awk -F ":" '{ for(i=NF;i>=1;i--) printf "0x%s ", $i }')
bt_addr=$(hexdump -v -e '1/1 "%02X "' /proc/device-tree/bluetooth/mac-address \
| awk '{ for(i=NF; i>0; i--) printf "0x%s ", $i }' \
| sed 's/ $//')
hcitool -i hci0 cmd 0x3f 0x0001 ${bt_addr}
hciconfig hci0 down
sleep 0.2

View File

@ -32,7 +32,9 @@ bt_power() {
set_btaddr() {
hciconfig hci0 up
sleep 0.2
bt_addr=$(echo "$(fw_printenv -n btaddr)" | awk -F ":" '{ for(i=NF;i>=1;i--) printf "0x%s ", $i }')
bt_addr=$(hexdump -v -e '1/1 "%02X "' /proc/device-tree/bluetooth/mac-address \
| awk '{ for(i=NF; i>0; i--) printf "0x%s ", $i }' \
| sed 's/ $//')
hcitool -i hci0 cmd 0x3f 0x0001 ${bt_addr}
hciconfig hci0 down
sleep 0.2