Store name in AOCKeyboardController to avoid setting it in detector
This commit is contained in:
parent
3dc2453deb
commit
5799ea8160
4 changed files with 12 additions and 5 deletions
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue