Store name in MSIVigorController to avoid setting it in detector

This commit is contained in:
Adam Honse 2025-08-14 11:26:20 -05:00
parent 82cb9fb7d0
commit f420e9bbbe
4 changed files with 17 additions and 18 deletions

View file

@ -29,9 +29,8 @@ void DetectMSIVigorGK30Controllers(hid_device_info* info, const std::string& nam
if(dev) if(dev)
{ {
MSIVigorGK30Controller* controller = new MSIVigorGK30Controller(dev, *info); MSIVigorGK30Controller* controller = new MSIVigorGK30Controller(dev, *info, name);
RGBController_MSIVigorGK30* rgb_controller = new RGBController_MSIVigorGK30(controller); RGBController_MSIVigorGK30* rgb_controller = new RGBController_MSIVigorGK30(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller); ResourceManager::get()->RegisterRGBController(rgb_controller);
} }

View file

@ -22,11 +22,11 @@ static unsigned char argb_colour_index_data[2][2][2] =
{ 0x01, 0x06 }, } //G1 R1 { 0x01, 0x06 }, } //G1 R1
}; };
MSIVigorGK30Controller::MSIVigorGK30Controller(hid_device* dev_handle, const hid_device_info& info) MSIVigorGK30Controller::MSIVigorGK30Controller(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;
} }
MSIVigorGK30Controller::~MSIVigorGK30Controller() MSIVigorGK30Controller::~MSIVigorGK30Controller()
@ -39,6 +39,11 @@ std::string MSIVigorGK30Controller::GetDeviceLocation()
return("HID: " + location); return("HID: " + location);
} }
std::string MSIVigorGK30Controller::GetNameString()
{
return(name);
}
std::string MSIVigorGK30Controller::GetSerialString() std::string MSIVigorGK30Controller::GetSerialString()
{ {
wchar_t serial_string[128]; wchar_t serial_string[128];
@ -52,11 +57,6 @@ std::string MSIVigorGK30Controller::GetSerialString()
return(StringUtils::wstring_to_string(serial_string)); return(StringUtils::wstring_to_string(serial_string));
} }
std::string MSIVigorGK30Controller::GetFirmwareVersion()
{
return(version);
}
unsigned int MSIVigorGK30Controller::GetLargestColour(unsigned int red, unsigned int green, unsigned int blue) unsigned int MSIVigorGK30Controller::GetLargestColour(unsigned int red, unsigned int green, unsigned int blue)
{ {
unsigned int largest; unsigned int largest;

View file

@ -46,12 +46,12 @@ enum
class MSIVigorGK30Controller class MSIVigorGK30Controller
{ {
public: public:
MSIVigorGK30Controller(hid_device* dev_handle, const hid_device_info& info); MSIVigorGK30Controller(hid_device* dev_handle, const hid_device_info& info, std::string dev_name);
~MSIVigorGK30Controller(); ~MSIVigorGK30Controller();
std::string GetSerialString();
std::string GetDeviceLocation(); std::string GetDeviceLocation();
std::string GetFirmwareVersion(); std::string GetNameString();
std::string GetSerialString();
void SetMode(std::vector<RGBColor> colors, void SetMode(std::vector<RGBColor> colors,
unsigned char brightness, unsigned char brightness,
@ -71,6 +71,6 @@ private:
unsigned char GetColourIndex(unsigned char red, unsigned char green, unsigned char blue); unsigned char GetColourIndex(unsigned char red, unsigned char green, unsigned char blue);
std::string location; std::string location;
std::string name;
std::string serial_number; std::string serial_number;
std::string version;
}; };

View file

@ -27,13 +27,13 @@
RGBController_MSIVigorGK30::RGBController_MSIVigorGK30(MSIVigorGK30Controller* controller_ptr) RGBController_MSIVigorGK30::RGBController_MSIVigorGK30(MSIVigorGK30Controller* controller_ptr)
{ {
controller = controller_ptr; controller = controller_ptr;
name = "MSI VigorGK30 USB Device";
name = controller->GetNameString();
vendor = "MSI"; vendor = "MSI";
type = DEVICE_TYPE_KEYBOARD; type = DEVICE_TYPE_KEYBOARD;
description = name; description = "MSI VigorGK30 USB Device";
location = controller->GetDeviceLocation(); location = controller->GetDeviceLocation();
serial = controller->GetSerialString(); serial = controller->GetSerialString();
version = controller->GetFirmwareVersion();
mode Custom; mode Custom;
Custom.name = "Custom"; Custom.name = "Custom";