From f54460fd2e8846b99ad087992c7dc01ce96f9f19 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Sun, 10 Aug 2025 00:08:59 -0500 Subject: [PATCH] Store name in GigabyteAorusPCCaseController to avoid setting it in detector --- .../GigabyteAorusPCCaseController.cpp | 8 +++++++- .../GigabyteAorusPCCaseController.h | 4 +++- .../GigabyteAorusPCCaseControllerDetect.cpp | 3 +-- .../RGBController_GigabyteAorusPCCase.cpp | 16 +++++++--------- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Controllers/GigabyteAorusPCCaseController/GigabyteAorusPCCaseController.cpp b/Controllers/GigabyteAorusPCCaseController/GigabyteAorusPCCaseController.cpp index 3cfd7305..acd9953d 100644 --- a/Controllers/GigabyteAorusPCCaseController/GigabyteAorusPCCaseController.cpp +++ b/Controllers/GigabyteAorusPCCaseController/GigabyteAorusPCCaseController.cpp @@ -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]; diff --git a/Controllers/GigabyteAorusPCCaseController/GigabyteAorusPCCaseController.h b/Controllers/GigabyteAorusPCCaseController/GigabyteAorusPCCaseController.h index eeeeae1e..c8806dca 100644 --- a/Controllers/GigabyteAorusPCCaseController/GigabyteAorusPCCaseController.h +++ b/Controllers/GigabyteAorusPCCaseController/GigabyteAorusPCCaseController.h @@ -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; }; diff --git a/Controllers/GigabyteAorusPCCaseController/GigabyteAorusPCCaseControllerDetect.cpp b/Controllers/GigabyteAorusPCCaseController/GigabyteAorusPCCaseControllerDetect.cpp index d3eaf4d1..ec6239cf 100644 --- a/Controllers/GigabyteAorusPCCaseController/GigabyteAorusPCCaseControllerDetect.cpp +++ b/Controllers/GigabyteAorusPCCaseController/GigabyteAorusPCCaseControllerDetect.cpp @@ -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); } diff --git a/Controllers/GigabyteAorusPCCaseController/RGBController_GigabyteAorusPCCase.cpp b/Controllers/GigabyteAorusPCCaseController/RGBController_GigabyteAorusPCCase.cpp index 5788c6a9..0f988621 100644 --- a/Controllers/GigabyteAorusPCCaseController/RGBController_GigabyteAorusPCCase.cpp +++ b/Controllers/GigabyteAorusPCCaseController/RGBController_GigabyteAorusPCCase.cpp @@ -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";