Store name in AlienwareMonitorController to avoid setting it in detector

This commit is contained in:
Adam Honse 2025-08-03 21:28:27 -05:00
parent 5e45480a0e
commit e4da571d6b
4 changed files with 14 additions and 6 deletions

View file

@ -15,10 +15,11 @@
#include "AlienwareMonitorController.h"
AlienwareMonitorController::AlienwareMonitorController(hid_device *dev_handle, const char *path)
AlienwareMonitorController::AlienwareMonitorController(hid_device *dev_handle, const char *path, std::string dev_name)
{
dev = dev_handle;
location = path;
name = dev_name;
Initialize();
}
@ -33,6 +34,11 @@ std::string AlienwareMonitorController::GetLocation()
return("HID: " + location);
}
std::string AlienwareMonitorController::GetName()
{
return(name);
}
std::string AlienwareMonitorController::GetSerialString()
{
return("");

View file

@ -18,16 +18,18 @@
class AlienwareMonitorController
{
public:
AlienwareMonitorController(hid_device* dev_handle, const char* path);
AlienwareMonitorController(hid_device* dev_handle, const char* path, std::string dev_name);
~AlienwareMonitorController();
std::string GetLocation();
std::string GetName();
std::string GetSerialString();
void SendColor(unsigned char led_id, unsigned char r, unsigned char g, unsigned char b);
private:
hid_device* dev;
std::string location;
std::string name;
void Initialize();
};

View file

@ -42,8 +42,9 @@ void DetectAlienwareAW3423DWFControllers(hid_device_info* info, const std::strin
hid_device* dev = hid_open_path(info->path);
if(dev)
{
AlienwareAW3423DWFController* controller = new AlienwareAW3423DWFController(dev, info->path);
AlienwareAW3423DWFController* controller = new AlienwareAW3423DWFController(dev, info->path);
RGBController_AlienwareAW3423DWF* rgb_controller = new RGBController_AlienwareAW3423DWF(controller);
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
@ -54,9 +55,8 @@ void DetectAlienwareMonitorControllers(hid_device_info* info, const std::string&
if(dev)
{
AlienwareMonitorController* controller = new AlienwareMonitorController(dev, info->path);
AlienwareMonitorController* controller = new AlienwareMonitorController(dev, info->path, name);
RGBController_AlienwareMonitor* rgb_controller = new RGBController_AlienwareMonitor(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}

View file

@ -26,7 +26,7 @@ RGBController_AlienwareMonitor::RGBController_AlienwareMonitor(AlienwareMonitorC
{
controller = controller_ptr;
name = "Alienware Monitor";
name = controller->GetName();
description = "Alienware Monitor";
vendor = "Alienware";
type = DEVICE_TYPE_MONITOR;