Store name in TrustControllers to avoid setting it in detectors
This commit is contained in:
parent
1bd9215a72
commit
fcce668d66
7 changed files with 35 additions and 33 deletions
|
|
@ -32,12 +32,12 @@ void DetectTrustGXT114Controllers(hid_device_info* info, const std::string& name
|
|||
|
||||
if(dev)
|
||||
{
|
||||
TrustGXT114Controller* controller = new TrustGXT114Controller(dev, *info);
|
||||
TrustGXT114Controller* controller = new TrustGXT114Controller(dev, *info, name);
|
||||
|
||||
if(controller->Test())
|
||||
{
|
||||
RGBController_TrustGXT114* rgb_controller = new RGBController_TrustGXT114(controller);
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
else
|
||||
|
|
@ -53,9 +53,9 @@ void DetectTrustGXT180Controllers(hid_device_info* info, const std::string& name
|
|||
|
||||
if(dev)
|
||||
{
|
||||
TrustGXT180Controller* controller = new TrustGXT180Controller(dev, *info);
|
||||
TrustGXT180Controller* controller = new TrustGXT180Controller(dev, *info, name);
|
||||
RGBController_TrustGXT180* rgb_controller = new RGBController_TrustGXT180(controller);
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,13 +27,13 @@
|
|||
RGBController_TrustGXT114::RGBController_TrustGXT114(TrustGXT114Controller* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
name = "Trust GXT 114";
|
||||
|
||||
name = controller->GetNameString();
|
||||
vendor = "Trust";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = name;
|
||||
description = "Trust GXT 114 Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
version = controller->GetFirmwareVersion();
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@
|
|||
#include "StringUtils.h"
|
||||
#include "TrustGXT114Controller.h"
|
||||
|
||||
TrustGXT114Controller::TrustGXT114Controller(hid_device* dev_handle, const hid_device_info& info)
|
||||
TrustGXT114Controller::TrustGXT114Controller(hid_device* dev_handle, const hid_device_info& info, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = info.path;
|
||||
version = "";
|
||||
name = dev_name;
|
||||
}
|
||||
|
||||
TrustGXT114Controller::~TrustGXT114Controller()
|
||||
|
|
@ -30,6 +30,11 @@ std::string TrustGXT114Controller::GetDeviceLocation()
|
|||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string TrustGXT114Controller::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string TrustGXT114Controller::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
|
|
@ -43,11 +48,6 @@ std::string TrustGXT114Controller::GetSerialString()
|
|||
return(StringUtils::wstring_to_string(serial_string));
|
||||
}
|
||||
|
||||
std::string TrustGXT114Controller::GetFirmwareVersion()
|
||||
{
|
||||
return(version);
|
||||
}
|
||||
|
||||
bool TrustGXT114Controller::Test()
|
||||
{
|
||||
/*-----------------------------------------*\
|
||||
|
|
|
|||
|
|
@ -41,12 +41,13 @@ enum
|
|||
class TrustGXT114Controller
|
||||
{
|
||||
public:
|
||||
TrustGXT114Controller(hid_device* dev_handle, const hid_device_info& info);
|
||||
TrustGXT114Controller(hid_device* dev_handle, const hid_device_info& info, std::string dev_name);
|
||||
~TrustGXT114Controller();
|
||||
|
||||
std::string GetSerialString();
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetFirmwareVersion();
|
||||
std::string GetNameString();
|
||||
|
||||
bool Test();
|
||||
void SetMode(RGBColor color, unsigned char brightness, unsigned char speed, unsigned char mode_value);
|
||||
|
||||
|
|
@ -54,6 +55,6 @@ protected:
|
|||
hid_device* dev;
|
||||
|
||||
private:
|
||||
std::string name;
|
||||
std::string location;
|
||||
std::string version;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -27,13 +27,13 @@
|
|||
RGBController_TrustGXT180::RGBController_TrustGXT180(TrustGXT180Controller* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
name = "Trust GXT 180";
|
||||
|
||||
name = controller->GetNameString();
|
||||
vendor = "Trust";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = name;
|
||||
description = "Trust GXT 180 Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
version = controller->GetFirmwareVersion();
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@
|
|||
#include "StringUtils.h"
|
||||
#include "TrustGXT180Controller.h"
|
||||
|
||||
TrustGXT180Controller::TrustGXT180Controller(hid_device* dev_handle, const hid_device_info& info)
|
||||
TrustGXT180Controller::TrustGXT180Controller(hid_device* dev_handle, const hid_device_info& info, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = info.path;
|
||||
version = "";
|
||||
name = dev_name;
|
||||
}
|
||||
|
||||
TrustGXT180Controller::~TrustGXT180Controller()
|
||||
|
|
@ -30,6 +30,11 @@ std::string TrustGXT180Controller::GetDeviceLocation()
|
|||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string TrustGXT180Controller::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string TrustGXT180Controller::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
|
|
@ -43,11 +48,6 @@ std::string TrustGXT180Controller::GetSerialString()
|
|||
return(StringUtils::wstring_to_string(serial_string));
|
||||
}
|
||||
|
||||
std::string TrustGXT180Controller::GetFirmwareVersion()
|
||||
{
|
||||
return(version);
|
||||
}
|
||||
|
||||
void TrustGXT180Controller::SetMode(RGBColor color, unsigned char brightness, unsigned char speed, unsigned char mode_value)
|
||||
{
|
||||
/*-----------------------------------------*\
|
||||
|
|
|
|||
|
|
@ -42,12 +42,13 @@ enum
|
|||
class TrustGXT180Controller
|
||||
{
|
||||
public:
|
||||
TrustGXT180Controller(hid_device* dev_handle, const hid_device_info& info);
|
||||
TrustGXT180Controller(hid_device* dev_handle, const hid_device_info& info, std::string dev_name);
|
||||
~TrustGXT180Controller();
|
||||
|
||||
std::string GetSerialString();
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetFirmwareVersion();
|
||||
std::string GetNameString();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SetMode(RGBColor color, unsigned char brightness, unsigned char speed, unsigned char mode_value);
|
||||
|
||||
protected:
|
||||
|
|
@ -55,5 +56,5 @@ protected:
|
|||
|
||||
private:
|
||||
std::string location;
|
||||
std::string version;
|
||||
std::string name;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue