Store name in HyperXKeyboardControllers to avoid setting it in detectors
This commit is contained in:
parent
6c8a46cc7d
commit
da21f992c5
19 changed files with 157 additions and 113 deletions
|
|
@ -18,10 +18,11 @@
|
|||
\*-----------------------------------------*/
|
||||
static const unsigned int SKIP_INDICES[] = { 23, 29, 41, 47, 70, 71, 76, 77, 87, 88, 93, 99, 100, 102, 108, 113 };
|
||||
|
||||
HyperXAlloyElite2Controller::HyperXAlloyElite2Controller(hid_device* dev_handle, const char* path)
|
||||
HyperXAlloyElite2Controller::HyperXAlloyElite2Controller(hid_device* dev_handle, const char* path, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
name = dev_name;
|
||||
}
|
||||
|
||||
HyperXAlloyElite2Controller::~HyperXAlloyElite2Controller()
|
||||
|
|
@ -34,6 +35,11 @@ std::string HyperXAlloyElite2Controller::GetDeviceLocation()
|
|||
return("HID " + location);
|
||||
}
|
||||
|
||||
std::string HyperXAlloyElite2Controller::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string HyperXAlloyElite2Controller::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
|
|
|
|||
|
|
@ -18,10 +18,11 @@
|
|||
class HyperXAlloyElite2Controller
|
||||
{
|
||||
public:
|
||||
HyperXAlloyElite2Controller(hid_device* dev_handle, const char* path);
|
||||
HyperXAlloyElite2Controller(hid_device* dev_handle, const char* path, std::string dev_name);
|
||||
~HyperXAlloyElite2Controller();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetNameString();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SetLEDsDirect(const std::vector<RGBColor>& colors);
|
||||
|
|
@ -29,6 +30,7 @@ public:
|
|||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string name;
|
||||
|
||||
void SendDirectInitialization();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ RGBController_HyperXAlloyElite2::RGBController_HyperXAlloyElite2(HyperXAlloyElit
|
|||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "HyperX Alloy Elite 2 Keyboard Device";
|
||||
name = controller->GetNameString();
|
||||
vendor = "HyperX";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "HyperX Alloy Elite 2 Keyboard Device";
|
||||
|
|
|
|||
|
|
@ -29,10 +29,11 @@ static unsigned int extended_red[] = {0x08, 0x48, 0x88, 0x09, 0x89, 0x0A, 0x8A,
|
|||
static unsigned int extended_grn[] = {0x29, 0x28, 0x78, 0x19, 0x79, 0x1A, 0x7A, 0x1B, 0x7B, 0x1C, 0x7C, 0x1D, 0x7D, 0x1E, 0x6E, 0x7E, 0x1F, 0x6F, 0x82, 0x23, 0x83, 0x22 };
|
||||
static unsigned int extended_blu[] = {0x39, 0x38, 0x68, 0x3A, 0x69, 0x2A, 0x6A, 0x2B, 0x6B, 0x2C, 0x6C, 0x2D, 0x6D, 0x2E, 0x5E, 0x5D, 0x2F, 0x5F, 0x72, 0x33, 0x73, 0x32 };
|
||||
|
||||
HyperXAlloyEliteController::HyperXAlloyEliteController(hid_device* dev_handle, const char* path)
|
||||
HyperXAlloyEliteController::HyperXAlloyEliteController(hid_device* dev_handle, const char* path, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
name = dev_name;
|
||||
}
|
||||
|
||||
HyperXAlloyEliteController::~HyperXAlloyEliteController()
|
||||
|
|
@ -45,6 +46,11 @@ std::string HyperXAlloyEliteController::GetDeviceLocation()
|
|||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string HyperXAlloyEliteController::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string HyperXAlloyEliteController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
|
|
|
|||
|
|
@ -66,10 +66,11 @@ enum
|
|||
class HyperXAlloyEliteController
|
||||
{
|
||||
public:
|
||||
HyperXAlloyEliteController(hid_device* dev_handle, const char* path);
|
||||
HyperXAlloyEliteController(hid_device* dev_handle, const char* path, std::string dev_name);
|
||||
~HyperXAlloyEliteController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetNameString();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SetMode
|
||||
|
|
@ -89,6 +90,7 @@ private:
|
|||
unsigned char active_direction;
|
||||
unsigned char active_speed;
|
||||
std::string location;
|
||||
std::string name;
|
||||
|
||||
void SelectProfile
|
||||
(
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ RGBController_HyperXAlloyElite::RGBController_HyperXAlloyElite(HyperXAlloyEliteC
|
|||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "HyperX Alloy Elite";
|
||||
name = controller->GetNameString();
|
||||
vendor = "HyperX";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "HyperX Alloy Elite Device";
|
||||
|
|
|
|||
|
|
@ -25,10 +25,11 @@ static unsigned int keys[] = {0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x
|
|||
0x7F, 0x81, 0x84, 0x85, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x91,
|
||||
0x94, 0x95 };
|
||||
|
||||
HyperXAlloyFPSController::HyperXAlloyFPSController(hid_device* dev_handle, const char* path)
|
||||
HyperXAlloyFPSController::HyperXAlloyFPSController(hid_device* dev_handle, const char* path, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
name = dev_name;
|
||||
}
|
||||
|
||||
HyperXAlloyFPSController::~HyperXAlloyFPSController()
|
||||
|
|
@ -41,6 +42,11 @@ std::string HyperXAlloyFPSController::GetDeviceLocation()
|
|||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string HyperXAlloyFPSController::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string HyperXAlloyFPSController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
|
|
|
|||
|
|
@ -30,10 +30,11 @@ enum
|
|||
class HyperXAlloyFPSController
|
||||
{
|
||||
public:
|
||||
HyperXAlloyFPSController(hid_device* dev_handle, const char* path);
|
||||
HyperXAlloyFPSController(hid_device* dev_handle, const char* path, std::string dev_name);
|
||||
~HyperXAlloyFPSController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetNameString();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SetLEDsDirect(std::vector<RGBColor> colors);
|
||||
|
|
@ -41,6 +42,7 @@ public:
|
|||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string name;
|
||||
|
||||
void SendDirect
|
||||
(
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ RGBController_HyperXAlloyFPS::RGBController_HyperXAlloyFPS(HyperXAlloyFPSControl
|
|||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "HyperX Alloy FPS";
|
||||
name = controller->GetNameString();
|
||||
vendor = "HyperX";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "HyperX Alloy FPS Device";
|
||||
|
|
|
|||
|
|
@ -13,10 +13,11 @@
|
|||
#include "HyperXAlloyOrigins60and65Controller.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
HyperXAlloyOrigins60and65Controller::HyperXAlloyOrigins60and65Controller(hid_device* dev_handle, const char* path)
|
||||
HyperXAlloyOrigins60and65Controller::HyperXAlloyOrigins60and65Controller(hid_device* dev_handle, const char* path, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
dev_name = name;
|
||||
}
|
||||
|
||||
HyperXAlloyOrigins60and65Controller::~HyperXAlloyOrigins60and65Controller()
|
||||
|
|
@ -29,6 +30,11 @@ std::string HyperXAlloyOrigins60and65Controller::GetDeviceLocation()
|
|||
return("HID " + location);
|
||||
}
|
||||
|
||||
std::string HyperXAlloyOrigins60and65Controller::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string HyperXAlloyOrigins60and65Controller::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
|
|
|
|||
|
|
@ -18,10 +18,11 @@
|
|||
class HyperXAlloyOrigins60and65Controller
|
||||
{
|
||||
public:
|
||||
HyperXAlloyOrigins60and65Controller(hid_device* dev_handle, const char* path);
|
||||
HyperXAlloyOrigins60and65Controller(hid_device* dev_handle, const char* path, std::string dev_name);
|
||||
~HyperXAlloyOrigins60and65Controller();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetNameString();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SetLEDsDirect(std::vector<RGBColor> colors);
|
||||
|
|
@ -29,6 +30,7 @@ public:
|
|||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string name;
|
||||
|
||||
void SendDirectInitialization();
|
||||
void SendDirectColorPacket
|
||||
|
|
|
|||
|
|
@ -216,13 +216,15 @@ RGBController_HyperXAlloyOrigins60and65::RGBController_HyperXAlloyOrigins60and65
|
|||
switch(layout)
|
||||
{
|
||||
case ALLOY_ORIGINS_60_LAYOUT:
|
||||
name = "HyperX Alloy Origins 60 Keyboard Device";
|
||||
description = "HyperX Alloy Origins 60 Keyboard Device";
|
||||
break;
|
||||
|
||||
case ALLOY_ORIGINS_65_LAYOUT:
|
||||
name = "HyperX Alloy Origins 65 Keyboard Device";
|
||||
description = "HyperX Alloy Origins 65 Keyboard Device";
|
||||
break;
|
||||
}
|
||||
|
||||
description = name;
|
||||
name = controller->GetNameString();
|
||||
vendor = "HyperX";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
location = controller->GetDeviceLocation();
|
||||
|
|
|
|||
|
|
@ -16,10 +16,11 @@
|
|||
// Skip these indices in the color output
|
||||
static unsigned int skip_idx[] = { 23, 29, 41, 47, 59, 70, 71, 87, 88, 93, 99, 100, 102, 108, 113, 114, 120, 123, 124 };
|
||||
|
||||
HyperXAlloyOriginsController::HyperXAlloyOriginsController(hid_device* dev_handle, const char* path)
|
||||
HyperXAlloyOriginsController::HyperXAlloyOriginsController(hid_device* dev_handle, const char* path, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
name = dev_name;
|
||||
}
|
||||
|
||||
HyperXAlloyOriginsController::~HyperXAlloyOriginsController()
|
||||
|
|
@ -32,6 +33,11 @@ std::string HyperXAlloyOriginsController::GetDeviceLocation()
|
|||
return("HID " + location);
|
||||
}
|
||||
|
||||
std::string HyperXAlloyOriginsController::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string HyperXAlloyOriginsController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
|
|
|
|||
|
|
@ -18,10 +18,11 @@
|
|||
class HyperXAlloyOriginsController
|
||||
{
|
||||
public:
|
||||
HyperXAlloyOriginsController(hid_device* dev_handle, const char* path);
|
||||
HyperXAlloyOriginsController(hid_device* dev_handle, const char* path, std::string dev_name);
|
||||
~HyperXAlloyOriginsController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetNameString();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SetLEDsDirect(std::vector<RGBColor> colors);
|
||||
|
|
@ -29,6 +30,7 @@ public:
|
|||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string name;
|
||||
|
||||
void SendDirectInitialization();
|
||||
void SendDirectColorPacket
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ RGBController_HyperXAlloyOrigins::RGBController_HyperXAlloyOrigins(HyperXAlloyOr
|
|||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "HyperX Alloy Origins Keyboard Device";
|
||||
name = controller->GetNameString();
|
||||
vendor = "HyperX";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "HyperX Alloy Origins Keyboard Device";
|
||||
|
|
|
|||
|
|
@ -17,10 +17,11 @@
|
|||
#include "LogManager.h"
|
||||
|
||||
|
||||
HyperXAlloyOriginsCoreController::HyperXAlloyOriginsCoreController(hid_device* dev_handle, hid_device_info* dev_info)
|
||||
HyperXAlloyOriginsCoreController::HyperXAlloyOriginsCoreController(hid_device* dev_handle, hid_device_info* dev_info, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = dev_info->path;
|
||||
name = dev_name;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Get the firmware version from the device info |
|
||||
|
|
@ -44,6 +45,11 @@ std::string HyperXAlloyOriginsCoreController::GetDeviceLocation()
|
|||
return("HID " + location);
|
||||
}
|
||||
|
||||
std::string HyperXAlloyOriginsCoreController::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string HyperXAlloyOriginsCoreController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
|
|
|
|||
|
|
@ -18,10 +18,11 @@
|
|||
class HyperXAlloyOriginsCoreController
|
||||
{
|
||||
public:
|
||||
HyperXAlloyOriginsCoreController(hid_device* dev_handle, hid_device_info* dev_info);
|
||||
HyperXAlloyOriginsCoreController(hid_device* dev_handle, hid_device_info* dev_info, std::string dev_name);
|
||||
~HyperXAlloyOriginsCoreController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetNameString();
|
||||
std::string GetSerialString();
|
||||
std::string GetFirmwareVersion();
|
||||
unsigned int GetVariant();
|
||||
|
|
@ -33,4 +34,5 @@ private:
|
|||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string firmware_version;
|
||||
std::string name;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ RGBController_HyperXAlloyOriginsCore::RGBController_HyperXAlloyOriginsCore(Hyper
|
|||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "HyperX Alloy Origins Core Keyboard Device";
|
||||
name = controller->GetNameString();
|
||||
vendor = "HyperX";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "HyperX Alloy Origins Core Keyboard Device";
|
||||
|
|
|
|||
|
|
@ -67,9 +67,8 @@ void DetectHyperXAlloyElite(hid_device_info* info, const std::string& name)
|
|||
|
||||
if(dev)
|
||||
{
|
||||
HyperXAlloyEliteController* controller = new HyperXAlloyEliteController(dev, info->path);
|
||||
HyperXAlloyEliteController* controller = new HyperXAlloyEliteController(dev, info->path, name);
|
||||
RGBController_HyperXAlloyElite* rgb_controller = new RGBController_HyperXAlloyElite(controller);
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
|
|
@ -81,9 +80,8 @@ void DetectHyperXAlloyElite2(hid_device_info* info, const std::string& name)
|
|||
|
||||
if(dev)
|
||||
{
|
||||
HyperXAlloyElite2Controller* controller = new HyperXAlloyElite2Controller(dev, info->path);
|
||||
HyperXAlloyElite2Controller* controller = new HyperXAlloyElite2Controller(dev, info->path, name);
|
||||
RGBController_HyperXAlloyElite2* rgb_controller = new RGBController_HyperXAlloyElite2(controller);
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
|
|
@ -95,9 +93,8 @@ void DetectHyperXAlloyFPS(hid_device_info* info, const std::string& name)
|
|||
|
||||
if(dev)
|
||||
{
|
||||
HyperXAlloyFPSController* controller = new HyperXAlloyFPSController(dev, info->path);
|
||||
HyperXAlloyFPSController* controller = new HyperXAlloyFPSController(dev, info->path, name);
|
||||
RGBController_HyperXAlloyFPS* rgb_controller = new RGBController_HyperXAlloyFPS(controller);
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
|
|
@ -109,9 +106,8 @@ void DetectHyperXAlloyOrigins(hid_device_info* info, const std::string& name)
|
|||
|
||||
if(dev)
|
||||
{
|
||||
HyperXAlloyOriginsController* controller = new HyperXAlloyOriginsController(dev, info->path);
|
||||
HyperXAlloyOriginsController* controller = new HyperXAlloyOriginsController(dev, info->path, name);
|
||||
RGBController_HyperXAlloyOrigins* rgb_controller = new RGBController_HyperXAlloyOrigins(controller);
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
|
|
@ -123,9 +119,8 @@ void DetectHyperXAlloyOriginsCore(hid_device_info* info, const std::string& name
|
|||
|
||||
if(dev)
|
||||
{
|
||||
HyperXAlloyOriginsCoreController* controller = new HyperXAlloyOriginsCoreController(dev, info);
|
||||
HyperXAlloyOriginsCoreController* controller = new HyperXAlloyOriginsCoreController(dev, info, name);
|
||||
RGBController_HyperXAlloyOriginsCore* rgb_controller = new RGBController_HyperXAlloyOriginsCore(controller);
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
|
|
@ -137,10 +132,9 @@ void DetectHyperXAlloyOrigins60and65(hid_device_info* info, const std::string& n
|
|||
|
||||
if(dev)
|
||||
{
|
||||
HyperXAlloyOrigins60and65Controller* controller = new HyperXAlloyOrigins60and65Controller(dev, info->path);
|
||||
HyperXAlloyOrigins60and65Controller* controller = new HyperXAlloyOrigins60and65Controller(dev, info->path, name);
|
||||
AlloyOrigins60and65MappingLayoutType layout = GetAlloyOrigins60and65MappingLayoutType(info->product_id);
|
||||
RGBController_HyperXAlloyOrigins60and65* rgb_controller = new RGBController_HyperXAlloyOrigins60and65(controller, layout);
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue