Store name in MSIRGBController to avoid setting it in detector

This commit is contained in:
Adam Honse 2025-08-14 10:19:11 -05:00
parent b13ca818bb
commit 719d7b8801
4 changed files with 28 additions and 14 deletions

View file

@ -15,9 +15,10 @@
#include "dmiinfo.h"
#include "super_io.h"
MSIRGBController::MSIRGBController(int sioaddr, bool invert)
MSIRGBController::MSIRGBController(int sioaddr, bool invert, std::string dev_name)
{
msi_sioaddr = sioaddr;
name = dev_name;
/*-----------------------------------------------------*\
| This setup step isn't well documented |
@ -74,6 +75,18 @@ MSIRGBController::~MSIRGBController()
}
std::string MSIRGBController::GetDeviceLocation()
{
char hex[12];
snprintf(hex, sizeof(hex), "0x%X", msi_sioaddr);
return("SIO: " + std::string(hex));
}
std::string MSIRGBController::GetDeviceName()
{
return(name);
}
void MSIRGBController::SetColor(unsigned char red, unsigned char green, unsigned char blue)
{
/*-----------------------------------------------------*\

View file

@ -42,7 +42,7 @@ enum
class MSIRGBController
{
public:
MSIRGBController(int sioaddr, bool invert);
MSIRGBController(int sioaddr, bool invert, std::string dev_name);
~MSIRGBController();
std::string GetDeviceName();
@ -54,4 +54,5 @@ public:
void SetColor(unsigned char red, unsigned char green, unsigned char blue);
private:
int msi_sioaddr;
std::string name;
};

View file

@ -114,9 +114,8 @@ void DetectMSIRGBControllers()
{
if (board_dmi.find(std::string(compatible_devices[i].name)) != std::string::npos)
{
MSIRGBController* controller = new MSIRGBController(sioaddr, compatible_devices[i].invert);
MSIRGBController* controller = new MSIRGBController(sioaddr, compatible_devices[i].invert, "MSI " + board_dmi);
RGBController_MSIRGB* rgb_controller = new RGBController_MSIRGB(controller);
rgb_controller->name = "MSI " + board_dmi;
ResourceManager::get()->RegisterRGBController(rgb_controller);
break;

View file

@ -26,10 +26,11 @@ RGBController_MSIRGB::RGBController_MSIRGB(MSIRGBController* controller_ptr)
{
controller = controller_ptr;
name = "MSI Motherboard";
name = controller->GetDeviceName();
vendor = "MSI";
type = DEVICE_TYPE_MOTHERBOARD;
description = "MSI-RGB Device";
location = controller->GetDeviceLocation();
mode Direct;
Direct.name = "Direct";