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

@@ -30,6 +30,17 @@ std::string HyperXAlloyOriginsController::GetDeviceLocation()
return("HID " + location);
}
std::string HyperXAlloyOriginsController::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 HyperXAlloyOriginsController::SetLEDsDirect(std::vector<RGBColor> colors)
{
/*-----------------------------------------------------*\

View File

@@ -21,6 +21,7 @@ public:
~HyperXAlloyOriginsController();
std::string GetDeviceLocation();
std::string GetSerialString();
void SetLEDsDirect(std::vector<RGBColor> colors);

View File

@@ -43,6 +43,17 @@ std::string HyperXKeyboardController::GetDeviceLocation()
return("HID: " + location);
}
std::string HyperXKeyboardController::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 HyperXKeyboardController::SetMode
(
unsigned char mode,

View File

@@ -69,6 +69,7 @@ public:
~HyperXKeyboardController();
std::string GetDeviceLocation();
std::string GetSerialString();
void SetMode
(

View File

@@ -176,6 +176,7 @@ RGBController_HyperXAlloyOrigins::RGBController_HyperXAlloyOrigins(HyperXAlloyOr
type = DEVICE_TYPE_KEYBOARD;
description = "HyperX Alloy Origins Keyboard Device";
location = hyperx->GetDeviceLocation();
serial = hyperx->GetSerialString();
mode Direct;
Direct.name = "Direct";

View File

@@ -184,6 +184,7 @@ RGBController_HyperXKeyboard::RGBController_HyperXKeyboard(HyperXKeyboardControl
type = DEVICE_TYPE_KEYBOARD;
description = "HyperX RGB Keyboard Device";
location = hyperx->GetDeviceLocation();
serial = hyperx->GetSerialString();
mode Direct;
Direct.name = "Direct";