Store name in ZotacV2GPUController to avoid setting it in detector
This commit is contained in:
parent
eb199dae67
commit
ce64dbc686
4 changed files with 190 additions and 183 deletions
|
|
@ -89,7 +89,7 @@ RGBController_ZotacV2GPU::RGBController_ZotacV2GPU(ZotacV2GPUController* control
|
||||||
{
|
{
|
||||||
controller = controller_ptr;
|
controller = controller_ptr;
|
||||||
|
|
||||||
name = "ZOTAC GPU";
|
name = controller->GetName();
|
||||||
vendor = "ZOTAC";
|
vendor = "ZOTAC";
|
||||||
description = "ZOTAC 30/40 series RGB GPU Device (" + controller->GetVersion() + ")";
|
description = "ZOTAC 30/40 series RGB GPU Device (" + controller->GetVersion() + ")";
|
||||||
location = controller->GetDeviceLocation();
|
location = controller->GetDeviceLocation();
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,11 @@
|
||||||
#include "ZotacV2GPUController.h"
|
#include "ZotacV2GPUController.h"
|
||||||
#include "LogManager.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->bus = bus;
|
||||||
this->dev = dev;
|
this->dev = dev;
|
||||||
|
this->name = dev_name;
|
||||||
|
|
||||||
if(dev)
|
if(dev)
|
||||||
{
|
{
|
||||||
|
|
@ -37,9 +38,14 @@ std::string ZotacV2GPUController::GetDeviceLocation()
|
||||||
return ("I2C: " + return_string);
|
return ("I2C: " + return_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string ZotacV2GPUController::GetName()
|
||||||
|
{
|
||||||
|
return(name);
|
||||||
|
}
|
||||||
|
|
||||||
std::string ZotacV2GPUController::GetVersion()
|
std::string ZotacV2GPUController::GetVersion()
|
||||||
{
|
{
|
||||||
return version;
|
return(version);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZotacV2GPUController::ReadVersion()
|
bool ZotacV2GPUController::ReadVersion()
|
||||||
|
|
|
||||||
|
|
@ -85,10 +85,11 @@ struct ZotacV2GPUZone
|
||||||
class ZotacV2GPUController
|
class ZotacV2GPUController
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ZotacV2GPUController(i2c_smbus_interface* bus, u8 dev);
|
ZotacV2GPUController(i2c_smbus_interface* bus, u8 dev, std::string dev_name);
|
||||||
~ZotacV2GPUController();
|
~ZotacV2GPUController();
|
||||||
|
|
||||||
std::string GetDeviceLocation();
|
std::string GetDeviceLocation();
|
||||||
|
std::string GetName();
|
||||||
std::string GetVersion();
|
std::string GetVersion();
|
||||||
|
|
||||||
bool TurnOnOff(bool on);
|
bool TurnOnOff(bool on);
|
||||||
|
|
@ -97,12 +98,12 @@ public:
|
||||||
bool SetMode(int zone, int idleActive, int syncMode, ZotacV2GPUZone zoneConfig);
|
bool SetMode(int zone, int idleActive, int syncMode, ZotacV2GPUZone zoneConfig);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
i2c_smbus_interface* bus;
|
||||||
|
u8 dev;
|
||||||
|
std::string name;
|
||||||
|
std::string version;
|
||||||
|
|
||||||
bool ReadVersion();
|
bool ReadVersion();
|
||||||
bool SendCommand(bool on, bool reset, int zone, int idleActive, int syncMode, ZotacV2GPUZone zoneConfig);
|
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);
|
bool ParseCommand(bool& on, bool& reset, int& zone, int& idleActive, int& syncMode, ZotacV2GPUZone& zoneConfig);
|
||||||
|
|
||||||
i2c_smbus_interface* bus;
|
|
||||||
u8 dev;
|
|
||||||
std::string version;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -32,11 +32,11 @@ void DetectZotacV2GPUControllers(i2c_smbus_interface* bus, u8 i2c_addr, const st
|
||||||
{
|
{
|
||||||
u8 rdata_pkt[I2C_SMBUS_BLOCK_MAX] = { 0x00 };
|
u8 rdata_pkt[I2C_SMBUS_BLOCK_MAX] = { 0x00 };
|
||||||
int rdata_len = sizeof(rdata_pkt);
|
int rdata_len = sizeof(rdata_pkt);
|
||||||
|
|
||||||
if(bus->i2c_read_block(i2c_addr, &rdata_len, rdata_pkt) >= 0)
|
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);
|
RGBController_ZotacV2GPU* rgb_controller = new RGBController_ZotacV2GPU(controller);
|
||||||
rgb_controller->name = name;
|
|
||||||
|
|
||||||
if(rgb_controller->config.numberOfZones > 0)
|
if(rgb_controller->config.numberOfZones > 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue