Store name in AlienwareKeyboardControllers to avoid setting it in detector

This commit is contained in:
Adam Honse 2025-08-03 18:43:02 -05:00
parent 90c1e10cc5
commit 5e45480a0e
7 changed files with 26 additions and 10 deletions

View file

@ -14,10 +14,11 @@
#include "AlienwareAW410KController.h"
#include "StringUtils.h"
AlienwareAW410KController::AlienwareAW410KController(hid_device* dev_handle, const char* path)
AlienwareAW410KController::AlienwareAW410KController(hid_device* dev_handle, const char* path, std::string dev_name)
{
dev = dev_handle;
location = path;
name = dev_name;
SendCommit();
}
@ -32,6 +33,11 @@ std::string AlienwareAW410KController::GetDeviceLocation()
return("HID: " + location);
}
std::string AlienwareAW410KController::GetDeviceName()
{
return(name);
}
std::string AlienwareAW410KController::GetSerialString()
{
wchar_t serial_string[128];

View file

@ -75,10 +75,11 @@ struct SelectedButtons
class AlienwareAW410KController
{
public:
AlienwareAW410KController(hid_device* dev_handle, const char* path);
AlienwareAW410KController(hid_device* dev_handle, const char* path, std::string dev_name);
~AlienwareAW410KController();
std::string GetDeviceLocation();
std::string GetDeviceName();
std::string GetSerialString();
void SendInitialize();
@ -140,6 +141,7 @@ public:
private:
hid_device* dev;
std::string location;
std::string name;
void SendMode
(

View file

@ -176,7 +176,7 @@ RGBController_AlienwareAW410K::RGBController_AlienwareAW410K(AlienwareAW410KCont
{
controller = controller_ptr;
name = "Alienware AW410K Keyboard Device";
name = controller->GetDeviceName();
vendor = "Alienware";
type = DEVICE_TYPE_KEYBOARD;
description = "Alienware AW410K Keyboard Device";

View file

@ -13,10 +13,11 @@
#include "AlienwareAW510KController.h"
#include "StringUtils.h"
AlienwareAW510KController::AlienwareAW510KController(hid_device* dev_handle, const char* path)
AlienwareAW510KController::AlienwareAW510KController(hid_device* dev_handle, const char* path, std::string dev_name)
{
dev = dev_handle;
location = path;
name = dev_name;
SendCommit();
}
@ -31,6 +32,11 @@ std::string AlienwareAW510KController::GetDeviceLocation()
return("HID: " + location);
}
std::string AlienwareAW510KController::GetDeviceName()
{
return(name);
}
std::string AlienwareAW510KController::GetSerialString()
{
wchar_t serial_string[128];

View file

@ -77,10 +77,11 @@ struct SelectedKeys
class AlienwareAW510KController
{
public:
AlienwareAW510KController(hid_device* dev_handle, const char* path);
AlienwareAW510KController(hid_device* dev_handle, const char* path, std::string dev_name);
~AlienwareAW510KController();
std::string GetDeviceLocation();
std::string GetDeviceName();
std::string GetSerialString();
void SendInitialize();
@ -142,6 +143,7 @@ public:
private:
hid_device* dev;
std::string location;
std::string name;
void SendMode
(

View file

@ -175,7 +175,7 @@ RGBController_AlienwareAW510K::RGBController_AlienwareAW510K(AlienwareAW510KCont
{
controller = controller_ptr;
name = "Alienware AW510K Keyboard Device";
name = controller->GetDeviceName();
vendor = "Alienware";
type = DEVICE_TYPE_KEYBOARD;
description = "Alienware AW510K Keyboard Device";

View file

@ -38,9 +38,9 @@ void DetectAlienwareAW510KControllers(hid_device_info* info, const std::string&
hid_device* dev = hid_open_path(info->path);
if( dev )
{
AlienwareAW510KController* controller = new AlienwareAW510KController(dev, info->path);
AlienwareAW510KController* controller = new AlienwareAW510KController(dev, info->path, name);
RGBController_AlienwareAW510K* rgb_controller = new RGBController_AlienwareAW510K(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
@ -50,9 +50,9 @@ void DetectAlienwareAW410KControllers(hid_device_info* info, const std::string&
hid_device* dev = hid_open_path(info->path);
if( dev )
{
AlienwareAW410KController* controller = new AlienwareAW410KController(dev, info->path);
AlienwareAW410KController* controller = new AlienwareAW410KController(dev, info->path, name);
RGBController_AlienwareAW410K* rgb_controller = new RGBController_AlienwareAW410K(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}/* DetectAlienwareKeyboardControllers() */