Store name in LexipMouseController to avoid setting it in detector

This commit is contained in:
Adam Honse 2025-08-11 20:46:58 -05:00
parent f6ddf5676a
commit f3c7a213b1
4 changed files with 15 additions and 14 deletions

View file

@ -13,11 +13,11 @@
#include "LexipMouseController.h"
#include "StringUtils.h"
LexipMouseController::LexipMouseController(hid_device* dev_handle, const hid_device_info& info)
LexipMouseController::LexipMouseController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name)
{
dev = dev_handle;
location = info.path;
version = "";
name = dev_name;
}
LexipMouseController::~LexipMouseController()
@ -30,6 +30,11 @@ std::string LexipMouseController::GetDeviceLocation()
return("HID: " + location);
}
std::string LexipMouseController::GetNameString()
{
return(name);
}
std::string LexipMouseController::GetSerialString()
{
wchar_t serial_string[128];
@ -43,11 +48,6 @@ std::string LexipMouseController::GetSerialString()
return(StringUtils::wstring_to_string(serial_string));
}
std::string LexipMouseController::GetFirmwareVersion()
{
return(version);
}
void LexipMouseController::SetDirect(RGBColor color)
{
/*-----------------------------------------*\

View file

@ -20,12 +20,12 @@
class LexipMouseController
{
public:
LexipMouseController(hid_device* dev_handle, const hid_device_info& info);
LexipMouseController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name);
~LexipMouseController();
std::string GetSerialString();
std::string GetDeviceLocation();
std::string GetFirmwareVersion();
std::string GetNameString();
std::string GetSerialString();
void SetDirect(RGBColor color);
protected:
@ -33,5 +33,6 @@ protected:
private:
std::string location;
std::string name;
std::string version;
};

View file

@ -29,9 +29,9 @@ void DetectLexipMouseControllers(hid_device_info* info, const std::string& name)
if(dev)
{
LexipMouseController* controller = new LexipMouseController(dev, *info);
LexipMouseController* controller = new LexipMouseController(dev, *info, name);
RGBController_LexipMouse* rgb_controller = new RGBController_LexipMouse(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}

View file

@ -27,13 +27,13 @@
RGBController_LexipMouse::RGBController_LexipMouse(LexipMouseController* controller_ptr)
{
controller = controller_ptr;
name = "Lexip Gaming Mouse";
name = controller->GetNameString();
vendor = "Lexip";
type = DEVICE_TYPE_MOUSE;
description = name;
location = controller->GetDeviceLocation();
serial = controller->GetSerialString();
version = controller->GetFirmwareVersion();
mode Direct;
Direct.name = "Direct";