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
|
|
@ -14,76 +14,16 @@
|
|||
\*-----------------------------------------------------*/
|
||||
#define HOLTEK_A070_PID 0xA070
|
||||
|
||||
typedef struct
|
||||
void DetectHoltekControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
unsigned short usb_vid;
|
||||
unsigned short usb_pid;
|
||||
unsigned char usb_interface;
|
||||
device_type type;
|
||||
const char * name;
|
||||
} holtek_device;
|
||||
|
||||
#define HOLTEK_NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
|
||||
|
||||
static const holtek_device device_list[] =
|
||||
{
|
||||
/*-------------------------------------------------------------------------------------------------------------*\
|
||||
| Mice |
|
||||
\*-------------------------------------------------------------------------------------------------------------*/
|
||||
{ HOLTEK_VID, HOLTEK_A070_PID, 1, DEVICE_TYPE_MOUSE, "Holtek USB Gaming Mouse" },
|
||||
};
|
||||
|
||||
void DetectHoltekControllers(std::vector<RGBController*>& rgb_controllers)
|
||||
{
|
||||
hid_init();
|
||||
|
||||
for(unsigned int device_idx = 0; device_idx < HOLTEK_NUM_DEVICES; device_idx++)
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
switch(device_list[device_idx].type)
|
||||
{
|
||||
case DEVICE_TYPE_MOUSE:
|
||||
{
|
||||
hid_device_info* info = hid_enumerate(device_list[device_idx].usb_vid, device_list[device_idx].usb_pid);
|
||||
|
||||
while(info)
|
||||
{
|
||||
if((info->vendor_id == device_list[device_idx].usb_vid)
|
||||
&&(info->product_id == device_list[device_idx].usb_pid)
|
||||
#ifdef USE_HID_USAGE
|
||||
&&(info->interface_number == device_list[device_idx].usb_interface)
|
||||
&&(info->usage_page == 0xFF00)
|
||||
&&(info->usage == 2))
|
||||
#else
|
||||
&&(info->interface_number == device_list[device_idx].usb_interface))
|
||||
#endif
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
switch(device_list[device_idx].usb_pid)
|
||||
{
|
||||
case HOLTEK_A070_PID:
|
||||
{
|
||||
HoltekA070Controller* controller = new HoltekA070Controller(dev, info->path);
|
||||
|
||||
RGBController_HoltekA070* rgb_controller = new RGBController_HoltekA070(controller);
|
||||
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
info = info->next;
|
||||
}
|
||||
hid_free_enumeration(info);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
HoltekA070Controller* controller = new HoltekA070Controller(dev, info->path);
|
||||
RGBController_HoltekA070* rgb_controller = new RGBController_HoltekA070(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
} /* DetectHoltekControllers() */
|
||||
|
||||
REGISTER_DETECTOR("Holtek", DetectHoltekControllers);
|
||||
REGISTER_HID_DETECTOR_IPU("Holtek USB Gaming Mouse", DetectHoltekControllers, HOLTEK_VID, HOLTEK_A070_PID, 1, 0xFF00, 2);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue