From f420e9bbbe11a4f928c3665fe90a866de09f020e Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Thu, 14 Aug 2025 11:26:20 -0500 Subject: [PATCH] Store name in MSIVigorController to avoid setting it in detector --- .../MSIVigorControllerDetect.cpp | 3 +-- .../MSIVigorGK30Controller.cpp | 18 +++++++++--------- .../MSIVigorGK30Controller.h | 8 ++++---- .../RGBController_MSIVigorGK30.cpp | 6 +++--- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/Controllers/MSIVigorController/MSIVigorControllerDetect.cpp b/Controllers/MSIVigorController/MSIVigorControllerDetect.cpp index 3a40f64a..e95380da 100644 --- a/Controllers/MSIVigorController/MSIVigorControllerDetect.cpp +++ b/Controllers/MSIVigorController/MSIVigorControllerDetect.cpp @@ -29,9 +29,8 @@ void DetectMSIVigorGK30Controllers(hid_device_info* info, const std::string& nam if(dev) { - MSIVigorGK30Controller* controller = new MSIVigorGK30Controller(dev, *info); + MSIVigorGK30Controller* controller = new MSIVigorGK30Controller(dev, *info, name); RGBController_MSIVigorGK30* rgb_controller = new RGBController_MSIVigorGK30(controller); - rgb_controller->name = name; ResourceManager::get()->RegisterRGBController(rgb_controller); } diff --git a/Controllers/MSIVigorController/MSIVigorGK30Controller.cpp b/Controllers/MSIVigorController/MSIVigorGK30Controller.cpp index a3daba57..ad53b0e8 100644 --- a/Controllers/MSIVigorController/MSIVigorGK30Controller.cpp +++ b/Controllers/MSIVigorController/MSIVigorGK30Controller.cpp @@ -22,11 +22,11 @@ static unsigned char argb_colour_index_data[2][2][2] = { 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; - location = info.path; - version = ""; + dev = dev_handle; + location = info.path; + name = dev_name; } MSIVigorGK30Controller::~MSIVigorGK30Controller() @@ -39,6 +39,11 @@ std::string MSIVigorGK30Controller::GetDeviceLocation() return("HID: " + location); } +std::string MSIVigorGK30Controller::GetNameString() +{ + return(name); +} + std::string MSIVigorGK30Controller::GetSerialString() { wchar_t serial_string[128]; @@ -52,11 +57,6 @@ std::string MSIVigorGK30Controller::GetSerialString() 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 largest; diff --git a/Controllers/MSIVigorController/MSIVigorGK30Controller.h b/Controllers/MSIVigorController/MSIVigorGK30Controller.h index d1be413e..7d1670af 100644 --- a/Controllers/MSIVigorController/MSIVigorGK30Controller.h +++ b/Controllers/MSIVigorController/MSIVigorGK30Controller.h @@ -46,12 +46,12 @@ enum class MSIVigorGK30Controller { 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(); - std::string GetSerialString(); std::string GetDeviceLocation(); - std::string GetFirmwareVersion(); + std::string GetNameString(); + std::string GetSerialString(); void SetMode(std::vector colors, unsigned char brightness, @@ -71,6 +71,6 @@ private: unsigned char GetColourIndex(unsigned char red, unsigned char green, unsigned char blue); std::string location; + std::string name; std::string serial_number; - std::string version; }; diff --git a/Controllers/MSIVigorController/RGBController_MSIVigorGK30.cpp b/Controllers/MSIVigorController/RGBController_MSIVigorGK30.cpp index 0842d0cb..d0b72361 100644 --- a/Controllers/MSIVigorController/RGBController_MSIVigorGK30.cpp +++ b/Controllers/MSIVigorController/RGBController_MSIVigorGK30.cpp @@ -27,13 +27,13 @@ RGBController_MSIVigorGK30::RGBController_MSIVigorGK30(MSIVigorGK30Controller* controller_ptr) { controller = controller_ptr; - name = "MSI VigorGK30 USB Device"; + + name = controller->GetNameString(); vendor = "MSI"; type = DEVICE_TYPE_KEYBOARD; - description = name; + description = "MSI VigorGK30 USB Device"; location = controller->GetDeviceLocation(); serial = controller->GetSerialString(); - version = controller->GetFirmwareVersion(); mode Custom; Custom.name = "Custom";