Fill in serial field for all HID controllers using hidapi

This commit is contained in:
Adam Honse 2020-12-03 00:01:42 -06:00
parent 92dc8411d6
commit d19baf1365
101 changed files with 446 additions and 2 deletions

View file

@ -28,6 +28,8 @@ RGBController_RedragonK556::RGBController_RedragonK556(RedragonK556Controller* r
vendor = "Redragon";
type = DEVICE_TYPE_KEYBOARD;
description = "Redragon Keyboard Device";
location = redragon->GetDeviceLocation();
serial = redragon->GetSerialString();
mode Custom;
Custom.name = "Custom";

View file

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

View file

@ -13,6 +13,17 @@ std::string RedragonK556Controller::GetDeviceLocation()
return("HID: " + location);
}
std::string RedragonK556Controller::GetSerialString()
{
wchar_t serial_string[128];
hid_get_serial_number_string(dev, serial_string, 128);
std::wstring return_wstring = serial_string;
std::string return_string(return_wstring.begin(), return_wstring.end());
return(return_string);
}
void RedragonK556Controller::SetKeyboardColors
(
unsigned char * color_data,

View file

@ -96,6 +96,7 @@ public:
~RedragonK556Controller();
std::string GetDeviceLocation();
std::string GetSerialString();
void SetKeyboardColors
(

View file

@ -18,6 +18,17 @@ std::string RedragonM711Controller::GetDeviceLocation()
return("HID: " + location);
}
std::string RedragonM711Controller::GetSerialString()
{
wchar_t serial_string[128];
hid_get_serial_number_string(dev, serial_string, 128);
std::wstring return_wstring = serial_string;
std::string return_string(return_wstring.begin(), return_wstring.end());
return(return_string);
}
void RedragonM711Controller::SendMouseColor
(
unsigned char red,

View file

@ -31,6 +31,7 @@ public:
~RedragonM711Controller();
std::string GetDeviceLocation();
std::string GetSerialString();
void SendMouseApply();