From 6a3096e36d88272d0ea6887c2696039843443c8c Mon Sep 17 00:00:00 2001 From: capitalistspz Date: Fri, 4 Oct 2024 22:41:54 +0100 Subject: [PATCH] Show bluetooth address in correct order. (It would be nice if `std::ranges::reverse_view` worked properly with clang 15) --- src/gui/PairingDialog.cpp | 6 ++++-- src/input/api/Wiimote/l2cap/L2CapWiimote.cpp | 10 ++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/gui/PairingDialog.cpp b/src/gui/PairingDialog.cpp index fb194aba..414a0e91 100644 --- a/src/gui/PairingDialog.cpp +++ b/src/gui/PairingDialog.cpp @@ -258,14 +258,16 @@ void PairingDialog::WorkerThread() char nameBuffer[HCI_MAX_NAME_LENGTH] = {}; // Get device name and compare. Would use product and vendor id from SDP, but many third-party Wiimotes don't store them - auto& addr = info->bdaddr; + const auto& addr = info->bdaddr; if (hci_read_remote_name(hostDesc, &addr, HCI_MAX_NAME_LENGTH, nameBuffer, 2000) != 0 || !isWiimoteName(nameBuffer)) { UpdateCallback(PairingState::SearchFailed); return; } - cemuLog_log(LogType::Force, "Pairing Dialog: Found '{}' with address {:02x}", nameBuffer, fmt::join(addr.b, ":")); + const auto& b = addr.b; + cemuLog_log(LogType::Force, "Pairing Dialog: Found '{}' with address '{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}'", + nameBuffer, b[5], b[4], b[3], b[2], b[1], b[0]); UpdateCallback(PairingState::Finished); L2CapWiimote::AddCandidateAddress(addr); diff --git a/src/input/api/Wiimote/l2cap/L2CapWiimote.cpp b/src/input/api/Wiimote/l2cap/L2CapWiimote.cpp index e924c586..351c279f 100644 --- a/src/input/api/Wiimote/l2cap/L2CapWiimote.cpp +++ b/src/input/api/Wiimote/l2cap/L2CapWiimote.cpp @@ -68,8 +68,9 @@ std::vector L2CapWiimote::get_devices() sendAddr.l2_bdaddr = addr; if (!AttemptConnect(sendFd, sendAddr) || !AttemptSetNonBlock(sendFd)) { - cemuLog_logDebug(LogType::Force,"Failed to connect send socket to '{:02x}': {}", - fmt::join(addr.b, ":"), strerror(errno)); + const auto& b = addr.b; + cemuLog_logDebug(LogType::Force,"Failed to connect send socket to '{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}': {}", + b[5], b[4], b[3], b[2], b[1], b[0], strerror(errno)); close(sendFd); continue; } @@ -87,8 +88,9 @@ std::vector L2CapWiimote::get_devices() recvAddr.l2_bdaddr = addr; if (!AttemptConnect(recvFd, recvAddr) || !AttemptSetNonBlock(recvFd)) { - cemuLog_logDebug(LogType::Force,"Failed to connect recv socket to '{:02x}': {}", - fmt::join(addr.b, ":"), strerror(errno)); + const auto& b = addr.b; + cemuLog_logDebug(LogType::Force,"Failed to connect recv socket to '{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}': {}", + b[5], b[4], b[3], b[2], b[1], b[0], strerror(errno)); close(sendFd); close(recvFd); continue;