Fix coolermaster rescan crash
This commit is contained in:
parent
477fabd381
commit
f5bbd49e78
2 changed files with 13 additions and 18 deletions
|
|
@ -10,24 +10,22 @@
|
|||
|
||||
CMKeyboardAbstractController::CMKeyboardAbstractController(hid_device* dev_handle, hid_device_info* dev_info)
|
||||
{
|
||||
const uint8_t sz = HID_MAX_STR;
|
||||
wchar_t tmp[sz];
|
||||
wchar_t tmp[HID_MAX_STR];
|
||||
|
||||
m_pDev = dev_handle;
|
||||
m_productId = dev_info->product_id;
|
||||
m_sLocation = dev_info->path;
|
||||
m_pDev = dev_handle;
|
||||
m_productId = dev_info->product_id;
|
||||
m_sLocation = dev_info->path;
|
||||
|
||||
hid_get_manufacturer_string(m_pDev, tmp, sz);
|
||||
std::wstring wName = std::wstring(tmp);
|
||||
m_vendorName = std::string(wName.begin(), wName.end());
|
||||
hid_get_manufacturer_string(m_pDev, tmp, HID_MAX_STR);
|
||||
std::wstring wVendorName = std::wstring(tmp);
|
||||
m_vendorName = std::string(wVendorName.begin(), wVendorName.end());
|
||||
|
||||
hid_get_product_string(m_pDev, tmp, sz);
|
||||
wName = std::wstring(tmp);
|
||||
m_deviceName = std::string(wName.begin(), wName.end());
|
||||
hid_get_product_string(m_pDev, tmp, HID_MAX_STR);
|
||||
std::wstring wDeviceName = std::wstring(tmp);
|
||||
m_deviceName = std::string(wDeviceName.begin(), wDeviceName.end());
|
||||
m_serialNumber = m_deviceName;
|
||||
|
||||
m_serialNumber = m_deviceName;
|
||||
|
||||
bool bNotFound = true;
|
||||
bool bNotFound = true;
|
||||
|
||||
for(uint16_t i = 0; i < COOLERMASTER_KEYBOARD_DEVICE_COUNT; i++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -53,11 +53,8 @@ RGBController_CMKeyboardController::~RGBController_CMKeyboardController()
|
|||
delete(m_pUnknownKeyNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
delete m_pLayoutManager;
|
||||
}
|
||||
|
||||
#include <set>
|
||||
#define COOLERMASTER_ZONES_MAX 1
|
||||
void RGBController_CMKeyboardController::SetupZones()
|
||||
{
|
||||
|
|
@ -115,7 +112,7 @@ void RGBController_CMKeyboardController::SetupZones()
|
|||
LOG_DEBUG("[%s] Created KB matrix with %d rows and %d columns containing %d keys",
|
||||
m_pController->GetDeviceName().c_str(), new_kb.GetRowCount(), new_kb.GetColumnCount(), new_zone.leds_count);
|
||||
|
||||
for(size_t led_idx = 0; led_idx < new_zone.leds_count; led_idx++)
|
||||
for(unsigned int led_idx = 0; led_idx < new_zone.leds_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue