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

@ -43,7 +43,7 @@ bool TestForGalaxGPUController(i2c_smbus_interface* bus, unsigned char address)
pass = true;
}
break;
/*-----------------------------------------------------------------*\
| V1 Controller - RTX 3080 |
\*-----------------------------------------------------------------*/
@ -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->bus = bus;
this->dev = dev;
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

@ -56,40 +56,40 @@ int RGBController_GalaxGPUv1::GetDeviceMode()
RGBController_GalaxGPUv1::RGBController_GalaxGPUv1(GalaxGPUv1Controller* controller_ptr)
{
controller = controller_ptr;
controller = controller_ptr;
name = controller->GetDeviceName();
vendor = "GALAX";
type = DEVICE_TYPE_GPU;
description = "GALAX / KFA2 RTX GPU";
location = controller->GetDeviceLocation();
name = controller->GetDeviceName();
vendor = "GALAX";
type = DEVICE_TYPE_GPU;
description = "GALAX / KFA2 RTX GPU";
location = controller->GetDeviceLocation();
mode Direct;
Direct.name = "Direct";
Direct.value = 1;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
Direct.name = "Direct";
Direct.value = 1;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = 2;
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Breathing.color_mode = MODE_COLORS_PER_LED;
Breathing.name = "Breathing";
Breathing.value = 2;
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Breathing.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Breathing);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = 3;
Rainbow.flags = 0;
Rainbow.color_mode = MODE_COLORS_NONE;
Rainbow.name = "Rainbow";
Rainbow.value = 3;
Rainbow.flags = 0;
Rainbow.color_mode = MODE_COLORS_NONE;
modes.push_back(Rainbow);
mode Cycle_Breathing;
Cycle_Breathing.name = "Cycle Breathing";
Cycle_Breathing.value = 4;
Cycle_Breathing.flags = 0;
Cycle_Breathing.color_mode = MODE_COLORS_NONE;
Cycle_Breathing.name = "Cycle Breathing";
Cycle_Breathing.value = 4;
Cycle_Breathing.flags = 0;
Cycle_Breathing.color_mode = MODE_COLORS_NONE;
modes.push_back(Cycle_Breathing);
SetupZones();

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->bus = bus;
this->dev = dev;
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;
};

View file

@ -56,65 +56,65 @@ int RGBController_GalaxGPUv2::GetDeviceMode()
RGBController_GalaxGPUv2::RGBController_GalaxGPUv2(GalaxGPUv2Controller* controller_ptr)
{
controller = controller_ptr;
controller = controller_ptr;
name = controller->GetDeviceName();
vendor = "GALAX";
type = DEVICE_TYPE_GPU;
description = "GALAX RTX 40+ GPU";
location = controller->GetDeviceLocation();
name = controller->GetDeviceName();
vendor = "GALAX";
type = DEVICE_TYPE_GPU;
description = "GALAX RTX 40+ GPU";
location = controller->GetDeviceLocation();
mode Direct;
Direct.name = "Direct";
Direct.value = 0;
Direct.brightness_min = 0x01;
Direct.brightness_max = 0x03;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED | MODE_FLAG_MANUAL_SAVE;
Direct.color_mode = MODE_COLORS_PER_LED;
Direct.name = "Direct";
Direct.value = 0;
Direct.brightness_min = 0x01;
Direct.brightness_max = 0x03;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED | MODE_FLAG_MANUAL_SAVE;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = 1;
Breathing.brightness_min = 0x01;
Breathing.brightness_max = 0x03;
Breathing.speed_min = 0x00;
Breathing.speed_max = 0x09;
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED | MODE_FLAG_MANUAL_SAVE;
Breathing.color_mode = MODE_COLORS_PER_LED;
Breathing.name = "Breathing";
Breathing.value = 1;
Breathing.brightness_min = 0x01;
Breathing.brightness_max = 0x03;
Breathing.speed_min = 0x00;
Breathing.speed_max = 0x09;
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED | MODE_FLAG_MANUAL_SAVE;
Breathing.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Breathing);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = 2;
Rainbow.flags = 0;
Rainbow.brightness_min = 0x01;
Rainbow.brightness_max = 0x03;
Rainbow.speed_min = 0x00;
Rainbow.speed_max = 0x09;
Rainbow.flags = MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED | MODE_FLAG_MANUAL_SAVE;
Rainbow.color_mode = MODE_COLORS_NONE;
Rainbow.name = "Rainbow";
Rainbow.value = 2;
Rainbow.flags = 0;
Rainbow.brightness_min = 0x01;
Rainbow.brightness_max = 0x03;
Rainbow.speed_min = 0x00;
Rainbow.speed_max = 0x09;
Rainbow.flags = MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED | MODE_FLAG_MANUAL_SAVE;
Rainbow.color_mode = MODE_COLORS_NONE;
modes.push_back(Rainbow);
mode Sync;
Sync.name = "External Sync";
Sync.value = 3;
Sync.flags = MODE_FLAG_MANUAL_SAVE;
Sync.color_mode = MODE_COLORS_NONE;
Sync.name = "External Sync";
Sync.value = 3;
Sync.flags = MODE_FLAG_MANUAL_SAVE;
Sync.color_mode = MODE_COLORS_NONE;
modes.push_back(Sync);
mode Off;
Off.name = "Off";
Off.value = 4;
Off.flags = MODE_FLAG_MANUAL_SAVE;
Off.color_mode = MODE_COLORS_NONE;
Off.name = "Off";
Off.value = 4;
Off.flags = MODE_FLAG_MANUAL_SAVE;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
SetupZones();
active_mode = GetDeviceMode();
modes[active_mode].brightness = controller->GetBrightness();
modes[active_mode].speed = controller->GetSpeed();
active_mode = GetDeviceMode();
modes[active_mode].brightness = controller->GetBrightness();
modes[active_mode].speed = controller->GetSpeed();
}
RGBController_GalaxGPUv2::~RGBController_GalaxGPUv2()