Files
OpenRGB/Controllers/DuckyKeyboardController/DuckyKeyboardControllerDetect.cpp
k1-801 dc2b41a0e2 Massive HID detectors update
Commit amended to undo change to device list management, still working through that merge request.  Want to work this one in first.  Changes by Adam Honse <calcprogrammer1@gmail.com>
2020-11-25 02:17:18 -06:00

40 lines
2.0 KiB
C++

#include "Detector.h"
#include "DuckyKeyboardController.h"
#include "RGBController.h"
#include "RGBController_DuckyKeyboard.h"
#include <hidapi/hidapi.h>
/*-----------------------------------------------------*\
| Ducky vendor ID |
\*-----------------------------------------------------*/
#define DUCKY_VID 0x04D9
/*-----------------------------------------------------*\
| Keyboard product IDs |
\*-----------------------------------------------------*/
#define DUCKY_SHINE_7_ONE_2_RGB_PID 0x0348
#define DUCKY_ONE_2_RGB_TKL_PID 0x0356
/******************************************************************************************\
* *
* DetectDuckyKeyboardControllers *
* *
* Tests the USB address to see if a Ducky RGB Keyboard controller exists there. *
* *
\******************************************************************************************/
void DetectDuckyKeyboardControllers(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if( dev )
{
DuckyKeyboardController* controller = new DuckyKeyboardController(dev, info->path);
RGBController_DuckyKeyboard* rgb_controller = new RGBController_DuckyKeyboard(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
} /* DetectDuckyKeyboardControllers() */
REGISTER_HID_DETECTOR_I("Ducky Shine 7/Ducky One 2 RGB", DetectDuckyKeyboardControllers, DUCKY_VID, DUCKY_SHINE_7_ONE_2_RGB_PID, 1);
REGISTER_HID_DETECTOR_I("Ducky One 2 RGB TKL", DetectDuckyKeyboardControllers, DUCKY_VID, DUCKY_ONE_2_RGB_TKL_PID, 1);