Store name in AOCMousematController to avoid setting it in detector

This commit is contained in:
Adam Honse 2025-08-03 21:42:40 -05:00
parent 74bbaaf643
commit b9a8a62e38
4 changed files with 12 additions and 5 deletions

View file

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

View file

@ -55,10 +55,11 @@ enum
class AOCMousematController class AOCMousematController
{ {
public: public:
AOCMousematController(hid_device* dev_handle, const char* path); AOCMousematController(hid_device* dev_handle, const char* path, std::string dev_name);
~AOCMousematController(); ~AOCMousematController();
std::string GetDeviceLocation(); std::string GetDeviceLocation();
std::string GetDeviceName();
std::string GetSerialString(); std::string GetSerialString();
void SendDirect void SendDirect
@ -78,4 +79,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 DetectAOCMousematControllers(hid_device_info* info, const std::string& name
if(dev) if(dev)
{ {
AOCMousematController* controller = new AOCMousematController(dev, info->path); AOCMousematController* controller = new AOCMousematController(dev, info->path, name);
RGBController_AOCMousemat* rgb_controller = new RGBController_AOCMousemat(controller); RGBController_AOCMousemat* rgb_controller = new RGBController_AOCMousemat(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller); ResourceManager::get()->RegisterRGBController(rgb_controller);
} }

View file

@ -26,7 +26,7 @@ RGBController_AOCMousemat::RGBController_AOCMousemat(AOCMousematController* cont
{ {
controller = controller_ptr; controller = controller_ptr;
name = "AOC Mousemat Device"; name = controller->GetDeviceName();
vendor = "AOC"; vendor = "AOC";
type = DEVICE_TYPE_MOUSEMAT; type = DEVICE_TYPE_MOUSEMAT;
description = "AOC Mousemat Device"; description = "AOC Mousemat Device";