Store name in AOCKeyboardController to avoid setting it in detector

This commit is contained in:
Adam Honse 2025-08-03 21:33:56 -05:00
parent 3dc2453deb
commit 5799ea8160
4 changed files with 12 additions and 5 deletions

View file

@ -17,10 +17,11 @@
using namespace std::chrono_literals;
AOCKeyboardController::AOCKeyboardController(hid_device* dev_handle, const char* path)
AOCKeyboardController::AOCKeyboardController(hid_device* dev_handle, const char* path, std::string dev_name)
{
dev = dev_handle;
location = path;
name = dev_name;
}
AOCKeyboardController::~AOCKeyboardController()
@ -33,6 +34,11 @@ std::string AOCKeyboardController::GetDeviceLocation()
return("HID " + location);
}
std::string AOCKeyboardController::GetDeviceName()
{
return(name);
}
std::string AOCKeyboardController::GetSerialString()
{
wchar_t serial_string[128];

View file

@ -64,10 +64,11 @@ enum
class AOCKeyboardController
{
public:
AOCKeyboardController(hid_device* dev_handle, const char* path);
AOCKeyboardController(hid_device* dev_handle, const char* path, std::string dev_name);
~AOCKeyboardController();
std::string GetDeviceLocation();
std::string GetDeviceName();
std::string GetSerialString();
void SetLightingConfig
@ -88,6 +89,7 @@ public:
private:
hid_device* dev;
std::string location;
std::string name;
void SendStartPacket();
void SendEndPacket();

View file

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

View file

@ -52,7 +52,7 @@ RGBController_AOCKeyboard::RGBController_AOCKeyboard(AOCKeyboardController* cont
{
controller = controller_ptr;
name = "AOC Keyboard Device";
name = controller->GetDeviceName();
vendor = "AOC";
type = DEVICE_TYPE_KEYBOARD;
description = "AOC Keyboard Device";