Store name in CorsairHydroPlatinumController to avoid setting it in detector

This commit is contained in:
Adam Honse 2025-08-05 20:50:38 -05:00
parent 69a065eeed
commit 2b546fce9f
4 changed files with 18 additions and 10 deletions

View file

@ -85,11 +85,12 @@ static const uint8_t MAGIC_3[61] =
0xff, 0xff, 0xff, 0xff, 0xff
};
CorsairHydroPlatinumController::CorsairHydroPlatinumController(hid_device* dev_handle, const char* path)
CorsairHydroPlatinumController::CorsairHydroPlatinumController(hid_device* dev_handle, const char* path, std::string dev_name)
{
dev = dev_handle;
location = path;
guard_manager_ptr = new DeviceGuardManager(new CorsairDeviceGuard());
dev = dev_handle;
location = path;
name = dev_name;
guard_manager_ptr = new DeviceGuardManager(new CorsairDeviceGuard());
SendMagic(MAGIC_1, CORSAIR_HYDRO_PLATINUM_MAGIC_1);
SendMagic(MAGIC_2, CORSAIR_HYDRO_PLATINUM_MAGIC_2);
@ -104,12 +105,17 @@ CorsairHydroPlatinumController::~CorsairHydroPlatinumController()
std::string CorsairHydroPlatinumController::GetLocation()
{
return ("HID: " + location);
return("HID: " + location);
}
std::string CorsairHydroPlatinumController::GetFirmwareString()
{
return firmware_version;
return(firmware_version);
}
std::string CorsairHydroPlatinumController::GetName()
{
return(name);
}
void CorsairHydroPlatinumController::SetupColors(std::vector<RGBColor> colors)

View file

@ -34,17 +34,19 @@ enum
class CorsairHydroPlatinumController
{
public:
CorsairHydroPlatinumController(hid_device* dev_handle, const char* path);
CorsairHydroPlatinumController(hid_device* dev_handle, const char* path, std::string dev_name);
~CorsairHydroPlatinumController();
std::string GetLocation();
std::string GetFirmwareString();
std::string GetName();
void SetupColors(std::vector<RGBColor> colors);
private:
hid_device* dev;
std::string location;
std::string firmware_version;
std::string name;
std::atomic<unsigned int> sequence_number;
DeviceGuardManager* guard_manager_ptr;

View file

@ -38,9 +38,9 @@ void DetectCorsairHydroPlatinumControllers(hid_device_info* info, const std::str
if(dev)
{
CorsairHydroPlatinumController* controller = new CorsairHydroPlatinumController(dev, info->path);
CorsairHydroPlatinumController* controller = new CorsairHydroPlatinumController(dev, info->path, name);
RGBController_CorsairHydroPlatinum* rgb_controller = new RGBController_CorsairHydroPlatinum(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}

View file

@ -36,7 +36,7 @@ RGBController_CorsairHydroPlatinum::RGBController_CorsairHydroPlatinum(CorsairHy
{
controller = controller_ptr;
name = "Corsair Hydro Platinum Series Device";
name = controller->GetName();
vendor = "Corsair";
description = "Corsair Hydro Platinum Series Device";
type = DEVICE_TYPE_COOLER;