Show bluetooth address in correct order.

(It would be nice if `std::ranges::reverse_view` worked properly with clang 15)
This commit is contained in:
capitalistspz 2024-10-04 22:41:54 +01:00
parent c7abd7a42a
commit 6a3096e36d
2 changed files with 10 additions and 6 deletions

View File

@ -258,14 +258,16 @@ void PairingDialog::WorkerThread()
char nameBuffer[HCI_MAX_NAME_LENGTH] = {}; 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 // 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, if (hci_read_remote_name(hostDesc, &addr, HCI_MAX_NAME_LENGTH, nameBuffer,
2000) != 0 || !isWiimoteName(nameBuffer)) 2000) != 0 || !isWiimoteName(nameBuffer))
{ {
UpdateCallback(PairingState::SearchFailed); UpdateCallback(PairingState::SearchFailed);
return; 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); UpdateCallback(PairingState::Finished);
L2CapWiimote::AddCandidateAddress(addr); L2CapWiimote::AddCandidateAddress(addr);

View File

@ -68,8 +68,9 @@ std::vector<WiimoteDevicePtr> L2CapWiimote::get_devices()
sendAddr.l2_bdaddr = addr; sendAddr.l2_bdaddr = addr;
if (!AttemptConnect(sendFd, sendAddr) || !AttemptSetNonBlock(sendFd)) { if (!AttemptConnect(sendFd, sendAddr) || !AttemptSetNonBlock(sendFd)) {
cemuLog_logDebug(LogType::Force,"Failed to connect send socket to '{:02x}': {}", const auto& b = addr.b;
fmt::join(addr.b, ":"), strerror(errno)); 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); close(sendFd);
continue; continue;
} }
@ -87,8 +88,9 @@ std::vector<WiimoteDevicePtr> L2CapWiimote::get_devices()
recvAddr.l2_bdaddr = addr; recvAddr.l2_bdaddr = addr;
if (!AttemptConnect(recvFd, recvAddr) || !AttemptSetNonBlock(recvFd)) { if (!AttemptConnect(recvFd, recvAddr) || !AttemptSetNonBlock(recvFd)) {
cemuLog_logDebug(LogType::Force,"Failed to connect recv socket to '{:02x}': {}", const auto& b = addr.b;
fmt::join(addr.b, ":"), strerror(errno)); 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(sendFd);
close(recvFd); close(recvFd);
continue; continue;