mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-05-14 01:24:39 -04:00
Move wstring to string conversion to StringUtils.cpp and update most HID get serial number functions to use it
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <cmath>
|
||||
#include <string.h>
|
||||
#include "MSIVigorGK30Controller.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
static unsigned char argb_colour_index_data[2][2][2] =
|
||||
{ //B0 B1
|
||||
@@ -26,20 +27,6 @@ MSIVigorGK30Controller::MSIVigorGK30Controller(hid_device* dev_handle, const hid
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MSIVigorGK30Controller::~MSIVigorGK30Controller()
|
||||
@@ -54,7 +41,15 @@ std::string MSIVigorGK30Controller::GetDeviceLocation()
|
||||
|
||||
std::string MSIVigorGK30Controller::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 MSIVigorGK30Controller::GetFirmwareVersion()
|
||||
|
||||
Reference in New Issue
Block a user