Store name in ZotacTuringGPUController to avoid setting it in detector

This commit is contained in:
Adam Honse 2025-08-14 23:18:16 -05:00
parent ad9fd08a08
commit eb199dae67
4 changed files with 49 additions and 42 deletions

View file

@ -26,7 +26,7 @@ RGBController_ZotacTuringGPU::RGBController_ZotacTuringGPU(ZotacTuringGPUControl
{
controller = controller_ptr;
name = "ZOTAC GPU";
name = controller->GetDeviceName();
vendor = "ZOTAC";
description = "ZOTAC Turing-based RGB GPU Device";
location = controller->GetDeviceLocation();

View file

@ -11,10 +11,11 @@
#include "ZotacTuringGPUController.h"
ZotacTuringGPUController::ZotacTuringGPUController(i2c_smbus_interface* bus, u8 dev)
ZotacTuringGPUController::ZotacTuringGPUController(i2c_smbus_interface* bus, u8 dev, std::string dev_name)
{
this->bus = bus;
this->dev = dev;
this->name = dev_name;
}
ZotacTuringGPUController::~ZotacTuringGPUController()
@ -31,6 +32,11 @@ std::string ZotacTuringGPUController::GetDeviceLocation()
return("I2C: " + return_string);
}
std::string ZotacTuringGPUController::GetDeviceName()
{
return(name);
}
void ZotacTuringGPUController::GetMode(RGBColor& color, int& mode, unsigned int& speed)
{
u8 rdata_pkt[I2C_SMBUS_BLOCK_MAX] = { 0x00 };

View file

@ -39,10 +39,11 @@ enum
class ZotacTuringGPUController
{
public:
ZotacTuringGPUController(i2c_smbus_interface* bus, u8 dev);
ZotacTuringGPUController(i2c_smbus_interface* bus, u8 dev, std::string dev_name);
~ZotacTuringGPUController();
std::string GetDeviceLocation();
std::string GetDeviceName();
void GetMode(RGBColor& color, int& mode, unsigned int& speed);
void SetMode(RGBColor color, int mode, unsigned int speed);
@ -50,5 +51,6 @@ public:
private:
i2c_smbus_interface* bus;
u8 dev;
std::string name;
};

View file

@ -51,9 +51,8 @@ void DetectZotacTuringGPUControllers(i2c_smbus_interface* bus, u8 i2c_addr, cons
{
if(TestForZotacTuringGPUController(bus, i2c_addr))
{
ZotacTuringGPUController* controller = new ZotacTuringGPUController(bus, i2c_addr);
ZotacTuringGPUController* controller = new ZotacTuringGPUController(bus, i2c_addr, name);
RGBController_ZotacTuringGPU* rgb_controller = new RGBController_ZotacTuringGPU(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}