Skip to content

Commit d7c3fd1

Browse files
Add firmware version retrieval to Thermaltake Riing controller
1 parent f93baff commit d7c3fd1

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

Controllers/ThermaltakeRiingController/ThermaltakeRiingController/RGBController_ThermaltakeRiing.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ RGBController_ThermaltakeRiing::RGBController_ThermaltakeRiing(ThermaltakeRiingC
3232
description = "Thermaltake Riing Device";
3333
location = controller->GetDeviceLocation();
3434
serial = controller->GetSerialString();
35+
version = controller->GetFirmwareVersion();
3536

3637
mode Direct;
3738
Direct.name = "Direct";

Controllers/ThermaltakeRiingController/ThermaltakeRiingController/ThermaltakeRiingController.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,32 @@ std::string ThermaltakeRiingController::GetSerialString()
4646
return(return_string);
4747
}
4848

49+
std::string ThermaltakeRiingController::GetFirmwareVersion()
50+
{
51+
unsigned char usb_buf[64];
52+
53+
/*-----------------------------------------------------*\
54+
| Zero out buffer |
55+
\*-----------------------------------------------------*/
56+
memset(usb_buf, 0x00, sizeof(usb_buf));
57+
58+
/*-----------------------------------------------------*\
59+
| Set up Get Firmware Version packet |
60+
\*-----------------------------------------------------*/
61+
usb_buf[0x00] = 0x33;
62+
usb_buf[0x01] = 0x50;
63+
64+
/*-----------------------------------------------------*\
65+
| Send packet |
66+
\*-----------------------------------------------------*/
67+
hid_write(dev, usb_buf, 64);
68+
hid_read(dev, usb_buf, 64);
69+
70+
std::string ret_str = std::to_string(usb_buf[2]) + "." + std::to_string(usb_buf[3]) + "." + std::to_string(usb_buf[4]);
71+
72+
return(ret_str);
73+
}
74+
4975
void ThermaltakeRiingController::SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors)
5076
{
5177
unsigned char* color_data = new unsigned char[3 * num_colors];

Controllers/ThermaltakeRiingController/ThermaltakeRiingController/ThermaltakeRiingController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class ThermaltakeRiingController
5454

5555
std::string GetDeviceLocation();
5656
std::string GetSerialString();
57+
std::string GetFirmwareVersion();
5758

5859
void SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors);
5960
void SetMode(unsigned char mode, unsigned char speed);

0 commit comments

Comments
 (0)