Store name in LenovoMotherboardController to avoid setting it in detector

This commit is contained in:
Adam Honse 2025-08-11 20:45:07 -05:00
parent b331fbcd4d
commit f6ddf5676a
4 changed files with 14 additions and 15 deletions

View file

@ -13,11 +13,11 @@
#include "LenovoMotherboardController.h" #include "LenovoMotherboardController.h"
#include "StringUtils.h" #include "StringUtils.h"
LenovoMotherboardController::LenovoMotherboardController(hid_device* dev_handle, const hid_device_info& info) LenovoMotherboardController::LenovoMotherboardController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name)
{ {
dev = dev_handle; dev = dev_handle;
location = info.path; location = info.path;
version = ""; name = dev_name;
} }
LenovoMotherboardController::~LenovoMotherboardController() LenovoMotherboardController::~LenovoMotherboardController()
@ -30,6 +30,11 @@ std::string LenovoMotherboardController::GetDeviceLocation()
return("HID: " + location); return("HID: " + location);
} }
std::string LenovoMotherboardController::GetNameString()
{
return(name);
}
std::string LenovoMotherboardController::GetSerialString() std::string LenovoMotherboardController::GetSerialString()
{ {
wchar_t serial_string[128]; wchar_t serial_string[128];
@ -43,11 +48,6 @@ std::string LenovoMotherboardController::GetSerialString()
return(StringUtils::wstring_to_string(serial_string)); return(StringUtils::wstring_to_string(serial_string));
} }
std::string LenovoMotherboardController::GetFirmwareVersion()
{
return(version);
}
void LenovoMotherboardController::SetMode(uint8_t zone, uint8_t mode, uint8_t brightness, uint8_t speed, RGBColor color) void LenovoMotherboardController::SetMode(uint8_t zone, uint8_t mode, uint8_t brightness, uint8_t speed, RGBColor color)
{ {
uint8_t r = RGBGetRValue(color); uint8_t r = RGBGetRValue(color);

View file

@ -43,17 +43,17 @@ enum
class LenovoMotherboardController class LenovoMotherboardController
{ {
public: public:
LenovoMotherboardController(hid_device* dev_handle, const hid_device_info& info); LenovoMotherboardController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name);
~LenovoMotherboardController(); ~LenovoMotherboardController();
std::string GetSerialString();
std::string GetDeviceLocation(); std::string GetDeviceLocation();
std::string GetFirmwareVersion(); std::string GetNameString();
std::string GetSerialString();
void SetMode(uint8_t zone, uint8_t mode, uint8_t brightness, uint8_t speed, RGBColor color); void SetMode(uint8_t zone, uint8_t mode, uint8_t brightness, uint8_t speed, RGBColor color);
private: private:
hid_device* dev; hid_device* dev;
std::string location; std::string location;
std::string version; std::string name;
}; };

View file

@ -32,9 +32,8 @@ void DetectLenovoMotherboardControllers(hid_device_info* info, const std::string
{ {
DMIInfo dmi; DMIInfo dmi;
LenovoMotherboardController* controller = new LenovoMotherboardController(dev, *info); LenovoMotherboardController* controller = new LenovoMotherboardController(dev, *info, name + " " + dmi.getMainboard());
RGBController_LenovoMotherboard* rgb_controller = new RGBController_LenovoMotherboard(controller); RGBController_LenovoMotherboard* rgb_controller = new RGBController_LenovoMotherboard(controller);
rgb_controller->name = name + " " + dmi.getMainboard();
ResourceManager::get()->RegisterRGBController(rgb_controller); ResourceManager::get()->RegisterRGBController(rgb_controller);
} }

View file

@ -27,13 +27,13 @@
RGBController_LenovoMotherboard::RGBController_LenovoMotherboard(LenovoMotherboardController* controller_ptr) RGBController_LenovoMotherboard::RGBController_LenovoMotherboard(LenovoMotherboardController* controller_ptr)
{ {
controller = controller_ptr; controller = controller_ptr;
name = "Lenovo motherboard";
name = controller->GetNameString();
vendor = "Lenovo"; vendor = "Lenovo";
type = DEVICE_TYPE_MOTHERBOARD; type = DEVICE_TYPE_MOTHERBOARD;
description = name; description = name;
location = controller->GetDeviceLocation(); location = controller->GetDeviceLocation();
serial = controller->GetSerialString(); serial = controller->GetSerialString();
version = controller->GetFirmwareVersion();
mode Static; mode Static;
Static.name = "Static"; Static.name = "Static";