Store name in N5312AController to avoid setting it in detector
This commit is contained in:
parent
f420e9bbbe
commit
85af2e1ed7
4 changed files with 17 additions and 17 deletions
|
|
@ -14,11 +14,11 @@
|
||||||
#include "N5312AController.h"
|
#include "N5312AController.h"
|
||||||
#include "StringUtils.h"
|
#include "StringUtils.h"
|
||||||
|
|
||||||
N5312AController::N5312AController(hid_device* dev_handle, const hid_device_info& info)
|
N5312AController::N5312AController(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;
|
||||||
|
|
||||||
SendInit();
|
SendInit();
|
||||||
}
|
}
|
||||||
|
|
@ -33,6 +33,11 @@ std::string N5312AController::GetDeviceLocation()
|
||||||
return("HID: " + location);
|
return("HID: " + location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string N5312AController::GetNameString()
|
||||||
|
{
|
||||||
|
return(name);
|
||||||
|
}
|
||||||
|
|
||||||
std::string N5312AController::GetSerialString()
|
std::string N5312AController::GetSerialString()
|
||||||
{
|
{
|
||||||
wchar_t serial_string[128];
|
wchar_t serial_string[128];
|
||||||
|
|
@ -46,11 +51,6 @@ std::string N5312AController::GetSerialString()
|
||||||
return(StringUtils::wstring_to_string(serial_string));
|
return(StringUtils::wstring_to_string(serial_string));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string N5312AController::GetFirmwareVersion()
|
|
||||||
{
|
|
||||||
return(version);
|
|
||||||
}
|
|
||||||
|
|
||||||
void N5312AController::SendInit()
|
void N5312AController::SendInit()
|
||||||
{
|
{
|
||||||
unsigned char usb_buf[N5312A_PACKET_DATA_LENGTH];
|
unsigned char usb_buf[N5312A_PACKET_DATA_LENGTH];
|
||||||
|
|
|
||||||
|
|
@ -41,12 +41,12 @@ enum
|
||||||
class N5312AController
|
class N5312AController
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
N5312AController(hid_device* dev_handle, const hid_device_info& info);
|
N5312AController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name);
|
||||||
~N5312AController();
|
~N5312AController();
|
||||||
|
|
||||||
std::string GetSerialString();
|
|
||||||
std::string GetDeviceLocation();
|
std::string GetDeviceLocation();
|
||||||
std::string GetFirmwareVersion();
|
std::string GetNameString();
|
||||||
|
std::string GetSerialString();
|
||||||
|
|
||||||
void SetColor(RGBColor color);
|
void SetColor(RGBColor color);
|
||||||
void SetMode(RGBColor color, unsigned char mode_value, unsigned char brightness, unsigned char speed);
|
void SetMode(RGBColor color, unsigned char mode_value, unsigned char brightness, unsigned char speed);
|
||||||
|
|
@ -55,6 +55,7 @@ private:
|
||||||
hid_device* dev;
|
hid_device* dev;
|
||||||
|
|
||||||
std::string location;
|
std::string location;
|
||||||
|
std::string name;
|
||||||
std::string version;
|
std::string version;
|
||||||
|
|
||||||
void SendInit();
|
void SendInit();
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,8 @@ void DetectN5312AControllers(hid_device_info* info, const std::string& name)
|
||||||
|
|
||||||
if(dev)
|
if(dev)
|
||||||
{
|
{
|
||||||
N5312AController* controller = new N5312AController(dev, *info);
|
N5312AController* controller = new N5312AController(dev, *info, name);
|
||||||
RGBController_N5312A* rgb_controller = new RGBController_N5312A(controller);
|
RGBController_N5312A* rgb_controller = new RGBController_N5312A(controller);
|
||||||
rgb_controller->name = name;
|
|
||||||
|
|
||||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,13 +29,13 @@
|
||||||
RGBController_N5312A::RGBController_N5312A(N5312AController* controller_ptr)
|
RGBController_N5312A::RGBController_N5312A(N5312AController* controller_ptr)
|
||||||
{
|
{
|
||||||
controller = controller_ptr;
|
controller = controller_ptr;
|
||||||
name = "N5312A Device";
|
|
||||||
|
name = controller->GetNameString();
|
||||||
vendor = "Unknown";
|
vendor = "Unknown";
|
||||||
type = DEVICE_TYPE_MOUSE;
|
type = DEVICE_TYPE_MOUSE;
|
||||||
description = name;
|
description = "N5312A Device";
|
||||||
location = controller->GetDeviceLocation();
|
location = controller->GetDeviceLocation();
|
||||||
serial = controller->GetSerialString();
|
serial = controller->GetSerialString();
|
||||||
version = controller->GetFirmwareVersion();
|
|
||||||
|
|
||||||
mode Static;
|
mode Static;
|
||||||
Static.name = "Direct";
|
Static.name = "Direct";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue