Store name in GalaxGPUControllers to avoid setting it in detectors

This commit is contained in:
Adam Honse 2025-08-08 11:32:30 -05:00
parent 2927135cdd
commit 6f9e164874
7 changed files with 89 additions and 93 deletions

View file

@ -89,9 +89,8 @@ void DetectGalaxGPUControllers(i2c_smbus_interface* bus, uint8_t i2c_addr, const
case 0x32:
case 0x23:
{
GalaxGPUv1Controller* controller = new GalaxGPUv1Controller(bus, i2c_addr);
GalaxGPUv1Controller* controller = new GalaxGPUv1Controller(bus, i2c_addr, name);
RGBController_GalaxGPUv1* rgb_controller = new RGBController_GalaxGPUv1(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
@ -102,9 +101,8 @@ void DetectGalaxGPUControllers(i2c_smbus_interface* bus, uint8_t i2c_addr, const
\*-----------------------------------------------------------------*/
case 0x51:
{
GalaxGPUv2Controller* controller = new GalaxGPUv2Controller(bus, i2c_addr);
GalaxGPUv2Controller* controller = new GalaxGPUv2Controller(bus, i2c_addr, name);
RGBController_GalaxGPUv2* rgb_controller = new RGBController_GalaxGPUv2(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}

View file

@ -12,12 +12,11 @@
#include <cstring>
#include "GalaxGPUv1Controller.h"
GalaxGPUv1Controller::GalaxGPUv1Controller(i2c_smbus_interface* bus, galax_gpu_dev_id dev)
GalaxGPUv1Controller::GalaxGPUv1Controller(i2c_smbus_interface* bus, galax_gpu_dev_id dev, std::string dev_name)
{
this->bus = bus;
this->dev = dev;
strcpy(device_name, "Galax RTX GPU"); // Would be nice to get the actual GPU name. Using this as a placeholder.
this->name = name;
}
GalaxGPUv1Controller::~GalaxGPUv1Controller()
@ -25,11 +24,6 @@ GalaxGPUv1Controller::~GalaxGPUv1Controller()
}
std::string GalaxGPUv1Controller::GetDeviceName()
{
return(device_name);
}
std::string GalaxGPUv1Controller::GetDeviceLocation()
{
std::string return_string(bus->device_name);
@ -40,6 +34,11 @@ std::string GalaxGPUv1Controller::GetDeviceLocation()
return("I2C: " + return_string);
}
std::string GalaxGPUv1Controller::GetDeviceName()
{
return(name);
}
unsigned char GalaxGPUv1Controller::GetLEDRed()
{
return(GalaxGPURegisterRead(GALAX_V1_RED_REGISTER));

View file

@ -46,11 +46,11 @@ enum
class GalaxGPUv1Controller
{
public:
GalaxGPUv1Controller(i2c_smbus_interface* bus, galax_gpu_dev_id);
GalaxGPUv1Controller(i2c_smbus_interface* bus, galax_gpu_dev_id, std::string dev_name);
~GalaxGPUv1Controller();
std::string GetDeviceName();
std::string GetDeviceLocation();
std::string GetDeviceName();
unsigned char GetLEDRed();
unsigned char GetLEDGreen();
unsigned char GetLEDBlue();
@ -64,7 +64,7 @@ public:
bool direct = false; // Temporary solution to check if we are in "Direct" mode
private:
char device_name[16];
i2c_smbus_interface * bus;
galax_gpu_dev_id dev;
std::string name;
};

View file

@ -12,12 +12,11 @@
#include <cstring>
#include "GalaxGPUv2Controller.h"
GalaxGPUv2Controller::GalaxGPUv2Controller(i2c_smbus_interface* bus, galax_gpu_dev_id dev)
GalaxGPUv2Controller::GalaxGPUv2Controller(i2c_smbus_interface* bus, galax_gpu_dev_id dev, std::string dev_name)
{
this->bus = bus;
this->dev = dev;
strcpy(device_name, "Galax RTX GPU"); // Would be nice to get the actual GPU name. Using this as a placeholder.
this->name = dev_name;
}
GalaxGPUv2Controller::~GalaxGPUv2Controller()
@ -25,11 +24,6 @@ GalaxGPUv2Controller::~GalaxGPUv2Controller()
}
std::string GalaxGPUv2Controller::GetDeviceName()
{
return(device_name);
}
std::string GalaxGPUv2Controller::GetDeviceLocation()
{
std::string return_string(bus->device_name);
@ -40,6 +34,11 @@ std::string GalaxGPUv2Controller::GetDeviceLocation()
return("I2C: " + return_string);
}
std::string GalaxGPUv2Controller::GetDeviceName()
{
return(name);
}
unsigned char GalaxGPUv2Controller::GetLEDRed()
{
return(GalaxGPURegisterRead(GALAX_V2_RED_REGISTER));

View file

@ -51,11 +51,11 @@ enum
class GalaxGPUv2Controller
{
public:
GalaxGPUv2Controller(i2c_smbus_interface* bus, galax_gpu_dev_id);
GalaxGPUv2Controller(i2c_smbus_interface* bus, galax_gpu_dev_id, std::string dev_name);
~GalaxGPUv2Controller();
std::string GetDeviceName();
std::string GetDeviceLocation();
std::string GetDeviceName();
unsigned char GetLEDRed();
unsigned char GetLEDGreen();
unsigned char GetLEDBlue();
@ -76,7 +76,7 @@ public:
bool direct = false; // Temporary solution to check if we are in "Direct" mode
private:
char device_name[16];
i2c_smbus_interface * bus;
galax_gpu_dev_id dev;
std::string name;
};