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