Use HID path for Location on Corsair Peripheral controller

This commit is contained in:
Adam Honse
2020-10-03 17:12:27 -05:00
parent c8da008b93
commit 1618de46b9
4 changed files with 13 additions and 4 deletions

View File

@@ -48,9 +48,10 @@ static unsigned int keys_k95[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
static unsigned int st100[] = { 0x00, 0x01, 0x02, 0x03, 0x05, 0x06, 0x07, 0x08, 0x04 };
CorsairPeripheralController::CorsairPeripheralController(hid_device* dev_handle)
CorsairPeripheralController::CorsairPeripheralController(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
dev = dev_handle;
location = path;
ReadFirmwareInfo();
@@ -67,6 +68,11 @@ device_type CorsairPeripheralController::GetDeviceType()
return type;
}
std::string CorsairPeripheralController::GetDeviceLocation()
{
return(location);
}
int CorsairPeripheralController::GetPhysicalLayout()
{
return physical_layout;

View File

@@ -66,12 +66,13 @@ enum
class CorsairPeripheralController
{
public:
CorsairPeripheralController(hid_device* dev_handle);
CorsairPeripheralController(hid_device* dev_handle, const char* path);
~CorsairPeripheralController();
int GetLogicalLayout();
int GetPhysicalLayout();
device_type GetDeviceType();
std::string GetDeviceLocation();
std::string GetFirmwareString();
void SetLEDs(std::vector<RGBColor> colors);
@@ -84,6 +85,7 @@ private:
hid_device* dev;
std::string firmware_version;
std::string location;
device_type type;
int physical_layout; //ANSI, ISO, etc.
int logical_layout; //Normal, K95 or K95 Platinum

View File

@@ -147,7 +147,7 @@ void DetectCorsairPeripheralControllers(std::vector<RGBController*>& rgb_control
if( dev )
{
CorsairPeripheralController* controller = new CorsairPeripheralController(dev);
CorsairPeripheralController* controller = new CorsairPeripheralController(dev, info->path);
if(controller->GetDeviceType() != DEVICE_TYPE_UNKNOWN)
{

View File

@@ -559,6 +559,7 @@ RGBController_CorsairPeripheral::RGBController_CorsairPeripheral(CorsairPeripher
description = "Corsair RGB Peripheral Device";
type = corsair->GetDeviceType();
version = corsair->GetFirmwareString();
location = corsair->GetDeviceLocation();
physical_layout = corsair->GetPhysicalLayout();
logical_layout = corsair->GetLogicalLayout();