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

@ -19,6 +19,7 @@ RGBController_ThermaltakeRiing::RGBController_ThermaltakeRiing(ThermaltakeRiingC
type = DEVICE_TYPE_COOLER;
description = "Thermaltake Riing Device";
location = riing->GetDeviceLocation();
serial = riing->GetSerialString();
mode Direct;
Direct.name = "Direct";

View file

@ -29,6 +29,17 @@ std::string ThermaltakeRiingController::GetDeviceLocation()
return("HID: " + location);
}
std::string ThermaltakeRiingController::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 ThermaltakeRiingController::SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors)
{
unsigned char* color_data = new unsigned char[3 * num_colors];

View file

@ -51,6 +51,7 @@ public:
~ThermaltakeRiingController();
std::string GetDeviceLocation();
std::string GetSerialString();
void SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors);
void SetMode(unsigned char mode, unsigned char speed);