mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-10 06:29:00 +01:00
Merge pull request #13298 from jordan-woyak/less-bt-spam
Core/WiimoteReal: Make Wii Remote scan logging less spammy on Linux.
This commit is contained in:
commit
01358c79a6
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include "Core/HW/WiimoteReal/IOLinux.h"
|
#include "Core/HW/WiimoteReal/IOLinux.h"
|
||||||
|
|
||||||
|
#include <ranges>
|
||||||
|
|
||||||
#include <bluetooth/bluetooth.h>
|
#include <bluetooth/bluetooth.h>
|
||||||
#include <bluetooth/hci.h>
|
#include <bluetooth/hci.h>
|
||||||
#include <bluetooth/hci_lib.h>
|
#include <bluetooth/hci_lib.h>
|
||||||
@ -73,30 +75,29 @@ void WiimoteScannerLinux::FindWiimotes(std::vector<Wiimote*>& found_wiimotes, Wi
|
|||||||
DEBUG_LOG_FMT(WIIMOTE, "Found {} Bluetooth device(s).", found_devices);
|
DEBUG_LOG_FMT(WIIMOTE, "Found {} Bluetooth device(s).", found_devices);
|
||||||
|
|
||||||
// Display discovered devices
|
// Display discovered devices
|
||||||
for (int i = 0; i < found_devices; ++i)
|
for (auto& scan_info : scan_infos | std::ranges::views::take(found_devices))
|
||||||
{
|
{
|
||||||
NOTICE_LOG_FMT(WIIMOTE, "found a device...");
|
|
||||||
|
|
||||||
// BT names are a maximum of 248 bytes apparently
|
// BT names are a maximum of 248 bytes apparently
|
||||||
char name[255] = {};
|
char name[255] = {};
|
||||||
if (hci_read_remote_name(m_device_sock, &scan_infos[i].bdaddr, sizeof(name), name, 1000) < 0)
|
if (hci_read_remote_name(m_device_sock, &scan_info.bdaddr, sizeof(name), name, 1000) < 0)
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(WIIMOTE, "name request failed");
|
ERROR_LOG_FMT(WIIMOTE, "Bluetooth read remote name failed.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
NOTICE_LOG_FMT(WIIMOTE, "device name {}", name);
|
INFO_LOG_FMT(WIIMOTE, "Found bluetooth device with name: {}", name);
|
||||||
|
|
||||||
if (!IsValidDeviceName(name))
|
if (!IsValidDeviceName(name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
char bdaddr_str[18] = {};
|
char bdaddr_str[18] = {};
|
||||||
ba2str(&scan_infos[i].bdaddr, bdaddr_str);
|
ba2str(&scan_info.bdaddr, bdaddr_str);
|
||||||
|
|
||||||
if (!IsNewWiimote(bdaddr_str))
|
if (!IsNewWiimote(bdaddr_str))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Found a new device
|
// Found a new device
|
||||||
Wiimote* wm = new WiimoteLinux(scan_infos[i].bdaddr);
|
Wiimote* wm = new WiimoteLinux(scan_info.bdaddr);
|
||||||
if (IsBalanceBoardName(name))
|
if (IsBalanceBoardName(name))
|
||||||
{
|
{
|
||||||
found_board = wm;
|
found_board = wm;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user