Fixed profile loading on Asus ROG Strix Scope II

* Reverted regression introduced with b4d15b954
* Resolves #4632
This commit is contained in:
Chris M 2025-03-03 11:34:05 +11:00
parent e0f40c52fe
commit 74446a3c67
2 changed files with 17 additions and 22 deletions

View file

@ -39,36 +39,29 @@ std::string AuraTUFKeyboardController::GetDeviceLocation()
return("HID: " + location);
}
std::string clean_serial(const std::wstring& wstr)
std::string AuraTUFKeyboardController::GetSerialString()
{
wchar_t serial_string[HID_MAX_STR];
memset(serial_string, 0, sizeof(serial_string));
int ret = hid_get_serial_number_string(dev, serial_string, HID_MAX_STR);
if(ret != 0)
{
return("");
}
/*-------------------------------------------------------------------------*\
| Skip non-ASCII, trailing garbage in serial numbers. Required by the |
| Scope II 96, whose original firmware outputs garbage, which even differs |
| after computer reboots and therefore breaks OpenRGB profile matching. |
\*-------------------------------------------------------------------------*/
std::string result;
for(wchar_t c : wstr)
switch(device_pid)
{
// Forbid control chars and anything above final printable low-ASCII.
if(c < 32 || c > 126)
{
case AURA_ROG_STRIX_SCOPE_II_96_WIRELESS_USB_PID:
serial_string[12] = L'\0';
break;
default:
break;
}
result += (char)c;
}
return(result);
}
std::string AuraTUFKeyboardController::GetSerialString()
{
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));

View file

@ -17,6 +17,8 @@
#include "RGBController.h"
#include "AsusAuraTUFKeyboardLayouts.h"
#define HID_MAX_STR 128
enum
{
AURA_KEYBOARD_MODE_STATIC = 0,