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 "GigabyteAorusPCCaseController.h"
#include "StringUtils.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; dev = dev_handle;
location = path; location = path;
name = dev_name;
} }
GigabyteAorusPCCaseController::~GigabyteAorusPCCaseController() GigabyteAorusPCCaseController::~GigabyteAorusPCCaseController()
@ -29,6 +30,11 @@ std::string GigabyteAorusPCCaseController::GetDeviceLocation()
return("HID: " + location); return("HID: " + location);
} }
std::string GigabyteAorusPCCaseController::GetNameString()
{
return(name);
}
std::string GigabyteAorusPCCaseController::GetSerialString() std::string GigabyteAorusPCCaseController::GetSerialString()
{ {
wchar_t serial_string[128]; wchar_t serial_string[128];

View file

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

View file

@ -37,9 +37,8 @@ void DetectGigabyteAorusPCCaseControllers(hid_device_info* info, const std::stri
if(dev) 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); RGBController_GigabyteAorusPCCase* rgb_controller = new RGBController_GigabyteAorusPCCase(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller); ResourceManager::get()->RegisterRGBController(rgb_controller);
} }

View file

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