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;
|
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;
|
dev = dev_handle;
|
||||||
location = path;
|
location = path;
|
||||||
|
name = dev_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
AOCKeyboardController::~AOCKeyboardController()
|
AOCKeyboardController::~AOCKeyboardController()
|
||||||
|
|
@ -33,6 +34,11 @@ std::string AOCKeyboardController::GetDeviceLocation()
|
||||||
return("HID " + location);
|
return("HID " + location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string AOCKeyboardController::GetDeviceName()
|
||||||
|
{
|
||||||
|
return(name);
|
||||||
|
}
|
||||||
|
|
||||||
std::string AOCKeyboardController::GetSerialString()
|
std::string AOCKeyboardController::GetSerialString()
|
||||||
{
|
{
|
||||||
wchar_t serial_string[128];
|
wchar_t serial_string[128];
|
||||||
|
|
|
||||||
|
|
@ -64,10 +64,11 @@ enum
|
||||||
class AOCKeyboardController
|
class AOCKeyboardController
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AOCKeyboardController(hid_device* dev_handle, const char* path);
|
AOCKeyboardController(hid_device* dev_handle, const char* path, std::string dev_name);
|
||||||
~AOCKeyboardController();
|
~AOCKeyboardController();
|
||||||
|
|
||||||
std::string GetDeviceLocation();
|
std::string GetDeviceLocation();
|
||||||
|
std::string GetDeviceName();
|
||||||
std::string GetSerialString();
|
std::string GetSerialString();
|
||||||
|
|
||||||
void SetLightingConfig
|
void SetLightingConfig
|
||||||
|
|
@ -88,6 +89,7 @@ public:
|
||||||
private:
|
private:
|
||||||
hid_device* dev;
|
hid_device* dev;
|
||||||
std::string location;
|
std::string location;
|
||||||
|
std::string name;
|
||||||
|
|
||||||
void SendStartPacket();
|
void SendStartPacket();
|
||||||
void SendEndPacket();
|
void SendEndPacket();
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,8 @@ void DetectAOCKeyboardControllers(hid_device_info* info, const std::string& name
|
||||||
|
|
||||||
if(dev)
|
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);
|
RGBController_AOCKeyboard* rgb_controller = new RGBController_AOCKeyboard(controller);
|
||||||
rgb_controller->name = name;
|
|
||||||
|
|
||||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ RGBController_AOCKeyboard::RGBController_AOCKeyboard(AOCKeyboardController* cont
|
||||||
{
|
{
|
||||||
controller = controller_ptr;
|
controller = controller_ptr;
|
||||||
|
|
||||||
name = "AOC Keyboard Device";
|
name = controller->GetDeviceName();
|
||||||
vendor = "AOC";
|
vendor = "AOC";
|
||||||
type = DEVICE_TYPE_KEYBOARD;
|
type = DEVICE_TYPE_KEYBOARD;
|
||||||
description = "AOC Keyboard Device";
|
description = "AOC Keyboard Device";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue