WiimoteReal/IOhidapi: Minor warning fixes and cleanups.

This commit is contained in:
Jordan Woyak 2025-10-03 17:54:44 -05:00
parent 4a39ca249c
commit 7609220e61
2 changed files with 6 additions and 6 deletions

View File

@ -8,7 +8,6 @@
#include "Common/Assert.h"
#include "Common/Logging/Log.h"
#include "Common/StringUtil.h"
#include "Core/HW/WiimoteCommon/WiimoteHid.h"
using namespace WiimoteCommon;
using namespace WiimoteReal;
@ -65,8 +64,8 @@ bool WiimoteScannerHidapi::IsReady() const
void WiimoteScannerHidapi::FindWiimotes(std::vector<Wiimote*>& wiimotes, Wiimote*& board)
{
hid_device_info* list = hid_enumerate(0x0, 0x0);
for (hid_device_info* device = list; device; device = device->next)
hid_device_info* list = hid_enumerate(0x0, 0x0); // FYI: 0 for all VID/PID.
for (hid_device_info* device = list; device != nullptr; device = device->next)
{
const std::string name = device->product_string ? WStringToUTF8(device->product_string) : "";
const bool is_wiimote =
@ -89,7 +88,7 @@ void WiimoteScannerHidapi::FindWiimotes(std::vector<Wiimote*>& wiimotes, Wiimote
hid_free_enumeration(list);
}
WiimoteHidapi::WiimoteHidapi(const std::string& device_path) : m_device_path(device_path)
WiimoteHidapi::WiimoteHidapi(std::string device_path) : m_device_path(std::move(device_path))
{
}
@ -145,6 +144,7 @@ int WiimoteHidapi::IORead(u8* buf)
int WiimoteHidapi::IOWrite(const u8* buf, size_t len)
{
assert(len > 0);
DEBUG_ASSERT(buf[0] == (WR_SET_REPORT | BT_OUTPUT));
int result = hid_write(m_handle, buf + 1, len - 1);
if (result == -1)

View File

@ -13,7 +13,7 @@ namespace WiimoteReal
class WiimoteHidapi final : public Wiimote
{
public:
explicit WiimoteHidapi(const std::string& device_path);
explicit WiimoteHidapi(std::string device_path);
~WiimoteHidapi() override;
std::string GetId() const override { return m_device_path; }
@ -26,7 +26,7 @@ protected:
int IOWrite(const u8* buf, size_t len) override;
private:
std::string m_device_path;
const std::string m_device_path;
hid_device* m_handle = nullptr;
};