mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-01-21 21:47:54 -05:00
Move HID detector calls to RunHIDDetector/RunHIDWrappedDetector functions and return controller list from detector functions
This commit is contained in:
@@ -11,27 +11,22 @@
|
||||
|
||||
#include <hidapi.h>
|
||||
#include "DetectionManager.h"
|
||||
#include "SRGBmodsLEDControllerV1.h"
|
||||
#include "SRGBmodsPicoController.h"
|
||||
#include "RGBController_SRGBmodsLEDControllerV1.h"
|
||||
#include "RGBController_SRGBmodsPico.h"
|
||||
#include "SRGBmodsLEDControllerV1.h"
|
||||
#include "SRGBmodsPicoController.h"
|
||||
|
||||
#define SRGBMODS_VID 0x16D0
|
||||
|
||||
#define SRGBMODS_PICO_PID 0x1123
|
||||
#define SRGBMODS_LED_CONTROLLER_V1_PID 0x1205
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectSRGBmodsControllers *
|
||||
* *
|
||||
* Detect devices supported by the SRGBmods driver *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectSRGBmodsControllers(hid_device_info* info, const std::string& name)
|
||||
DetectedControllers DetectSRGBmodsControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
DetectedControllers detected_controllers;
|
||||
hid_device* dev;
|
||||
|
||||
dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
@@ -40,26 +35,28 @@ void DetectSRGBmodsControllers(hid_device_info* info, const std::string& name)
|
||||
|
||||
std::wstring product_str(product);
|
||||
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| Test the product string in case this USB ID is reused for other Pi Pico |
|
||||
| projects |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
/*-------------------------------------------------*\
|
||||
| Test the product string in case this USB ID is |
|
||||
| reused for other Pi Pico projects |
|
||||
\*-------------------------------------------------*/
|
||||
if(product_str == L"SRGBmods Pico LED Controller" || product_str == L"Pico LED Controller")
|
||||
{
|
||||
SRGBmodsPicoController* controller = new SRGBmodsPicoController(dev, info->path, name);
|
||||
RGBController_SRGBmodsPico* rgb_controller = new RGBController_SRGBmodsPico(controller);
|
||||
|
||||
DetectionManager::get()->RegisterRGBController(rgb_controller);
|
||||
detected_controllers.push_back(rgb_controller);
|
||||
}
|
||||
else if(product_str == L"LED Controller v1")
|
||||
{
|
||||
SRGBmodsLEDControllerV1* controller = new SRGBmodsLEDControllerV1(dev, info->path, name);
|
||||
RGBController_SRGBmodsLEDControllerV1* rgb_controller = new RGBController_SRGBmodsLEDControllerV1(controller);
|
||||
|
||||
DetectionManager::get()->RegisterRGBController(rgb_controller);
|
||||
detected_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
} /* DetectSRGBmodsControllers() */
|
||||
|
||||
return(detected_controllers);
|
||||
}
|
||||
|
||||
REGISTER_HID_DETECTOR("SRGBmods Pico LED Controller", DetectSRGBmodsControllers, SRGBMODS_VID, SRGBMODS_PICO_PID );
|
||||
REGISTER_HID_DETECTOR("SRGBMods LED Controller v1", DetectSRGBmodsControllers, SRGBMODS_VID, SRGBMODS_LED_CONTROLLER_V1_PID);
|
||||
|
||||
Reference in New Issue
Block a user