diff --git a/Controllers/SteelSeriesController/SteelSeriesAerox3Controller/SteelSeriesAerox3Controller.cpp b/Controllers/SteelSeriesController/SteelSeriesAerox3Controller/SteelSeriesAerox3Controller.cpp index eab43c44..7ce220b8 100644 --- a/Controllers/SteelSeriesController/SteelSeriesAerox3Controller/SteelSeriesAerox3Controller.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesAerox3Controller/SteelSeriesAerox3Controller.cpp @@ -12,8 +12,7 @@ #include "SteelSeriesAerox3Controller.h" #include "LogManager.h" -SteelSeriesAerox3Controller::SteelSeriesAerox3Controller(hid_device* dev_handle, steelseries_type proto_type, const char* path) - : SteelSeriesMouseController(dev_handle, proto_type, path) +SteelSeriesAerox3Controller::SteelSeriesAerox3Controller(hid_device* dev_handle, steelseries_type proto_type, const char* path, std::string dev_name) : SteelSeriesMouseController(dev_handle, proto_type, path, dev_name) { SendInit(); } diff --git a/Controllers/SteelSeriesController/SteelSeriesAerox3Controller/SteelSeriesAerox3Controller.h b/Controllers/SteelSeriesController/SteelSeriesAerox3Controller/SteelSeriesAerox3Controller.h index 91a7b8a6..a802f7e0 100644 --- a/Controllers/SteelSeriesController/SteelSeriesAerox3Controller/SteelSeriesAerox3Controller.h +++ b/Controllers/SteelSeriesController/SteelSeriesAerox3Controller/SteelSeriesAerox3Controller.h @@ -35,7 +35,7 @@ static const steelseries_mouse aerox_3 = class SteelSeriesAerox3Controller: public SteelSeriesMouseController { public: - SteelSeriesAerox3Controller(hid_device* dev_handle, steelseries_type proto_type, const char* path); + SteelSeriesAerox3Controller(hid_device* dev_handle, steelseries_type proto_type, const char* path, std::string dev_name); ~SteelSeriesAerox3Controller(); std::string GetFirmwareVersion() override; diff --git a/Controllers/SteelSeriesController/SteelSeriesAerox5Controller/SteelSeriesAerox5Controller.cpp b/Controllers/SteelSeriesController/SteelSeriesAerox5Controller/SteelSeriesAerox5Controller.cpp index 6b8b7655..a73b2b68 100644 --- a/Controllers/SteelSeriesController/SteelSeriesAerox5Controller/SteelSeriesAerox5Controller.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesAerox5Controller/SteelSeriesAerox5Controller.cpp @@ -12,8 +12,7 @@ #include "SteelSeriesAerox5Controller.h" #include "LogManager.h" -SteelSeriesAerox5Controller::SteelSeriesAerox5Controller(hid_device* dev_handle, steelseries_type proto_type, const char* path) - : SteelSeriesMouseController(dev_handle, proto_type, path) +SteelSeriesAerox5Controller::SteelSeriesAerox5Controller(hid_device* dev_handle, steelseries_type proto_type, const char* path, std::string dev_name) : SteelSeriesMouseController(dev_handle, proto_type, path, dev_name) { SendInit(); } diff --git a/Controllers/SteelSeriesController/SteelSeriesAerox5Controller/SteelSeriesAerox5Controller.h b/Controllers/SteelSeriesController/SteelSeriesAerox5Controller/SteelSeriesAerox5Controller.h index 42bd2920..be30691f 100644 --- a/Controllers/SteelSeriesController/SteelSeriesAerox5Controller/SteelSeriesAerox5Controller.h +++ b/Controllers/SteelSeriesController/SteelSeriesAerox5Controller/SteelSeriesAerox5Controller.h @@ -37,9 +37,7 @@ static const steelseries_mouse aerox_5 = class SteelSeriesAerox5Controller : public SteelSeriesMouseController { public: - SteelSeriesAerox5Controller(hid_device *dev_handle, - steelseries_type proto_type, - const char *path); + SteelSeriesAerox5Controller(hid_device *dev_handle, steelseries_type proto_type, const char *path, std::string dev_name); ~SteelSeriesAerox5Controller(); std::string GetFirmwareVersion() override; diff --git a/Controllers/SteelSeriesController/SteelSeriesAeroxWirelessController/SteelSeriesAeroxWirelessController.cpp b/Controllers/SteelSeriesController/SteelSeriesAeroxWirelessController/SteelSeriesAeroxWirelessController.cpp index 9277d1f9..febcdb51 100644 --- a/Controllers/SteelSeriesController/SteelSeriesAeroxWirelessController/SteelSeriesAeroxWirelessController.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesAeroxWirelessController/SteelSeriesAeroxWirelessController.cpp @@ -13,8 +13,7 @@ #include "LogManager.h" #include "SteelSeriesGeneric.h" -SteelSeriesAeroxWirelessController::SteelSeriesAeroxWirelessController(hid_device* dev_handle, steelseries_type proto_type, const char* path) - : SteelSeriesMouseController(dev_handle, proto_type, path) +SteelSeriesAeroxWirelessController::SteelSeriesAeroxWirelessController(hid_device* dev_handle, steelseries_type proto_type, const char* path, std::string dev_name) : SteelSeriesMouseController(dev_handle, proto_type, path, dev_name) { switch(proto_type) { diff --git a/Controllers/SteelSeriesController/SteelSeriesAeroxWirelessController/SteelSeriesAeroxWirelessController.h b/Controllers/SteelSeriesController/SteelSeriesAeroxWirelessController/SteelSeriesAeroxWirelessController.h index 0cbce6d5..7e5bb28b 100644 --- a/Controllers/SteelSeriesController/SteelSeriesAeroxWirelessController/SteelSeriesAeroxWirelessController.h +++ b/Controllers/SteelSeriesController/SteelSeriesAeroxWirelessController/SteelSeriesAeroxWirelessController.h @@ -56,7 +56,7 @@ static const steelseries_mouse aerox_9 = class SteelSeriesAeroxWirelessController: public SteelSeriesMouseController { public: - SteelSeriesAeroxWirelessController(hid_device* dev_handle, steelseries_type proto_type, const char* path); + SteelSeriesAeroxWirelessController(hid_device* dev_handle, steelseries_type proto_type, const char* path, std::string dev_name); ~SteelSeriesAeroxWirelessController(); std::string GetFirmwareVersion() override; diff --git a/Controllers/SteelSeriesController/SteelSeriesApex3Controller/RGBController_SteelSeriesApex3.cpp b/Controllers/SteelSeriesController/SteelSeriesApex3Controller/RGBController_SteelSeriesApex3.cpp index 8474c180..5c6c7ee7 100644 --- a/Controllers/SteelSeriesController/SteelSeriesApex3Controller/RGBController_SteelSeriesApex3.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesApex3Controller/RGBController_SteelSeriesApex3.cpp @@ -24,39 +24,39 @@ RGBController_SteelSeriesApex3::RGBController_SteelSeriesApex3(SteelSeriesApex3Controller* controller_ptr) { - controller = controller_ptr; + controller = controller_ptr; - name = "SteelSeries Apex 3 device"; - vendor = "SteelSeries"; - type = DEVICE_TYPE_KEYBOARD; - description = name; - location = controller->GetDeviceLocation(); - serial = controller->GetSerialString(); + name = controller->GetNameString(); + vendor = "SteelSeries"; + type = DEVICE_TYPE_KEYBOARD; + description = "SteelSeries Apex 3 Device"; + location = controller->GetDeviceLocation(); + serial = controller->GetSerialString(); mode direct; - direct.name = "Direct"; - direct.value = static_cast(APEX3_MODES::DIRECT); - direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS; + direct.name = "Direct"; + direct.value = static_cast(APEX3_MODES::DIRECT); + direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS; if(controller->SupportsSave()) { - direct.flags |= MODE_FLAG_MANUAL_SAVE; + direct.flags |= MODE_FLAG_MANUAL_SAVE; } - direct.color_mode = MODE_COLORS_PER_LED; - direct.brightness_min = STEELSERIES_APEX3_BRIGHTNESS_MIN; - direct.brightness_max = controller->GetMaxBrightness(); - direct.brightness = direct.brightness_max; + direct.color_mode = MODE_COLORS_PER_LED; + direct.brightness_min = STEELSERIES_APEX3_BRIGHTNESS_MIN; + direct.brightness_max = controller->GetMaxBrightness(); + direct.brightness = direct.brightness_max; modes.push_back(direct); if(controller->SupportsRainbowWave()) { mode rainbow; - rainbow.name = "Rainbow Wave"; - rainbow.value = static_cast(APEX3_MODES::RAINBOW_WAVE); - rainbow.flags = MODE_FLAG_HAS_BRIGHTNESS; - rainbow.color_mode = MODE_COLORS_NONE; - rainbow.brightness_min = STEELSERIES_APEX3_BRIGHTNESS_MIN; - rainbow.brightness_max = controller->GetMaxBrightness(); - rainbow.brightness = rainbow.brightness_max; + rainbow.name = "Rainbow Wave"; + rainbow.value = static_cast(APEX3_MODES::RAINBOW_WAVE); + rainbow.flags = MODE_FLAG_HAS_BRIGHTNESS; + rainbow.color_mode = MODE_COLORS_NONE; + rainbow.brightness_min = STEELSERIES_APEX3_BRIGHTNESS_MIN; + rainbow.brightness_max = controller->GetMaxBrightness(); + rainbow.brightness = rainbow.brightness_max; modes.push_back(rainbow); } diff --git a/Controllers/SteelSeriesController/SteelSeriesApex3Controller/SteelSeriesApex3Controller.cpp b/Controllers/SteelSeriesController/SteelSeriesApex3Controller/SteelSeriesApex3Controller.cpp index 1b9aecdc..9a70de8f 100644 --- a/Controllers/SteelSeriesController/SteelSeriesApex3Controller/SteelSeriesApex3Controller.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesApex3Controller/SteelSeriesApex3Controller.cpp @@ -13,10 +13,11 @@ #include "SteelSeriesApex3Controller.h" #include "StringUtils.h" -SteelSeriesApex3Controller::SteelSeriesApex3Controller(hid_device* dev_handle, const char* path) +SteelSeriesApex3Controller::SteelSeriesApex3Controller(hid_device* dev_handle, const char* path, std::string dev_name) { dev = dev_handle; location = path; + name = dev_name; } SteelSeriesApex3Controller::~SteelSeriesApex3Controller() @@ -29,6 +30,11 @@ std::string SteelSeriesApex3Controller::GetDeviceLocation() return("HID: " + location); } +std::string SteelSeriesApex3Controller::GetNameString() +{ + return(name); +} + std::string SteelSeriesApex3Controller::GetSerialString() { wchar_t serial_string[128]; diff --git a/Controllers/SteelSeriesController/SteelSeriesApex3Controller/SteelSeriesApex3Controller.h b/Controllers/SteelSeriesController/SteelSeriesApex3Controller/SteelSeriesApex3Controller.h index da0798f5..ab49112c 100644 --- a/Controllers/SteelSeriesController/SteelSeriesApex3Controller/SteelSeriesApex3Controller.h +++ b/Controllers/SteelSeriesController/SteelSeriesApex3Controller/SteelSeriesApex3Controller.h @@ -22,10 +22,11 @@ class SteelSeriesApex3Controller { public: - SteelSeriesApex3Controller(hid_device* dev_handle, const char* path); + SteelSeriesApex3Controller(hid_device* dev_handle, const char* path, std::string dev_name); virtual ~SteelSeriesApex3Controller(); std::string GetDeviceLocation(); + std::string GetNameString(); std::string GetSerialString(); steelseries_type GetKeyboardType(); @@ -40,4 +41,5 @@ public: private: std::string location; + std::string name; }; diff --git a/Controllers/SteelSeriesController/SteelSeriesApex8ZoneController/SteelSeriesApex8ZoneController.cpp b/Controllers/SteelSeriesController/SteelSeriesApex8ZoneController/SteelSeriesApex8ZoneController.cpp index db27b9db..a4dfa285 100644 --- a/Controllers/SteelSeriesController/SteelSeriesApex8ZoneController/SteelSeriesApex8ZoneController.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesApex8ZoneController/SteelSeriesApex8ZoneController.cpp @@ -14,7 +14,7 @@ #include "SteelSeriesApex8ZoneController.h" #include "LogManager.h" -SteelSeriesApex8ZoneController::SteelSeriesApex8ZoneController(hid_device* dev_handle, const char* path) : SteelSeriesApex3Controller(dev_handle, path) +SteelSeriesApex8ZoneController::SteelSeriesApex8ZoneController(hid_device* dev_handle, const char* path, std::string dev_name) : SteelSeriesApex3Controller(dev_handle, path, dev_name) { } diff --git a/Controllers/SteelSeriesController/SteelSeriesApex8ZoneController/SteelSeriesApex8ZoneController.h b/Controllers/SteelSeriesController/SteelSeriesApex8ZoneController/SteelSeriesApex8ZoneController.h index bb2913b5..8cf7bd3a 100644 --- a/Controllers/SteelSeriesController/SteelSeriesApex8ZoneController/SteelSeriesApex8ZoneController.h +++ b/Controllers/SteelSeriesController/SteelSeriesApex8ZoneController/SteelSeriesApex8ZoneController.h @@ -25,7 +25,7 @@ class SteelSeriesApex8ZoneController : public SteelSeriesApex3Controller { public: - SteelSeriesApex8ZoneController(hid_device *dev_handle, const char *path); + SteelSeriesApex8ZoneController(hid_device *dev_handle, const char *path, std::string dev_name); ~SteelSeriesApex8ZoneController(); void SetColor(std::vector colors, uint8_t mode, uint8_t brightness); diff --git a/Controllers/SteelSeriesController/SteelSeriesApexBaseController.cpp b/Controllers/SteelSeriesController/SteelSeriesApexBaseController.cpp new file mode 100644 index 00000000..ea68962d --- /dev/null +++ b/Controllers/SteelSeriesController/SteelSeriesApexBaseController.cpp @@ -0,0 +1,148 @@ +/*---------------------------------------------------------*\ +| SteelSeriesApexBaseController.cpp | +| | +| Driver base for SteelSeries Apex | +| | +| Florian Heilmann (FHeilmann) 19 Oct 2020 | +| | +| This file is part of the OpenRGB project | +| SPDX-License-Identifier: GPL-2.0-only | +\*---------------------------------------------------------*/ + +#include "SteelSeriesApexBaseController.h" + +SteelSeriesApexBaseController::SteelSeriesApexBaseController(hid_device* dev_handle, const char* path, std::string dev_name) +{ + dev = dev_handle; + location = path; + name = dev_name; +} + +SteelSeriesApexBaseController::~SteelSeriesApexBaseController() +{ + +} + +std::string SteelSeriesApexBaseController::GetLocation() +{ + return("HID: " + location); +}; + +std::string SteelSeriesApexBaseController::GetName() +{ + return(name); +} + +/*---------------------------------------------------------*\ +| The serial number of the keyboard is acquired by sending | +| an output report to address 0xFF and reading the result. | +| The HID capability table is not used. The serial number | +| also contains the model number which can be used to | +| determine the physical layout of different region | +| keyboards throughout the product stack. | +\*---------------------------------------------------------*/ +std::string SteelSeriesApexBaseController::GetSerial() +{ + std::string return_string = ""; + if(proto_type == APEX) + { + unsigned char obuf[STEELSERIES_PACKET_OUT_SIZE]; + unsigned char ibuf[STEELSERIES_PACKET_IN_SIZE]; + int result; + + memset(obuf, 0x00, sizeof(obuf)); + obuf[0x00] = 0; + obuf[0x01] = 0xFF; + hid_write(dev, obuf, STEELSERIES_PACKET_OUT_SIZE); + + result = hid_read_timeout(dev, ibuf, STEELSERIES_PACKET_IN_SIZE, 2); + + /*-------------------------------------------------*\ + | Only the first 19 bytes are of value | + \*-------------------------------------------------*/ + if(result > 0) + { + std::string serialnum(ibuf, ibuf+19); + return_string = serialnum; + } + } + + return(return_string); +} + +std::string SteelSeriesApexBaseController::GetVersion() +{ + std::string return_string = "Unsupported protocol"; + + if(proto_type == APEX) + { + /*-------------------------------------------------*\ + | For the Apex Pro there are two firmware versions | + | which can be acquired, KBD and LED. We know | + | where both are located, we do not know which is | + | what. For now we'll make an assumption and fix | + | if proven wrong. | + \*-------------------------------------------------*/ + unsigned char obuf[STEELSERIES_PACKET_OUT_SIZE]; + unsigned char ibuf[STEELSERIES_PACKET_IN_SIZE]; + int result; + + memset(obuf, 0x00, sizeof(obuf)); + obuf[0x00] = 0; + obuf[0x01] = 0x90; + hid_write(dev, obuf, STEELSERIES_PACKET_OUT_SIZE); + result = hid_read_timeout(dev, ibuf, STEELSERIES_PACKET_IN_SIZE, 2); + + if(result > 0) + { + std::string fwver(ibuf, ibuf+STEELSERIES_PACKET_IN_SIZE); + fwver = fwver.c_str(); + + /*---------------------------------------------*\ + | Find 2 periods in string, if found we can | + | form a X.Y.Z revision. | + \*---------------------------------------------*/ + std::size_t majorp = fwver.find('.'); + if(majorp != std::string::npos) + { + std::size_t minorp = fwver.find('.', majorp+1); + if(minorp != std::string::npos) + { + std::string major = fwver.substr(0, majorp); + std::string minor = fwver.substr(majorp+1, (minorp-majorp-1)); + std::string build = fwver.substr(minorp+1); + return_string = "KBD: " + major + "." + minor + "." + build; + } + } + } + + /*-------------------------------------------------*\ + | Clear and reuse buffer | + \*-------------------------------------------------*/ + memset(ibuf, 0x00, sizeof(ibuf)); + obuf[0x02] = 0x01; + hid_write(dev, obuf, STEELSERIES_PACKET_OUT_SIZE); + result = hid_read_timeout(dev, ibuf, STEELSERIES_PACKET_IN_SIZE, 10); + + if(result > 0) + { + std::string fwver(ibuf, ibuf+STEELSERIES_PACKET_IN_SIZE); + fwver = fwver.c_str(); + + std::size_t majorp = fwver.find('.'); + if(majorp != std::string::npos) + { + std::size_t minorp = fwver.find('.', majorp+1); + if(minorp != std::string::npos) + { + std::string major = fwver.substr(0, majorp); + std::string minor = fwver.substr(majorp+1, (minorp-majorp-1)); + std::string build = fwver.substr(minorp+1); + return_string = return_string + " / LED: " + major + "." + minor + "." + build; + } + } + } + } + + return(return_string); +} diff --git a/Controllers/SteelSeriesController/SteelSeriesApexBaseController.h b/Controllers/SteelSeriesController/SteelSeriesApexBaseController.h index eff0aa55..adce58a7 100644 --- a/Controllers/SteelSeriesController/SteelSeriesApexBaseController.h +++ b/Controllers/SteelSeriesController/SteelSeriesApexBaseController.h @@ -16,154 +16,29 @@ #include "RGBController.h" #include "SteelSeriesGeneric.h" -#define STEELSERIES_PACKET_IN_SIZE 64 +#define STEELSERIES_PACKET_IN_SIZE 64 #define STEELSERIES_PACKET_OUT_SIZE STEELSERIES_PACKET_IN_SIZE + 1 class SteelSeriesApexBaseController { public: + SteelSeriesApexBaseController(hid_device* dev_handle, const char* path, std::string dev_name); + virtual ~SteelSeriesApexBaseController(); - virtual ~SteelSeriesApexBaseController() - { + std::string GetLocation(); + std::string GetName(); + std::string GetSerial(); + std::string GetVersion(); - } + virtual void SetMode(unsigned char mode, std::vector colors) = 0; - std::string GetDeviceLocation() - { - return("HID: " + location); - }; + virtual void SetLEDsDirect(std::vector colors) = 0; - steelseries_type proto_type; - - /*----------------------------------------*\ - | The serial number of the keyboard is | - | acquired by sending an output report | - | to address 0xFF and reading the result. | - | The HID capability table is not used. | - | The serial number also contains the model| - | number which can be used to determine | - | the physical layout of different region | - | keyboards throughout the product stack. | - \*----------------------------------------*/ - - std::string GetSerialString() - { - std::string return_string = ""; - if(proto_type == APEX) - { - unsigned char obuf[STEELSERIES_PACKET_OUT_SIZE]; - unsigned char ibuf[STEELSERIES_PACKET_IN_SIZE]; - int result; - - memset(obuf, 0x00, sizeof(obuf)); - obuf[0x00] = 0; - obuf[0x01] = 0xFF; - hid_write(dev, obuf, STEELSERIES_PACKET_OUT_SIZE); - - result = hid_read_timeout(dev, ibuf, STEELSERIES_PACKET_IN_SIZE, 2); - - /*---------------------------------------*\ - | Only the first 19 bytes are of value | - \*---------------------------------------*/ - if( result > 0) - { - std::string serialnum(ibuf, ibuf+19); - return_string = serialnum; - } - } - - return(return_string); - } - - std::string GetVersionString() - { - - std::string return_string = "Unsupported protocol"; - - if(proto_type == APEX) - { - /*--------------------------------------------*\ - | For the Apex Pro there are two firmware | - | versions which can be acquired, KBD and LED. | - | We know where both are located, we do not | - | know which is what. For now we'll make an | - | assumption and fix if proven wrong. | - \*--------------------------------------------*/ - - unsigned char obuf[STEELSERIES_PACKET_OUT_SIZE]; - unsigned char ibuf[STEELSERIES_PACKET_IN_SIZE]; - int result; - - memset(obuf, 0x00, sizeof(obuf)); - obuf[0x00] = 0; - obuf[0x01] = 0x90; - hid_write(dev, obuf, STEELSERIES_PACKET_OUT_SIZE); - result = hid_read_timeout(dev, ibuf, STEELSERIES_PACKET_IN_SIZE, 2); - - if(result > 0) - { - std::string fwver(ibuf, ibuf+STEELSERIES_PACKET_IN_SIZE); - fwver = fwver.c_str(); - - /*---------------------------------------*\ - | Find 2 periods in string, if found we | - | can form a X.Y.Z revision. | - \*---------------------------------------*/ - - std::size_t majorp = fwver.find('.'); - if(majorp != std::string::npos) - { - std::size_t minorp = fwver.find('.', majorp+1); - if(minorp != std::string::npos) - { - std::string major = fwver.substr(0, majorp); - std::string minor = fwver.substr(majorp+1, (minorp-majorp-1)); - std::string build = fwver.substr(minorp+1); - return_string = "KBD: " + major + "." + minor + "." + build; - } - } - } - - /*---------------------------------------*\ - | Clear and reuse buffer | - \*---------------------------------------*/ - memset(ibuf, 0x00, sizeof(ibuf)); - obuf[0x02] = 0x01; - hid_write(dev, obuf, STEELSERIES_PACKET_OUT_SIZE); - result = hid_read_timeout(dev, ibuf, STEELSERIES_PACKET_IN_SIZE, 10); - - if(result > 0) - { - std::string fwver(ibuf, ibuf+STEELSERIES_PACKET_IN_SIZE); - fwver = fwver.c_str(); - - std::size_t majorp = fwver.find('.'); - if(majorp != std::string::npos) - { - std::size_t minorp = fwver.find('.', majorp+1); - if(minorp != std::string::npos) - { - std::string major = fwver.substr(0, majorp); - std::string minor = fwver.substr(majorp+1, (minorp-majorp-1)); - std::string build = fwver.substr(minorp+1); - return_string = return_string + " / LED: " + major + "." + minor + "." + build; - } - } - } - } - return(return_string); - } - - virtual void SetMode - ( - unsigned char mode, - std::vector colors - ) = 0; - - virtual void SetLEDsDirect(std::vector colors) = 0; + steelseries_type proto_type; protected: - std::string location; - hid_device* dev; - unsigned char active_mode; + hid_device* dev; + unsigned char active_mode; + std::string location; + std::string name; }; diff --git a/Controllers/SteelSeriesController/SteelSeriesApexController/RGBController_SteelSeriesApex.cpp b/Controllers/SteelSeriesController/SteelSeriesApexController/RGBController_SteelSeriesApex.cpp index 178810fe..a6079015 100644 --- a/Controllers/SteelSeriesController/SteelSeriesApexController/RGBController_SteelSeriesApex.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesApexController/RGBController_SteelSeriesApex.cpp @@ -41,23 +41,23 @@ static const unsigned int zone_sizes[] = RGBController_SteelSeriesApex::RGBController_SteelSeriesApex(SteelSeriesApexBaseController* controller_ptr) { - controller = controller_ptr; + controller = controller_ptr; - name = "SteelSeries Apex RGB Keyboard"; - vendor = "SteelSeries"; - type = DEVICE_TYPE_KEYBOARD; - description = "SteelSeries Apex RGB Device"; - location = controller->GetDeviceLocation(); - serial = controller->GetSerialString(); - version = controller->GetVersionString(); + name = controller->GetName(); + vendor = "SteelSeries"; + type = DEVICE_TYPE_KEYBOARD; + description = "SteelSeries Apex RGB Device"; + location = controller->GetLocation(); + serial = controller->GetSerial(); + version = controller->GetVersion(); - proto_type = controller->proto_type; + proto_type = controller->proto_type; mode Direct; - Direct.name = "Direct"; - Direct.value = 0x00; - Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR; - Direct.color_mode = MODE_COLORS_PER_LED; + Direct.name = "Direct"; + Direct.value = 0x00; + Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR; + Direct.color_mode = MODE_COLORS_PER_LED; modes.push_back(Direct); SetupZones(); diff --git a/Controllers/SteelSeriesController/SteelSeriesApexController/SteelSeriesApexController.cpp b/Controllers/SteelSeriesController/SteelSeriesApexController/SteelSeriesApexController.cpp index 2f868d31..d7f1d1d9 100644 --- a/Controllers/SteelSeriesController/SteelSeriesApexController/SteelSeriesApexController.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesApexController/SteelSeriesApexController.cpp @@ -27,10 +27,8 @@ static unsigned int keys[] = {0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62, 0x63 }; -SteelSeriesApexController::SteelSeriesApexController(hid_device* dev_handle, steelseries_type type, const char* path) +SteelSeriesApexController::SteelSeriesApexController(hid_device* dev_handle, steelseries_type type, const char* path, std::string dev_name) : SteelSeriesApexBaseController(dev_handle, path, dev_name) { - dev = dev_handle; - location = path; proto_type = type; } diff --git a/Controllers/SteelSeriesController/SteelSeriesApexController/SteelSeriesApexController.h b/Controllers/SteelSeriesController/SteelSeriesApexController/SteelSeriesApexController.h index 4d9da257..440cecdf 100644 --- a/Controllers/SteelSeriesController/SteelSeriesApexController/SteelSeriesApexController.h +++ b/Controllers/SteelSeriesController/SteelSeriesApexController/SteelSeriesApexController.h @@ -25,7 +25,7 @@ enum class SteelSeriesApexController : public SteelSeriesApexBaseController { public: - SteelSeriesApexController(hid_device* dev_handle, steelseries_type type, const char* path); + SteelSeriesApexController(hid_device* dev_handle, steelseries_type type, const char* path, std::string dev_name); ~SteelSeriesApexController(); void SetMode diff --git a/Controllers/SteelSeriesController/SteelSeriesApexMController/SteelSeriesApexMController.cpp b/Controllers/SteelSeriesController/SteelSeriesApexMController/SteelSeriesApexMController.cpp index f5e63a64..23942ca7 100644 --- a/Controllers/SteelSeriesController/SteelSeriesApexMController/SteelSeriesApexMController.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesApexMController/SteelSeriesApexMController.cpp @@ -36,10 +36,8 @@ static unsigned int keys_m[] = 37, 53, 54, 55, 56, NA, 57, 58, 59, 60, NA, 61, 62, 63, 64, 65, 66, 67, NA, NA, NA, NA }; -SteelSeriesApexMController::SteelSeriesApexMController(hid_device* dev_handle, steelseries_type type, const char* path) +SteelSeriesApexMController::SteelSeriesApexMController(hid_device* dev_handle, steelseries_type type, const char* path, std::string dev_name) : SteelSeriesApexBaseController(dev_handle, path, dev_name) { - dev = dev_handle; - location = path; proto_type = type; EnableLEDControl(); } diff --git a/Controllers/SteelSeriesController/SteelSeriesApexMController/SteelSeriesApexMController.h b/Controllers/SteelSeriesController/SteelSeriesApexMController/SteelSeriesApexMController.h index 66afebe7..8e4c4a49 100644 --- a/Controllers/SteelSeriesController/SteelSeriesApexMController/SteelSeriesApexMController.h +++ b/Controllers/SteelSeriesController/SteelSeriesApexMController/SteelSeriesApexMController.h @@ -20,7 +20,7 @@ class SteelSeriesApexMController : public SteelSeriesApexBaseController { public: - SteelSeriesApexMController(hid_device* dev_handle, steelseries_type type, const char* path); + SteelSeriesApexMController(hid_device* dev_handle, steelseries_type type, const char* path, std::string dev_name); ~SteelSeriesApexMController(); void SetMode @@ -32,7 +32,6 @@ public: void SetLEDsDirect(std::vector colors); private: - void EnableLEDControl(); void SelectProfile ( diff --git a/Controllers/SteelSeriesController/SteelSeriesApexTZoneController/SteelSeriesApexTZoneController.cpp b/Controllers/SteelSeriesController/SteelSeriesApexTZoneController/SteelSeriesApexTZoneController.cpp index a06d6a9d..4d2b3d3a 100644 --- a/Controllers/SteelSeriesController/SteelSeriesApexTZoneController/SteelSeriesApexTZoneController.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesApexTZoneController/SteelSeriesApexTZoneController.cpp @@ -12,7 +12,7 @@ #include #include "SteelSeriesApexTZoneController.h" -SteelSeriesApexTZoneController::SteelSeriesApexTZoneController(hid_device* dev_handle, const char* path) : SteelSeriesApex3Controller(dev_handle, path) +SteelSeriesApexTZoneController::SteelSeriesApexTZoneController(hid_device* dev_handle, const char* path, std::string dev_name) : SteelSeriesApex3Controller(dev_handle, path, dev_name) { } diff --git a/Controllers/SteelSeriesController/SteelSeriesApexTZoneController/SteelSeriesApexTZoneController.h b/Controllers/SteelSeriesController/SteelSeriesApexTZoneController/SteelSeriesApexTZoneController.h index 4b143211..e37966ee 100644 --- a/Controllers/SteelSeriesController/SteelSeriesApexTZoneController/SteelSeriesApexTZoneController.h +++ b/Controllers/SteelSeriesController/SteelSeriesApexTZoneController/SteelSeriesApexTZoneController.h @@ -24,7 +24,7 @@ class SteelSeriesApexTZoneController : public SteelSeriesApex3Controller { public: - SteelSeriesApexTZoneController(hid_device *dev_handle, const char *path); + SteelSeriesApexTZoneController(hid_device *dev_handle, const char *path, std::string dev_name); ~SteelSeriesApexTZoneController(); void SetColor(std::vector colors, uint8_t mode, uint8_t brightness); diff --git a/Controllers/SteelSeriesController/SteelSeriesArctis5Controller/RGBController_SteelSeriesArctis5.cpp b/Controllers/SteelSeriesController/SteelSeriesArctis5Controller/RGBController_SteelSeriesArctis5.cpp index ff426fb8..9272e96e 100644 --- a/Controllers/SteelSeriesController/SteelSeriesArctis5Controller/RGBController_SteelSeriesArctis5.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesArctis5Controller/RGBController_SteelSeriesArctis5.cpp @@ -24,14 +24,14 @@ RGBController_SteelSeriesArctis5::RGBController_SteelSeriesArctis5(SteelSeriesArctis5Controller* controller_ptr) { - controller = controller_ptr; - name = "SteelSeries Arctis 5 headset"; - vendor = "SteelSeries"; - type = DEVICE_TYPE_HEADSET; - description = name; - location = controller->GetDeviceLocation(); - serial = controller->GetSerialString(); - version = controller->GetFirmwareVersion(); + controller = controller_ptr; + + name = controller->GetNameString(); + vendor = "SteelSeries"; + type = DEVICE_TYPE_HEADSET; + description = "SteelSeries Arctis 5 Headset Device"; + location = controller->GetDeviceLocation(); + serial = controller->GetSerialString(); mode Direct; Direct.name = "Direct"; diff --git a/Controllers/SteelSeriesController/SteelSeriesArctis5Controller/SteelSeriesArctis5Controller.cpp b/Controllers/SteelSeriesController/SteelSeriesArctis5Controller/SteelSeriesArctis5Controller.cpp index 1684038d..9e03d86a 100644 --- a/Controllers/SteelSeriesController/SteelSeriesArctis5Controller/SteelSeriesArctis5Controller.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesArctis5Controller/SteelSeriesArctis5Controller.cpp @@ -13,11 +13,11 @@ #include "SteelSeriesArctis5Controller.h" #include "StringUtils.h" -SteelSeriesArctis5Controller::SteelSeriesArctis5Controller(hid_device* dev_handle, const hid_device_info& info) +SteelSeriesArctis5Controller::SteelSeriesArctis5Controller(hid_device* dev_handle, const hid_device_info& info, std::string dev_name) { - dev = dev_handle; - location = info.path; - version = ""; + dev = dev_handle; + location = info.path; + name = dev_name; } SteelSeriesArctis5Controller::~SteelSeriesArctis5Controller() @@ -30,6 +30,11 @@ std::string SteelSeriesArctis5Controller::GetDeviceLocation() return("HID: " + location); } +std::string SteelSeriesArctis5Controller::GetNameString() +{ + return(name); +} + std::string SteelSeriesArctis5Controller::GetSerialString() { wchar_t serial_string[128]; @@ -43,11 +48,6 @@ std::string SteelSeriesArctis5Controller::GetSerialString() return(StringUtils::wstring_to_string(serial_string)); } -std::string SteelSeriesArctis5Controller::GetFirmwareVersion() -{ - return(version); -} - void SteelSeriesArctis5Controller::SetColor(unsigned char zone_id, RGBColor color) { unsigned char usb_buf[ARCTIS_5_REPORT_SIZE]; diff --git a/Controllers/SteelSeriesController/SteelSeriesArctis5Controller/SteelSeriesArctis5Controller.h b/Controllers/SteelSeriesController/SteelSeriesArctis5Controller/SteelSeriesArctis5Controller.h index de05fc3e..fe523c5a 100644 --- a/Controllers/SteelSeriesController/SteelSeriesArctis5Controller/SteelSeriesArctis5Controller.h +++ b/Controllers/SteelSeriesController/SteelSeriesArctis5Controller/SteelSeriesArctis5Controller.h @@ -21,18 +21,17 @@ class SteelSeriesArctis5Controller { public: - SteelSeriesArctis5Controller(hid_device* dev_handle, const hid_device_info& info); - + SteelSeriesArctis5Controller(hid_device* dev_handle, const hid_device_info& info, std::string dev_name); ~SteelSeriesArctis5Controller(); std::string GetDeviceLocation(); + std::string GetNameString(); std::string GetSerialString(); - std::string GetFirmwareVersion(); + void SetColor(unsigned char zone_id, RGBColor color); private: - std::string location; - std::string version; - hid_device* dev; + std::string location; + std::string name; }; diff --git a/Controllers/SteelSeriesController/SteelSeriesControllerDetect.cpp b/Controllers/SteelSeriesController/SteelSeriesControllerDetect.cpp index a6c47f8b..1950ed95 100644 --- a/Controllers/SteelSeriesController/SteelSeriesControllerDetect.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesControllerDetect.cpp @@ -119,11 +119,12 @@ void DetectSteelSeriesAerox3(hid_device_info* info, const std::string& name) { hid_device* dev = hid_open_path(info->path); + if(dev) { - SteelSeriesAerox3Controller* controller = new SteelSeriesAerox3Controller(dev, AEROX_3, info->path); - RGBController_SteelSeriesRival3* rgb_controller = new RGBController_SteelSeriesRival3(controller); - rgb_controller->name = name; + SteelSeriesAerox3Controller* controller = new SteelSeriesAerox3Controller(dev, AEROX_3, info->path, name); + RGBController_SteelSeriesRival3* rgb_controller = new RGBController_SteelSeriesRival3(controller); + ResourceManager::get()->RegisterRGBController(rgb_controller); } } @@ -131,11 +132,12 @@ void DetectSteelSeriesAerox3(hid_device_info* info, const std::string& name) void DetectSteelSeriesAeroxWireless(hid_device_info* info, const std::string& name, steelseries_type proto_type) { hid_device* dev = hid_open_path(info->path); + if(dev) { - SteelSeriesAeroxWirelessController* controller = new SteelSeriesAeroxWirelessController(dev, proto_type, info->path); - RGBController_SteelSeriesRival3* rgb_controller = new RGBController_SteelSeriesRival3(controller); - rgb_controller->name = name; + SteelSeriesAeroxWirelessController* controller = new SteelSeriesAeroxWirelessController(dev, proto_type, info->path, name); + RGBController_SteelSeriesRival3* rgb_controller = new RGBController_SteelSeriesRival3(controller); + ResourceManager::get()->RegisterRGBController(rgb_controller); } } @@ -153,11 +155,12 @@ void DetectSteelSeriesAerox3WirelessWired(hid_device_info* info, const std::stri void DetectSteelSeriesAerox5(hid_device_info* info, const std::string& name) { hid_device* dev = hid_open_path(info->path); + if(dev) { - SteelSeriesAerox5Controller* controller = new SteelSeriesAerox5Controller(dev, AEROX_3, info->path); - RGBController_SteelSeriesRival3* rgb_controller = new RGBController_SteelSeriesRival3(controller); - rgb_controller->name = name; + SteelSeriesAerox5Controller* controller = new SteelSeriesAerox5Controller(dev, AEROX_3, info->path, name); + RGBController_SteelSeriesRival3* rgb_controller = new RGBController_SteelSeriesRival3(controller); + ResourceManager::get()->RegisterRGBController(rgb_controller); } } @@ -205,11 +208,12 @@ void DetectSteelSeriesAerox9WirelessWired(hid_device_info* info, const std::stri void DetectSteelSeriesApex3Full(hid_device_info* info, const std::string& name) { hid_device* dev = hid_open_path(info->path); + if(dev) { - SteelSeriesApexTZoneController* controller = new SteelSeriesApexTZoneController(dev, info->path); - RGBController_SteelSeriesApex3* rgb_controller = new RGBController_SteelSeriesApex3(controller); - rgb_controller->name = name; + SteelSeriesApexTZoneController* controller = new SteelSeriesApexTZoneController(dev, info->path, name); + RGBController_SteelSeriesApex3* rgb_controller = new RGBController_SteelSeriesApex3(controller); + ResourceManager::get()->RegisterRGBController(rgb_controller); } } @@ -217,11 +221,12 @@ void DetectSteelSeriesApex3Full(hid_device_info* info, const std::string& name) void DetectSteelSeriesApex3TKL(hid_device_info* info, const std::string& name) { hid_device* dev = hid_open_path(info->path); + if(dev) { - SteelSeriesApex8ZoneController* controller = new SteelSeriesApex8ZoneController(dev, info->path); - RGBController_SteelSeriesApex3* rgb_controller = new RGBController_SteelSeriesApex3(controller); - rgb_controller->name = name; + SteelSeriesApex8ZoneController* controller = new SteelSeriesApex8ZoneController(dev, info->path, name); + RGBController_SteelSeriesApex3* rgb_controller = new RGBController_SteelSeriesApex3(controller); + ResourceManager::get()->RegisterRGBController(rgb_controller); } } @@ -229,11 +234,12 @@ void DetectSteelSeriesApex3TKL(hid_device_info* info, const std::string& name) void DetectSteelSeriesApex(hid_device_info* info, const std::string& name) { hid_device* dev = hid_open_path(info->path); + if(dev) { - SteelSeriesApexController* controller = new SteelSeriesApexController(dev, APEX, info->path); - RGBController_SteelSeriesApex* rgb_controller = new RGBController_SteelSeriesApex(controller); - rgb_controller->name = name; + SteelSeriesApexController* controller = new SteelSeriesApexController(dev, APEX, info->path, name); + RGBController_SteelSeriesApex* rgb_controller = new RGBController_SteelSeriesApex(controller); + ResourceManager::get()->RegisterRGBController(rgb_controller); } } @@ -241,11 +247,12 @@ void DetectSteelSeriesApex(hid_device_info* info, const std::string& name) void DetectSteelSeriesApexM(hid_device_info* info, const std::string& name) { hid_device* dev = hid_open_path(info->path); + if(dev) { - SteelSeriesApexMController* controller = new SteelSeriesApexMController(dev, APEX_M, info->path); - RGBController_SteelSeriesApex* rgb_controller = new RGBController_SteelSeriesApex(controller); - rgb_controller->name = name; + SteelSeriesApexMController* controller = new SteelSeriesApexMController(dev, APEX_M, info->path, name); + RGBController_SteelSeriesApex* rgb_controller = new RGBController_SteelSeriesApex(controller); + ResourceManager::get()->RegisterRGBController(rgb_controller); } } @@ -253,11 +260,12 @@ void DetectSteelSeriesApexM(hid_device_info* info, const std::string& name) void DetectSteelSeriesApexOld(hid_device_info* info, const std::string& name) { hid_device* dev = hid_open_path(info->path); + if(dev) { - SteelSeriesOldApexController* controller = new SteelSeriesOldApexController(dev, APEX_OLD, info->path); - RGBController_SteelSeriesOldApex* rgb_controller = new RGBController_SteelSeriesOldApex(controller); - rgb_controller->name = name; + SteelSeriesOldApexController* controller = new SteelSeriesOldApexController(dev, APEX_OLD, info->path, name); + RGBController_SteelSeriesOldApex* rgb_controller = new RGBController_SteelSeriesOldApex(controller); + ResourceManager::get()->RegisterRGBController(rgb_controller); } } @@ -265,11 +273,12 @@ void DetectSteelSeriesApexOld(hid_device_info* info, const std::string& name) void DetectSteelSeriesHeadset(hid_device_info* info, const std::string& name) { hid_device* dev = hid_open_path(info->path); + if(dev) { - SteelSeriesSiberiaController* controller = new SteelSeriesSiberiaController(dev, info->path); - RGBController_SteelSeriesSiberia* rgb_controller = new RGBController_SteelSeriesSiberia(controller); - rgb_controller->name = name; + SteelSeriesSiberiaController* controller = new SteelSeriesSiberiaController(dev, info->path, name); + RGBController_SteelSeriesSiberia* rgb_controller = new RGBController_SteelSeriesSiberia(controller); + ResourceManager::get()->RegisterRGBController(rgb_controller); } } @@ -277,11 +286,12 @@ void DetectSteelSeriesHeadset(hid_device_info* info, const std::string& name) void DetectSteelSeriesMousemat(hid_device_info* info, const std::string& name) { hid_device* dev = hid_open_path(info->path); + if(dev) { - SteelSeriesQCKMatController* controller = new SteelSeriesQCKMatController(dev, info->path); - RGBController_SteelSeriesQCKMat* rgb_controller = new RGBController_SteelSeriesQCKMat(controller); - rgb_controller->name = name; + SteelSeriesQCKMatController* controller = new SteelSeriesQCKMatController(dev, info->path, name); + RGBController_SteelSeriesQCKMat* rgb_controller = new RGBController_SteelSeriesQCKMat(controller); + ResourceManager::get()->RegisterRGBController(rgb_controller); } } @@ -289,11 +299,12 @@ void DetectSteelSeriesMousemat(hid_device_info* info, const std::string& name) void DetectSteelSeriesRival100(hid_device_info* info, const std::string& name) { hid_device* dev = hid_open_path(info->path); + if(dev) { - SteelSeriesRivalController* controller = new SteelSeriesRivalController(dev, RIVAL_100, info->path); - RGBController_SteelSeriesRival* rgb_controller = new RGBController_SteelSeriesRival(controller); - rgb_controller->name = name; + SteelSeriesRivalController* controller = new SteelSeriesRivalController(dev, RIVAL_100, info->path, name); + RGBController_SteelSeriesRival* rgb_controller = new RGBController_SteelSeriesRival(controller); + ResourceManager::get()->RegisterRGBController(rgb_controller); } } @@ -301,11 +312,12 @@ void DetectSteelSeriesRival100(hid_device_info* info, const std::string& name) void DetectSteelSeriesRival300(hid_device_info* info, const std::string& name) { hid_device* dev = hid_open_path(info->path); + if(dev) { - SteelSeriesRivalController* controller = new SteelSeriesRivalController(dev, RIVAL_300, info->path); - RGBController_SteelSeriesRival* rgb_controller = new RGBController_SteelSeriesRival(controller); - rgb_controller->name = name; + SteelSeriesRivalController* controller = new SteelSeriesRivalController(dev, RIVAL_300, info->path, name); + RGBController_SteelSeriesRival* rgb_controller = new RGBController_SteelSeriesRival(controller); + ResourceManager::get()->RegisterRGBController(rgb_controller); } } @@ -313,11 +325,12 @@ void DetectSteelSeriesRival300(hid_device_info* info, const std::string& name) void DetectSteelSeriesRival600(hid_device_info* info, const std::string& name) { hid_device* dev = hid_open_path(info->path); + if(dev) { - SteelSeriesRivalController* controller = new SteelSeriesRivalController(dev, RIVAL_600, info->path); - RGBController_SteelSeriesRival* rgb_controller = new RGBController_SteelSeriesRival(controller); - rgb_controller->name = name; + SteelSeriesRivalController* controller = new SteelSeriesRivalController(dev, RIVAL_600, info->path, name); + RGBController_SteelSeriesRival* rgb_controller = new RGBController_SteelSeriesRival(controller); + ResourceManager::get()->RegisterRGBController(rgb_controller); } } @@ -326,11 +339,12 @@ void DetectSteelSeriesRival600(hid_device_info* info, const std::string& name) void DetectSteelSeriesRival650(hid_device_info* info, const std::string& name) { hid_device* dev = hid_open_path(info->path); + if(dev) { - SteelSeriesRivalController* controller = new SteelSeriesRivalController(dev, RIVAL_650, info->path); - RGBController_SteelSeriesRival* rgb_controller = new RGBController_SteelSeriesRival(controller); - rgb_controller->name = name; + SteelSeriesRivalController* controller = new SteelSeriesRivalController(dev, RIVAL_650, info->path, name); + RGBController_SteelSeriesRival* rgb_controller = new RGBController_SteelSeriesRival(controller); + ResourceManager::get()->RegisterRGBController(rgb_controller); } } @@ -338,11 +352,12 @@ void DetectSteelSeriesRival650(hid_device_info* info, const std::string& name) void DetectSteelSeriesRival700(hid_device_info* info, const std::string& name) { hid_device* dev = hid_open_path(info->path); + if(dev) { - SteelSeriesRivalController* controller = new SteelSeriesRivalController(dev, RIVAL_700, info->path); - RGBController_SteelSeriesRival* rgb_controller = new RGBController_SteelSeriesRival(controller); - rgb_controller->name = name; + SteelSeriesRivalController* controller = new SteelSeriesRivalController(dev, RIVAL_700, info->path, name); + RGBController_SteelSeriesRival* rgb_controller = new RGBController_SteelSeriesRival(controller); + ResourceManager::get()->RegisterRGBController(rgb_controller); } } @@ -351,11 +366,12 @@ void DetectSteelSeriesRival700(hid_device_info* info, const std::string& name) void DetectSteelSeriesRival3(hid_device_info* info, const std::string& name) { hid_device* dev = hid_open_path(info->path); + if(dev) { - SteelSeriesRival3Controller* controller = new SteelSeriesRival3Controller(dev, RIVAL_3, info->path); - RGBController_SteelSeriesRival3* rgb_controller = new RGBController_SteelSeriesRival3(controller); - rgb_controller->name = name; + SteelSeriesRival3Controller* controller = new SteelSeriesRival3Controller(dev, RIVAL_3, info->path, name); + RGBController_SteelSeriesRival3* rgb_controller = new RGBController_SteelSeriesRival3(controller); + ResourceManager::get()->RegisterRGBController(rgb_controller); } } @@ -363,11 +379,12 @@ void DetectSteelSeriesRival3(hid_device_info* info, const std::string& name) void DetectSteelSeriesSensei(hid_device_info* info, const std::string& name) { hid_device* dev = hid_open_path(info->path); + if(dev) { - SteelSeriesSenseiController* controller = new SteelSeriesSenseiController(dev, SENSEI, info->path); - RGBController_SteelSeriesSensei* rgb_controller = new RGBController_SteelSeriesSensei(controller); - rgb_controller->name = name; + SteelSeriesSenseiController* controller = new SteelSeriesSenseiController(dev, SENSEI, info->path, name); + RGBController_SteelSeriesSensei* rgb_controller = new RGBController_SteelSeriesSensei(controller); + ResourceManager::get()->RegisterRGBController(rgb_controller); } } @@ -378,9 +395,9 @@ void DetectSteelSeriesArctis5(hid_device_info* info, const std::string& name) if(dev) { - SteelSeriesArctis5Controller* controller = new SteelSeriesArctis5Controller(dev, *info); - RGBController_SteelSeriesArctis5* rgb_controller = new RGBController_SteelSeriesArctis5(controller); - rgb_controller->name = name; + SteelSeriesArctis5Controller* controller = new SteelSeriesArctis5Controller(dev, *info, name); + RGBController_SteelSeriesArctis5* rgb_controller = new RGBController_SteelSeriesArctis5(controller); + ResourceManager::get()->RegisterRGBController(rgb_controller); } } diff --git a/Controllers/SteelSeriesController/SteelSeriesMouseController/SteelSeriesMouseController.cpp b/Controllers/SteelSeriesController/SteelSeriesMouseController/SteelSeriesMouseController.cpp index 165077eb..78c31881 100644 --- a/Controllers/SteelSeriesController/SteelSeriesMouseController/SteelSeriesMouseController.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesMouseController/SteelSeriesMouseController.cpp @@ -13,10 +13,11 @@ #include "SteelSeriesMouseController.h" #include "StringUtils.h" -SteelSeriesMouseController::SteelSeriesMouseController(hid_device* dev_handle, steelseries_type proto_type, const char* path) +SteelSeriesMouseController::SteelSeriesMouseController(hid_device* dev_handle, steelseries_type proto_type, const char* path, std::string dev_name) { dev = dev_handle; location = path; + name = dev_name; proto = proto_type; } @@ -30,6 +31,11 @@ std::string SteelSeriesMouseController::GetDeviceLocation() return("HID: " + location); } +std::string SteelSeriesMouseController::GetNameString() +{ + return(name); +} + std::string SteelSeriesMouseController::GetSerialString() { wchar_t serial_string[128]; diff --git a/Controllers/SteelSeriesController/SteelSeriesMouseController/SteelSeriesMouseController.h b/Controllers/SteelSeriesController/SteelSeriesMouseController/SteelSeriesMouseController.h index c12d3d89..f0252bf9 100644 --- a/Controllers/SteelSeriesController/SteelSeriesMouseController/SteelSeriesMouseController.h +++ b/Controllers/SteelSeriesController/SteelSeriesMouseController/SteelSeriesMouseController.h @@ -48,10 +48,11 @@ typedef struct class SteelSeriesMouseController { public: - SteelSeriesMouseController(hid_device* dev_handle, steelseries_type proto_type, const char* path); + SteelSeriesMouseController(hid_device* dev_handle, steelseries_type proto_type, const char* path, std::string dev_name); virtual ~SteelSeriesMouseController(); std::string GetDeviceLocation(); + std::string GetNameString(); std::string GetSerialString(); steelseries_type GetMouseType(); @@ -75,6 +76,7 @@ public: protected: hid_device* dev; std::string location; + std::string name; steelseries_type proto; private: diff --git a/Controllers/SteelSeriesController/SteelSeriesOldApexController/RGBController_SteelSeriesOldApex.cpp b/Controllers/SteelSeriesController/SteelSeriesOldApexController/RGBController_SteelSeriesOldApex.cpp index c319c192..26d18f6c 100644 --- a/Controllers/SteelSeriesController/SteelSeriesOldApexController/RGBController_SteelSeriesOldApex.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesOldApexController/RGBController_SteelSeriesOldApex.cpp @@ -29,20 +29,20 @@ RGBController_SteelSeriesOldApex::RGBController_SteelSeriesOldApex(SteelSeriesOldApexController* controller_ptr) { - controller = controller_ptr; + controller = controller_ptr; - name = controller->GetDeviceName(); - vendor = "SteelSeries"; - type = DEVICE_TYPE_KEYBOARD; - description = "SteelSeries old Apex device"; - location = controller->GetDeviceLocation(); - serial = controller->GetSerialString(); + name = controller->GetDeviceName(); + vendor = "SteelSeries"; + type = DEVICE_TYPE_KEYBOARD; + description = "SteelSeries Old Apex Device"; + location = controller->GetDeviceLocation(); + serial = controller->GetSerialString(); mode direct; - direct.name = "Direct"; - direct.value = STEELSERIES_OLDAPEX_DIRECT; - direct.flags = MODE_FLAG_HAS_PER_LED_COLOR; - direct.color_mode = MODE_COLORS_PER_LED; + direct.name = "Direct"; + direct.value = STEELSERIES_OLDAPEX_DIRECT; + direct.flags = MODE_FLAG_HAS_PER_LED_COLOR; + direct.color_mode = MODE_COLORS_PER_LED; modes.push_back(direct); SetupZones(); @@ -66,7 +66,7 @@ void RGBController_SteelSeriesOldApex::SetupZones() zones.push_back(qwerty_zone); led qwerty_led; - qwerty_led.name = "QWERTY"; + qwerty_led.name = "QWERTY"; leds.push_back(qwerty_led); zone tenkey_zone; @@ -79,7 +79,7 @@ void RGBController_SteelSeriesOldApex::SetupZones() zones.push_back(tenkey_zone); led tenkey_led; - tenkey_led.name = "TenKey"; + tenkey_led.name = "TenKey"; leds.push_back(tenkey_led); zone function_zone; @@ -92,33 +92,33 @@ void RGBController_SteelSeriesOldApex::SetupZones() zones.push_back(function_zone); led function_led; - function_led.name = "FunctionKeys"; + function_led.name = "FunctionKeys"; leds.push_back(function_led); zone mx_zone; - mx_zone.name = "MXKeys"; - mx_zone.type = ZONE_TYPE_LINEAR; - mx_zone.leds_min = 1; - mx_zone.leds_max = 1; - mx_zone.leds_count = 1; - mx_zone.matrix_map = NULL; + mx_zone.name = "MXKeys"; + mx_zone.type = ZONE_TYPE_LINEAR; + mx_zone.leds_min = 1; + mx_zone.leds_max = 1; + mx_zone.leds_count = 1; + mx_zone.matrix_map = NULL; zones.push_back(mx_zone); led mx_led; - mx_led.name = "MXKeys"; + mx_led.name = "MXKeys"; leds.push_back(mx_led); zone logo_zone; - logo_zone.name = "Logo"; - logo_zone.type = ZONE_TYPE_LINEAR; - logo_zone.leds_min = 1; - logo_zone.leds_max = 1; - logo_zone.leds_count = 1; - logo_zone.matrix_map = NULL; + logo_zone.name = "Logo"; + logo_zone.type = ZONE_TYPE_LINEAR; + logo_zone.leds_min = 1; + logo_zone.leds_max = 1; + logo_zone.leds_count = 1; + logo_zone.matrix_map = NULL; zones.push_back(logo_zone); led logo_led; - logo_led.name = "Logo"; + logo_led.name = "Logo"; leds.push_back(logo_led); SetupColors(); diff --git a/Controllers/SteelSeriesController/SteelSeriesOldApexController/SteelSeriesOldApexController.cpp b/Controllers/SteelSeriesController/SteelSeriesOldApexController/SteelSeriesOldApexController.cpp index 271fb171..855ee0de 100644 --- a/Controllers/SteelSeriesController/SteelSeriesOldApexController/SteelSeriesOldApexController.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesOldApexController/SteelSeriesOldApexController.cpp @@ -39,11 +39,13 @@ SteelSeriesOldApexController::SteelSeriesOldApexController ( hid_device* dev_handle, steelseries_type proto_type, - const char* path + const char* path, + std::string dev_name ) { dev = dev_handle; location = path; + name = dev_name; proto = proto_type; } @@ -57,9 +59,9 @@ std::string SteelSeriesOldApexController::GetDeviceLocation() return("HID: " + location); } -char* SteelSeriesOldApexController::GetDeviceName() +std::string SteelSeriesOldApexController::GetDeviceName() { - return device_name; + return(name); } std::string SteelSeriesOldApexController::GetSerialString() diff --git a/Controllers/SteelSeriesController/SteelSeriesOldApexController/SteelSeriesOldApexController.h b/Controllers/SteelSeriesController/SteelSeriesOldApexController/SteelSeriesOldApexController.h index 1c7a2495..c85cf117 100644 --- a/Controllers/SteelSeriesController/SteelSeriesOldApexController/SteelSeriesOldApexController.h +++ b/Controllers/SteelSeriesController/SteelSeriesOldApexController/SteelSeriesOldApexController.h @@ -40,13 +40,14 @@ public: ( hid_device* dev_handle, steelseries_type proto_type, - const char* path + const char* path, + std::string dev_name ); ~SteelSeriesOldApexController(); std::string GetDeviceLocation(); - char* GetDeviceName(); + std::string GetDeviceName(); std::string GetSerialString(); steelseries_type GetKeyboardType(); @@ -63,8 +64,8 @@ public: void DoUpdateLEDs(); private: - char device_name[32]; - hid_device* dev; - std::string location; - steelseries_type proto; + hid_device* dev; + std::string location; + std::string name; + steelseries_type proto; }; diff --git a/Controllers/SteelSeriesController/SteelSeriesQCKMatController/RGBController_SteelSeriesQCKMat.cpp b/Controllers/SteelSeriesController/SteelSeriesQCKMatController/RGBController_SteelSeriesQCKMat.cpp index deeaf109..4ab83e5e 100644 --- a/Controllers/SteelSeriesController/SteelSeriesQCKMatController/RGBController_SteelSeriesQCKMat.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesQCKMatController/RGBController_SteelSeriesQCKMat.cpp @@ -24,19 +24,19 @@ RGBController_SteelSeriesQCKMat::RGBController_SteelSeriesQCKMat(SteelSeriesQCKMatController* controller_ptr) { - controller = controller_ptr; + controller = controller_ptr; - name = controller->GetDeviceName(); - vendor = "SteelSeries"; - type = DEVICE_TYPE_MOUSEMAT; - description = "SteelSeries QCK Mat Device"; - location = controller->GetDeviceLocation(); - serial = controller->GetSerialString(); + name = controller->GetDeviceName(); + vendor = "SteelSeries"; + type = DEVICE_TYPE_MOUSEMAT; + description = "SteelSeries QCK Mat Device"; + location = controller->GetDeviceLocation(); + serial = controller->GetSerialString(); mode Direct; - Direct.name = "Direct"; - Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR; - Direct.color_mode = MODE_COLORS_PER_LED; + Direct.name = "Direct"; + Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR; + Direct.color_mode = MODE_COLORS_PER_LED; modes.push_back(Direct); SetupZones(); diff --git a/Controllers/SteelSeriesController/SteelSeriesQCKMatController/SteelSeriesQCKMatController.cpp b/Controllers/SteelSeriesController/SteelSeriesQCKMatController/SteelSeriesQCKMatController.cpp index 96f0d673..42601f4a 100644 --- a/Controllers/SteelSeriesController/SteelSeriesQCKMatController/SteelSeriesQCKMatController.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesQCKMatController/SteelSeriesQCKMatController.cpp @@ -13,10 +13,11 @@ #include "SteelSeriesQCKMatController.h" #include "StringUtils.h" -SteelSeriesQCKMatController::SteelSeriesQCKMatController(hid_device* dev_handle, const char* path) +SteelSeriesQCKMatController::SteelSeriesQCKMatController(hid_device* dev_handle, const char* path, std::string dev_name) { dev = dev_handle; location = path; + name = dev_name; } SteelSeriesQCKMatController::~SteelSeriesQCKMatController() @@ -29,9 +30,9 @@ std::string SteelSeriesQCKMatController::GetDeviceLocation() return("HID: " + location); } -char* SteelSeriesQCKMatController::GetDeviceName() +std::string SteelSeriesQCKMatController::GetDeviceName() { - return device_name; + return(name); } std::string SteelSeriesQCKMatController::GetSerialString() diff --git a/Controllers/SteelSeriesController/SteelSeriesQCKMatController/SteelSeriesQCKMatController.h b/Controllers/SteelSeriesController/SteelSeriesQCKMatController/SteelSeriesQCKMatController.h index 81dc4ad2..da6fcb2d 100644 --- a/Controllers/SteelSeriesController/SteelSeriesQCKMatController/SteelSeriesQCKMatController.h +++ b/Controllers/SteelSeriesController/SteelSeriesQCKMatController/SteelSeriesQCKMatController.h @@ -18,18 +18,17 @@ class SteelSeriesQCKMatController { public: - SteelSeriesQCKMatController(hid_device* dev_handle, const char* path); - + SteelSeriesQCKMatController(hid_device* dev_handle, const char* path, std::string dev_name); ~SteelSeriesQCKMatController(); std::string GetDeviceLocation(); - char* GetDeviceName(); + std::string GetDeviceName(); std::string GetSerialString(); - void SetColors(std::vector colors); + void SetColors(std::vector colors); private: - char device_name[32]; - hid_device* dev; - std::string location; + hid_device* dev; + std::string location; + std::string name; }; diff --git a/Controllers/SteelSeriesController/SteelSeriesRival3Controller/RGBController_SteelSeriesRival3.cpp b/Controllers/SteelSeriesController/SteelSeriesRival3Controller/RGBController_SteelSeriesRival3.cpp index 3c95e98c..0a6c4509 100644 --- a/Controllers/SteelSeriesController/SteelSeriesRival3Controller/RGBController_SteelSeriesRival3.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesRival3Controller/RGBController_SteelSeriesRival3.cpp @@ -26,6 +26,7 @@ RGBController_SteelSeriesRival3::RGBController_SteelSeriesRival3(SteelSeriesMous { controller = controller_ptr; + name = controller->GetNameString(); vendor = "SteelSeries"; type = DEVICE_TYPE_MOUSE; description = "SteelSeries Mouse Device"; diff --git a/Controllers/SteelSeriesController/SteelSeriesRival3Controller/SteelSeriesRival3Controller.cpp b/Controllers/SteelSeriesController/SteelSeriesRival3Controller/SteelSeriesRival3Controller.cpp index 1113a7db..4f60c333 100644 --- a/Controllers/SteelSeriesController/SteelSeriesRival3Controller/SteelSeriesRival3Controller.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesRival3Controller/SteelSeriesRival3Controller.cpp @@ -14,16 +14,9 @@ #include #include "SteelSeriesRival3Controller.h" -SteelSeriesRival3Controller::SteelSeriesRival3Controller - ( - hid_device* dev_handle, - steelseries_type proto_type, - const char* path - ) : SteelSeriesMouseController(dev_handle, proto_type, path) +SteelSeriesRival3Controller::SteelSeriesRival3Controller(hid_device* dev_handle, steelseries_type proto_type, const char* path, std::string dev_name) : SteelSeriesMouseController(dev_handle, proto_type, path, dev_name) { - //dev = dev_handle; - //location = path; - //proto = proto_type; + } SteelSeriesRival3Controller::~SteelSeriesRival3Controller() @@ -31,34 +24,6 @@ SteelSeriesRival3Controller::~SteelSeriesRival3Controller() hid_close(dev); } -/* -std::string SteelSeriesRival3Controller::GetDeviceLocation() -{ - return("HID: " + location); -} - -char* SteelSeriesRival3Controller::GetDeviceName() -{ - return device_name; -} - -std::string SteelSeriesRival3Controller::GetSerialString() -{ - wchar_t serial_string[128]; - int ret = hid_get_serial_number_string(dev, serial_string, 128); - - if (ret != 0) - { - return(""); - } - - std::wstring return_wstring = serial_string; - std::string return_string(return_wstring.begin(), return_wstring.end()); - - return(return_string); -} -*/ - std::string SteelSeriesRival3Controller::GetFirmwareVersion() { const uint8_t FW_BUFFER_SIZE = 3; @@ -78,21 +43,6 @@ steelseries_mouse SteelSeriesRival3Controller::GetMouse() return rival_3; } -/* -steelseries_type SteelSeriesRival3Controller::GetMouseType() -{ - return proto; -} - -void SteelSeriesRival3Controller::Save() -{ - const uint8_t SAVE_BUFFER_SIZE = 10; - uint8_t usb_buf[SAVE_BUFFER_SIZE] = { 0x00, 0x09 }; - - hid_write(dev, usb_buf, SAVE_BUFFER_SIZE); -} -*/ - void SteelSeriesRival3Controller::SetLightEffectAll(uint8_t effect) { const uint8_t EFFECT_BUFFER_SIZE = 4; diff --git a/Controllers/SteelSeriesController/SteelSeriesRival3Controller/SteelSeriesRival3Controller.h b/Controllers/SteelSeriesController/SteelSeriesRival3Controller/SteelSeriesRival3Controller.h index 08c77370..c431e9d7 100644 --- a/Controllers/SteelSeriesController/SteelSeriesRival3Controller/SteelSeriesRival3Controller.h +++ b/Controllers/SteelSeriesController/SteelSeriesRival3Controller/SteelSeriesRival3Controller.h @@ -16,16 +16,6 @@ #include "SteelSeriesGeneric.h" #include "SteelSeriesMouseController.h" -//#define STEELSERIES_RIVAL_3_BRIGHTNESS_MAX 0x64 - -/*static const steelseries_mouse_led_info rival_3_leds[]= -{ - {"Front", 0x01}, - {"Middle", 0x02}, - {"Rear", 0x03}, - {"Logo", 0x04} -};*/ - static const steelseries_mouse rival_3 = { { 0x04, 0x03, 0x00, 0x05 }, @@ -40,23 +30,11 @@ static const steelseries_mouse rival_3 = class SteelSeriesRival3Controller: public SteelSeriesMouseController { public: - SteelSeriesRival3Controller - ( - hid_device* dev_handle, - steelseries_type proto_type, - const char* path - ); - + SteelSeriesRival3Controller(hid_device* dev_handle, steelseries_type proto_type, const char* path, std::string dev_name); ~SteelSeriesRival3Controller(); - //std::string GetDeviceLocation(); - //char* GetDeviceName(); - //std::string GetSerialString(); std::string GetFirmwareVersion(); steelseries_mouse GetMouse(); - //steelseries_type GetMouseType(); - - //void Save(); void SetLightEffectAll(uint8_t effect); @@ -68,10 +46,4 @@ public: unsigned char blue, unsigned char brightness ); - -private: - //char device_name[32]; - //hid_device* dev; - //std::string location; - //steelseries_type proto; }; diff --git a/Controllers/SteelSeriesController/SteelSeriesRivalController/RGBController_SteelSeriesRival.cpp b/Controllers/SteelSeriesController/SteelSeriesRivalController/RGBController_SteelSeriesRival.cpp index e36fa11f..6308a4e3 100644 --- a/Controllers/SteelSeriesController/SteelSeriesRivalController/RGBController_SteelSeriesRival.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesRivalController/RGBController_SteelSeriesRival.cpp @@ -50,31 +50,31 @@ static const steelseries_rival_led_info rival_600_leds[]= RGBController_SteelSeriesRival::RGBController_SteelSeriesRival(SteelSeriesRivalController* controller_ptr) { - controller = controller_ptr; + controller = controller_ptr; - name = controller->GetDeviceName(); - vendor = "SteelSeries"; - type = DEVICE_TYPE_MOUSE; - description = "SteelSeries Rival Device"; - location = controller->GetDeviceLocation(); - serial = controller->GetSerialString(); - version = controller->GetFirmwareVersion(); + name = controller->GetDeviceName(); + vendor = "SteelSeries"; + type = DEVICE_TYPE_MOUSE; + description = "SteelSeries Rival Device"; + location = controller->GetDeviceLocation(); + serial = controller->GetSerialString(); + version = controller->GetFirmwareVersion(); mode Direct; - Direct.name = "Direct"; - Direct.value = STEELSERIES_RIVAL_DIRECT; - Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE; - Direct.color_mode = MODE_COLORS_PER_LED; + Direct.name = "Direct"; + Direct.value = STEELSERIES_RIVAL_DIRECT; + Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE; + Direct.color_mode = MODE_COLORS_PER_LED; modes.push_back(Direct); mode Pulsate; - Pulsate.name = "Pulsate"; - Pulsate.value = STEELSERIES_RIVAL_PULSATE; - Pulsate.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE; - Pulsate.color_mode = MODE_COLORS_PER_LED; - Pulsate.speed_min = STEELSERIES_RIVAL_EFFECT_PULSATE_MIN; - Pulsate.speed_max = STEELSERIES_RIVAL_EFFECT_PULSATE_MAX; - Pulsate.speed = STEELSERIES_RIVAL_EFFECT_PULSATE_MID; + Pulsate.name = "Pulsate"; + Pulsate.value = STEELSERIES_RIVAL_PULSATE; + Pulsate.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE; + Pulsate.color_mode = MODE_COLORS_PER_LED; + Pulsate.speed_min = STEELSERIES_RIVAL_EFFECT_PULSATE_MIN; + Pulsate.speed_max = STEELSERIES_RIVAL_EFFECT_PULSATE_MAX; + Pulsate.speed = STEELSERIES_RIVAL_EFFECT_PULSATE_MID; modes.push_back(Pulsate); SetupZones(); diff --git a/Controllers/SteelSeriesController/SteelSeriesRivalController/SteelSeriesRivalController.cpp b/Controllers/SteelSeriesController/SteelSeriesRivalController/SteelSeriesRivalController.cpp index 55a7aa5a..24526a09 100644 --- a/Controllers/SteelSeriesController/SteelSeriesRivalController/SteelSeriesRivalController.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesRivalController/SteelSeriesRivalController.cpp @@ -35,11 +35,13 @@ SteelSeriesRivalController::SteelSeriesRivalController ( hid_device* dev_handle, steelseries_type proto_type, - const char* path + const char* path, + std::string dev_name ) { dev = dev_handle; location = path; + name = dev_name; proto = proto_type; } @@ -53,9 +55,9 @@ std::string SteelSeriesRivalController::GetDeviceLocation() return("HID: " + location); } -char* SteelSeriesRivalController::GetDeviceName() +std::string SteelSeriesRivalController::GetDeviceName() { - return device_name; + return(name); } std::string SteelSeriesRivalController::GetSerialString() diff --git a/Controllers/SteelSeriesController/SteelSeriesRivalController/SteelSeriesRivalController.h b/Controllers/SteelSeriesController/SteelSeriesRivalController/SteelSeriesRivalController.h index 1ee64944..e48000a2 100644 --- a/Controllers/SteelSeriesController/SteelSeriesRivalController/SteelSeriesRivalController.h +++ b/Controllers/SteelSeriesController/SteelSeriesRivalController/SteelSeriesRivalController.h @@ -38,13 +38,14 @@ public: ( hid_device* dev_handle, steelseries_type proto_type, - const char* path + const char* path, + std::string dev_name ); ~SteelSeriesRivalController(); std::string GetDeviceLocation(); - char* GetDeviceName(); + std::string GetDeviceName(); std::string GetSerialString(); std::string GetFirmwareVersion(); @@ -78,9 +79,9 @@ public: ); private: - char device_name[32]; hid_device* dev; std::string location; + std::string name; steelseries_type proto; void SetRival650Color diff --git a/Controllers/SteelSeriesController/SteelSeriesSenseiController/RGBController_SteelSeriesSensei.cpp b/Controllers/SteelSeriesController/SteelSeriesSenseiController/RGBController_SteelSeriesSensei.cpp index ab7065f3..99722356 100644 --- a/Controllers/SteelSeriesController/SteelSeriesSenseiController/RGBController_SteelSeriesSensei.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesSenseiController/RGBController_SteelSeriesSensei.cpp @@ -25,40 +25,40 @@ RGBController_SteelSeriesSensei::RGBController_SteelSeriesSensei(SteelSeriesSenseiController* controller_ptr) { - controller = controller_ptr; + controller = controller_ptr; - name = controller->GetDeviceName(); - vendor = "SteelSeries"; - type = DEVICE_TYPE_MOUSE; - description = "SteelSeries Sensei Device"; - location = controller->GetDeviceLocation(); - serial = controller->GetSerialString(); + name = controller->GetDeviceName(); + vendor = "SteelSeries"; + type = DEVICE_TYPE_MOUSE; + description = "SteelSeries Sensei Device"; + location = controller->GetDeviceLocation(); + serial = controller->GetSerialString(); mode Direct; - Direct.name = "Direct"; - Direct.value = STEELSERIES_SENSEI_MODE_DIRECT; - Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR; - Direct.color_mode = MODE_COLORS_PER_LED; + Direct.name = "Direct"; + Direct.value = STEELSERIES_SENSEI_MODE_DIRECT; + Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR; + Direct.color_mode = MODE_COLORS_PER_LED; modes.push_back(Direct); mode Breathing; - Breathing.name = "Breathing"; - Breathing.value = STEELSERIES_SENSEI_MODE_BREATHING; - Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR; - Breathing.color_mode = MODE_COLORS_PER_LED; - Breathing.speed_min = STEELSERIES_SENSEI_EFFECT_BREATHING_MIN; - Breathing.speed_max = STEELSERIES_SENSEI_EFFECT_BREATHING_MAX; - Breathing.speed = STEELSERIES_SENSEI_EFFECT_BREATHING_MID; + Breathing.name = "Breathing"; + Breathing.value = STEELSERIES_SENSEI_MODE_BREATHING; + Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR; + Breathing.color_mode = MODE_COLORS_PER_LED; + Breathing.speed_min = STEELSERIES_SENSEI_EFFECT_BREATHING_MIN; + Breathing.speed_max = STEELSERIES_SENSEI_EFFECT_BREATHING_MAX; + Breathing.speed = STEELSERIES_SENSEI_EFFECT_BREATHING_MID; modes.push_back(Breathing); mode Rainbow; - Rainbow.name = "Rainbow"; - Rainbow.value = STEELSERIES_SENSEI_MODE_RAINBOW; - Rainbow.flags = MODE_FLAG_HAS_SPEED; - Rainbow.color_mode = MODE_COLORS_NONE; - Rainbow.speed_min = STEELSERIES_SENSEI_EFFECT_RAINBOW_MIN; - Rainbow.speed_max = STEELSERIES_SENSEI_EFFECT_RAINBOW_MAX; - Rainbow.speed = STEELSERIES_SENSEI_EFFECT_RAINBOW_MID; + Rainbow.name = "Rainbow"; + Rainbow.value = STEELSERIES_SENSEI_MODE_RAINBOW; + Rainbow.flags = MODE_FLAG_HAS_SPEED; + Rainbow.color_mode = MODE_COLORS_NONE; + Rainbow.speed_min = STEELSERIES_SENSEI_EFFECT_RAINBOW_MIN; + Rainbow.speed_max = STEELSERIES_SENSEI_EFFECT_RAINBOW_MAX; + Rainbow.speed = STEELSERIES_SENSEI_EFFECT_RAINBOW_MID; modes.push_back(Rainbow); SetupZones(); diff --git a/Controllers/SteelSeriesController/SteelSeriesSenseiController/SteelSeriesSenseiController.cpp b/Controllers/SteelSeriesController/SteelSeriesSenseiController/SteelSeriesSenseiController.cpp index 91edc292..97955435 100644 --- a/Controllers/SteelSeriesController/SteelSeriesSenseiController/SteelSeriesSenseiController.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesSenseiController/SteelSeriesSenseiController.cpp @@ -35,11 +35,13 @@ SteelSeriesSenseiController::SteelSeriesSenseiController ( hid_device* dev_handle, steelseries_type proto_type, - const char* path + const char* path, + std::string dev_name ) { dev = dev_handle; location = path; + name = dev_name; proto = proto_type; } @@ -53,9 +55,9 @@ std::string SteelSeriesSenseiController::GetDeviceLocation() return("HID: " + location); } -char* SteelSeriesSenseiController::GetDeviceName() +std::string SteelSeriesSenseiController::GetDeviceName() { - return device_name; + return(name); } std::string SteelSeriesSenseiController::GetSerialString() diff --git a/Controllers/SteelSeriesController/SteelSeriesSenseiController/SteelSeriesSenseiController.h b/Controllers/SteelSeriesController/SteelSeriesSenseiController/SteelSeriesSenseiController.h index dc28a6fb..56c08c30 100644 --- a/Controllers/SteelSeriesController/SteelSeriesSenseiController/SteelSeriesSenseiController.h +++ b/Controllers/SteelSeriesController/SteelSeriesSenseiController/SteelSeriesSenseiController.h @@ -47,13 +47,14 @@ public: ( hid_device* dev_handle, steelseries_type proto_type, - const char* path + const char* path, + std::string dev_name ); ~SteelSeriesSenseiController(); std::string GetDeviceLocation(); - char* GetDeviceName(); + std::string GetDeviceName(); std::string GetSerialString(); steelseries_type GetMouseType(); @@ -86,6 +87,7 @@ public: unsigned char green, unsigned char blue ); + void SetColorAll ( unsigned char red, @@ -94,8 +96,8 @@ public: ); private: - char device_name[32]; - hid_device* dev; - std::string location; - steelseries_type proto; + hid_device* dev; + std::string location; + std::string name; + steelseries_type proto; }; diff --git a/Controllers/SteelSeriesController/SteelSeriesSiberiaController/RGBController_SteelSeriesSiberia.cpp b/Controllers/SteelSeriesController/SteelSeriesSiberiaController/RGBController_SteelSeriesSiberia.cpp index 3cb40c0c..9c526ce6 100644 --- a/Controllers/SteelSeriesController/SteelSeriesSiberiaController/RGBController_SteelSeriesSiberia.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesSiberiaController/RGBController_SteelSeriesSiberia.cpp @@ -24,19 +24,19 @@ RGBController_SteelSeriesSiberia::RGBController_SteelSeriesSiberia(SteelSeriesSiberiaController* controller_ptr) { - controller = controller_ptr; + controller = controller_ptr; - name = controller->GetDeviceName(); - vendor = "SteelSeries"; - type = DEVICE_TYPE_HEADSET; - description = "SteelSeries Siberia Device"; - location = controller->GetDeviceLocation(); - serial = controller->GetSerialString(); + name = controller->GetDeviceName(); + vendor = "SteelSeries"; + type = DEVICE_TYPE_HEADSET; + description = "SteelSeries Siberia Device"; + location = controller->GetDeviceLocation(); + serial = controller->GetSerialString(); mode Static; - Static.name = "Static"; - Static.flags = MODE_FLAG_HAS_PER_LED_COLOR; - Static.color_mode = MODE_COLORS_PER_LED; + Static.name = "Static"; + Static.flags = MODE_FLAG_HAS_PER_LED_COLOR; + Static.color_mode = MODE_COLORS_PER_LED; modes.push_back(Static); SetupZones(); diff --git a/Controllers/SteelSeriesController/SteelSeriesSiberiaController/SteelSeriesSiberiaController.cpp b/Controllers/SteelSeriesController/SteelSeriesSiberiaController/SteelSeriesSiberiaController.cpp index 4413d391..85198811 100644 --- a/Controllers/SteelSeriesController/SteelSeriesSiberiaController/SteelSeriesSiberiaController.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesSiberiaController/SteelSeriesSiberiaController.cpp @@ -35,14 +35,11 @@ static void send_usb_msg(hid_device* dev, unsigned char * data_pkt, unsigned int hid_write(dev, usb_pkt, 16); } -SteelSeriesSiberiaController::SteelSeriesSiberiaController - ( - hid_device* dev_handle, - const char* path - ) +SteelSeriesSiberiaController::SteelSeriesSiberiaController(hid_device* dev_handle, const char* path, std::string dev_name) { dev = dev_handle; location = path; + name = dev_name; } SteelSeriesSiberiaController::~SteelSeriesSiberiaController() @@ -55,9 +52,9 @@ std::string SteelSeriesSiberiaController::GetDeviceLocation() return("HID: " + location); } -char* SteelSeriesSiberiaController::GetDeviceName() +std::string SteelSeriesSiberiaController::GetDeviceName() { - return device_name; + return(name); } std::string SteelSeriesSiberiaController::GetSerialString() @@ -73,12 +70,7 @@ std::string SteelSeriesSiberiaController::GetSerialString() return(StringUtils::wstring_to_string(serial_string)); } -void SteelSeriesSiberiaController::SetColor - ( - unsigned char red, - unsigned char green, - unsigned char blue - ) +void SteelSeriesSiberiaController::SetColor(unsigned char red, unsigned char green, unsigned char blue) { unsigned char usb_buf[4]; memset(usb_buf, 0x00, sizeof(usb_buf)); diff --git a/Controllers/SteelSeriesController/SteelSeriesSiberiaController/SteelSeriesSiberiaController.h b/Controllers/SteelSeriesController/SteelSeriesSiberiaController/SteelSeriesSiberiaController.h index 460f9e45..7aabc54c 100644 --- a/Controllers/SteelSeriesController/SteelSeriesSiberiaController/SteelSeriesSiberiaController.h +++ b/Controllers/SteelSeriesController/SteelSeriesSiberiaController/SteelSeriesSiberiaController.h @@ -17,27 +17,17 @@ class SteelSeriesSiberiaController { public: - SteelSeriesSiberiaController - ( - hid_device* dev_handle, - const char* path - ); - + SteelSeriesSiberiaController(hid_device* dev_handle, const char* path, std::string dev_name); ~SteelSeriesSiberiaController(); std::string GetDeviceLocation(); - char* GetDeviceName(); + std::string GetDeviceName(); std::string GetSerialString(); - void SetColor - ( - unsigned char red, - unsigned char green, - unsigned char blue - ); + void SetColor(unsigned char red, unsigned char green, unsigned char blue); private: - char device_name[32]; - hid_device* dev; - std::string location; + hid_device* dev; + std::string location; + std::string name; };