mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2025-12-31 11:17:52 -05:00
* USB devices that are **not** registering a detector that includes the VID and PID will need to specify these details separately to be added to the UDEV rules at compile time * Resolves #2440
45 lines
2.2 KiB
C++
45 lines
2.2 KiB
C++
#include "Detector.h"
|
|
#include "DygmaRaiseController.h"
|
|
#include "RGBController.h"
|
|
#include "RGBController_DygmaRaise.h"
|
|
#include "find_usb_serial_port.h"
|
|
#include <vector>
|
|
#include <stdio.h>
|
|
|
|
|
|
#define DYGMA_RAISE_VID 0x1209
|
|
#define DYGMA_RAISE_PID 0x2201
|
|
|
|
/******************************************************************************************\
|
|
* *
|
|
* DetectDygmaRaiseControllers *
|
|
* *
|
|
* Tests the USB address to see if a DygmaRaise keyboard exists there. *
|
|
* Then opens a serial port to communicate with the KB *
|
|
* *
|
|
\******************************************************************************************/
|
|
|
|
void DetectDygmaRaiseControllers(std::vector<RGBController*> &rgb_controllers)
|
|
{
|
|
std::vector<std::string *> ports = find_usb_serial_port(DYGMA_RAISE_VID, DYGMA_RAISE_PID);
|
|
|
|
for(std::size_t i = 0; i < ports.size(); i++)
|
|
{
|
|
if(*ports[i] != "")
|
|
{
|
|
DygmaRaiseController* controller = new DygmaRaiseController();
|
|
controller->Initialize((char *)ports[i]->c_str());
|
|
|
|
RGBController_DygmaRaise* rgb_controller = new RGBController_DygmaRaise(controller);
|
|
rgb_controllers.push_back(rgb_controller);
|
|
}
|
|
}
|
|
}
|
|
|
|
REGISTER_DETECTOR("Dygma Raise", DetectDygmaRaiseControllers);
|
|
/*---------------------------------------------------------------------------------------------------------*\
|
|
| Entries for dynamic UDEV rules |
|
|
| |
|
|
| DUMMY_DEVICE_DETECTOR("Dygma Raise", DetectDygmaRaiseControllers, 0x1209, 0x2201 ) |
|
|
\*---------------------------------------------------------------------------------------------------------*/
|