Store name in ColorfulGPUControllers to avoid setting it in detectors
This commit is contained in:
parent
2ec68c29de
commit
526d35edfe
8 changed files with 32 additions and 14 deletions
|
|
@ -12,10 +12,11 @@
|
||||||
#include "pci_ids.h"
|
#include "pci_ids.h"
|
||||||
#include "LogManager.h"
|
#include "LogManager.h"
|
||||||
|
|
||||||
ColorfulGPUController::ColorfulGPUController(i2c_smbus_interface* bus, colorful_gpu_dev_id dev)
|
ColorfulGPUController::ColorfulGPUController(i2c_smbus_interface* bus, colorful_gpu_dev_id dev, std::string dev_name)
|
||||||
{
|
{
|
||||||
this->bus = bus;
|
this->bus = bus;
|
||||||
this->dev = dev;
|
this->dev = dev;
|
||||||
|
this->name = dev_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
ColorfulGPUController::~ColorfulGPUController()
|
ColorfulGPUController::~ColorfulGPUController()
|
||||||
|
|
@ -33,6 +34,11 @@ std::string ColorfulGPUController::GetDeviceLocation()
|
||||||
return("I2C: " + return_string);
|
return("I2C: " + return_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string ColorfulGPUController::GetDeviceName()
|
||||||
|
{
|
||||||
|
return(name);
|
||||||
|
}
|
||||||
|
|
||||||
void ColorfulGPUController::SetDirect(RGBColor color)
|
void ColorfulGPUController::SetDirect(RGBColor color)
|
||||||
{
|
{
|
||||||
uint8_t r = RGBGetRValue(color);
|
uint8_t r = RGBGetRValue(color);
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,16 @@ typedef unsigned char colorful_gpu_dev_id;
|
||||||
class ColorfulGPUController
|
class ColorfulGPUController
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ColorfulGPUController(i2c_smbus_interface* bus, colorful_gpu_dev_id dev);
|
ColorfulGPUController(i2c_smbus_interface* bus, colorful_gpu_dev_id dev, std::string dev_name);
|
||||||
~ColorfulGPUController();
|
~ColorfulGPUController();
|
||||||
|
|
||||||
std::string GetDeviceLocation();
|
std::string GetDeviceLocation();
|
||||||
|
std::string GetDeviceName();
|
||||||
|
|
||||||
void SetDirect(RGBColor color);
|
void SetDirect(RGBColor color);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
i2c_smbus_interface * bus;
|
i2c_smbus_interface * bus;
|
||||||
colorful_gpu_dev_id dev;
|
colorful_gpu_dev_id dev;
|
||||||
|
std::string name;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,8 @@ void DetectColorfulGPUControllers(i2c_smbus_interface* bus, uint8_t i2c_addr, co
|
||||||
{
|
{
|
||||||
if(TestForColorfulGPU(bus, i2c_addr))
|
if(TestForColorfulGPU(bus, i2c_addr))
|
||||||
{
|
{
|
||||||
ColorfulGPUController* controller = new ColorfulGPUController(bus, i2c_addr);
|
ColorfulGPUController* controller = new ColorfulGPUController(bus, i2c_addr, name);
|
||||||
RGBController_ColorfulGPU* rgb_controller = new RGBController_ColorfulGPU(controller);
|
RGBController_ColorfulGPU* rgb_controller = new RGBController_ColorfulGPU(controller);
|
||||||
rgb_controller->name = name;
|
|
||||||
|
|
||||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,8 @@
|
||||||
RGBController_ColorfulGPU::RGBController_ColorfulGPU(ColorfulGPUController * colorful_gpu_ptr)
|
RGBController_ColorfulGPU::RGBController_ColorfulGPU(ColorfulGPUController * colorful_gpu_ptr)
|
||||||
{
|
{
|
||||||
controller = colorful_gpu_ptr;
|
controller = colorful_gpu_ptr;
|
||||||
name = "Colorful GPU Device";
|
|
||||||
|
name = controller->GetDeviceName();
|
||||||
vendor = "Colorful";
|
vendor = "Colorful";
|
||||||
type = DEVICE_TYPE_GPU;
|
type = DEVICE_TYPE_GPU;
|
||||||
description = name;
|
description = name;
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,11 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "ColorfulTuringGPUController.h"
|
#include "ColorfulTuringGPUController.h"
|
||||||
|
|
||||||
ColorfulTuringGPUController::ColorfulTuringGPUController(i2c_smbus_interface* bus, colorful_gpu_dev_id dev)
|
ColorfulTuringGPUController::ColorfulTuringGPUController(i2c_smbus_interface* bus, colorful_gpu_dev_id dev, std::string dev_name)
|
||||||
{
|
{
|
||||||
this->bus = bus;
|
this->bus = bus;
|
||||||
this->dev = dev;
|
this->dev = dev;
|
||||||
|
this->name = dev_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
ColorfulTuringGPUController::~ColorfulTuringGPUController()
|
ColorfulTuringGPUController::~ColorfulTuringGPUController()
|
||||||
|
|
@ -31,6 +32,11 @@ std::string ColorfulTuringGPUController::GetDeviceLocation()
|
||||||
return("I2C: " + return_string);
|
return("I2C: " + return_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string ColorfulTuringGPUController::GetDeviceName()
|
||||||
|
{
|
||||||
|
return(name);
|
||||||
|
}
|
||||||
|
|
||||||
int ColorfulTuringGPUController::GetMode()
|
int ColorfulTuringGPUController::GetMode()
|
||||||
{
|
{
|
||||||
uint8_t data_pkt[COLORFUL_MODE_PACKET_LENGTH];
|
uint8_t data_pkt[COLORFUL_MODE_PACKET_LENGTH];
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,12 @@ enum
|
||||||
class ColorfulTuringGPUController
|
class ColorfulTuringGPUController
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ColorfulTuringGPUController(i2c_smbus_interface* bus, colorful_gpu_dev_id dev);
|
ColorfulTuringGPUController(i2c_smbus_interface* bus, colorful_gpu_dev_id dev, std::string dev_name);
|
||||||
~ColorfulTuringGPUController();
|
~ColorfulTuringGPUController();
|
||||||
|
|
||||||
std::string GetDeviceLocation();
|
std::string GetDeviceLocation();
|
||||||
|
std::string GetDeviceName();
|
||||||
|
|
||||||
int GetMode();
|
int GetMode();
|
||||||
RGBColor GetColor();
|
RGBColor GetColor();
|
||||||
void SetDirect(RGBColor color, bool save);
|
void SetDirect(RGBColor color, bool save);
|
||||||
|
|
@ -47,4 +49,5 @@ public:
|
||||||
private:
|
private:
|
||||||
i2c_smbus_interface * bus;
|
i2c_smbus_interface * bus;
|
||||||
colorful_gpu_dev_id dev;
|
colorful_gpu_dev_id dev;
|
||||||
|
std::string name;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,8 @@ void DetectColorfulTuringGPUControllers(i2c_smbus_interface* bus, uint8_t i2c_ad
|
||||||
{
|
{
|
||||||
if(bus->port_id == 1)
|
if(bus->port_id == 1)
|
||||||
{
|
{
|
||||||
ColorfulTuringGPUController* controller = new ColorfulTuringGPUController(bus, i2c_addr);
|
ColorfulTuringGPUController* controller = new ColorfulTuringGPUController(bus, i2c_addr, name);
|
||||||
RGBController_ColorfulTuringGPU* rgb_controller = new RGBController_ColorfulTuringGPU(controller);
|
RGBController_ColorfulTuringGPU* rgb_controller = new RGBController_ColorfulTuringGPU(controller);
|
||||||
rgb_controller->name = name;
|
|
||||||
|
|
||||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,8 @@
|
||||||
RGBController_ColorfulTuringGPU::RGBController_ColorfulTuringGPU(ColorfulTuringGPUController * colorful_gpu_ptr)
|
RGBController_ColorfulTuringGPU::RGBController_ColorfulTuringGPU(ColorfulTuringGPUController * colorful_gpu_ptr)
|
||||||
{
|
{
|
||||||
controller = colorful_gpu_ptr;
|
controller = colorful_gpu_ptr;
|
||||||
name = "Colorful GPU Device";
|
|
||||||
|
name = controller->GetDeviceName();
|
||||||
vendor = "Colorful";
|
vendor = "Colorful";
|
||||||
type = DEVICE_TYPE_GPU;
|
type = DEVICE_TYPE_GPU;
|
||||||
description = name;
|
description = name;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue