mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-10-30 04:21:08 -04:00
Convert SkydimoSerialController to use USB Serial detector
This commit is contained in:
1 parent
d0d2bfb553
commit
e2bae772a9
1 file changed
+13
-21
@@ -14,38 +14,30 @@
|
||||
#include "LogManager.h"
|
||||
#include "RGBController_SkydimoSerial.h"
|
||||
#include "SkydimoSerialController.h"
|
||||
#include "find_usb_serial_port.h"
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Skydimo serial vendor and product IDs |
|
||||
\*---------------------------------------------------------*/
|
||||
#define SKYDIMO_SERIAL_VID 0x1A86
|
||||
#define SKYDIMO_SERIAL_PID 0x7523
|
||||
#define SKYDIMO_SERIAL_VID 0x1A86
|
||||
#define SKYDIMO_SERIAL_PID 0x7523
|
||||
|
||||
DetectedControllers DetectSkydimoSerialControllers()
|
||||
DetectedControllers DetectSkydimoSerialControllers(SerialDeviceInfo* port_info, const std::string& name)
|
||||
{
|
||||
DetectedControllers detected_controllers;
|
||||
std::vector<std::string> ports = find_usb_serial_port(SKYDIMO_SERIAL_VID, SKYDIMO_SERIAL_PID);
|
||||
|
||||
for(unsigned int port_idx = 0; port_idx < ports.size(); port_idx++)
|
||||
SkydimoSerialController* controller = new SkydimoSerialController(port_info->port_path);
|
||||
|
||||
if(controller->IsPresent())
|
||||
{
|
||||
SkydimoSerialController* controller = new SkydimoSerialController(ports[port_idx]);
|
||||
|
||||
if(controller->IsPresent())
|
||||
{
|
||||
RGBController_SkydimoSerial* rgb_controller = new RGBController_SkydimoSerial(controller);
|
||||
detected_controllers.push_back(rgb_controller);
|
||||
LOG_INFO("[SkydimoSerialControllerDetect] Detected %s at %s",
|
||||
controller->GetName().c_str(), ports[port_idx].c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
RGBController_SkydimoSerial* rgb_controller = new RGBController_SkydimoSerial(controller);
|
||||
detected_controllers.push_back(rgb_controller);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
return(detected_controllers);
|
||||
}
|
||||
|
||||
REGISTER_DETECTOR("Skydimo Serial", DetectSkydimoSerialControllers);
|
||||
REGISTER_CUSTOM_UDEV_RULE(skydimo_serial, "Skydimo Serial", "SUBSYSTEMS==\"serial|hidraw\", ATTRS{idVendor}==\"1a86\", ATTRS{idProduct}==\"7523\", TAG+=\"uaccess\", TAG+=\"Skydimo_Serial\"");
|
||||
REGISTER_USB_SERIAL_DETECTOR("Skydimo Serial", DetectSkydimoSerialControllers, SKYDIMO_SERIAL_VID, SKYDIMO_SERIAL_PID);
|
||||
Reference in new issue
Block a user