Store name in PNYLovelaceGPUController to avoid setting it in detector

This commit is contained in:
Adam Honse 2025-08-14 19:17:34 -05:00
parent 67e08d3415
commit 2134323bf8
4 changed files with 22 additions and 14 deletions

View file

@ -11,10 +11,11 @@
#include "PNYLovelaceGPUController.h"
PNYLovelaceGPUController::PNYLovelaceGPUController(i2c_smbus_interface* bus, pny_dev_id dev)
PNYLovelaceGPUController::PNYLovelaceGPUController(i2c_smbus_interface* bus, pny_dev_id dev, std::string dev_name)
{
this->bus = bus;
this->dev = dev;
this->name = dev_name;
}
PNYLovelaceGPUController::~PNYLovelaceGPUController()
@ -32,6 +33,11 @@ std::string PNYLovelaceGPUController::GetDeviceLocation()
return("I2C: " + return_string);
}
std::string PNYLovelaceGPUController::GetDeviceName()
{
return(name);
}
void PNYLovelaceGPUController::SetOff()
{
unsigned char data[7] = {};

View file

@ -34,10 +34,12 @@ enum
class PNYLovelaceGPUController
{
public:
PNYLovelaceGPUController(i2c_smbus_interface* bus, pny_dev_id dev);
PNYLovelaceGPUController(i2c_smbus_interface* bus, pny_dev_id dev, std::string dev_name);
~PNYLovelaceGPUController();
std::string GetDeviceLocation();
std::string GetDeviceName();
void SetOff();
void SetBreath(unsigned char speed, unsigned char red, unsigned char green, unsigned char blue);
void SetCycle(unsigned char speed, unsigned char brightness);
@ -48,5 +50,6 @@ public:
private:
i2c_smbus_interface* bus;
pny_dev_id dev;
std::string name;
};

View file

@ -31,9 +31,8 @@ void DetectPNYLovelaceGPUControllers(i2c_smbus_interface* bus, uint8_t i2c_addr,
return;
}
PNYLovelaceGPUController* controller = new PNYLovelaceGPUController(bus, i2c_addr);
PNYLovelaceGPUController* controller = new PNYLovelaceGPUController(bus, i2c_addr, name);
RGBController_PNYLovelaceGPU* rgb_controller = new RGBController_PNYLovelaceGPU(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
} /* DetectPNYLovelaceGPUControllers() */

View file

@ -26,7 +26,7 @@ RGBController_PNYLovelaceGPU::RGBController_PNYLovelaceGPU(PNYLovelaceGPUControl
{
controller = controller_ptr;
name = "PNY GPU";
name = controller->GetDeviceName();
vendor = "PNY";
description = "PNY RGB GPU Device";
location = controller->GetDeviceLocation();