Store name in GigabyteAorusPCCaseController to avoid setting it in detector

This commit is contained in:
Adam Honse 2025-08-10 00:08:59 -05:00
parent 2bde9b287f
commit f54460fd2e
4 changed files with 18 additions and 13 deletions

View file

@ -13,10 +13,11 @@
#include "GigabyteAorusPCCaseController.h"
#include "StringUtils.h"
GigabyteAorusPCCaseController::GigabyteAorusPCCaseController(hid_device *dev_handle, const char *path)
GigabyteAorusPCCaseController::GigabyteAorusPCCaseController(hid_device *dev_handle, const char *path, std::string dev_name)
{
dev = dev_handle;
location = path;
name = dev_name;
}
GigabyteAorusPCCaseController::~GigabyteAorusPCCaseController()
@ -29,6 +30,11 @@ std::string GigabyteAorusPCCaseController::GetDeviceLocation()
return("HID: " + location);
}
std::string GigabyteAorusPCCaseController::GetNameString()
{
return(name);
}
std::string GigabyteAorusPCCaseController::GetSerialString()
{
wchar_t serial_string[128];

View file

@ -48,10 +48,11 @@ enum
class GigabyteAorusPCCaseController
{
public:
GigabyteAorusPCCaseController(hid_device* dev_handle, const char* path);
GigabyteAorusPCCaseController(hid_device* dev_handle, const char* path, std::string dev_name);
~GigabyteAorusPCCaseController();
std::string GetDeviceLocation();
std::string GetNameString();
std::string GetSerialString();
void SendColor(uint8_t red, uint8_t green, uint8_t blue);
@ -63,4 +64,5 @@ public:
private:
hid_device* dev;
std::string location;
std::string name;
};

View file

@ -37,9 +37,8 @@ void DetectGigabyteAorusPCCaseControllers(hid_device_info* info, const std::stri
if(dev)
{
GigabyteAorusPCCaseController* controller = new GigabyteAorusPCCaseController(dev, info->path);
GigabyteAorusPCCaseController* controller = new GigabyteAorusPCCaseController(dev, info->path, name);
RGBController_GigabyteAorusPCCase* rgb_controller = new RGBController_GigabyteAorusPCCase(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}

View file

@ -24,16 +24,14 @@
RGBController_GigabyteAorusPCCase::RGBController_GigabyteAorusPCCase(GigabyteAorusPCCaseController *controller_ptr)
{
controller = controller_ptr;
controller = controller_ptr;
name = "Gigabyte AORUS PC Case";
vendor = "Gigabyte";
description = "Gigabyte AORUS PC Case";
type = DEVICE_TYPE_CASE;
location = controller->GetDeviceLocation();
serial = controller->GetSerialString();
name = controller->GetNameString();
vendor = "Gigabyte";
description = "Gigabyte AORUS PC Case Device";
type = DEVICE_TYPE_CASE;
location = controller->GetDeviceLocation();
serial = controller->GetSerialString();
mode Custom;
Custom.name = "Custom";