Store name in DreamCheekyController to avoid setting it in detector

This commit is contained in:
Adam Honse 2025-08-06 11:31:48 -05:00
parent 13e8f70438
commit e6190ec275
4 changed files with 12 additions and 5 deletions

View file

@ -13,10 +13,11 @@
#include "DreamCheekyController.h" #include "DreamCheekyController.h"
#include "StringUtils.h" #include "StringUtils.h"
DreamCheekyController::DreamCheekyController(hid_device* dev_handle, const char* path) DreamCheekyController::DreamCheekyController(hid_device* dev_handle, const char* path, std::string dev_name)
{ {
dev = dev_handle; dev = dev_handle;
location = path; location = path;
name = dev_name;
/*-----------------------------------------------------*\ /*-----------------------------------------------------*\
| The Dream Cheeky Webmail Notifier requires four | | The Dream Cheeky Webmail Notifier requires four |
@ -43,6 +44,11 @@ std::string DreamCheekyController::GetDeviceLocation()
return("HID: " + location); return("HID: " + location);
} }
std::string DreamCheekyController::GetNameString()
{
return(name);
}
std::string DreamCheekyController::GetSerialString() std::string DreamCheekyController::GetSerialString()
{ {
wchar_t serial_string[128]; wchar_t serial_string[128];

View file

@ -17,10 +17,11 @@
class DreamCheekyController class DreamCheekyController
{ {
public: public:
DreamCheekyController(hid_device* dev_handle, const char* path); DreamCheekyController(hid_device* dev_handle, const char* path, std::string dev_name);
~DreamCheekyController(); ~DreamCheekyController();
std::string GetDeviceLocation(); std::string GetDeviceLocation();
std::string GetNameString();
std::string GetSerialString(); std::string GetSerialString();
void SetColor(unsigned char red, unsigned char grn, unsigned char blu); void SetColor(unsigned char red, unsigned char grn, unsigned char blu);
@ -28,4 +29,5 @@ public:
private: private:
hid_device* dev; hid_device* dev;
std::string location; std::string location;
std::string name;
}; };

View file

@ -29,9 +29,8 @@ void DetectDreamCheekyControllers(hid_device_info* info, const std::string& name
if(dev) if(dev)
{ {
DreamCheekyController* controller = new DreamCheekyController(dev, info->path); DreamCheekyController* controller = new DreamCheekyController(dev, info->path, name);
RGBController_DreamCheeky* rgb_controller = new RGBController_DreamCheeky(controller); RGBController_DreamCheeky* rgb_controller = new RGBController_DreamCheeky(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller); ResourceManager::get()->RegisterRGBController(rgb_controller);
} }

View file

@ -15,7 +15,7 @@ RGBController_DreamCheeky::RGBController_DreamCheeky(DreamCheekyController* cont
{ {
controller = controller_ptr; controller = controller_ptr;
name = "Dream Cheeky Device"; name = controller->GetNameString();
type = DEVICE_TYPE_ACCESSORY; type = DEVICE_TYPE_ACCESSORY;
vendor = "Dream Cheeky"; vendor = "Dream Cheeky";
description = "Dream Cheeky Device"; description = "Dream Cheeky Device";