Add firmware version retrieval to Thermaltake Riing controller

This commit is contained in:
Adam Honse 2020-06-06 12:57:30 -05:00
parent f93baffae6
commit d7c3fd1fb1
3 changed files with 28 additions and 0 deletions

View file

@ -32,6 +32,7 @@ RGBController_ThermaltakeRiing::RGBController_ThermaltakeRiing(ThermaltakeRiingC
description = "Thermaltake Riing Device";
location = controller->GetDeviceLocation();
serial = controller->GetSerialString();
version = controller->GetFirmwareVersion();
mode Direct;
Direct.name = "Direct";

View file

@ -46,6 +46,32 @@ std::string ThermaltakeRiingController::GetSerialString()
return(return_string);
}
std::string ThermaltakeRiingController::GetFirmwareVersion()
{
unsigned char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Get Firmware Version packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x33;
usb_buf[0x01] = 0x50;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 64);
hid_read(dev, usb_buf, 64);
std::string ret_str = std::to_string(usb_buf[2]) + "." + std::to_string(usb_buf[3]) + "." + std::to_string(usb_buf[4]);
return(ret_str);
}
void ThermaltakeRiingController::SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors)
{
unsigned char* color_data = new unsigned char[3 * num_colors];

View file

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