Store name in ViewSonicController to avoid setting it in detector
This commit is contained in:
parent
ef6241fe38
commit
550503d757
4 changed files with 32 additions and 26 deletions
|
|
@ -25,14 +25,14 @@
|
||||||
|
|
||||||
RGBController_XG270QG::RGBController_XG270QG(VS_XG270QG_Controller* controller_ptr)
|
RGBController_XG270QG::RGBController_XG270QG(VS_XG270QG_Controller* controller_ptr)
|
||||||
{
|
{
|
||||||
controller = controller_ptr;
|
controller = controller_ptr;
|
||||||
|
|
||||||
name = "ViewSonic Elite XG270QG";
|
name = controller->GetName();
|
||||||
vendor = "ViewSonic";
|
vendor = "ViewSonic";
|
||||||
type = DEVICE_TYPE_MONITOR;
|
type = DEVICE_TYPE_MONITOR;
|
||||||
description = "ViewSonic Monitor";
|
description = "ViewSonic Monitor Device";
|
||||||
location = controller->GetLocation();
|
location = controller->GetLocation();
|
||||||
serial = controller->GetSerial();
|
serial = controller->GetSerial();
|
||||||
|
|
||||||
mode Off;
|
mode Off;
|
||||||
Off.name = "Off";
|
Off.name = "Off";
|
||||||
|
|
@ -41,12 +41,12 @@ RGBController_XG270QG::RGBController_XG270QG(VS_XG270QG_Controller* controller_p
|
||||||
modes.push_back(Off);
|
modes.push_back(Off);
|
||||||
|
|
||||||
mode Custom;
|
mode Custom;
|
||||||
Custom.name = "Custom";
|
Custom.name = "Custom";
|
||||||
Custom.value = VS_MODE_STATIC;
|
Custom.value = VS_MODE_STATIC;
|
||||||
Custom.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_AUTOMATIC_SAVE;
|
Custom.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_AUTOMATIC_SAVE;
|
||||||
Custom.colors_min = 1;
|
Custom.colors_min = 1;
|
||||||
Custom.colors_max = 1;
|
Custom.colors_max = 1;
|
||||||
Custom.color_mode = MODE_COLORS_PER_LED;
|
Custom.color_mode = MODE_COLORS_PER_LED;
|
||||||
Custom.colors.resize(1);
|
Custom.colors.resize(1);
|
||||||
modes.push_back(Custom);
|
modes.push_back(Custom);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,11 @@
|
||||||
#include "StringUtils.h"
|
#include "StringUtils.h"
|
||||||
#include "VS_XG270QG_Controller.h"
|
#include "VS_XG270QG_Controller.h"
|
||||||
|
|
||||||
VS_XG270QG_Controller::VS_XG270QG_Controller(hid_device* device, const char* path)
|
VS_XG270QG_Controller::VS_XG270QG_Controller(hid_device* device, const char* path, std::string dev_name)
|
||||||
{
|
{
|
||||||
dev = device;
|
dev = device;
|
||||||
location = path;
|
location = path;
|
||||||
|
name = dev_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
VS_XG270QG_Controller::~VS_XG270QG_Controller()
|
VS_XG270QG_Controller::~VS_XG270QG_Controller()
|
||||||
|
|
@ -27,7 +28,12 @@ VS_XG270QG_Controller::~VS_XG270QG_Controller()
|
||||||
|
|
||||||
std::string VS_XG270QG_Controller::GetLocation()
|
std::string VS_XG270QG_Controller::GetLocation()
|
||||||
{
|
{
|
||||||
return location;
|
return(location);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string VS_XG270QG_Controller::GetName()
|
||||||
|
{
|
||||||
|
return(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string VS_XG270QG_Controller::GetSerial()
|
std::string VS_XG270QG_Controller::GetSerial()
|
||||||
|
|
@ -54,7 +60,8 @@ void VS_XG270QG_Controller::SendModeComplete
|
||||||
uint8_t mode2, uint8_t r2, uint8_t g2, uint8_t b2
|
uint8_t mode2, uint8_t r2, uint8_t g2, uint8_t b2
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
uint8_t data[] = {
|
uint8_t data[] =
|
||||||
|
{
|
||||||
0x02,
|
0x02,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00,
|
||||||
|
|
|
||||||
|
|
@ -32,10 +32,11 @@ enum
|
||||||
class VS_XG270QG_Controller
|
class VS_XG270QG_Controller
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VS_XG270QG_Controller(hid_device* device, const char* path);
|
VS_XG270QG_Controller(hid_device* device, const char* path, std::string dev_name);
|
||||||
~VS_XG270QG_Controller();
|
~VS_XG270QG_Controller();
|
||||||
|
|
||||||
std::string GetLocation();
|
std::string GetLocation();
|
||||||
|
std::string GetName();
|
||||||
std::string GetSerial();
|
std::string GetSerial();
|
||||||
|
|
||||||
void SetMode(uint8_t mode1, uint8_t r1, uint8_t g1, uint8_t b1,
|
void SetMode(uint8_t mode1, uint8_t r1, uint8_t g1, uint8_t b1,
|
||||||
|
|
@ -44,8 +45,7 @@ public:
|
||||||
private:
|
private:
|
||||||
hid_device* dev;
|
hid_device* dev;
|
||||||
std::string location;
|
std::string location;
|
||||||
|
std::string name;
|
||||||
std::string version;
|
|
||||||
std::string serial;
|
std::string serial;
|
||||||
|
|
||||||
std::string ReadVersion();
|
std::string ReadVersion();
|
||||||
|
|
|
||||||
|
|
@ -23,15 +23,14 @@ void DetectViewSonic(hid_device_info* info, const std::string& name)
|
||||||
{
|
{
|
||||||
hid_device* dev = hid_open_path(info->path);
|
hid_device* dev = hid_open_path(info->path);
|
||||||
|
|
||||||
if (dev)
|
if(dev)
|
||||||
{
|
{
|
||||||
VS_XG270QG_Controller* controller = new VS_XG270QG_Controller(dev, info->path);
|
VS_XG270QG_Controller* controller = new VS_XG270QG_Controller(dev, info->path, name);
|
||||||
RGBController_XG270QG* rgb_controller = new RGBController_XG270QG(controller);
|
RGBController_XG270QG* rgb_controller = new RGBController_XG270QG(controller);
|
||||||
rgb_controller->name = name;
|
|
||||||
|
|
||||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
REGISTER_HID_DETECTOR_IPU("ViewSonic Monitor XG270QG", DetectViewSonic, WINBOND_VID, VS_XG270QG_PID, 0, 0xFF00, 1);
|
REGISTER_HID_DETECTOR_IPU("ViewSonic Monitor XG270QG", DetectViewSonic, WINBOND_VID, VS_XG270QG_PID, 0, 0xFF00, 1);
|
||||||
REGISTER_HID_DETECTOR_IP("ViewSonic Monitor XG271QG", DetectViewSonic, VIEWSONIC_VID, VS_XG271QG_PID, 0, 0x0001);
|
REGISTER_HID_DETECTOR_IP( "ViewSonic Monitor XG271QG", DetectViewSonic, VIEWSONIC_VID, VS_XG271QG_PID, 0, 0x0001);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue