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)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "ViewSonic Elite XG270QG";
|
||||
vendor = "ViewSonic";
|
||||
type = DEVICE_TYPE_MONITOR;
|
||||
description = "ViewSonic Monitor";
|
||||
location = controller->GetLocation();
|
||||
serial = controller->GetSerial();
|
||||
name = controller->GetName();
|
||||
vendor = "ViewSonic";
|
||||
type = DEVICE_TYPE_MONITOR;
|
||||
description = "ViewSonic Monitor Device";
|
||||
location = controller->GetLocation();
|
||||
serial = controller->GetSerial();
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
|
|
@ -41,12 +41,12 @@ RGBController_XG270QG::RGBController_XG270QG(VS_XG270QG_Controller* controller_p
|
|||
modes.push_back(Off);
|
||||
|
||||
mode Custom;
|
||||
Custom.name = "Custom";
|
||||
Custom.value = VS_MODE_STATIC;
|
||||
Custom.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_AUTOMATIC_SAVE;
|
||||
Custom.colors_min = 1;
|
||||
Custom.colors_max = 1;
|
||||
Custom.color_mode = MODE_COLORS_PER_LED;
|
||||
Custom.name = "Custom";
|
||||
Custom.value = VS_MODE_STATIC;
|
||||
Custom.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_AUTOMATIC_SAVE;
|
||||
Custom.colors_min = 1;
|
||||
Custom.colors_max = 1;
|
||||
Custom.color_mode = MODE_COLORS_PER_LED;
|
||||
Custom.colors.resize(1);
|
||||
modes.push_back(Custom);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,10 +14,11 @@
|
|||
#include "StringUtils.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;
|
||||
location = path;
|
||||
dev = device;
|
||||
location = path;
|
||||
name = dev_name;
|
||||
}
|
||||
|
||||
VS_XG270QG_Controller::~VS_XG270QG_Controller()
|
||||
|
|
@ -27,7 +28,12 @@ VS_XG270QG_Controller::~VS_XG270QG_Controller()
|
|||
|
||||
std::string VS_XG270QG_Controller::GetLocation()
|
||||
{
|
||||
return location;
|
||||
return(location);
|
||||
}
|
||||
|
||||
std::string VS_XG270QG_Controller::GetName()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
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 data[] = {
|
||||
uint8_t data[] =
|
||||
{
|
||||
0x02,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00,
|
||||
|
|
|
|||
|
|
@ -32,10 +32,11 @@ enum
|
|||
class VS_XG270QG_Controller
|
||||
{
|
||||
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();
|
||||
|
||||
std::string GetLocation();
|
||||
std::string GetName();
|
||||
std::string GetSerial();
|
||||
|
||||
void SetMode(uint8_t mode1, uint8_t r1, uint8_t g1, uint8_t b1,
|
||||
|
|
@ -44,8 +45,7 @@ public:
|
|||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
|
||||
std::string version;
|
||||
std::string name;
|
||||
std::string serial;
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
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_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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue