Store name in OKSKeyboardController to avoid setting it in detector
This commit is contained in:
parent
e418aa7f95
commit
2c630a5218
4 changed files with 54 additions and 47 deletions
|
|
@ -13,10 +13,11 @@
|
|||
#include "OKSKeyboardController.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
OKSKeyboardController::OKSKeyboardController(hid_device* dev_handle, const char* path, const unsigned short pid)
|
||||
OKSKeyboardController::OKSKeyboardController(hid_device* dev_handle, const char* path, const unsigned short pid, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
name = dev_name;
|
||||
usb_pid = pid;
|
||||
|
||||
SendInitialize();
|
||||
|
|
@ -32,6 +33,11 @@ std::string OKSKeyboardController::GetDeviceLocation()
|
|||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string OKSKeyboardController::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string OKSKeyboardController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
|
|
|
|||
|
|
@ -67,10 +67,11 @@ union uint32_kb2
|
|||
class OKSKeyboardController
|
||||
{
|
||||
public:
|
||||
OKSKeyboardController(hid_device* dev_handle, const char* path, const unsigned short pid);
|
||||
OKSKeyboardController(hid_device* dev_handle, const char* path, const unsigned short pid, std::string dev_name);
|
||||
~OKSKeyboardController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetNameString();
|
||||
std::string GetSerialString();
|
||||
unsigned short GetUSBPID();
|
||||
|
||||
|
|
@ -80,6 +81,7 @@ public:
|
|||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string name;
|
||||
unsigned short usb_pid;
|
||||
|
||||
void Send(const uint8_t bin[64], const uint16_t len);
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ void DetectOKSKeyboardControllers(hid_device_info* info, const std::string& name
|
|||
|
||||
if(dev)
|
||||
{
|
||||
OKSKeyboardController* controller = new OKSKeyboardController(dev, info->path, info->product_id);
|
||||
OKSKeyboardController* controller = new OKSKeyboardController(dev, info->path, info->product_id, name);
|
||||
RGBController_OKSKeyboard* rgb_controller = new RGBController_OKSKeyboard(controller);
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
} /* DetectOKSKeyboardControllers() */
|
||||
|
|
|
|||
|
|
@ -111,8 +111,7 @@ RGBController_OKSKeyboard::RGBController_OKSKeyboard(OKSKeyboardController* cont
|
|||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
|
||||
name = "OKS Keyboard Device";
|
||||
name = controller->GetNameString();
|
||||
vendor = "OKS";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "OKS Keyboard Device";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue