Store name in AOCMouseController to avoid setting it in detector

This commit is contained in:
Adam Honse 2025-08-03 21:38:07 -05:00
parent 5799ea8160
commit 74bbaaf643
4 changed files with 12 additions and 5 deletions

View file

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

View file

@ -56,10 +56,11 @@ enum
class AOCMouseController
{
public:
AOCMouseController(hid_device* dev_handle, const char* path);
AOCMouseController(hid_device* dev_handle, const char* path, std::string dev_name);
~AOCMouseController();
std::string GetDeviceLocation();
std::string GetDeviceName();
std::string GetSerialString();
void SendDirect
@ -79,4 +80,5 @@ public:
private:
hid_device* dev;
std::string location;
std::string name;
};

View file

@ -33,9 +33,8 @@ void DetectAOCMouseControllers(hid_device_info* info, const std::string& name)
if(dev)
{
AOCMouseController* controller = new AOCMouseController(dev, info->path);
AOCMouseController* controller = new AOCMouseController(dev, info->path, name);
RGBController_AOCMouse* rgb_controller = new RGBController_AOCMouse(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}

View file

@ -26,7 +26,7 @@ RGBController_AOCMouse::RGBController_AOCMouse(AOCMouseController* controller_pt
{
controller = controller_ptr;
name = "AOC Mouse Device";
name = controller->GetDeviceName();
vendor = "AOC";
type = DEVICE_TYPE_MOUSE;
description = "AOC Mouse Device";