diff --git a/Controllers/GigabyteAorusMouseController/GigabyteAorusMouseController.cpp b/Controllers/GigabyteAorusMouseController/GigabyteAorusMouseController.cpp index 8be767ab..4754174d 100644 --- a/Controllers/GigabyteAorusMouseController/GigabyteAorusMouseController.cpp +++ b/Controllers/GigabyteAorusMouseController/GigabyteAorusMouseController.cpp @@ -11,25 +11,13 @@ #include #include "GigabyteAorusMouseController.h" +#include "StringUtils.h" GigabyteAorusMouseController::GigabyteAorusMouseController(hid_device* dev_handle, const hid_device_info& info) { dev = dev_handle; location = info.path; version = ""; - - wchar_t serial_string[128]; - int ret = hid_get_serial_number_string(dev, serial_string, 128); - - if(ret != 0) - { - serial_number = ""; - } - else - { - std::wstring return_wstring = serial_string; - serial_number = std::string(return_wstring.begin(), return_wstring.end()); - } } GigabyteAorusMouseController::~GigabyteAorusMouseController() @@ -44,7 +32,15 @@ std::string GigabyteAorusMouseController::GetDeviceLocation() std::string GigabyteAorusMouseController::GetSerialString() { - return(serial_number); + wchar_t serial_string[128]; + int ret = hid_get_serial_number_string(dev, serial_string, 128); + + if(ret != 0) + { + return(""); + } + + return(StringUtils::wstring_to_string(serial_string)); } std::string GigabyteAorusMouseController::GetFirmwareVersion() diff --git a/Controllers/GigabyteAorusMouseController/GigabyteAorusMouseController.h b/Controllers/GigabyteAorusMouseController/GigabyteAorusMouseController.h index a19ce69c..45091c00 100644 --- a/Controllers/GigabyteAorusMouseController/GigabyteAorusMouseController.h +++ b/Controllers/GigabyteAorusMouseController/GigabyteAorusMouseController.h @@ -54,6 +54,5 @@ private: hid_device* dev; std::string location; - std::string serial_number; std::string version; };