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)
{
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);
}

View file

@ -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;

View file

@ -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<RGBColor> 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;
};

View file

@ -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";