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 "AOCMouseController.h"
#include "StringUtils.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; dev = dev_handle;
location = path; location = path;
name = dev_name;
} }
AOCMouseController::~AOCMouseController() AOCMouseController::~AOCMouseController()
@ -29,6 +30,11 @@ std::string AOCMouseController::GetDeviceLocation()
return("HID " + location); return("HID " + location);
} }
std::string AOCMouseController::GetDeviceName()
{
return(name);
}
std::string AOCMouseController::GetSerialString() std::string AOCMouseController::GetSerialString()
{ {
wchar_t serial_string[128]; wchar_t serial_string[128];

View file

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

View file

@ -33,9 +33,8 @@ void DetectAOCMouseControllers(hid_device_info* info, const std::string& name)
if(dev) 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); RGBController_AOCMouse* rgb_controller = new RGBController_AOCMouse(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller); ResourceManager::get()->RegisterRGBController(rgb_controller);
} }

View file

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