From 05c7d49a6249a65888e6105cff01725cb99eac9a Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Mon, 5 Oct 2020 00:13:11 -0500 Subject: [PATCH] Use HID path for Location on Thermaltake Riing controller --- .../RGBController_ThermaltakeRiing.cpp | 1 + .../ThermaltakeRiingController.cpp | 10 ++++++++-- .../ThermaltakeRiingController.h | 5 ++++- .../ThermaltakeRiingControllerDetect.cpp | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Controllers/ThermaltakeRiingController/RGBController_ThermaltakeRiing.cpp b/Controllers/ThermaltakeRiingController/RGBController_ThermaltakeRiing.cpp index 5eb7f2a6..0c1f845b 100644 --- a/Controllers/ThermaltakeRiingController/RGBController_ThermaltakeRiing.cpp +++ b/Controllers/ThermaltakeRiingController/RGBController_ThermaltakeRiing.cpp @@ -17,6 +17,7 @@ RGBController_ThermaltakeRiing::RGBController_ThermaltakeRiing(ThermaltakeRiingC name = "Thermaltake Riing"; type = DEVICE_TYPE_COOLER; description = "Thermaltake Riing Device"; + location = riing->GetDeviceLocation(); mode Direct; Direct.name = "Direct"; diff --git a/Controllers/ThermaltakeRiingController/ThermaltakeRiingController.cpp b/Controllers/ThermaltakeRiingController/ThermaltakeRiingController.cpp index 3191af21..314a2b7f 100644 --- a/Controllers/ThermaltakeRiingController/ThermaltakeRiingController.cpp +++ b/Controllers/ThermaltakeRiingController/ThermaltakeRiingController.cpp @@ -11,9 +11,10 @@ #include -ThermaltakeRiingController::ThermaltakeRiingController(hid_device* dev_handle) +ThermaltakeRiingController::ThermaltakeRiingController(hid_device* dev_handle, const char* path) { - dev = dev_handle; + dev = dev_handle; + location = path; SendInit(); } @@ -23,6 +24,11 @@ ThermaltakeRiingController::~ThermaltakeRiingController() } +std::string ThermaltakeRiingController::GetDeviceLocation() +{ + return(location); +} + void ThermaltakeRiingController::SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors) { unsigned char* color_data = new unsigned char[3 * num_colors]; diff --git a/Controllers/ThermaltakeRiingController/ThermaltakeRiingController.h b/Controllers/ThermaltakeRiingController/ThermaltakeRiingController.h index 18944b75..bcead589 100644 --- a/Controllers/ThermaltakeRiingController/ThermaltakeRiingController.h +++ b/Controllers/ThermaltakeRiingController/ThermaltakeRiingController.h @@ -47,9 +47,11 @@ enum class ThermaltakeRiingController { public: - ThermaltakeRiingController(hid_device* dev_handle); + ThermaltakeRiingController(hid_device* dev_handle, const char* path); ~ThermaltakeRiingController(); + std::string GetDeviceLocation(); + void SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors); void SetMode(unsigned char mode, unsigned char speed); @@ -58,6 +60,7 @@ private: unsigned char current_mode; unsigned char current_speed; + std::string location; void SendInit(); diff --git a/Controllers/ThermaltakeRiingController/ThermaltakeRiingControllerDetect.cpp b/Controllers/ThermaltakeRiingController/ThermaltakeRiingControllerDetect.cpp index ccab5bf3..faf97621 100644 --- a/Controllers/ThermaltakeRiingController/ThermaltakeRiingControllerDetect.cpp +++ b/Controllers/ThermaltakeRiingController/ThermaltakeRiingControllerDetect.cpp @@ -47,7 +47,7 @@ void DetectThermaltakeRiingControllers(std::vector& rgb_controll if(dev) { - ThermaltakeRiingController* controller = new ThermaltakeRiingController(dev); + ThermaltakeRiingController* controller = new ThermaltakeRiingController(dev, info->path); RGBController_ThermaltakeRiing* rgb_controller = new RGBController_ThermaltakeRiing(controller);