Store name in RedragonMouseController to avoid setting it in detector

This commit is contained in:
Adam Honse 2025-08-14 19:28:20 -05:00
parent ce86faabfe
commit 06413f2877
4 changed files with 50 additions and 41 deletions

View file

@ -26,7 +26,7 @@ RGBController_RedragonMouse::RGBController_RedragonMouse(RedragonMouseController
{
controller = controller_ptr;
name = "Redragon Mouse Device";
name = controller->GetNameString();
vendor = "Redragon";
type = DEVICE_TYPE_MOUSE;
description = "Redragon Mouse Device";

View file

@ -39,11 +39,12 @@
void DetectRedragonMice(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
RedragonMouseController* controller = new RedragonMouseController(dev, info->path);
RedragonMouseController* controller = new RedragonMouseController(dev, info->path, name);
RGBController_RedragonMouse* rgb_controller = new RGBController_RedragonMouse(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}

View file

@ -13,10 +13,11 @@
#include "RedragonMouseController.h"
#include "StringUtils.h"
RedragonMouseController::RedragonMouseController(hid_device* dev_handle, const char* path)
RedragonMouseController::RedragonMouseController(hid_device* dev_handle, const char* path, std::string dev_name)
{
dev = dev_handle;
location = path;
name = dev_name;
unsigned char active_profile = 0x00;
@ -34,6 +35,11 @@ std::string RedragonMouseController::GetDeviceLocation()
return("HID: " + location);
}
std::string RedragonMouseController::GetNameString()
{
return(name);
}
std::string RedragonMouseController::GetSerialString()
{
wchar_t serial_string[128];

View file

@ -31,10 +31,11 @@ enum
class RedragonMouseController
{
public:
RedragonMouseController(hid_device* dev_handle, const char* path);
RedragonMouseController(hid_device* dev_handle, const char* path, std::string dev_name);
~RedragonMouseController();
std::string GetDeviceLocation();
std::string GetNameString();
std::string GetSerialString();
void SendMouseApply();
@ -64,6 +65,7 @@ public:
private:
hid_device* dev;
std::string location;
std::string name;
void SendWritePacket
(