Store name in MSIOptixController to avoid setting it in detector
This commit is contained in:
parent
2dd013a0a0
commit
b13ca818bb
4 changed files with 17 additions and 18 deletions
|
|
@ -13,11 +13,11 @@
|
||||||
#include "MSIOptixController.h"
|
#include "MSIOptixController.h"
|
||||||
#include "StringUtils.h"
|
#include "StringUtils.h"
|
||||||
|
|
||||||
MSIOptixController::MSIOptixController(hid_device* dev_handle, const hid_device_info& info)
|
MSIOptixController::MSIOptixController(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;
|
||||||
}
|
}
|
||||||
|
|
||||||
MSIOptixController::~MSIOptixController()
|
MSIOptixController::~MSIOptixController()
|
||||||
|
|
@ -30,6 +30,11 @@ std::string MSIOptixController::GetDeviceLocation()
|
||||||
return("HID: " + location);
|
return("HID: " + location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string MSIOptixController::GetNameString()
|
||||||
|
{
|
||||||
|
return(name);
|
||||||
|
}
|
||||||
|
|
||||||
std::string MSIOptixController::GetSerialString()
|
std::string MSIOptixController::GetSerialString()
|
||||||
{
|
{
|
||||||
wchar_t serial_string[128];
|
wchar_t serial_string[128];
|
||||||
|
|
@ -43,11 +48,6 @@ std::string MSIOptixController::GetSerialString()
|
||||||
return(StringUtils::wstring_to_string(serial_string));
|
return(StringUtils::wstring_to_string(serial_string));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string MSIOptixController::GetFirmwareVersion()
|
|
||||||
{
|
|
||||||
return(version);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned char MSIOptixController::GetMysteriousFlag(unsigned char mode_value)
|
unsigned char MSIOptixController::GetMysteriousFlag(unsigned char mode_value)
|
||||||
{
|
{
|
||||||
switch(mode_value)
|
switch(mode_value)
|
||||||
|
|
|
||||||
|
|
@ -67,12 +67,12 @@ enum
|
||||||
class MSIOptixController
|
class MSIOptixController
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MSIOptixController(hid_device* dev_handle, const hid_device_info& info);
|
MSIOptixController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name);
|
||||||
~MSIOptixController();
|
~MSIOptixController();
|
||||||
|
|
||||||
std::string GetSerialString();
|
|
||||||
std::string GetDeviceLocation();
|
std::string GetDeviceLocation();
|
||||||
std::string GetFirmwareVersion();
|
std::string GetNameString();
|
||||||
|
std::string GetSerialString();
|
||||||
|
|
||||||
void SetDirect(std::vector<RGBColor> colors, unsigned char brightness);
|
void SetDirect(std::vector<RGBColor> colors, unsigned char brightness);
|
||||||
void SetMode(std::vector<RGBColor> colors, unsigned char brightness, unsigned char speed, unsigned char mode_value, unsigned int mode_flags);
|
void SetMode(std::vector<RGBColor> colors, unsigned char brightness, unsigned char speed, unsigned char mode_value, unsigned int mode_flags);
|
||||||
|
|
@ -82,7 +82,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string location;
|
std::string location;
|
||||||
std::string version;
|
std::string name;
|
||||||
|
|
||||||
unsigned char GetMysteriousFlag(unsigned char mode_value);
|
unsigned char GetMysteriousFlag(unsigned char mode_value);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,9 @@ void DetectMSIOptixControllers(hid_device_info* info, const std::string& name)
|
||||||
|
|
||||||
if(dev)
|
if(dev)
|
||||||
{
|
{
|
||||||
MSIOptixController* controller = new MSIOptixController(dev, *info);
|
MSIOptixController* controller = new MSIOptixController(dev, *info, name);
|
||||||
RGBController_MSIOptix* rgb_controller = new RGBController_MSIOptix(controller);
|
RGBController_MSIOptix* rgb_controller = new RGBController_MSIOptix(controller);
|
||||||
rgb_controller->name = name;
|
|
||||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,13 +27,12 @@
|
||||||
RGBController_MSIOptix::RGBController_MSIOptix(MSIOptixController* controller_ptr)
|
RGBController_MSIOptix::RGBController_MSIOptix(MSIOptixController* controller_ptr)
|
||||||
{
|
{
|
||||||
controller = controller_ptr;
|
controller = controller_ptr;
|
||||||
name = "MSI Optix USB Device";
|
name = controller->GetNameString();
|
||||||
vendor = "MSI";
|
vendor = "MSI";
|
||||||
type = DEVICE_TYPE_LEDSTRIP;
|
type = DEVICE_TYPE_LEDSTRIP;
|
||||||
description = name;
|
description = "MSI Optix USB Device";
|
||||||
location = controller->GetDeviceLocation();
|
location = controller->GetDeviceLocation();
|
||||||
serial = controller->GetSerialString();
|
serial = controller->GetSerialString();
|
||||||
version = controller->GetFirmwareVersion();
|
|
||||||
|
|
||||||
mode Direct;
|
mode Direct;
|
||||||
Direct.name = "Direct";
|
Direct.name = "Direct";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue