Store name in AsusLegacyUSBControllers to avoid setting it in detectors

This commit is contained in:
Adam Honse 2025-08-04 13:37:21 -05:00
parent 142e7fcc02
commit c761661386
10 changed files with 46 additions and 22 deletions

View file

@ -21,10 +21,11 @@
#define ASUS_CERBERUS_KB_PACKET_SIZE 8
AsusCerberusKeyboardController::AsusCerberusKeyboardController(hid_device* dev_handle, const char* path, unsigned short rev_version)
AsusCerberusKeyboardController::AsusCerberusKeyboardController(hid_device* dev_handle, const char* path, unsigned short rev_version, std::string dev_name)
{
dev = dev_handle;
location = path;
name = dev_name;
version = rev_version;
}
@ -38,6 +39,11 @@ std::string AsusCerberusKeyboardController::GetDeviceLocation()
return("HID: " + location);
}
std::string AsusCerberusKeyboardController::GetDeviceName()
{
return(name);
}
std::string AsusCerberusKeyboardController::GetSerialString()
{
wchar_t serial_string[128];

View file

@ -30,10 +30,11 @@ enum
class AsusCerberusKeyboardController
{
public:
AsusCerberusKeyboardController(hid_device* dev_handle, const char* path, unsigned short rev_version);
AsusCerberusKeyboardController(hid_device* dev_handle, const char* path, unsigned short rev_version, std::string dev_name);
~AsusCerberusKeyboardController();
std::string GetDeviceLocation();
std::string GetDeviceName();
std::string GetSerialString();
std::string GetVersion();
@ -47,5 +48,6 @@ public:
private:
hid_device* dev;
std::string location;
std::string name;
unsigned short version;
};

View file

@ -185,7 +185,7 @@ RGBController_AsusCerberusKeyboard::RGBController_AsusCerberusKeyboard(AsusCerbe
controller->SetProfile(1);
name = "ASUS Cerberus Keyboard";
name = controller->GetDeviceName();
vendor = "ASUS";
type = DEVICE_TYPE_KEYBOARD;
description = "ASUS Cerberus Keyboard Device";

View file

@ -29,9 +29,9 @@ void DetectAsusCerberusMech(hid_device_info* info, const std::string& name)
if(dev)
{
AsusCerberusKeyboardController* controller = new AsusCerberusKeyboardController(dev, info->path, info->release_number);
AsusCerberusKeyboardController* controller = new AsusCerberusKeyboardController(dev, info->path, info->release_number, name);
RGBController_AsusCerberusKeyboard* rgb_controller = new RGBController_AsusCerberusKeyboard(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
@ -42,9 +42,9 @@ void DetectAsusSagarisKeyboard(hid_device_info* info, const std::string& name)
if(dev)
{
AsusSagarisKeyboardController* controller = new AsusSagarisKeyboardController(dev, info->path, info->release_number);
AsusSagarisKeyboardController* controller = new AsusSagarisKeyboardController(dev, info->path, info->release_number, name);
RGBController_AsusSagarisKeyboard* rgb_controller = new RGBController_AsusSagarisKeyboard(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
@ -55,9 +55,9 @@ void DetectAsusStrixClaw(hid_device_info* info, const std::string& name)
if(dev)
{
StrixClawController* controller = new StrixClawController(dev, info->path);
StrixClawController* controller = new StrixClawController(dev, info->path, name);
RGBController_StrixClaw* rgb_controller = new RGBController_StrixClaw(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}

View file

@ -20,10 +20,11 @@
#define ASUS_SAGARIS_KB_PACKET_SIZE 65
AsusSagarisKeyboardController::AsusSagarisKeyboardController(hid_device* dev_handle, const char* path, unsigned short rev_version)
AsusSagarisKeyboardController::AsusSagarisKeyboardController(hid_device* dev_handle, const char* path, unsigned short rev_version, std::string dev_name)
{
dev = dev_handle;
location = path;
name = dev_name;
version = rev_version;
}
@ -42,6 +43,11 @@ std::string AsusSagarisKeyboardController::GetDeviceLocation()
return("HID: " + location);
}
std::string AsusSagarisKeyboardController::GetDeviceName()
{
return(name);
}
std::string AsusSagarisKeyboardController::GetSerialString()
{
wchar_t serial_string[128];

View file

@ -54,11 +54,12 @@ typedef struct
class AsusSagarisKeyboardController
{
public:
AsusSagarisKeyboardController(hid_device* dev_handle, const char* path, unsigned short rev_version);
AsusSagarisKeyboardController(hid_device* dev_handle, const char* path, unsigned short rev_version, std::string dev_name);
~AsusSagarisKeyboardController();
std::string GetVersion();
std::string GetDeviceLocation();
std::string GetDeviceName();
std::string GetSerialString();
sagaris_mode GetMode();
@ -73,5 +74,6 @@ public:
private:
hid_device* dev;
std::string location;
std::string name;
unsigned short version;
};

View file

@ -28,7 +28,7 @@ RGBController_AsusSagarisKeyboard::RGBController_AsusSagarisKeyboard(AsusSagaris
{
controller = controller_ptr;
name = "ASUS Sagaris Keyboard";
name = controller->GetDeviceName();
vendor = "ASUS";
type = DEVICE_TYPE_KEYBOARD;
description = "ASUS Sagaris Keyboard Device";

View file

@ -14,10 +14,11 @@
#include "AsusStrixClawController.h"
#include "StringUtils.h"
StrixClawController::StrixClawController(hid_device* dev_handle, const char* path)
StrixClawController::StrixClawController(hid_device* dev_handle, const char* path, std::string dev_name)
{
dev = dev_handle;
location = path;
name = dev_name;
}
StrixClawController::~StrixClawController()
@ -30,6 +31,11 @@ std::string StrixClawController::GetDeviceLocation()
return("HID: " + location);
}
std::string StrixClawController::GetDeviceName()
{
return(name);
}
std::string StrixClawController::GetSerialString()
{
wchar_t serial_string[HID_MAX_STR];

View file

@ -20,10 +20,11 @@
class StrixClawController
{
public:
StrixClawController(hid_device* dev_handle, const char* path);
StrixClawController(hid_device* dev_handle, const char* path, std::string dev_name);
virtual ~StrixClawController();
std::string GetDeviceLocation();
std::string GetDeviceName();
std::string GetSerialString();
std::string GetVersion();
@ -33,4 +34,5 @@ public:
private:
hid_device* dev;
std::string location;
std::string name;
};

View file

@ -26,7 +26,7 @@ RGBController_StrixClaw::RGBController_StrixClaw(StrixClawController* controller
{
controller = controller_ptr;
name = "ASUS ROG Strix Claw";
name = controller->GetDeviceName();
vendor = "ASUS";
type = DEVICE_TYPE_MOUSE;
description = "ASUS Legacy Mouse Device";