Move wstring to string conversion to StringUtils.cpp and update most HID get serial number functions to use it
This commit is contained in:
parent
366fda30f5
commit
b4d15b9545
159 changed files with 623 additions and 930 deletions
|
|
@ -10,6 +10,7 @@
|
|||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <cstring>
|
||||
#include "StringUtils.h"
|
||||
#include "WootingKeyboardController.h"
|
||||
|
||||
WootingKeyboardController::WootingKeyboardController()
|
||||
|
|
@ -44,7 +45,15 @@ std::string WootingKeyboardController::GetDescription()
|
|||
|
||||
std::string WootingKeyboardController::GetSerial()
|
||||
{
|
||||
return serial;
|
||||
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));
|
||||
}
|
||||
|
||||
uint8_t WootingKeyboardController::GetWootingType()
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ public:
|
|||
std::string vendor;
|
||||
std::string description;
|
||||
std::string location;
|
||||
std::string serial;
|
||||
uint8_t wooting_type;
|
||||
uint8_t key_code_limit;
|
||||
|
||||
|
|
|
|||
|
|
@ -70,10 +70,6 @@ WootingOneKeyboardController::WootingOneKeyboardController(hid_device* dev_handl
|
|||
wName = std::wstring(tmpName);
|
||||
description = std::string(wName.begin(), wName.end());
|
||||
|
||||
hid_get_serial_number_string(dev, tmpName, szTemp);
|
||||
wName = std::wstring(tmpName);
|
||||
serial = std::string(wName.begin(), wName.end());
|
||||
|
||||
SendInitialize();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,10 +53,6 @@ WootingTwoKeyboardController::WootingTwoKeyboardController(hid_device* dev_handl
|
|||
wName = std::wstring(tmpName);
|
||||
description = std::string(wName.begin(), wName.end());
|
||||
|
||||
hid_get_serial_number_string(dev, tmpName, szTemp);
|
||||
wName = std::wstring(tmpName);
|
||||
serial = std::string(wName.begin(), wName.end());
|
||||
|
||||
SendInitialize();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue