Add optional HID device hotplug support (requires https://gitlab.com/OpenRGBDevelopers/hidapi-hotplug)

This commit is contained in:
Adam Honse
2026-01-22 13:02:56 -06:00
parent 3d113dab3c
commit 39f112bb98
46 changed files with 1434 additions and 226 deletions

View File

@@ -13,10 +13,11 @@
#include "LogitechG810Controller.h"
#include "StringUtils.h"
LogitechG810Controller::LogitechG810Controller(hid_device* dev_handle_0x11, hid_device* dev_handle_0x12, std::string dev_name)
LogitechG810Controller::LogitechG810Controller(hid_device* dev_handle_0x11, hid_device* dev_handle_0x12, char* path, std::string dev_name)
{
dev_pkt_0x11 = dev_handle_0x11;
dev_pkt_0x12 = dev_handle_0x12;
location = path;
name = dev_name;
}
@@ -26,6 +27,11 @@ LogitechG810Controller::~LogitechG810Controller()
hid_close(dev_pkt_0x12);
}
std::string LogitechG810Controller::GetLocationString()
{
return("HID: " + location);
}
std::string LogitechG810Controller::GetNameString()
{
return(name);

View File

@@ -52,9 +52,10 @@ enum
class LogitechG810Controller
{
public:
LogitechG810Controller(hid_device* dev_handle_0x11, hid_device* dev_handle_0x12, std::string dev_name);
LogitechG810Controller(hid_device* dev_handle_0x11, hid_device* dev_handle_0x12, char* path, std::string dev_name);
~LogitechG810Controller();
std::string GetLocationString();
std::string GetNameString();
std::string GetSerialString();
@@ -79,6 +80,7 @@ public:
private:
hid_device* dev_pkt_0x11;
hid_device* dev_pkt_0x12;
std::string location;
std::string name;
void SendDirectFrame

View File

@@ -187,6 +187,7 @@ RGBController_LogitechG810::RGBController_LogitechG810(LogitechG810Controller* c
vendor = "Logitech";
type = DEVICE_TYPE_KEYBOARD;
description = "Logitech Keyboard Device";
location = controller->GetLocationString();
serial = controller->GetSerialString();
mode Direct;