Store name in DuckyKeyboardController to avoid setting it in detector
This commit is contained in:
parent
a8500a2a8a
commit
a73a879238
4 changed files with 16 additions and 8 deletions
|
|
@ -13,10 +13,11 @@
|
|||
#include "DuckyKeyboardController.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
DuckyKeyboardController::DuckyKeyboardController(hid_device* dev_handle, const char* path, const unsigned short pid)
|
||||
DuckyKeyboardController::DuckyKeyboardController(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();
|
||||
|
|
@ -27,11 +28,16 @@ DuckyKeyboardController::~DuckyKeyboardController()
|
|||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string DuckyKeyboardController::GetDeviceLocation()
|
||||
std::string DuckyKeyboardController::GetLocationString()
|
||||
{
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string DuckyKeyboardController::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string DuckyKeyboardController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
|
|
|
|||
|
|
@ -29,10 +29,11 @@
|
|||
class DuckyKeyboardController
|
||||
{
|
||||
public:
|
||||
DuckyKeyboardController(hid_device* dev_handle, const char* path, const unsigned short pid);
|
||||
DuckyKeyboardController(hid_device* dev_handle, const char* path, const unsigned short pid, std::string dev_name);
|
||||
~DuckyKeyboardController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetLocationString();
|
||||
std::string GetNameString();
|
||||
std::string GetSerialString();
|
||||
unsigned short GetUSBPID();
|
||||
|
||||
|
|
@ -45,6 +46,7 @@ public:
|
|||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string name;
|
||||
unsigned short usb_pid;
|
||||
|
||||
void SendInitialize();
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ void DetectDuckyKeyboardControllers(hid_device_info* info, const std::string& na
|
|||
|
||||
if(dev)
|
||||
{
|
||||
DuckyKeyboardController* controller = new DuckyKeyboardController(dev, info->path, info->product_id);
|
||||
DuckyKeyboardController* controller = new DuckyKeyboardController(dev, info->path, info->product_id, name);
|
||||
RGBController_DuckyKeyboard* rgb_controller = new RGBController_DuckyKeyboard(controller);
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
} /* DetectDuckyKeyboardControllers() */
|
||||
|
|
|
|||
|
|
@ -203,11 +203,11 @@ RGBController_DuckyKeyboard::RGBController_DuckyKeyboard(DuckyKeyboardController
|
|||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "Ducky Keyboard Device";
|
||||
name = controller->GetNameString();
|
||||
vendor = "Ducky";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "Ducky Keyboard Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
location = controller->GetLocationString();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue