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:
k1-801 2020-11-12 09:45:44 +04:00 committed by Adam Honse
parent cae28f3ac6
commit dc2b41a0e2
32 changed files with 945 additions and 1893 deletions

View file

@ -2,7 +2,6 @@
#include "MSI3ZoneController.h"
#include "RGBController.h"
#include "RGBController_MSI3Zone.h"
#include <vector>
#include <hidapi/hidapi.h>
#define MSI_3_ZONE_KEYBOARD_VID 0x1770
@ -17,35 +16,16 @@
* *
\******************************************************************************************/
void DetectMSI3ZoneControllers(std::vector<RGBController*>& rgb_controllers)
void DetectMSI3ZoneControllers(hid_device_info* info, const std::string&)
{
hid_device_info* info;
hid_device* dev = NULL;
hid_init();
info = hid_enumerate(MSI_3_ZONE_KEYBOARD_VID, MSI_3_ZONE_KEYBOARD_PID);
//Look for MSI/Steelseries 3-zone Keyboard
while(info)
hid_device* dev = hid_open_path(info->path);
if( dev )
{
if((info->vendor_id == MSI_3_ZONE_KEYBOARD_VID)
&&(info->product_id == MSI_3_ZONE_KEYBOARD_PID))
{
dev = hid_open_path(info->path);
if( dev )
{
MSI3ZoneController* controller = new MSI3ZoneController(dev, info->path);
RGBController_MSI3Zone* rgb_controller = new RGBController_MSI3Zone(controller);
rgb_controllers.push_back(rgb_controller);
}
}
info = info->next;
MSI3ZoneController* controller = new MSI3ZoneController(dev, info->path);
RGBController_MSI3Zone* rgb_controller = new RGBController_MSI3Zone(controller);
// Constructor sets the name
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
} /* DetectMSI3ZoneControllers() */
REGISTER_DETECTOR("MSI 3-Zone Laptop", DetectMSI3ZoneControllers);
REGISTER_HID_DETECTOR("MSI 3-Zone Laptop", DetectMSI3ZoneControllers, MSI_3_ZONE_KEYBOARD_VID, MSI_3_ZONE_KEYBOARD_PID);