From d19baf13653fbf65252abbbe3d02ba7d4647db62 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Thu, 3 Dec 2020 00:01:42 -0600 Subject: [PATCH] Fill in serial field for all HID controllers using hidapi --- .../AMDWraithPrismController.cpp | 11 +++++++++++ .../AMDWraithPrismController.h | 1 + .../RGBController_AMDWraithPrism.cpp | 1 + .../AsusAuraCoreController/AsusAuraCoreController.cpp | 11 +++++++++++ .../AsusAuraCoreController/AsusAuraCoreController.h | 1 + .../RGBController_AsusAuraCore.cpp | 1 + .../AsusAuraUSBController/AsusAuraMouseController.cpp | 11 +++++++++++ .../AsusAuraUSBController/AsusAuraMouseController.h | 1 + .../AsusAuraUSBController/AsusAuraUSBController.cpp | 11 +++++++++++ .../AsusAuraUSBController/AsusAuraUSBController.h | 1 + .../RGBController_AsusAuraMouse.cpp | 1 + .../RGBController_AsusAuraUSB.cpp | 1 + .../CorsairLightingNodeController.cpp | 11 +++++++++++ .../CorsairLightingNodeController.h | 1 + .../RGBController_CorsairLightingNode.cpp | 1 + .../CorsairPeripheralController.cpp | 11 +++++++++++ .../CorsairPeripheralController.h | 1 + .../RGBController_CorsairPeripheral.cpp | 1 + .../DuckyKeyboardController.cpp | 11 +++++++++++ .../DuckyKeyboardController/DuckyKeyboardController.h | 1 + .../RGBController_DuckyKeyboard.cpp | 1 + .../ATC800Controller.cpp | 11 +++++++++++ .../ATC800Controller.h | 1 + .../RGBController_AorusATC800.cpp | 1 + Controllers/HoltekController/HoltekA070Controller.cpp | 11 +++++++++++ Controllers/HoltekController/HoltekA070Controller.h | 1 + .../HoltekController/RGBController_HoltekA070.cpp | 1 + .../HyperXAlloyOriginsController.cpp | 11 +++++++++++ .../HyperXAlloyOriginsController.h | 1 + .../HyperXKeyboardController.cpp | 11 +++++++++++ .../HyperXKeyboardController.h | 1 + .../RGBController_HyperXAlloyOrigins.cpp | 1 + .../RGBController_HyperXKeyboard.cpp | 1 + .../HyperXPulsefireSurgeController.cpp | 11 +++++++++++ .../HyperXPulsefireSurgeController.h | 1 + .../RGBController_HyperXPulsefireSurge.cpp | 1 + .../HyperXMousematController.cpp | 11 +++++++++++ .../HyperXMousematController.h | 1 + .../RGBController_HyperXMousemat.cpp | 1 + .../LogitechController/LogitechG203Controller.cpp | 11 +++++++++++ .../LogitechController/LogitechG203Controller.h | 1 + .../LogitechController/LogitechG203LController.cpp | 11 +++++++++++ .../LogitechController/LogitechG203LController.h | 1 + .../LogitechController/LogitechG213Controller.cpp | 11 +++++++++++ .../LogitechController/LogitechG213Controller.h | 1 + .../LogitechController/LogitechG403Controller.cpp | 11 +++++++++++ .../LogitechController/LogitechG403Controller.h | 1 + .../LogitechController/LogitechG502PSController.cpp | 11 +++++++++++ .../LogitechController/LogitechG502PSController.h | 1 + .../LogitechController/LogitechG810Controller.cpp | 11 +++++++++++ .../LogitechController/LogitechG810Controller.h | 2 ++ .../LogitechGPowerPlayController.cpp | 11 +++++++++++ .../LogitechController/LogitechGPowerPlayController.h | 1 + .../LogitechGProWirelessController.cpp | 11 +++++++++++ .../LogitechGProWirelessController.h | 1 + .../LogitechController/RGBController_LogitechG203.cpp | 1 + .../RGBController_LogitechG203L.cpp | 1 + .../LogitechController/RGBController_LogitechG213.cpp | 1 + .../LogitechController/RGBController_LogitechG403.cpp | 1 + .../RGBController_LogitechG502PS.cpp | 1 + .../LogitechController/RGBController_LogitechG810.cpp | 1 + .../RGBController_LogitechGPowerPlay.cpp | 2 ++ .../RGBController_LogitechGProWireless.cpp | 1 + Controllers/MSI3ZoneController/MSI3ZoneController.cpp | 11 +++++++++++ Controllers/MSI3ZoneController/MSI3ZoneController.h | 3 ++- .../MSI3ZoneController/RGBController_MSI3Zone.cpp | 1 + Controllers/NZXTHue2Controller/NZXTHue2Controller.cpp | 11 +++++++++++ Controllers/NZXTHue2Controller/NZXTHue2Controller.h | 1 + .../NZXTHue2Controller/RGBController_NZXTHue2.cpp | 1 + .../NZXTKrakenController/NZXTKrakenController.cpp | 11 +++++++++++ .../NZXTKrakenController/NZXTKrakenController.h | 1 + .../NZXTKrakenController/RGBController_NZXTKraken.cpp | 1 + .../RedragonController/RGBController_RedragonK556.cpp | 2 ++ .../RedragonController/RGBController_RedragonM711.cpp | 1 + .../RedragonController/RedragonK556Controller.cpp | 11 +++++++++++ .../RedragonController/RedragonK556Controller.h | 1 + .../RedragonController/RedragonM711Controller.cpp | 11 +++++++++++ .../RedragonController/RedragonM711Controller.h | 1 + .../SinowealthController/RGBController_Sinowealth.cpp | 1 + .../SinowealthController/SinowealthController.cpp | 11 +++++++++++ .../SinowealthController/SinowealthController.h | 1 + .../SonyDS4Controller/RGBController_SonyDS4.cpp | 1 + Controllers/SonyDS4Controller/SonyDS4Controller.cpp | 11 +++++++++++ Controllers/SonyDS4Controller/SonyDS4Controller.h | 1 + .../RGBController_SteelSeriesApex.cpp | 1 + .../RGBController_SteelSeriesOldApex.cpp | 1 + .../RGBController_SteelSeriesRival.cpp | 1 + .../RGBController_SteelSeriesSiberia.cpp | 1 + .../SteelSeriesApexBaseController.h | 11 +++++++++++ .../SteelSeriesOldApexController.cpp | 11 +++++++++++ .../SteelSeriesOldApexController.h | 1 + .../SteelSeriesRivalController.cpp | 11 +++++++++++ .../SteelSeriesRivalController.h | 1 + .../SteelSeriesSiberiaController.cpp | 11 +++++++++++ .../SteelSeriesSiberiaController.h | 3 ++- .../RGBController_ThermaltakePoseidonZRGB.cpp | 1 + .../ThermaltakePoseidonZRGBController.cpp | 11 +++++++++++ .../ThermaltakePoseidonZRGBController.h | 1 + .../RGBController_ThermaltakeRiing.cpp | 1 + .../ThermaltakeRiingController.cpp | 11 +++++++++++ .../ThermaltakeRiingController.h | 1 + 101 files changed, 446 insertions(+), 2 deletions(-) diff --git a/Controllers/AMDWraithPrismController/AMDWraithPrismController.cpp b/Controllers/AMDWraithPrismController/AMDWraithPrismController.cpp index 23e66d19..e44d1e0d 100644 --- a/Controllers/AMDWraithPrismController/AMDWraithPrismController.cpp +++ b/Controllers/AMDWraithPrismController/AMDWraithPrismController.cpp @@ -49,6 +49,17 @@ char* AMDWraithPrismController::GetDeviceName() return device_name; } +std::string AMDWraithPrismController::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + std::string AMDWraithPrismController::GetEffectChannelString(unsigned char channel) { std::string ret_string = ""; diff --git a/Controllers/AMDWraithPrismController/AMDWraithPrismController.h b/Controllers/AMDWraithPrismController/AMDWraithPrismController.h index ab6fd6b8..5aef416f 100644 --- a/Controllers/AMDWraithPrismController/AMDWraithPrismController.h +++ b/Controllers/AMDWraithPrismController/AMDWraithPrismController.h @@ -117,6 +117,7 @@ public: std::string GetEffectChannelString(unsigned char channel); std::string GetFirmwareVersionString(); std::string GetLocationString(); + std::string GetSerialString(); void SetRingEffectChannel(unsigned char channel); diff --git a/Controllers/AMDWraithPrismController/RGBController_AMDWraithPrism.cpp b/Controllers/AMDWraithPrismController/RGBController_AMDWraithPrism.cpp index ec21d982..58c6aae1 100644 --- a/Controllers/AMDWraithPrismController/RGBController_AMDWraithPrism.cpp +++ b/Controllers/AMDWraithPrismController/RGBController_AMDWraithPrism.cpp @@ -19,6 +19,7 @@ RGBController_AMDWraithPrism::RGBController_AMDWraithPrism(AMDWraithPrismControl description = "AMD Wraith Prism Device"; version = wraith->GetFirmwareVersionString(); location = wraith->GetLocationString(); + serial = wraith->GetSerialString(); mode Direct; Direct.name = "Direct"; diff --git a/Controllers/AsusAuraCoreController/AsusAuraCoreController.cpp b/Controllers/AsusAuraCoreController/AsusAuraCoreController.cpp index 57db8fce..4977e265 100644 --- a/Controllers/AsusAuraCoreController/AsusAuraCoreController.cpp +++ b/Controllers/AsusAuraCoreController/AsusAuraCoreController.cpp @@ -26,6 +26,17 @@ std::string AuraCoreController::GetDeviceLocation() return("HID: " + location); } +std::string AuraCoreController::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + void AuraCoreController::SendBrightness ( unsigned char brightness diff --git a/Controllers/AsusAuraCoreController/AsusAuraCoreController.h b/Controllers/AsusAuraCoreController/AsusAuraCoreController.h index 504539d0..e3cd295c 100644 --- a/Controllers/AsusAuraCoreController/AsusAuraCoreController.h +++ b/Controllers/AsusAuraCoreController/AsusAuraCoreController.h @@ -52,6 +52,7 @@ public: ~AuraCoreController(); std::string GetDeviceLocation(); + std::string GetSerialString(); void SendBrightness ( diff --git a/Controllers/AsusAuraCoreController/RGBController_AsusAuraCore.cpp b/Controllers/AsusAuraCoreController/RGBController_AsusAuraCore.cpp index eedd7d7c..0ec8d3e9 100644 --- a/Controllers/AsusAuraCoreController/RGBController_AsusAuraCore.cpp +++ b/Controllers/AsusAuraCoreController/RGBController_AsusAuraCore.cpp @@ -17,6 +17,7 @@ RGBController_AuraCore::RGBController_AuraCore(AuraCoreController* aura_ptr) type = DEVICE_TYPE_KEYBOARD; description = "ASUS Aura Core Device"; location = aura->GetDeviceLocation(); + serial = aura->GetSerialString(); mode Static; Static.name = "Static"; diff --git a/Controllers/AsusAuraUSBController/AsusAuraMouseController.cpp b/Controllers/AsusAuraUSBController/AsusAuraMouseController.cpp index 81a9565e..a0784a1c 100644 --- a/Controllers/AsusAuraUSBController/AsusAuraMouseController.cpp +++ b/Controllers/AsusAuraUSBController/AsusAuraMouseController.cpp @@ -27,6 +27,17 @@ std::string AuraMouseController::GetDeviceLocation() return("HID: " + location); } +std::string AuraMouseController::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + void AuraMouseController::SendUpdate ( unsigned char zone, diff --git a/Controllers/AsusAuraUSBController/AsusAuraMouseController.h b/Controllers/AsusAuraUSBController/AsusAuraMouseController.h index 3f06a7cc..25674237 100644 --- a/Controllers/AsusAuraUSBController/AsusAuraMouseController.h +++ b/Controllers/AsusAuraUSBController/AsusAuraMouseController.h @@ -38,6 +38,7 @@ public: virtual ~AuraMouseController(); std::string GetDeviceLocation(); + std::string GetSerialString(); void SendUpdate ( diff --git a/Controllers/AsusAuraUSBController/AsusAuraUSBController.cpp b/Controllers/AsusAuraUSBController/AsusAuraUSBController.cpp index 3416d8a8..932035c2 100644 --- a/Controllers/AsusAuraUSBController/AsusAuraUSBController.cpp +++ b/Controllers/AsusAuraUSBController/AsusAuraUSBController.cpp @@ -40,6 +40,17 @@ std::string AuraUSBController::GetDeviceName() return(device_name); } +std::string AuraUSBController::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + const std::vector& AuraUSBController::GetAuraDevices() const { return(device_info); diff --git a/Controllers/AsusAuraUSBController/AsusAuraUSBController.h b/Controllers/AsusAuraUSBController/AsusAuraUSBController.h index f0e72d68..a7b37c11 100644 --- a/Controllers/AsusAuraUSBController/AsusAuraUSBController.h +++ b/Controllers/AsusAuraUSBController/AsusAuraUSBController.h @@ -66,6 +66,7 @@ public: std::string GetDeviceLocation(); std::string GetDeviceName(); + std::string GetSerialString(); const std::vector& GetAuraDevices() const; diff --git a/Controllers/AsusAuraUSBController/RGBController_AsusAuraMouse.cpp b/Controllers/AsusAuraUSBController/RGBController_AsusAuraMouse.cpp index 1b831513..fdab10bf 100644 --- a/Controllers/AsusAuraUSBController/RGBController_AsusAuraMouse.cpp +++ b/Controllers/AsusAuraUSBController/RGBController_AsusAuraMouse.cpp @@ -18,6 +18,7 @@ RGBController_AuraMouse::RGBController_AuraMouse(AuraMouseController* aura_ptr) type = DEVICE_TYPE_MOUSE; description = "ASUS Aura Mouse Device"; location = aura->GetDeviceLocation(); + serial = aura->GetSerialString(); mode Direct; Direct.name = "Direct"; diff --git a/Controllers/AsusAuraUSBController/RGBController_AsusAuraUSB.cpp b/Controllers/AsusAuraUSBController/RGBController_AsusAuraUSB.cpp index 6198aae1..34e29478 100644 --- a/Controllers/AsusAuraUSBController/RGBController_AsusAuraUSB.cpp +++ b/Controllers/AsusAuraUSBController/RGBController_AsusAuraUSB.cpp @@ -20,6 +20,7 @@ RGBController_AuraUSB::RGBController_AuraUSB(AuraUSBController* aura_ptr) : type = DEVICE_TYPE_MOTHERBOARD; description = "ASUS Aura USB Device"; location = aura->GetDeviceLocation(); + serial = aura->GetSerialString(); mode Direct; Direct.name = "Direct"; diff --git a/Controllers/CorsairLightingNodeController/CorsairLightingNodeController.cpp b/Controllers/CorsairLightingNodeController/CorsairLightingNodeController.cpp index d0670a2b..0bb8933e 100644 --- a/Controllers/CorsairLightingNodeController/CorsairLightingNodeController.cpp +++ b/Controllers/CorsairLightingNodeController/CorsairLightingNodeController.cpp @@ -59,6 +59,17 @@ std::string CorsairLightingNodeController::GetLocationString() return("HID: " + location); } +std::string CorsairLightingNodeController::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + void CorsairLightingNodeController::SetChannelEffect(unsigned char channel, unsigned char num_leds, unsigned char mode, diff --git a/Controllers/CorsairLightingNodeController/CorsairLightingNodeController.h b/Controllers/CorsairLightingNodeController/CorsairLightingNodeController.h index c81627c3..a49882b9 100644 --- a/Controllers/CorsairLightingNodeController/CorsairLightingNodeController.h +++ b/Controllers/CorsairLightingNodeController/CorsairLightingNodeController.h @@ -84,6 +84,7 @@ public: std::string GetFirmwareString(); std::string GetLocationString(); + std::string GetSerialString(); unsigned int GetStripsOnChannel(unsigned int channel); diff --git a/Controllers/CorsairLightingNodeController/RGBController_CorsairLightingNode.cpp b/Controllers/CorsairLightingNodeController/RGBController_CorsairLightingNode.cpp index 6e25d46b..3a15e2c1 100644 --- a/Controllers/CorsairLightingNodeController/RGBController_CorsairLightingNode.cpp +++ b/Controllers/CorsairLightingNodeController/RGBController_CorsairLightingNode.cpp @@ -20,6 +20,7 @@ RGBController_CorsairLightingNode::RGBController_CorsairLightingNode(CorsairLigh type = DEVICE_TYPE_LEDSTRIP; version = corsair->GetFirmwareString(); location = corsair->GetLocationString(); + serial = corsair->GetSerialString(); mode Direct; Direct.name = "Direct"; diff --git a/Controllers/CorsairPeripheralController/CorsairPeripheralController.cpp b/Controllers/CorsairPeripheralController/CorsairPeripheralController.cpp index a444b75c..e9f938d5 100644 --- a/Controllers/CorsairPeripheralController/CorsairPeripheralController.cpp +++ b/Controllers/CorsairPeripheralController/CorsairPeripheralController.cpp @@ -96,6 +96,17 @@ std::string CorsairPeripheralController::GetName() return name; } +std::string CorsairPeripheralController::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + void CorsairPeripheralController::SetLEDs(std::vectorcolors) { switch(type) diff --git a/Controllers/CorsairPeripheralController/CorsairPeripheralController.h b/Controllers/CorsairPeripheralController/CorsairPeripheralController.h index 054e390f..c8d92c27 100644 --- a/Controllers/CorsairPeripheralController/CorsairPeripheralController.h +++ b/Controllers/CorsairPeripheralController/CorsairPeripheralController.h @@ -75,6 +75,7 @@ public: std::string GetDeviceLocation(); std::string GetFirmwareString(); std::string GetName(); + std::string GetSerialString(); void SetLEDs(std::vector colors); void SetLEDsKeyboardFull(std::vector colors); diff --git a/Controllers/CorsairPeripheralController/RGBController_CorsairPeripheral.cpp b/Controllers/CorsairPeripheralController/RGBController_CorsairPeripheral.cpp index b162bbb3..2eb60f62 100644 --- a/Controllers/CorsairPeripheralController/RGBController_CorsairPeripheral.cpp +++ b/Controllers/CorsairPeripheralController/RGBController_CorsairPeripheral.cpp @@ -580,6 +580,7 @@ RGBController_CorsairPeripheral::RGBController_CorsairPeripheral(CorsairPeripher type = corsair->GetDeviceType(); version = corsair->GetFirmwareString(); location = corsair->GetDeviceLocation(); + serial = corsair->GetSerialString(); physical_layout = corsair->GetPhysicalLayout(); logical_layout = corsair->GetLogicalLayout(); diff --git a/Controllers/DuckyKeyboardController/DuckyKeyboardController.cpp b/Controllers/DuckyKeyboardController/DuckyKeyboardController.cpp index f9d6c470..d87b416d 100644 --- a/Controllers/DuckyKeyboardController/DuckyKeyboardController.cpp +++ b/Controllers/DuckyKeyboardController/DuckyKeyboardController.cpp @@ -28,6 +28,17 @@ std::string DuckyKeyboardController::GetDeviceLocation() return("HID: " + location); } +std::string DuckyKeyboardController::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + void DuckyKeyboardController::SendColors ( unsigned char* color_data, diff --git a/Controllers/DuckyKeyboardController/DuckyKeyboardController.h b/Controllers/DuckyKeyboardController/DuckyKeyboardController.h index 019b6c57..e91c2828 100644 --- a/Controllers/DuckyKeyboardController/DuckyKeyboardController.h +++ b/Controllers/DuckyKeyboardController/DuckyKeyboardController.h @@ -21,6 +21,7 @@ public: ~DuckyKeyboardController(); std::string GetDeviceLocation(); + std::string GetSerialString(); void SendColors ( diff --git a/Controllers/DuckyKeyboardController/RGBController_DuckyKeyboard.cpp b/Controllers/DuckyKeyboardController/RGBController_DuckyKeyboard.cpp index f3578522..5374bcbd 100644 --- a/Controllers/DuckyKeyboardController/RGBController_DuckyKeyboard.cpp +++ b/Controllers/DuckyKeyboardController/RGBController_DuckyKeyboard.cpp @@ -180,6 +180,7 @@ RGBController_DuckyKeyboard::RGBController_DuckyKeyboard(DuckyKeyboardController type = DEVICE_TYPE_KEYBOARD; description = "Ducky Keyboard Device"; location = ducky->GetDeviceLocation(); + serial = ducky->GetSerialString(); mode Direct; Direct.name = "Direct"; diff --git a/Controllers/GigabyteAorusCPUCoolerController/ATC800Controller.cpp b/Controllers/GigabyteAorusCPUCoolerController/ATC800Controller.cpp index aae37b32..ec5f73a1 100644 --- a/Controllers/GigabyteAorusCPUCoolerController/ATC800Controller.cpp +++ b/Controllers/GigabyteAorusCPUCoolerController/ATC800Controller.cpp @@ -27,6 +27,17 @@ std::string ATC800Controller::GetDeviceLocation() return("HID: " + location); } +std::string ATC800Controller::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + void ATC800Controller::SendCoolerMode ( unsigned char mode, diff --git a/Controllers/GigabyteAorusCPUCoolerController/ATC800Controller.h b/Controllers/GigabyteAorusCPUCoolerController/ATC800Controller.h index 1b279b8f..3a70bc7a 100644 --- a/Controllers/GigabyteAorusCPUCoolerController/ATC800Controller.h +++ b/Controllers/GigabyteAorusCPUCoolerController/ATC800Controller.h @@ -45,6 +45,7 @@ public: ~ATC800Controller(); std::string GetDeviceLocation(); + std::string GetSerialString(); void SendCoolerMode ( diff --git a/Controllers/GigabyteAorusCPUCoolerController/RGBController_AorusATC800.cpp b/Controllers/GigabyteAorusCPUCoolerController/RGBController_AorusATC800.cpp index 595c3520..21854446 100644 --- a/Controllers/GigabyteAorusCPUCoolerController/RGBController_AorusATC800.cpp +++ b/Controllers/GigabyteAorusCPUCoolerController/RGBController_AorusATC800.cpp @@ -18,6 +18,7 @@ RGBController_AorusATC800::RGBController_AorusATC800(ATC800Controller* cooler_pt type = DEVICE_TYPE_COOLER; description = "Aorus ATC800 CPU Cooler"; location = cooler->GetDeviceLocation(); + serial = cooler->GetSerialString(); mode Static; Static.name = "Static"; diff --git a/Controllers/HoltekController/HoltekA070Controller.cpp b/Controllers/HoltekController/HoltekA070Controller.cpp index 1dc5bc9a..9c91364c 100644 --- a/Controllers/HoltekController/HoltekA070Controller.cpp +++ b/Controllers/HoltekController/HoltekA070Controller.cpp @@ -21,6 +21,17 @@ std::string HoltekA070Controller::GetDeviceLocation() return("HID: " + location); } +std::string HoltekA070Controller::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + /*-------------------------------------------------------------------------------------------------*\ | Private packet sending functions. | \*-------------------------------------------------------------------------------------------------*/ diff --git a/Controllers/HoltekController/HoltekA070Controller.h b/Controllers/HoltekController/HoltekA070Controller.h index 5f1d1f04..7005339d 100644 --- a/Controllers/HoltekController/HoltekA070Controller.h +++ b/Controllers/HoltekController/HoltekA070Controller.h @@ -28,6 +28,7 @@ public: ~HoltekA070Controller(); std::string GetDeviceLocation(); + std::string GetSerialString(); void SendCustomColor ( diff --git a/Controllers/HoltekController/RGBController_HoltekA070.cpp b/Controllers/HoltekController/RGBController_HoltekA070.cpp index 75b14344..1d3f54ae 100644 --- a/Controllers/HoltekController/RGBController_HoltekA070.cpp +++ b/Controllers/HoltekController/RGBController_HoltekA070.cpp @@ -17,6 +17,7 @@ RGBController_HoltekA070::RGBController_HoltekA070(HoltekA070Controller* holtek_ type = DEVICE_TYPE_MOUSE; description = "Holtek USB Gaming Mouse Device"; location = holtek->GetDeviceLocation(); + serial = holtek->GetSerialString(); mode Static; Static.name = "Static"; diff --git a/Controllers/HyperXKeyboardController/HyperXAlloyOriginsController.cpp b/Controllers/HyperXKeyboardController/HyperXAlloyOriginsController.cpp index 4c245ad9..2d0705f4 100644 --- a/Controllers/HyperXKeyboardController/HyperXAlloyOriginsController.cpp +++ b/Controllers/HyperXKeyboardController/HyperXAlloyOriginsController.cpp @@ -30,6 +30,17 @@ std::string HyperXAlloyOriginsController::GetDeviceLocation() return("HID " + location); } +std::string HyperXAlloyOriginsController::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + void HyperXAlloyOriginsController::SetLEDsDirect(std::vector colors) { /*-----------------------------------------------------*\ diff --git a/Controllers/HyperXKeyboardController/HyperXAlloyOriginsController.h b/Controllers/HyperXKeyboardController/HyperXAlloyOriginsController.h index 0d230fe4..4a111482 100644 --- a/Controllers/HyperXKeyboardController/HyperXAlloyOriginsController.h +++ b/Controllers/HyperXKeyboardController/HyperXAlloyOriginsController.h @@ -21,6 +21,7 @@ public: ~HyperXAlloyOriginsController(); std::string GetDeviceLocation(); + std::string GetSerialString(); void SetLEDsDirect(std::vector colors); diff --git a/Controllers/HyperXKeyboardController/HyperXKeyboardController.cpp b/Controllers/HyperXKeyboardController/HyperXKeyboardController.cpp index 22f3b8fd..7dac20d6 100644 --- a/Controllers/HyperXKeyboardController/HyperXKeyboardController.cpp +++ b/Controllers/HyperXKeyboardController/HyperXKeyboardController.cpp @@ -43,6 +43,17 @@ std::string HyperXKeyboardController::GetDeviceLocation() return("HID: " + location); } +std::string HyperXKeyboardController::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + void HyperXKeyboardController::SetMode ( unsigned char mode, diff --git a/Controllers/HyperXKeyboardController/HyperXKeyboardController.h b/Controllers/HyperXKeyboardController/HyperXKeyboardController.h index 5110e2a4..45efd522 100644 --- a/Controllers/HyperXKeyboardController/HyperXKeyboardController.h +++ b/Controllers/HyperXKeyboardController/HyperXKeyboardController.h @@ -69,6 +69,7 @@ public: ~HyperXKeyboardController(); std::string GetDeviceLocation(); + std::string GetSerialString(); void SetMode ( diff --git a/Controllers/HyperXKeyboardController/RGBController_HyperXAlloyOrigins.cpp b/Controllers/HyperXKeyboardController/RGBController_HyperXAlloyOrigins.cpp index e8dff75b..f17c6092 100644 --- a/Controllers/HyperXKeyboardController/RGBController_HyperXAlloyOrigins.cpp +++ b/Controllers/HyperXKeyboardController/RGBController_HyperXAlloyOrigins.cpp @@ -176,6 +176,7 @@ RGBController_HyperXAlloyOrigins::RGBController_HyperXAlloyOrigins(HyperXAlloyOr type = DEVICE_TYPE_KEYBOARD; description = "HyperX Alloy Origins Keyboard Device"; location = hyperx->GetDeviceLocation(); + serial = hyperx->GetSerialString(); mode Direct; Direct.name = "Direct"; diff --git a/Controllers/HyperXKeyboardController/RGBController_HyperXKeyboard.cpp b/Controllers/HyperXKeyboardController/RGBController_HyperXKeyboard.cpp index d10ae696..43e6f065 100644 --- a/Controllers/HyperXKeyboardController/RGBController_HyperXKeyboard.cpp +++ b/Controllers/HyperXKeyboardController/RGBController_HyperXKeyboard.cpp @@ -184,6 +184,7 @@ RGBController_HyperXKeyboard::RGBController_HyperXKeyboard(HyperXKeyboardControl type = DEVICE_TYPE_KEYBOARD; description = "HyperX RGB Keyboard Device"; location = hyperx->GetDeviceLocation(); + serial = hyperx->GetSerialString(); mode Direct; Direct.name = "Direct"; diff --git a/Controllers/HyperXMouseController/HyperXPulsefireSurgeController.cpp b/Controllers/HyperXMouseController/HyperXPulsefireSurgeController.cpp index 89caa1d1..e50bead2 100644 --- a/Controllers/HyperXMouseController/HyperXPulsefireSurgeController.cpp +++ b/Controllers/HyperXMouseController/HyperXPulsefireSurgeController.cpp @@ -27,6 +27,17 @@ std::string HyperXPulsefireSurgeController::GetDeviceLocation() return("HID " + location); } +std::string HyperXPulsefireSurgeController::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + /*-------------------------------------------------------------------------------------------------*\ | Private packet sending functions. | \*-------------------------------------------------------------------------------------------------*/ diff --git a/Controllers/HyperXMouseController/HyperXPulsefireSurgeController.h b/Controllers/HyperXMouseController/HyperXPulsefireSurgeController.h index 7f1d64ea..d2fcb405 100644 --- a/Controllers/HyperXMouseController/HyperXPulsefireSurgeController.h +++ b/Controllers/HyperXMouseController/HyperXPulsefireSurgeController.h @@ -38,6 +38,7 @@ public: ~HyperXPulsefireSurgeController(); std::string GetDeviceLocation(); + std::string GetSerialString(); void SelectProfile ( diff --git a/Controllers/HyperXMouseController/RGBController_HyperXPulsefireSurge.cpp b/Controllers/HyperXMouseController/RGBController_HyperXPulsefireSurge.cpp index fe5b3481..953c4dcb 100644 --- a/Controllers/HyperXMouseController/RGBController_HyperXPulsefireSurge.cpp +++ b/Controllers/HyperXMouseController/RGBController_HyperXPulsefireSurge.cpp @@ -20,6 +20,7 @@ RGBController_HyperXPulsefireSurge::RGBController_HyperXPulsefireSurge(HyperXPul type = DEVICE_TYPE_MOUSE; description = "HyperX Pulsefire Surge Device"; location = hyperx->GetDeviceLocation(); + serial = hyperx->GetSerialString(); mode Direct; Direct.name = "Direct"; diff --git a/Controllers/HyperXMousematController/HyperXMousematController.cpp b/Controllers/HyperXMousematController/HyperXMousematController.cpp index b22619a9..fa38b8b2 100644 --- a/Controllers/HyperXMousematController/HyperXMousematController.cpp +++ b/Controllers/HyperXMousematController/HyperXMousematController.cpp @@ -27,6 +27,17 @@ std::string HyperXMousematController::GetDeviceLocation() return("HID " + location); } +std::string HyperXMousematController::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + /*-------------------------------------------------------------------------------------------------*\ | Private packet sending functions. | \*-------------------------------------------------------------------------------------------------*/ diff --git a/Controllers/HyperXMousematController/HyperXMousematController.h b/Controllers/HyperXMousematController/HyperXMousematController.h index 4048a162..ba075840 100644 --- a/Controllers/HyperXMousematController/HyperXMousematController.h +++ b/Controllers/HyperXMousematController/HyperXMousematController.h @@ -21,6 +21,7 @@ public: ~HyperXMousematController(); std::string GetDeviceLocation(); + std::string GetSerialString(); void SendDirect ( diff --git a/Controllers/HyperXMousematController/RGBController_HyperXMousemat.cpp b/Controllers/HyperXMousematController/RGBController_HyperXMousemat.cpp index d9354b70..6480006b 100644 --- a/Controllers/HyperXMousematController/RGBController_HyperXMousemat.cpp +++ b/Controllers/HyperXMousematController/RGBController_HyperXMousemat.cpp @@ -20,6 +20,7 @@ RGBController_HyperXMousemat::RGBController_HyperXMousemat(HyperXMousematControl type = DEVICE_TYPE_MOUSEMAT; description = "HyperX Mousemat Device"; location = hyperx->GetDeviceLocation(); + serial = hyperx->GetSerialString(); mode Direct; Direct.name = "Direct"; diff --git a/Controllers/LogitechController/LogitechG203Controller.cpp b/Controllers/LogitechController/LogitechG203Controller.cpp index 11dc1e1a..3ea57b2d 100644 --- a/Controllers/LogitechController/LogitechG203Controller.cpp +++ b/Controllers/LogitechController/LogitechG203Controller.cpp @@ -22,6 +22,17 @@ std::string LogitechG203Controller::GetDeviceLocation() return("HID " + location); } +std::string LogitechG203Controller::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + /*-------------------------------------------------------------------------------------------------*\ | Private packet sending functions. | \*-------------------------------------------------------------------------------------------------*/ diff --git a/Controllers/LogitechController/LogitechG203Controller.h b/Controllers/LogitechController/LogitechG203Controller.h index c9ec7c02..53d4f28f 100644 --- a/Controllers/LogitechController/LogitechG203Controller.h +++ b/Controllers/LogitechController/LogitechG203Controller.h @@ -40,6 +40,7 @@ public: ~LogitechG203Controller(); std::string GetDeviceLocation(); + std::string GetSerialString(); void SendMouseMode ( diff --git a/Controllers/LogitechController/LogitechG203LController.cpp b/Controllers/LogitechController/LogitechG203LController.cpp index a767a898..ce88fbaf 100644 --- a/Controllers/LogitechController/LogitechG203LController.cpp +++ b/Controllers/LogitechController/LogitechG203LController.cpp @@ -13,6 +13,17 @@ std::string LogitechG203LController::GetDeviceLocation() return("HID: " + location); } +std::string LogitechG203LController::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + void LogitechG203LController::SendApply() { unsigned char usb_buf[20]; diff --git a/Controllers/LogitechController/LogitechG203LController.h b/Controllers/LogitechController/LogitechG203LController.h index e7cfbef0..84dd0ab1 100644 --- a/Controllers/LogitechController/LogitechG203LController.h +++ b/Controllers/LogitechController/LogitechG203LController.h @@ -23,6 +23,7 @@ public: ~LogitechG203LController(); std::string GetDeviceLocation(); + std::string GetSerialString(); void SetSingleLED(int led, unsigned char red, unsigned char green, unsigned char blue); void SetMode(int mode, int speed, unsigned char brightness, unsigned char dir, unsigned char red, unsigned char green, unsigned char blue); diff --git a/Controllers/LogitechController/LogitechG213Controller.cpp b/Controllers/LogitechController/LogitechG213Controller.cpp index e0491eb6..035b4ba0 100644 --- a/Controllers/LogitechController/LogitechG213Controller.cpp +++ b/Controllers/LogitechController/LogitechG213Controller.cpp @@ -25,6 +25,17 @@ std::string LogitechG213Controller::GetDeviceLocation() return("HID: " + location); } +std::string LogitechG213Controller::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + void LogitechG213Controller::SetDirect ( unsigned char zone, diff --git a/Controllers/LogitechController/LogitechG213Controller.h b/Controllers/LogitechController/LogitechG213Controller.h index 72b28899..024f4bff 100644 --- a/Controllers/LogitechController/LogitechG213Controller.h +++ b/Controllers/LogitechController/LogitechG213Controller.h @@ -20,6 +20,7 @@ public: ~LogitechG213Controller(); std::string GetDeviceLocation(); + std::string GetSerialString(); void SetDirect ( diff --git a/Controllers/LogitechController/LogitechG403Controller.cpp b/Controllers/LogitechController/LogitechG403Controller.cpp index 2b3ae5b1..d8ba26fa 100644 --- a/Controllers/LogitechController/LogitechG403Controller.cpp +++ b/Controllers/LogitechController/LogitechG403Controller.cpp @@ -27,6 +27,17 @@ std::string LogitechG403Controller::GetDeviceLocation() return("HID: " + location); } +std::string LogitechG403Controller::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + void LogitechG403Controller::SendMouseMode ( unsigned char mode, diff --git a/Controllers/LogitechController/LogitechG403Controller.h b/Controllers/LogitechController/LogitechG403Controller.h index b9ad6512..6317de88 100644 --- a/Controllers/LogitechController/LogitechG403Controller.h +++ b/Controllers/LogitechController/LogitechG403Controller.h @@ -40,6 +40,7 @@ public: ~LogitechG403Controller(); std::string GetDeviceLocation(); + std::string GetSerialString(); void SendMouseMode ( diff --git a/Controllers/LogitechController/LogitechG502PSController.cpp b/Controllers/LogitechController/LogitechG502PSController.cpp index ce860175..676aebe1 100644 --- a/Controllers/LogitechController/LogitechG502PSController.cpp +++ b/Controllers/LogitechController/LogitechG502PSController.cpp @@ -27,6 +27,17 @@ std::string LogitechG502PSController::GetDeviceLocation() return("HID: " + location); } +std::string LogitechG502PSController::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + void LogitechG502PSController::SendMouseMode ( unsigned char mode, diff --git a/Controllers/LogitechController/LogitechG502PSController.h b/Controllers/LogitechController/LogitechG502PSController.h index 839ba07d..8ba47779 100644 --- a/Controllers/LogitechController/LogitechG502PSController.h +++ b/Controllers/LogitechController/LogitechG502PSController.h @@ -41,6 +41,7 @@ public: ~LogitechG502PSController(); std::string GetDeviceLocation(); + std::string GetSerialString(); void SendMouseMode ( diff --git a/Controllers/LogitechController/LogitechG810Controller.cpp b/Controllers/LogitechController/LogitechG810Controller.cpp index b910854f..501ecbf1 100644 --- a/Controllers/LogitechController/LogitechG810Controller.cpp +++ b/Controllers/LogitechController/LogitechG810Controller.cpp @@ -21,6 +21,17 @@ LogitechG810Controller::~LogitechG810Controller() } +std::string LogitechG810Controller::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev_pkt_0x11, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + void LogitechG810Controller::Commit() { SendCommit(); diff --git a/Controllers/LogitechController/LogitechG810Controller.h b/Controllers/LogitechController/LogitechG810Controller.h index 60b571d0..18b91666 100644 --- a/Controllers/LogitechController/LogitechG810Controller.h +++ b/Controllers/LogitechController/LogitechG810Controller.h @@ -54,6 +54,8 @@ public: LogitechG810Controller(hid_device* dev_handle_0x11, hid_device* dev_handle_0x12); ~LogitechG810Controller(); + std::string GetSerialString(); + void Commit(); void SetDirect diff --git a/Controllers/LogitechController/LogitechGPowerPlayController.cpp b/Controllers/LogitechController/LogitechGPowerPlayController.cpp index f22f1781..f78f81fe 100644 --- a/Controllers/LogitechController/LogitechGPowerPlayController.cpp +++ b/Controllers/LogitechController/LogitechGPowerPlayController.cpp @@ -27,6 +27,17 @@ std::string LogitechGPowerPlayController::GetDeviceLocation() return("HID: " + location); } +std::string LogitechGPowerPlayController::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + void LogitechGPowerPlayController::SendMouseMatMode ( unsigned char mode, diff --git a/Controllers/LogitechController/LogitechGPowerPlayController.h b/Controllers/LogitechController/LogitechGPowerPlayController.h index 977ca0fc..2dbfa505 100644 --- a/Controllers/LogitechController/LogitechGPowerPlayController.h +++ b/Controllers/LogitechController/LogitechGPowerPlayController.h @@ -40,6 +40,7 @@ public: ~LogitechGPowerPlayController(); std::string GetDeviceLocation(); + std::string GetSerialString(); void SendMouseMatMode ( diff --git a/Controllers/LogitechController/LogitechGProWirelessController.cpp b/Controllers/LogitechController/LogitechGProWirelessController.cpp index 72e7aa5f..bb4e1c70 100644 --- a/Controllers/LogitechController/LogitechGProWirelessController.cpp +++ b/Controllers/LogitechController/LogitechGProWirelessController.cpp @@ -27,6 +27,17 @@ std::string LogitechGProWirelessController::GetDeviceLocation() return("HID: " + location); } +std::string LogitechGProWirelessController::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + void LogitechGProWirelessController::SendMouseMode ( unsigned char mode, diff --git a/Controllers/LogitechController/LogitechGProWirelessController.h b/Controllers/LogitechController/LogitechGProWirelessController.h index e8a591bd..828e1967 100644 --- a/Controllers/LogitechController/LogitechGProWirelessController.h +++ b/Controllers/LogitechController/LogitechGProWirelessController.h @@ -40,6 +40,7 @@ public: ~LogitechGProWirelessController(); std::string GetDeviceLocation(); + std::string GetSerialString(); void SendMouseMode ( diff --git a/Controllers/LogitechController/RGBController_LogitechG203.cpp b/Controllers/LogitechController/RGBController_LogitechG203.cpp index c5b299cc..50827848 100644 --- a/Controllers/LogitechController/RGBController_LogitechG203.cpp +++ b/Controllers/LogitechController/RGBController_LogitechG203.cpp @@ -18,6 +18,7 @@ RGBController_LogitechG203::RGBController_LogitechG203(LogitechG203Controller* l type = DEVICE_TYPE_MOUSE; description = "Logitech Mouse Device"; location = logitech->GetDeviceLocation(); + serial = logitech->GetSerialString(); mode Static; Static.name = "Static"; diff --git a/Controllers/LogitechController/RGBController_LogitechG203L.cpp b/Controllers/LogitechController/RGBController_LogitechG203L.cpp index 08750bc8..9cfc88ba 100644 --- a/Controllers/LogitechController/RGBController_LogitechG203L.cpp +++ b/Controllers/LogitechController/RGBController_LogitechG203L.cpp @@ -9,6 +9,7 @@ RGBController_LogitechG203L::RGBController_LogitechG203L(LogitechG203LController type = DEVICE_TYPE_MOUSE; description = "Logitech Mouse Device"; location = logitech->GetDeviceLocation(); + serial = logitech->GetSerialString(); mode Direct; Direct.name = "Direct"; diff --git a/Controllers/LogitechController/RGBController_LogitechG213.cpp b/Controllers/LogitechController/RGBController_LogitechG213.cpp index f53ba1af..fe6b36f1 100644 --- a/Controllers/LogitechController/RGBController_LogitechG213.cpp +++ b/Controllers/LogitechController/RGBController_LogitechG213.cpp @@ -37,6 +37,7 @@ RGBController_LogitechG213::RGBController_LogitechG213(LogitechG213Controller* l type = DEVICE_TYPE_KEYBOARD; description = "Logitech G213 Keyboard Device"; location = logitechG213->GetDeviceLocation(); + serial = logitechG213->GetSerialString(); mode Direct; Direct.name = "Direct"; diff --git a/Controllers/LogitechController/RGBController_LogitechG403.cpp b/Controllers/LogitechController/RGBController_LogitechG403.cpp index fb578ca6..d7ffb3ef 100644 --- a/Controllers/LogitechController/RGBController_LogitechG403.cpp +++ b/Controllers/LogitechController/RGBController_LogitechG403.cpp @@ -18,6 +18,7 @@ RGBController_LogitechG403::RGBController_LogitechG403(LogitechG403Controller* l type = DEVICE_TYPE_MOUSE; description = "Logitech Mouse Device"; location = logitech->GetDeviceLocation(); + serial = logitech->GetSerialString(); mode Static; Static.name = "Static"; diff --git a/Controllers/LogitechController/RGBController_LogitechG502PS.cpp b/Controllers/LogitechController/RGBController_LogitechG502PS.cpp index bffd15cb..c8104082 100644 --- a/Controllers/LogitechController/RGBController_LogitechG502PS.cpp +++ b/Controllers/LogitechController/RGBController_LogitechG502PS.cpp @@ -18,6 +18,7 @@ RGBController_LogitechG502PS::RGBController_LogitechG502PS(LogitechG502PSControl type = DEVICE_TYPE_MOUSE; description = "Logitech Mouse Device"; location = logitech->GetDeviceLocation(); + serial = logitech->GetSerialString(); mode Static; Static.name = "Static"; diff --git a/Controllers/LogitechController/RGBController_LogitechG810.cpp b/Controllers/LogitechController/RGBController_LogitechG810.cpp index f1a5ee16..1c4ef084 100644 --- a/Controllers/LogitechController/RGBController_LogitechG810.cpp +++ b/Controllers/LogitechController/RGBController_LogitechG810.cpp @@ -173,6 +173,7 @@ RGBController_LogitechG810::RGBController_LogitechG810(LogitechG810Controller* l vendor = "Logitech"; type = DEVICE_TYPE_KEYBOARD; description = "Logitech Keyboard Device"; + serial = logitech->GetSerialString(); mode Direct; Direct.name = "Direct"; diff --git a/Controllers/LogitechController/RGBController_LogitechGPowerPlay.cpp b/Controllers/LogitechController/RGBController_LogitechGPowerPlay.cpp index 679a3849..37e17e2e 100644 --- a/Controllers/LogitechController/RGBController_LogitechGPowerPlay.cpp +++ b/Controllers/LogitechController/RGBController_LogitechGPowerPlay.cpp @@ -17,6 +17,8 @@ RGBController_LogitechGPowerPlay::RGBController_LogitechGPowerPlay(LogitechGPowe vendor = "Logitech"; type = DEVICE_TYPE_MOUSEMAT; description = "Logitech G PowerPlay Wireless Charging System"; + location = logitech->GetDeviceLocation(); + serial = logitech->GetSerialString(); mode Off; Off.name = "Off"; diff --git a/Controllers/LogitechController/RGBController_LogitechGProWireless.cpp b/Controllers/LogitechController/RGBController_LogitechGProWireless.cpp index 9a3ee7b2..6bd3a62c 100644 --- a/Controllers/LogitechController/RGBController_LogitechGProWireless.cpp +++ b/Controllers/LogitechController/RGBController_LogitechGProWireless.cpp @@ -18,6 +18,7 @@ RGBController_LogitechGProWireless::RGBController_LogitechGProWireless(LogitechG type = DEVICE_TYPE_MOUSE; description = "Logitech G Pro Wireless Gaming Mouse"; location = logitech->GetDeviceLocation(); + serial = logitech->GetSerialString(); mode Off; Off.name = "Off"; diff --git a/Controllers/MSI3ZoneController/MSI3ZoneController.cpp b/Controllers/MSI3ZoneController/MSI3ZoneController.cpp index f88e7933..f3d665a1 100644 --- a/Controllers/MSI3ZoneController/MSI3ZoneController.cpp +++ b/Controllers/MSI3ZoneController/MSI3ZoneController.cpp @@ -32,6 +32,17 @@ std::string MSI3ZoneController::GetDeviceLocation() return("HID: " + location); } +std::string MSI3ZoneController::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + void MSI3ZoneController::SetLEDs(std::vector colors) { //Shout out to bparker06 for reverse engineering the MSI keyboard USB protocol! diff --git a/Controllers/MSI3ZoneController/MSI3ZoneController.h b/Controllers/MSI3ZoneController/MSI3ZoneController.h index d50892b4..38fb619c 100644 --- a/Controllers/MSI3ZoneController/MSI3ZoneController.h +++ b/Controllers/MSI3ZoneController/MSI3ZoneController.h @@ -20,8 +20,9 @@ public: MSI3ZoneController(hid_device* dev_handle, const char* path); ~MSI3ZoneController(); - char* GetDeviceName(); + char* GetDeviceName(); std::string GetDeviceLocation(); + std::string GetSerialString(); void SetLEDs(std::vector colors); diff --git a/Controllers/MSI3ZoneController/RGBController_MSI3Zone.cpp b/Controllers/MSI3ZoneController/RGBController_MSI3Zone.cpp index 91750bac..e2f0e98d 100644 --- a/Controllers/MSI3ZoneController/RGBController_MSI3Zone.cpp +++ b/Controllers/MSI3ZoneController/RGBController_MSI3Zone.cpp @@ -18,6 +18,7 @@ RGBController_MSI3Zone::RGBController_MSI3Zone(MSI3ZoneController* msi_ptr) type = DEVICE_TYPE_KEYBOARD; description = "MSI 3-Zone Keyboard Device"; location = msi->GetDeviceLocation(); + serial = msi->GetSerialString(); mode Direct; Direct.name = "Direct"; diff --git a/Controllers/NZXTHue2Controller/NZXTHue2Controller.cpp b/Controllers/NZXTHue2Controller/NZXTHue2Controller.cpp index 61707590..9cf364d4 100644 --- a/Controllers/NZXTHue2Controller/NZXTHue2Controller.cpp +++ b/Controllers/NZXTHue2Controller/NZXTHue2Controller.cpp @@ -68,6 +68,17 @@ std::string NZXTHue2Controller::GetFirmwareVersion() return(firmware_version); } +std::string NZXTHue2Controller::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + void NZXTHue2Controller::SendFan ( unsigned char port, diff --git a/Controllers/NZXTHue2Controller/NZXTHue2Controller.h b/Controllers/NZXTHue2Controller/NZXTHue2Controller.h index 20488c7f..0a76087b 100644 --- a/Controllers/NZXTHue2Controller/NZXTHue2Controller.h +++ b/Controllers/NZXTHue2Controller/NZXTHue2Controller.h @@ -59,6 +59,7 @@ public: std::string GetFirmwareVersion(); std::string GetLocation(); + std::string GetSerialString(); unsigned char GetFanCommand ( diff --git a/Controllers/NZXTHue2Controller/RGBController_NZXTHue2.cpp b/Controllers/NZXTHue2Controller/RGBController_NZXTHue2.cpp index 8b8f80d7..4a168303 100644 --- a/Controllers/NZXTHue2Controller/RGBController_NZXTHue2.cpp +++ b/Controllers/NZXTHue2Controller/RGBController_NZXTHue2.cpp @@ -19,6 +19,7 @@ RGBController_NZXTHue2::RGBController_NZXTHue2(NZXTHue2Controller* hue2_ptr) description = "NZXT Hue 2 Device"; version = hue2->GetFirmwareVersion(); location = hue2->GetLocation(); + serial = hue2->GetSerialString(); mode Direct; Direct.name = "Direct"; diff --git a/Controllers/NZXTKrakenController/NZXTKrakenController.cpp b/Controllers/NZXTKrakenController/NZXTKrakenController.cpp index 12af33e7..32e94978 100644 --- a/Controllers/NZXTKrakenController/NZXTKrakenController.cpp +++ b/Controllers/NZXTKrakenController/NZXTKrakenController.cpp @@ -53,6 +53,17 @@ std::string NZXTKrakenController::GetLocation() return("HID: " + location); } +std::string NZXTKrakenController::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + void NZXTKrakenController::UpdateStatus() { unsigned char usb_buf[64]; diff --git a/Controllers/NZXTKrakenController/NZXTKrakenController.h b/Controllers/NZXTKrakenController/NZXTKrakenController.h index 27ca84a6..b63cc2c3 100644 --- a/Controllers/NZXTKrakenController/NZXTKrakenController.h +++ b/Controllers/NZXTKrakenController/NZXTKrakenController.h @@ -51,6 +51,7 @@ public: std::string GetFirmwareVersion(); std::string GetLocation(); + std::string GetSerialString(); void UpdateEffect ( diff --git a/Controllers/NZXTKrakenController/RGBController_NZXTKraken.cpp b/Controllers/NZXTKrakenController/RGBController_NZXTKraken.cpp index 2b4694e0..fdfb9337 100644 --- a/Controllers/NZXTKrakenController/RGBController_NZXTKraken.cpp +++ b/Controllers/NZXTKrakenController/RGBController_NZXTKraken.cpp @@ -20,6 +20,7 @@ RGBController_NZXTKraken::RGBController_NZXTKraken(NZXTKrakenController* nzxtkra description = "NZXT Kraken X42/X52/X62/X72/M22"; version = nzxtkraken->GetFirmwareVersion(); location = nzxtkraken->GetLocation(); + serial = nzxtkraken->GetSerialString(); mode Direct; Direct.name = "Direct"; diff --git a/Controllers/RedragonController/RGBController_RedragonK556.cpp b/Controllers/RedragonController/RGBController_RedragonK556.cpp index 6fd85fc3..254e2940 100644 --- a/Controllers/RedragonController/RGBController_RedragonK556.cpp +++ b/Controllers/RedragonController/RGBController_RedragonK556.cpp @@ -28,6 +28,8 @@ RGBController_RedragonK556::RGBController_RedragonK556(RedragonK556Controller* r vendor = "Redragon"; type = DEVICE_TYPE_KEYBOARD; description = "Redragon Keyboard Device"; + location = redragon->GetDeviceLocation(); + serial = redragon->GetSerialString(); mode Custom; Custom.name = "Custom"; diff --git a/Controllers/RedragonController/RGBController_RedragonM711.cpp b/Controllers/RedragonController/RGBController_RedragonM711.cpp index c733a7b1..e4b56b84 100644 --- a/Controllers/RedragonController/RGBController_RedragonM711.cpp +++ b/Controllers/RedragonController/RGBController_RedragonM711.cpp @@ -18,6 +18,7 @@ RGBController_RedragonM711::RGBController_RedragonM711(RedragonM711Controller* r type = DEVICE_TYPE_MOUSE; description = "Redragon Mouse Device"; location = redragon->GetDeviceLocation(); + serial = redragon->GetSerialString(); mode Static; Static.name = "Static"; diff --git a/Controllers/RedragonController/RedragonK556Controller.cpp b/Controllers/RedragonController/RedragonK556Controller.cpp index 562e7da3..e9cc8c72 100644 --- a/Controllers/RedragonController/RedragonK556Controller.cpp +++ b/Controllers/RedragonController/RedragonK556Controller.cpp @@ -13,6 +13,17 @@ std::string RedragonK556Controller::GetDeviceLocation() return("HID: " + location); } +std::string RedragonK556Controller::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + void RedragonK556Controller::SetKeyboardColors ( unsigned char * color_data, diff --git a/Controllers/RedragonController/RedragonK556Controller.h b/Controllers/RedragonController/RedragonK556Controller.h index ce881a3d..a615fab2 100644 --- a/Controllers/RedragonController/RedragonK556Controller.h +++ b/Controllers/RedragonController/RedragonK556Controller.h @@ -96,6 +96,7 @@ public: ~RedragonK556Controller(); std::string GetDeviceLocation(); + std::string GetSerialString(); void SetKeyboardColors ( diff --git a/Controllers/RedragonController/RedragonM711Controller.cpp b/Controllers/RedragonController/RedragonM711Controller.cpp index 30cfef9f..aded1b72 100644 --- a/Controllers/RedragonController/RedragonM711Controller.cpp +++ b/Controllers/RedragonController/RedragonM711Controller.cpp @@ -18,6 +18,17 @@ std::string RedragonM711Controller::GetDeviceLocation() return("HID: " + location); } +std::string RedragonM711Controller::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + void RedragonM711Controller::SendMouseColor ( unsigned char red, diff --git a/Controllers/RedragonController/RedragonM711Controller.h b/Controllers/RedragonController/RedragonM711Controller.h index b35e4cb0..8c4e7477 100644 --- a/Controllers/RedragonController/RedragonM711Controller.h +++ b/Controllers/RedragonController/RedragonM711Controller.h @@ -31,6 +31,7 @@ public: ~RedragonM711Controller(); std::string GetDeviceLocation(); + std::string GetSerialString(); void SendMouseApply(); diff --git a/Controllers/SinowealthController/RGBController_Sinowealth.cpp b/Controllers/SinowealthController/RGBController_Sinowealth.cpp index 6b4a34b2..e63262ba 100644 --- a/Controllers/SinowealthController/RGBController_Sinowealth.cpp +++ b/Controllers/SinowealthController/RGBController_Sinowealth.cpp @@ -17,6 +17,7 @@ RGBController_Sinowealth::RGBController_Sinowealth(SinowealthController* sinowea type = DEVICE_TYPE_MOUSE; description = "Sinowealth Device"; location = sinowealth->GetLocation(); + serial = sinowealth->GetSerialString(); mode Static; Static.name = "Static"; diff --git a/Controllers/SinowealthController/SinowealthController.cpp b/Controllers/SinowealthController/SinowealthController.cpp index 9d05f09b..be074628 100644 --- a/Controllers/SinowealthController/SinowealthController.cpp +++ b/Controllers/SinowealthController/SinowealthController.cpp @@ -39,6 +39,17 @@ unsigned int SinowealthController::GetLEDCount() return(led_count); } +std::string SinowealthController::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev_report_id_4, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + void SinowealthController::SetLEDColor ( RGBColor* color_buf diff --git a/Controllers/SinowealthController/SinowealthController.h b/Controllers/SinowealthController/SinowealthController.h index 71224583..f13a5820 100644 --- a/Controllers/SinowealthController/SinowealthController.h +++ b/Controllers/SinowealthController/SinowealthController.h @@ -55,6 +55,7 @@ public: unsigned int GetLEDCount(); std::string GetLocation(); + std::string GetSerialString(); void SetLEDColor(RGBColor* color_buf); void SetMode(unsigned char mode, unsigned char speed, unsigned char direction, RGBColor* color_buf); diff --git a/Controllers/SonyDS4Controller/RGBController_SonyDS4.cpp b/Controllers/SonyDS4Controller/RGBController_SonyDS4.cpp index 87272302..a6e8b603 100644 --- a/Controllers/SonyDS4Controller/RGBController_SonyDS4.cpp +++ b/Controllers/SonyDS4Controller/RGBController_SonyDS4.cpp @@ -19,6 +19,7 @@ RGBController_SonyDS4::RGBController_SonyDS4(SonyDS4Controller* dualshock) type = DEVICE_TYPE_GAMEPAD; description = "Sony DualShock 4 Device"; location = dualshock->GetLocation(); + serial = dualshock->GetSerialString(); mode Direct; Direct.value = 0; diff --git a/Controllers/SonyDS4Controller/SonyDS4Controller.cpp b/Controllers/SonyDS4Controller/SonyDS4Controller.cpp index 46279f52..fc668cfb 100644 --- a/Controllers/SonyDS4Controller/SonyDS4Controller.cpp +++ b/Controllers/SonyDS4Controller/SonyDS4Controller.cpp @@ -36,6 +36,17 @@ std::string SonyDS4Controller::GetLocation() return("HID: " + location); } +std::string SonyDS4Controller::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(device_handle, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + void SonyDS4Controller::SetColors(unsigned char red, unsigned char green, unsigned char blue) { if(is_bluetooth) diff --git a/Controllers/SonyDS4Controller/SonyDS4Controller.h b/Controllers/SonyDS4Controller/SonyDS4Controller.h index 108892ae..6e4983df 100644 --- a/Controllers/SonyDS4Controller/SonyDS4Controller.h +++ b/Controllers/SonyDS4Controller/SonyDS4Controller.h @@ -16,6 +16,7 @@ public: SonyDS4Controller(hid_device * device_handle, const char * device_path); std::string GetLocation(); + std::string GetSerialString(); void SetColors(unsigned char red, unsigned char green, unsigned char blue); diff --git a/Controllers/SteelSeriesController/RGBController_SteelSeriesApex.cpp b/Controllers/SteelSeriesController/RGBController_SteelSeriesApex.cpp index 17fcfa5a..1d1fd34b 100644 --- a/Controllers/SteelSeriesController/RGBController_SteelSeriesApex.cpp +++ b/Controllers/SteelSeriesController/RGBController_SteelSeriesApex.cpp @@ -262,6 +262,7 @@ RGBController_SteelSeriesApex::RGBController_SteelSeriesApex(SteelSeriesApexBase type = DEVICE_TYPE_KEYBOARD; description = "SteelSeries Apex RGB Device"; location = steelseries->GetDeviceLocation(); + serial = steelseries->GetSerialString(); proto_type = steelseries->proto_type; diff --git a/Controllers/SteelSeriesController/RGBController_SteelSeriesOldApex.cpp b/Controllers/SteelSeriesController/RGBController_SteelSeriesOldApex.cpp index de2db5c4..605f53c4 100644 --- a/Controllers/SteelSeriesController/RGBController_SteelSeriesOldApex.cpp +++ b/Controllers/SteelSeriesController/RGBController_SteelSeriesOldApex.cpp @@ -27,6 +27,7 @@ RGBController_SteelSeriesOldApex::RGBController_SteelSeriesOldApex(SteelSeriesOl type = DEVICE_TYPE_KEYBOARD; description = "SteelSeries old Apex device"; location = OldApex->GetDeviceLocation(); + serial = OldApex->GetSerialString(); mode Brightness8; Brightness8.name = "Brightness 8"; diff --git a/Controllers/SteelSeriesController/RGBController_SteelSeriesRival.cpp b/Controllers/SteelSeriesController/RGBController_SteelSeriesRival.cpp index 0a26e055..3966f792 100644 --- a/Controllers/SteelSeriesController/RGBController_SteelSeriesRival.cpp +++ b/Controllers/SteelSeriesController/RGBController_SteelSeriesRival.cpp @@ -18,6 +18,7 @@ RGBController_SteelSeriesRival::RGBController_SteelSeriesRival(SteelSeriesRivalC type = DEVICE_TYPE_MOUSE; description = "SteelSeries Rival Device"; location = rival->GetDeviceLocation(); + serial = rival->GetSerialString(); mode Static; Static.name = "Static"; diff --git a/Controllers/SteelSeriesController/RGBController_SteelSeriesSiberia.cpp b/Controllers/SteelSeriesController/RGBController_SteelSeriesSiberia.cpp index c9aca15f..c1d41c79 100644 --- a/Controllers/SteelSeriesController/RGBController_SteelSeriesSiberia.cpp +++ b/Controllers/SteelSeriesController/RGBController_SteelSeriesSiberia.cpp @@ -18,6 +18,7 @@ RGBController_SteelSeriesSiberia::RGBController_SteelSeriesSiberia(SteelSeriesSi type = DEVICE_TYPE_HEADSET; description = "SteelSeries Siberia Device"; location = siberia->GetDeviceLocation(); + serial = siberia->GetSerialString(); mode Static; Static.name = "Static"; diff --git a/Controllers/SteelSeriesController/SteelSeriesApexBaseController.h b/Controllers/SteelSeriesController/SteelSeriesApexBaseController.h index c0bf79cb..880f5d9f 100644 --- a/Controllers/SteelSeriesController/SteelSeriesApexBaseController.h +++ b/Controllers/SteelSeriesController/SteelSeriesApexBaseController.h @@ -23,6 +23,17 @@ public: return("HID: " + location); }; + std::string GetSerialString() + { + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); + } + steelseries_type proto_type; virtual void SetMode diff --git a/Controllers/SteelSeriesController/SteelSeriesOldApexController.cpp b/Controllers/SteelSeriesController/SteelSeriesOldApexController.cpp index 0a7f7d98..26e90cd9 100644 --- a/Controllers/SteelSeriesController/SteelSeriesOldApexController.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesOldApexController.cpp @@ -63,6 +63,17 @@ char* SteelSeriesOldApexController::GetDeviceName() return device_name; } +std::string SteelSeriesOldApexController::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + steelseries_type SteelSeriesOldApexController::GetKeyboardType() { return proto; diff --git a/Controllers/SteelSeriesController/SteelSeriesOldApexController.h b/Controllers/SteelSeriesController/SteelSeriesOldApexController.h index 244f07df..b9c3e40f 100644 --- a/Controllers/SteelSeriesController/SteelSeriesOldApexController.h +++ b/Controllers/SteelSeriesController/SteelSeriesOldApexController.h @@ -63,6 +63,7 @@ public: std::string GetDeviceLocation(); char* GetDeviceName(); + std::string GetSerialString(); steelseries_type GetKeyboardType(); diff --git a/Controllers/SteelSeriesController/SteelSeriesRivalController.cpp b/Controllers/SteelSeriesController/SteelSeriesRivalController.cpp index 8d56ef69..925c8190 100644 --- a/Controllers/SteelSeriesController/SteelSeriesRivalController.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesRivalController.cpp @@ -54,6 +54,17 @@ char* SteelSeriesRivalController::GetDeviceName() return device_name; } +std::string SteelSeriesRivalController::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + steelseries_type SteelSeriesRivalController::GetMouseType() { return proto; diff --git a/Controllers/SteelSeriesController/SteelSeriesRivalController.h b/Controllers/SteelSeriesController/SteelSeriesRivalController.h index ac18207e..53b4c539 100644 --- a/Controllers/SteelSeriesController/SteelSeriesRivalController.h +++ b/Controllers/SteelSeriesController/SteelSeriesRivalController.h @@ -44,6 +44,7 @@ public: std::string GetDeviceLocation(); char* GetDeviceName(); + std::string GetSerialString(); steelseries_type GetMouseType(); diff --git a/Controllers/SteelSeriesController/SteelSeriesSiberiaController.cpp b/Controllers/SteelSeriesController/SteelSeriesSiberiaController.cpp index 02e96b75..fb8563ce 100644 --- a/Controllers/SteelSeriesController/SteelSeriesSiberiaController.cpp +++ b/Controllers/SteelSeriesController/SteelSeriesSiberiaController.cpp @@ -57,6 +57,17 @@ char* SteelSeriesSiberiaController::GetDeviceName() return device_name; } +std::string SteelSeriesSiberiaController::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + void SteelSeriesSiberiaController::SetColor ( unsigned char red, diff --git a/Controllers/SteelSeriesController/SteelSeriesSiberiaController.h b/Controllers/SteelSeriesController/SteelSeriesSiberiaController.h index 723830c3..8b872b85 100644 --- a/Controllers/SteelSeriesController/SteelSeriesSiberiaController.h +++ b/Controllers/SteelSeriesController/SteelSeriesSiberiaController.h @@ -24,7 +24,8 @@ public: ~SteelSeriesSiberiaController(); std::string GetDeviceLocation(); - char* GetDeviceName(); + char* GetDeviceName(); + std::string GetSerialString(); void SetColor ( diff --git a/Controllers/ThermaltakePoseidonZRGBController/RGBController_ThermaltakePoseidonZRGB.cpp b/Controllers/ThermaltakePoseidonZRGBController/RGBController_ThermaltakePoseidonZRGB.cpp index d43b7f9b..bf3e6089 100644 --- a/Controllers/ThermaltakePoseidonZRGBController/RGBController_ThermaltakePoseidonZRGB.cpp +++ b/Controllers/ThermaltakePoseidonZRGBController/RGBController_ThermaltakePoseidonZRGB.cpp @@ -152,6 +152,7 @@ RGBController_PoseidonZRGB::RGBController_PoseidonZRGB(PoseidonZRGBController* p type = DEVICE_TYPE_KEYBOARD; description = "Thermaltake Poseidon Z RGB Device"; location = poseidon->GetDeviceLocation(); + serial = poseidon->GetSerialString(); mode Direct; Direct.name = "Direct"; diff --git a/Controllers/ThermaltakePoseidonZRGBController/ThermaltakePoseidonZRGBController.cpp b/Controllers/ThermaltakePoseidonZRGBController/ThermaltakePoseidonZRGBController.cpp index 6ec5f9ea..1137915d 100644 --- a/Controllers/ThermaltakePoseidonZRGBController/ThermaltakePoseidonZRGBController.cpp +++ b/Controllers/ThermaltakePoseidonZRGBController/ThermaltakePoseidonZRGBController.cpp @@ -38,6 +38,17 @@ std::string PoseidonZRGBController::GetDeviceLocation() return("HID: " + location); } +std::string PoseidonZRGBController::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + void PoseidonZRGBController::SetMode(unsigned char mode, unsigned char direction, unsigned char speed) { active_mode = mode; diff --git a/Controllers/ThermaltakePoseidonZRGBController/ThermaltakePoseidonZRGBController.h b/Controllers/ThermaltakePoseidonZRGBController/ThermaltakePoseidonZRGBController.h index 3b36b697..d6ff43a6 100644 --- a/Controllers/ThermaltakePoseidonZRGBController/ThermaltakePoseidonZRGBController.h +++ b/Controllers/ThermaltakePoseidonZRGBController/ThermaltakePoseidonZRGBController.h @@ -78,6 +78,7 @@ public: ~PoseidonZRGBController(); std::string GetDeviceLocation(); + std::string GetSerialString(); void SetMode(unsigned char mode, unsigned char direction, unsigned char speed); void SetLEDsDirect(std::vector colors); diff --git a/Controllers/ThermaltakeRiingController/RGBController_ThermaltakeRiing.cpp b/Controllers/ThermaltakeRiingController/RGBController_ThermaltakeRiing.cpp index 3ccd823c..0f167d20 100644 --- a/Controllers/ThermaltakeRiingController/RGBController_ThermaltakeRiing.cpp +++ b/Controllers/ThermaltakeRiingController/RGBController_ThermaltakeRiing.cpp @@ -19,6 +19,7 @@ RGBController_ThermaltakeRiing::RGBController_ThermaltakeRiing(ThermaltakeRiingC type = DEVICE_TYPE_COOLER; description = "Thermaltake Riing Device"; location = riing->GetDeviceLocation(); + serial = riing->GetSerialString(); mode Direct; Direct.name = "Direct"; diff --git a/Controllers/ThermaltakeRiingController/ThermaltakeRiingController.cpp b/Controllers/ThermaltakeRiingController/ThermaltakeRiingController.cpp index fc0ecf4d..04107e64 100644 --- a/Controllers/ThermaltakeRiingController/ThermaltakeRiingController.cpp +++ b/Controllers/ThermaltakeRiingController/ThermaltakeRiingController.cpp @@ -29,6 +29,17 @@ std::string ThermaltakeRiingController::GetDeviceLocation() return("HID: " + location); } +std::string ThermaltakeRiingController::GetSerialString() +{ + wchar_t serial_string[128]; + hid_get_serial_number_string(dev, serial_string, 128); + + std::wstring return_wstring = serial_string; + std::string return_string(return_wstring.begin(), return_wstring.end()); + + return(return_string); +} + 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 bcead589..5424562e 100644 --- a/Controllers/ThermaltakeRiingController/ThermaltakeRiingController.h +++ b/Controllers/ThermaltakeRiingController/ThermaltakeRiingController.h @@ -51,6 +51,7 @@ public: ~ThermaltakeRiingController(); std::string GetDeviceLocation(); + std::string GetSerialString(); void SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors); void SetMode(unsigned char mode, unsigned char speed);