fix: display Bluetooth MAC addresses in conventional MSB-first order

bdAddr bytes are stored LSB-first (HCI wire order) throughout the stack,
but the bluetooth app and btbonds tool formatted them LSB-first too, so
every MAC displayed byte-reversed. Print addr[5] down to addr[0] instead.
Display-only change; wire-order parsing and syscalls untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-08 10:57:48 +02:00
parent c03abeb2a1
commit 1fd63d8d1f
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -297,9 +297,9 @@ static void refresh_devices() {
}
if (!found) {
snprintf(g_device_names[i], 64, "%02X:%02X:%02X:%02X:%02X:%02X",
g_devices[i].bdAddr[0], g_devices[i].bdAddr[1],
g_devices[i].bdAddr[2], g_devices[i].bdAddr[3],
g_devices[i].bdAddr[4], g_devices[i].bdAddr[5]);
g_devices[i].bdAddr[5], g_devices[i].bdAddr[4],
g_devices[i].bdAddr[3], g_devices[i].bdAddr[2],
g_devices[i].bdAddr[1], g_devices[i].bdAddr[0]);
}
}
}
@@ -374,7 +374,7 @@ static const char* device_class_str(uint32_t cod) {
static void format_addr(char* buf, int len, const uint8_t* addr) {
snprintf(buf, len, "%02X:%02X:%02X:%02X:%02X:%02X",
addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
addr[5], addr[4], addr[3], addr[2], addr[1], addr[0]);
}
static const char* rssi_bar(int8_t rssi) {