Use HID path for Location on Redragon controllers

This commit is contained in:
Adam Honse
2020-10-02 20:28:38 -05:00
parent fe74d9ea78
commit b829bfe538
6 changed files with 28 additions and 9 deletions

View File

@@ -16,6 +16,7 @@ RGBController_RedragonM711::RGBController_RedragonM711(RedragonM711Controller* r
name = "Redragon Mouse Device";
type = DEVICE_TYPE_MOUSE;
description = "Redragon Mouse Device";
location = redragon->GetDeviceLocation();
mode Static;
Static.name = "Static";

View File

@@ -99,7 +99,7 @@ void DetectRedragonControllers(std::vector<RGBController*>& rgb_controllers)
{
case DEVICE_TYPE_KEYBOARD:
{
RedragonK556Controller* controller = new RedragonK556Controller(dev);
RedragonK556Controller* controller = new RedragonK556Controller(dev, info->path);
RGBController_RedragonK556* rgb_controller = new RGBController_RedragonK556(controller);
@@ -110,7 +110,7 @@ void DetectRedragonControllers(std::vector<RGBController*>& rgb_controllers)
case DEVICE_TYPE_MOUSE:
{
RedragonM711Controller* controller = new RedragonM711Controller(dev);
RedragonM711Controller* controller = new RedragonM711Controller(dev, info->path);
RGBController_RedragonM711* rgb_controller = new RGBController_RedragonM711(controller);

View File

@@ -2,9 +2,15 @@
#include <cstring>
RedragonK556Controller::RedragonK556Controller(hid_device* dev_handle)
RedragonK556Controller::RedragonK556Controller(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
dev = dev_handle;
location = path;
}
std::string RedragonK556Controller::GetDeviceLocation()
{
return(location);
}
void RedragonK556Controller::SetKeyboardColors
@@ -223,4 +229,4 @@ void RedragonK556Controller::SendKeyboardParameter
\*-----------------------------------------------------*/
hid_write(dev, (unsigned char *)usb_buf, 64);
hid_read(dev, (unsigned char *)usb_buf, 64);
}
}

View File

@@ -92,9 +92,11 @@ enum
class RedragonK556Controller
{
public:
RedragonK556Controller(hid_device* dev_handle);
RedragonK556Controller(hid_device* dev_handle, const char* path);
~RedragonK556Controller();
std::string GetDeviceLocation();
void SetKeyboardColors
(
unsigned char * color_data,
@@ -131,6 +133,7 @@ public:
private:
hid_device* dev;
std::string location;
void ComputeChecksum
(

View File

@@ -2,9 +2,10 @@
#include <cstring>
RedragonM711Controller::RedragonM711Controller(hid_device* dev_handle)
RedragonM711Controller::RedragonM711Controller(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
dev = dev_handle;
location = path;
unsigned char active_profile = 0x00;
@@ -12,6 +13,11 @@ RedragonM711Controller::RedragonM711Controller(hid_device* dev_handle)
SendMouseApply();
}
std::string RedragonM711Controller::GetDeviceLocation()
{
return(location);
}
void RedragonM711Controller::SendMouseColor
(
unsigned char red,

View File

@@ -27,9 +27,11 @@ enum
class RedragonM711Controller
{
public:
RedragonM711Controller(hid_device* dev_handle);
RedragonM711Controller(hid_device* dev_handle, const char* path);
~RedragonM711Controller();
std::string GetDeviceLocation();
void SendMouseApply();
void SendMouseColor
@@ -56,6 +58,7 @@ public:
private:
hid_device* dev;
std::string location;
void SendWritePacket
(