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>
This commit is contained in:
parent
cae28f3ac6
commit
dc2b41a0e2
32 changed files with 945 additions and 1893 deletions
|
|
@ -11,24 +11,6 @@
|
|||
#define HYPERX_VID 0x0951
|
||||
#define HYPERX_FURY_ULTRA_PID 0x1705
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short usb_vid;
|
||||
unsigned short usb_pid;
|
||||
unsigned char usb_interface;
|
||||
const char * name;
|
||||
} hyperx_device;
|
||||
|
||||
#define HYPERX_NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
|
||||
|
||||
static const hyperx_device device_list[] =
|
||||
{
|
||||
/*-----------------------------------------------------------------------------------------------------*\
|
||||
| Mousemats |
|
||||
\*-----------------------------------------------------------------------------------------------------*/
|
||||
{ HYPERX_VID, HYPERX_FURY_ULTRA_PID, 0, "HyperX Fury Ultra" },
|
||||
};
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectHyperXMousematControllers *
|
||||
|
|
@ -37,43 +19,16 @@ static const hyperx_device device_list[] =
|
|||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectHyperXMousematControllers(std::vector<RGBController*>& rgb_controllers)
|
||||
void DetectHyperXMousematControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device_info* info;
|
||||
hid_device* dev = NULL;
|
||||
|
||||
hid_init();
|
||||
|
||||
for(std::size_t device_idx = 0; device_idx < HYPERX_NUM_DEVICES; device_idx++)
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if( dev )
|
||||
{
|
||||
dev = NULL;
|
||||
|
||||
info = hid_enumerate(device_list[device_idx].usb_vid, device_list[device_idx].usb_pid);
|
||||
|
||||
//Look for HyperX RGB Peripheral
|
||||
while(info)
|
||||
{
|
||||
if((info->vendor_id == device_list[device_idx].usb_vid)
|
||||
&&(info->product_id == device_list[device_idx].usb_pid)
|
||||
&&(info->interface_number == device_list[device_idx].usb_interface))
|
||||
{
|
||||
dev = hid_open_path(info->path);
|
||||
|
||||
if( dev )
|
||||
{
|
||||
HyperXMousematController* controller = new HyperXMousematController(dev, info->path);
|
||||
|
||||
RGBController_HyperXMousemat* rgb_controller = new RGBController_HyperXMousemat(controller);
|
||||
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
info = info->next;
|
||||
}
|
||||
HyperXMousematController* controller = new HyperXMousematController(dev, info->path);
|
||||
RGBController_HyperXMousemat* rgb_controller = new RGBController_HyperXMousemat(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
} /* DetectHyperXMousematControllers() */
|
||||
|
||||
REGISTER_DETECTOR("HyperX Mousemat", DetectHyperXMousematControllers);
|
||||
REGISTER_HID_DETECTOR_I("HyperX Fury Ultra", DetectHyperXMousematControllers, HYPERX_VID, HYPERX_FURY_ULTRA_PID, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue