Store name in ZotacV2GPUController to avoid setting it in detector

This commit is contained in:
Adam Honse 2025-08-14 23:25:32 -05:00
parent eb199dae67
commit ce64dbc686
4 changed files with 190 additions and 183 deletions

View file

@ -89,7 +89,7 @@ RGBController_ZotacV2GPU::RGBController_ZotacV2GPU(ZotacV2GPUController* control
{
controller = controller_ptr;
name = "ZOTAC GPU";
name = controller->GetName();
vendor = "ZOTAC";
description = "ZOTAC 30/40 series RGB GPU Device (" + controller->GetVersion() + ")";
location = controller->GetDeviceLocation();

View file

@ -12,10 +12,11 @@
#include "ZotacV2GPUController.h"
#include "LogManager.h"
ZotacV2GPUController::ZotacV2GPUController(i2c_smbus_interface* bus, u8 dev)
ZotacV2GPUController::ZotacV2GPUController(i2c_smbus_interface* bus, u8 dev, std::string dev_name)
{
this->bus = bus;
this->dev = dev;
this->name = dev_name;
if(dev)
{
@ -37,9 +38,14 @@ std::string ZotacV2GPUController::GetDeviceLocation()
return ("I2C: " + return_string);
}
std::string ZotacV2GPUController::GetName()
{
return(name);
}
std::string ZotacV2GPUController::GetVersion()
{
return version;
return(version);
}
bool ZotacV2GPUController::ReadVersion()

View file

@ -85,10 +85,11 @@ struct ZotacV2GPUZone
class ZotacV2GPUController
{
public:
ZotacV2GPUController(i2c_smbus_interface* bus, u8 dev);
ZotacV2GPUController(i2c_smbus_interface* bus, u8 dev, std::string dev_name);
~ZotacV2GPUController();
std::string GetDeviceLocation();
std::string GetName();
std::string GetVersion();
bool TurnOnOff(bool on);
@ -97,12 +98,12 @@ public:
bool SetMode(int zone, int idleActive, int syncMode, ZotacV2GPUZone zoneConfig);
private:
i2c_smbus_interface* bus;
u8 dev;
std::string name;
std::string version;
bool ReadVersion();
bool SendCommand(bool on, bool reset, int zone, int idleActive, int syncMode, ZotacV2GPUZone zoneConfig);
bool ParseCommand(bool& on, bool& reset, int& zone, int& idleActive, int& syncMode, ZotacV2GPUZone& zoneConfig);
i2c_smbus_interface* bus;
u8 dev;
std::string version;
};

View file

@ -32,11 +32,11 @@ void DetectZotacV2GPUControllers(i2c_smbus_interface* bus, u8 i2c_addr, const st
{
u8 rdata_pkt[I2C_SMBUS_BLOCK_MAX] = { 0x00 };
int rdata_len = sizeof(rdata_pkt);
if(bus->i2c_read_block(i2c_addr, &rdata_len, rdata_pkt) >= 0)
{
ZotacV2GPUController* controller = new ZotacV2GPUController(bus, i2c_addr);
ZotacV2GPUController* controller = new ZotacV2GPUController(bus, i2c_addr, name);
RGBController_ZotacV2GPU* rgb_controller = new RGBController_ZotacV2GPU(controller);
rgb_controller->name = name;
if(rgb_controller->config.numberOfZones > 0)
{