Store name in CorsairPeripheralV2Controllers to avoid setting it in detectors
This commit is contained in:
parent
fa74b64d6d
commit
4036a9e414
4 changed files with 9 additions and 25 deletions
|
|
@ -14,21 +14,11 @@
|
|||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
CorsairPeripheralV2Controller::CorsairPeripheralV2Controller(hid_device* dev_handle, const char* path, std::string /*name*/)
|
||||
CorsairPeripheralV2Controller::CorsairPeripheralV2Controller(hid_device* dev_handle, const char* path, std::string name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Get device name from HID manufacturer and product strings |
|
||||
\*---------------------------------------------------------*/
|
||||
wchar_t name_string[HID_MAX_STR];
|
||||
|
||||
hid_get_manufacturer_string(dev, name_string, HID_MAX_STR);
|
||||
device_name = StringUtils::wstring_to_string(name_string);
|
||||
|
||||
hid_get_product_string(dev, name_string, HID_MAX_STR);
|
||||
device_name.append(" ").append(StringUtils::wstring_to_string(name_string));
|
||||
device_name = name;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Get PID |
|
||||
|
|
|
|||
|
|
@ -35,15 +35,7 @@ void DetectCorsairV2HardwareControllers(hid_device_info* info, const std::string
|
|||
{
|
||||
CorsairPeripheralV2HWController* controller = new CorsairPeripheralV2HWController(dev, info->path, name);
|
||||
RGBController_CorsairV2HW* rgb_controller = new RGBController_CorsairV2HW(controller);
|
||||
if(info->product_id == CORSAIR_SLIPSTREAM_WIRELESS_PID1
|
||||
|| info->product_id == CORSAIR_SLIPSTREAM_WIRELESS_PID2)
|
||||
{
|
||||
rgb_controller->name = controller->GetName();
|
||||
}
|
||||
else
|
||||
{
|
||||
rgb_controller->name = name;
|
||||
}
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
} /* DetectCorsairV2HardwareControllers() */
|
||||
|
|
@ -56,12 +48,11 @@ void DetectCorsairV2SoftwareControllers(hid_device_info* info, const std::string
|
|||
{
|
||||
CorsairPeripheralV2SWController* controller = new CorsairPeripheralV2SWController(dev, info->path, name);
|
||||
RGBController_CorsairV2SW* rgb_controller = new RGBController_CorsairV2SW(controller);
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
} /* DetectCorsairV2SoftwareControllers() */
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------------*\
|
||||
| Keyboards |
|
||||
\*-----------------------------------------------------------------------------------------------------*/
|
||||
|
|
@ -95,6 +86,7 @@ REGISTER_HID_DETECTOR_IP("Corsair M65 RGB Ultra Wired", DetectCorsai
|
|||
REGISTER_HID_DETECTOR_IP("Corsair M65 RGB Ultra Wireless (Wired)", DetectCorsairV2HardwareControllers, CORSAIR_VID, CORSAIR_M65_RGB_ULTRA_WIRELESS_PID, 1, 0xFF42);
|
||||
REGISTER_HID_DETECTOR_IP("Corsair Slipstream Wireless Receiver HW", DetectCorsairV2HardwareControllers, CORSAIR_VID, CORSAIR_SLIPSTREAM_WIRELESS_PID1, 1, 0xFF42);
|
||||
REGISTER_HID_DETECTOR_IP("Corsair Slipstream Wireless Receiver SW", DetectCorsairV2SoftwareControllers, CORSAIR_VID, CORSAIR_SLIPSTREAM_WIRELESS_PID2, 1, 0xFF42);
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------------*\
|
||||
| Mousemat |
|
||||
\*-----------------------------------------------------------------------------------------------------*/
|
||||
|
|
|
|||
|
|
@ -31,8 +31,9 @@ RGBController_CorsairV2HW::RGBController_CorsairV2HW(CorsairPeripheralV2Controll
|
|||
controller = controller_ptr;
|
||||
const corsair_v2_device* corsair = controller->GetDeviceData();
|
||||
|
||||
name = controller->GetName();
|
||||
vendor = "Corsair";
|
||||
description = controller->GetName();
|
||||
description = "Corsair Peripheral V2 HW Device";
|
||||
type = corsair->type;
|
||||
version = controller->GetFirmwareString();
|
||||
location = controller->GetDeviceLocation();
|
||||
|
|
|
|||
|
|
@ -31,8 +31,9 @@ RGBController_CorsairV2SW::RGBController_CorsairV2SW(CorsairPeripheralV2Controll
|
|||
controller = controller_ptr;
|
||||
const corsair_v2_device* corsair = controller->GetDeviceData();
|
||||
|
||||
name = controller->GetName();
|
||||
vendor = "Corsair";
|
||||
description = controller->GetName();
|
||||
description = "Corsair Peripheral V2 SW Device";
|
||||
type = corsair->type;
|
||||
version = controller->GetFirmwareString();
|
||||
location = controller->GetDeviceLocation();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue