Store name in CreativeSoundBlasterXG6Controller to avoid setting it in detector

This commit is contained in:
Adam Honse 2025-08-06 08:25:20 -05:00
parent 31ec06b576
commit dc0103a155
4 changed files with 13 additions and 5 deletions

View file

@ -27,9 +27,9 @@ void DetectCreativeDevice(hid_device_info* info, const std::string& name)
if(dev) if(dev)
{ {
CreativeSoundBlasterXG6Controller* controller = new CreativeSoundBlasterXG6Controller(dev, info->path); CreativeSoundBlasterXG6Controller* controller = new CreativeSoundBlasterXG6Controller(dev, info->path, name);
RGBController_CreativeSoundBlasterXG6* rgb_controller = new RGBController_CreativeSoundBlasterXG6(controller); RGBController_CreativeSoundBlasterXG6* rgb_controller = new RGBController_CreativeSoundBlasterXG6(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller); ResourceManager::get()->RegisterRGBController(rgb_controller);
} }
} }

View file

@ -9,10 +9,11 @@
#include "CreativeSoundBlasterXG6Controller.h" #include "CreativeSoundBlasterXG6Controller.h"
CreativeSoundBlasterXG6Controller::CreativeSoundBlasterXG6Controller(hid_device* dev_handle, const char* path) CreativeSoundBlasterXG6Controller::CreativeSoundBlasterXG6Controller(hid_device* dev_handle, const char* path, std::string dev_name)
{ {
dev = dev_handle; dev = dev_handle;
location = path; location = path;
name = dev_name;
} }
CreativeSoundBlasterXG6Controller::~CreativeSoundBlasterXG6Controller() CreativeSoundBlasterXG6Controller::~CreativeSoundBlasterXG6Controller()
@ -25,6 +26,11 @@ std::string CreativeSoundBlasterXG6Controller::GetDeviceLocation()
return("HID " + location); return("HID " + location);
} }
std::string CreativeSoundBlasterXG6Controller::GetDeviceName()
{
return(name);
}
void CreativeSoundBlasterXG6Controller::SetLedColor (unsigned char red, void CreativeSoundBlasterXG6Controller::SetLedColor (unsigned char red,
unsigned char green, unsigned char green,
unsigned char blue, unsigned char blue,

View file

@ -16,7 +16,7 @@
class CreativeSoundBlasterXG6Controller class CreativeSoundBlasterXG6Controller
{ {
public: public:
CreativeSoundBlasterXG6Controller(hid_device* dev_handle, const char* path); CreativeSoundBlasterXG6Controller(hid_device* dev_handle, const char* path, std::string dev_name);
~CreativeSoundBlasterXG6Controller(); ~CreativeSoundBlasterXG6Controller();
void SetLedColor(unsigned char red, void SetLedColor(unsigned char red,
@ -25,9 +25,11 @@ public:
unsigned char brightness); unsigned char brightness);
std::string GetDeviceLocation(); std::string GetDeviceLocation();
std::string GetDeviceName();
std::string GetSerialString(); std::string GetSerialString();
private: private:
hid_device* dev; hid_device* dev;
std::string location; std::string location;
std::string name;
}; };

View file

@ -24,7 +24,7 @@ RGBController_CreativeSoundBlasterXG6::RGBController_CreativeSoundBlasterXG6(Cre
{ {
controller = controller_ptr; controller = controller_ptr;
name = "Creative SoundBlasterX G6 Device"; name = controller->GetDeviceName();
vendor = "Creative"; vendor = "Creative";
type = DEVICE_TYPE_HEADSET; type = DEVICE_TYPE_HEADSET;
description = "Creative SoundBlasterX G6 Device"; description = "Creative SoundBlasterX G6 Device";