From 07dc0ce9883db9b47b874fd3b67d31e94d41f80f Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Mon, 5 Oct 2020 00:15:16 -0500 Subject: [PATCH] Use HID path for Location on SteelSeries Apex controller --- .../RGBController_SteelSeriesApex.cpp | 1 + .../SteelSeriesApexController.cpp | 12 +++++++++--- .../SteelSeriesApexController.h | 7 +++++-- .../SteelSeriesControllerDetect.cpp | 2 +- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Controllers/SteelSeriesController/RGBController_SteelSeriesApex.cpp b/Controllers/SteelSeriesController/RGBController_SteelSeriesApex.cpp index f992323e4..daf3c6c3d 100644 --- a/Controllers/SteelSeriesController/RGBController_SteelSeriesApex.cpp +++ b/Controllers/SteelSeriesController/RGBController_SteelSeriesApex.cpp @@ -268,6 +268,7 @@ RGBController_SteelSeriesApex::RGBController_SteelSeriesApex(SteelSeriesApexCont name = "SteelSeries Apex RGB Keyboard"; type = DEVICE_TYPE_KEYBOARD; description = "SteelSeries Apex RGB Device"; + location = steelseries->GetDeviceLocation(); proto_type = steelseries->proto_type; diff --git a/Controllers/SteelSeriesController/SteelSeriesApexController.cpp b/Controllers/SteelSeriesController/SteelSeriesApexController.cpp index ec27a33ca..bb9ebcfcf 100644 --- a/Controllers/SteelSeriesController/SteelSeriesApexController.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesApexController.cpp @@ -31,10 +31,11 @@ static unsigned int keys_tkl[] = {0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x64, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xf0, 0x31 }; -SteelSeriesApexController::SteelSeriesApexController(hid_device* dev_handle, steelseries_type type) +SteelSeriesApexController::SteelSeriesApexController(hid_device* dev_handle, steelseries_type type, const char* path) { - dev = dev_handle; - proto_type = type; + dev = dev_handle; + location = path; + proto_type = type; } SteelSeriesApexController::~SteelSeriesApexController() @@ -42,6 +43,11 @@ SteelSeriesApexController::~SteelSeriesApexController() } +std::string SteelSeriesApexController::GetDeviceLocation() +{ + return(location); +} + void SteelSeriesApexController::SetMode ( unsigned char mode, diff --git a/Controllers/SteelSeriesController/SteelSeriesApexController.h b/Controllers/SteelSeriesController/SteelSeriesApexController.h index 4a3eedf41..b7ebf6f36 100644 --- a/Controllers/SteelSeriesController/SteelSeriesApexController.h +++ b/Controllers/SteelSeriesController/SteelSeriesApexController.h @@ -23,9 +23,11 @@ enum class SteelSeriesApexController { public: - SteelSeriesApexController(hid_device* dev_handle, steelseries_type type); + SteelSeriesApexController(hid_device* dev_handle, steelseries_type type, const char* path); ~SteelSeriesApexController(); + std::string GetDeviceLocation(); + steelseries_type proto_type; void SetMode @@ -39,9 +41,10 @@ public: private: hid_device* dev; unsigned char active_mode; + std::string location; void SelectProfile ( unsigned char profile ); -}; \ No newline at end of file +}; diff --git a/Controllers/SteelSeriesController/SteelSeriesControllerDetect.cpp b/Controllers/SteelSeriesController/SteelSeriesControllerDetect.cpp index c308bd6fd..2c961fd5f 100644 --- a/Controllers/SteelSeriesController/SteelSeriesControllerDetect.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesControllerDetect.cpp @@ -128,7 +128,7 @@ void DetectSteelSeriesControllers(std::vector& rgb_controllers) { case DEVICE_TYPE_KEYBOARD: { - SteelSeriesApexController* controller = new SteelSeriesApexController(dev, device_list[device_idx].proto_type); + SteelSeriesApexController* controller = new SteelSeriesApexController(dev, device_list[device_idx].proto_type, info->path); RGBController_SteelSeriesApex* rgb_controller = new RGBController_SteelSeriesApex(controller); rgb_controller->name = device_list[device_idx].name;