From 6e812a569bbefcf28e23435d7493fd319c2ec74c Mon Sep 17 00:00:00 2001 From: Isaac Hermida Date: Mon, 3 Apr 2023 16:38:45 +0200 Subject: [PATCH] ccimx93: bluetooth-init: fix how to set btaddr Use the specific hcitool vendor command to set the BT mac address. It is a custom vendor command (0x3f), and the field is 0x0022. The BT address is passed from last octet to first octet. https://onedigi.atlassian.net/browse/DEL-8346 Signed-off-by: Isaac Hermida --- .../bluez/bluez5-init/ccimx93/bluetooth-init | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-init/ccimx93/bluetooth-init b/meta-digi-dey/recipes-connectivity/bluez/bluez5-init/ccimx93/bluetooth-init index 6ceda69b4..a13439151 100644 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-init/ccimx93/bluetooth-init +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-init/ccimx93/bluetooth-init @@ -19,16 +19,21 @@ log() { printf "<3>iw612-bluetooth: %s\n" "${1}" >/dev/kmsg } +set_btaddr() { + bt_addr=$(echo $(fw_printenv -n btaddr) | awk -F ":" '{ for(i=NF;i>=1;i--) printf "0x%s ", $i }') + hcitool -i ${HCI_IFACE} cmd 0x3f 0x0022 0xfe 0x06 ${bt_addr} +} + bluetooth_start() { if ! [ -e "/proc/device-tree/bluetooth/mac-address" ]; then log "[ERROR] Bluetooth mac-address not found" return fi - BTADDR=$(hexdump -ve '1/1 "%02X" ":"' /proc/device-tree/bluetooth/mac-address 2>/dev/null | sed 's/:$//g') - hciattach -t5 /dev/ttyBt any 115200 flow nosleep "${BTADDR}" && \ + hciattach -t5 /dev/ttyBt any 115200 flow nosleep && \ hciconfig ${HCI_IFACE} up && \ sleep 0.2 && \ + set_btaddr && \ hcitool -i ${HCI_IFACE} cmd 0x3f 0x0009 0xc0 0xc6 0x2d 0x00 && \ sleep 0.2 && \ killall hciattach && \