Store name in MSIMysticLightControllers to avoid setting it in detectors
This commit is contained in:
parent
4c018421a2
commit
49e4f00aff
14 changed files with 138 additions and 240 deletions
|
|
@ -32,20 +32,19 @@ const std::vector<MSI_ZONE> zones_set =
|
|||
MSI_ZONE_ON_BOARD_LED_0
|
||||
};
|
||||
|
||||
|
||||
MSIMysticLight112Controller::MSIMysticLight112Controller
|
||||
(
|
||||
hid_device* handle,
|
||||
const char *path
|
||||
const char* path,
|
||||
std::string dev_name
|
||||
)
|
||||
{
|
||||
dev = handle;
|
||||
dev = handle;
|
||||
location = path;
|
||||
name = dev_name;
|
||||
|
||||
if(dev)
|
||||
{
|
||||
location = path;
|
||||
|
||||
ReadName();
|
||||
ReadFwVersion();
|
||||
ReadSettings();
|
||||
}
|
||||
|
|
@ -385,31 +384,6 @@ bool MSIMysticLight112Controller::ReadFwVersion()
|
|||
return(ret_val > 0);
|
||||
}
|
||||
|
||||
void MSIMysticLight112Controller::ReadName()
|
||||
{
|
||||
wchar_t tname[256];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Get the manufacturer string from HID |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_get_manufacturer_string(dev, tname, 256);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Convert to std::string |
|
||||
\*-----------------------------------------------------*/
|
||||
name = StringUtils::wstring_to_string(tname);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Get the product string from HID |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_get_product_string(dev, tname, 256);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Append the product string to the manufacturer string |
|
||||
\*-----------------------------------------------------*/
|
||||
name.append(" ").append(StringUtils::wstring_to_string(tname));
|
||||
}
|
||||
|
||||
MSI_MODE MSIMysticLight112Controller::GetMode()
|
||||
{
|
||||
return (MSI_MODE)data.on_board_led.effect;
|
||||
|
|
|
|||
|
|
@ -21,10 +21,12 @@ class MSIMysticLight112Controller
|
|||
{
|
||||
public:
|
||||
MSIMysticLight112Controller
|
||||
(
|
||||
hid_device* handle,
|
||||
const char *path
|
||||
);
|
||||
(
|
||||
hid_device* handle,
|
||||
const char* path,
|
||||
std::string dev_name
|
||||
);
|
||||
|
||||
~MSIMysticLight112Controller();
|
||||
|
||||
void SetMode
|
||||
|
|
@ -77,26 +79,17 @@ public:
|
|||
std::string GetFWVersion();
|
||||
std::string GetSerial();
|
||||
|
||||
|
||||
void SetDirectMode
|
||||
(
|
||||
bool mode
|
||||
);
|
||||
|
||||
bool IsDirectModeActive() { return direct_mode; }
|
||||
size_t GetMaxOnboardLeds();
|
||||
const std::vector<MSI_ZONE>*
|
||||
GetSupportedZones() { return supported_zones; }
|
||||
|
||||
private:
|
||||
bool ReadSettings();
|
||||
bool ReadFwVersion();
|
||||
void ReadName();
|
||||
ZoneData* GetZoneData
|
||||
(
|
||||
FeaturePacket_112& dataPacket,
|
||||
MSI_ZONE zone
|
||||
);
|
||||
|
||||
hid_device* dev;
|
||||
std::string name;
|
||||
std::string location;
|
||||
|
|
@ -108,4 +101,12 @@ private:
|
|||
bool direct_mode;
|
||||
size_t numof_onboard_leds;
|
||||
const std::vector<MSI_ZONE>* supported_zones;
|
||||
|
||||
bool ReadSettings();
|
||||
bool ReadFwVersion();
|
||||
ZoneData* GetZoneData
|
||||
(
|
||||
FeaturePacket_112& dataPacket,
|
||||
MSI_ZONE zone
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -27,11 +27,8 @@ const ZoneDescription led_zones[] =
|
|||
ZoneDescription{ "Onboard LEDs", MSI_ZONE_ON_BOARD_LED_0 }
|
||||
};
|
||||
|
||||
|
||||
static std::vector<const ZoneDescription*> zone_description;
|
||||
|
||||
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name MSI Mystic Light (112 Byte)
|
||||
@category Motherboard
|
||||
|
|
@ -48,7 +45,7 @@ RGBController_MSIMysticLight112::RGBController_MSIMysticLight112
|
|||
MSIMysticLight112Controller* controller_ptr
|
||||
)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetDeviceName();
|
||||
vendor = "MSI";
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ public:
|
|||
void DeviceSaveMode();
|
||||
|
||||
private:
|
||||
MSIMysticLight112Controller* controller;
|
||||
|
||||
void SetupModes();
|
||||
void UpdateLed
|
||||
(
|
||||
|
|
@ -45,6 +47,4 @@ private:
|
|||
);
|
||||
int GetDeviceMode();
|
||||
void GetDeviceConfig();
|
||||
|
||||
MSIMysticLight112Controller* controller;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@ const std::vector<MSI_ZONE> zones_set3 =
|
|||
MSI_ZONE_ON_BOARD_LED_0
|
||||
};
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------------------------------------*\
|
||||
| Definition of the board sepcific configurations (number of onboard LEDs and supported zones). |
|
||||
| |
|
||||
|
|
@ -83,17 +82,17 @@ static const mystic_light_162_config board_configs[] =
|
|||
MSIMysticLight162Controller::MSIMysticLight162Controller
|
||||
(
|
||||
hid_device* handle,
|
||||
const char *path,
|
||||
unsigned short pid
|
||||
const char* path,
|
||||
unsigned short pid,
|
||||
std::string dev_name
|
||||
)
|
||||
{
|
||||
dev = handle;
|
||||
dev = handle;
|
||||
location = path;
|
||||
name = dev_name;
|
||||
|
||||
if(dev)
|
||||
{
|
||||
location = path;
|
||||
|
||||
ReadName();
|
||||
ReadFwVersion();
|
||||
ReadSettings();
|
||||
}
|
||||
|
|
@ -408,31 +407,6 @@ bool MSIMysticLight162Controller::ReadFwVersion()
|
|||
return(ret_val > 0);
|
||||
}
|
||||
|
||||
void MSIMysticLight162Controller::ReadName()
|
||||
{
|
||||
wchar_t tname[256];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Get the manufacturer string from HID |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_get_manufacturer_string(dev, tname, 256);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Convert to std::string |
|
||||
\*-----------------------------------------------------*/
|
||||
name = StringUtils::wstring_to_string(tname);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Get the product string from HID |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_get_product_string(dev, tname, 256);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Append the product string to the manufacturer string |
|
||||
\*-----------------------------------------------------*/
|
||||
name.append(" ").append(StringUtils::wstring_to_string(tname));
|
||||
}
|
||||
|
||||
MSI_MODE MSIMysticLight162Controller::GetMode()
|
||||
{
|
||||
return (MSI_MODE)data.on_board_led.effect;
|
||||
|
|
|
|||
|
|
@ -22,11 +22,13 @@ class MSIMysticLight162Controller
|
|||
{
|
||||
public:
|
||||
MSIMysticLight162Controller
|
||||
(
|
||||
hid_device* handle,
|
||||
const char *path,
|
||||
unsigned short pid
|
||||
);
|
||||
(
|
||||
hid_device* handle,
|
||||
const char* path,
|
||||
unsigned short pid,
|
||||
std::string dev_name
|
||||
);
|
||||
|
||||
~MSIMysticLight162Controller();
|
||||
|
||||
void SetMode
|
||||
|
|
@ -76,15 +78,6 @@ public:
|
|||
GetSupportedZones() { return supported_zones; }
|
||||
|
||||
private:
|
||||
bool ReadSettings();
|
||||
bool ReadFwVersion();
|
||||
void ReadName();
|
||||
ZoneData* GetZoneData
|
||||
(
|
||||
FeaturePacket_162& dataPacket,
|
||||
MSI_ZONE zone
|
||||
);
|
||||
|
||||
hid_device* dev;
|
||||
std::string name;
|
||||
std::string location;
|
||||
|
|
@ -94,4 +87,12 @@ private:
|
|||
FeaturePacket_162 data;
|
||||
size_t numof_onboard_leds;
|
||||
const std::vector<MSI_ZONE>* supported_zones;
|
||||
|
||||
bool ReadSettings();
|
||||
bool ReadFwVersion();
|
||||
ZoneData* GetZoneData
|
||||
(
|
||||
FeaturePacket_162& dataPacket,
|
||||
MSI_ZONE zone
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ RGBController_MSIMysticLight162::RGBController_MSIMysticLight162
|
|||
MSIMysticLight162Controller* controller_ptr
|
||||
)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetDeviceName();
|
||||
vendor = "MSI";
|
||||
|
|
|
|||
|
|
@ -220,8 +220,6 @@ const std::vector<MSI_ZONE> zones_set18 =
|
|||
MSI_ZONE_J_PIPE_1
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------*\
|
||||
| Definition of the board sepcific configurations (number of onboard LEDs and supported zones). |
|
||||
| |
|
||||
|
|
@ -335,21 +333,20 @@ Color* per_led_jrainbow1_sync;
|
|||
Color* per_led_jrainbow2_sync;
|
||||
Color* per_led_jcorsair_sync;
|
||||
|
||||
|
||||
MSIMysticLight185Controller::MSIMysticLight185Controller
|
||||
(
|
||||
hid_device* handle,
|
||||
const char *path,
|
||||
unsigned short pid
|
||||
const char* path,
|
||||
unsigned short pid,
|
||||
std::string dev_name
|
||||
)
|
||||
{
|
||||
dev = handle;
|
||||
dev = handle;
|
||||
location = path;
|
||||
name = dev_name;
|
||||
|
||||
if(dev)
|
||||
{
|
||||
location = path;
|
||||
|
||||
ReadName();
|
||||
ReadFwVersion();
|
||||
ReadSettings();
|
||||
}
|
||||
|
|
@ -1048,31 +1045,6 @@ bool MSIMysticLight185Controller::ReadFwVersion()
|
|||
return (ret_val > 0);
|
||||
}
|
||||
|
||||
void MSIMysticLight185Controller::ReadName()
|
||||
{
|
||||
wchar_t tname[256];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Get the manufacturer string from HID |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_get_manufacturer_string(dev, tname, 256);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Convert to std::string |
|
||||
\*-----------------------------------------------------*/
|
||||
name = StringUtils::wstring_to_string(tname);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Get the product string from HID |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_get_product_string(dev, tname, 256);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Append the product string to the manufacturer string |
|
||||
\*-----------------------------------------------------*/
|
||||
name.append(" ").append(StringUtils::wstring_to_string(tname));
|
||||
}
|
||||
|
||||
MSI_MODE MSIMysticLight185Controller::GetMode()
|
||||
{
|
||||
if(data.on_board_led.effect == MSI_DIRECT_MODE)
|
||||
|
|
|
|||
|
|
@ -29,9 +29,11 @@ public:
|
|||
MSIMysticLight185Controller
|
||||
(
|
||||
hid_device* handle,
|
||||
const char *path,
|
||||
unsigned short pid
|
||||
const char* path,
|
||||
unsigned short pid,
|
||||
std::string dev_name
|
||||
);
|
||||
|
||||
~MSIMysticLight185Controller();
|
||||
|
||||
void SetMode
|
||||
|
|
@ -113,21 +115,6 @@ public:
|
|||
DIRECT_MODE GetSupportedDirectMode() { return per_led_mode; }
|
||||
|
||||
private:
|
||||
bool ReadSettings();
|
||||
bool ReadFwVersion();
|
||||
void ReadName();
|
||||
ZoneData* GetZoneData
|
||||
(
|
||||
FeaturePacket_185& data_packet,
|
||||
MSI_ZONE zone
|
||||
);
|
||||
RainbowZoneData* GetRainbowZoneData(MSI_ZONE zone);
|
||||
Color* GetPerLedZoneData
|
||||
(
|
||||
MSI_ZONE zone
|
||||
);
|
||||
void SelectPerLedProtocol();
|
||||
|
||||
hid_device* dev;
|
||||
std::string name;
|
||||
std::string location;
|
||||
|
|
@ -153,4 +140,18 @@ private:
|
|||
int numof_JRGBs;
|
||||
const std::vector<MSI_ZONE>* supported_zones;
|
||||
DIRECT_MODE per_led_mode;
|
||||
|
||||
bool ReadSettings();
|
||||
bool ReadFwVersion();
|
||||
ZoneData* GetZoneData
|
||||
(
|
||||
FeaturePacket_185& data_packet,
|
||||
MSI_ZONE zone
|
||||
);
|
||||
RainbowZoneData* GetRainbowZoneData(MSI_ZONE zone);
|
||||
Color* GetPerLedZoneData
|
||||
(
|
||||
MSI_ZONE zone
|
||||
);
|
||||
void SelectPerLedProtocol();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ RGBController_MSIMysticLight185::RGBController_MSIMysticLight185
|
|||
MSIMysticLight185Controller* controller_ptr
|
||||
)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetDeviceName();
|
||||
vendor = "MSI";
|
||||
|
|
|
|||
|
|
@ -67,14 +67,18 @@ void init_packet(FeaturePacket_Zone_761 * packet)
|
|||
MSIMysticLight761Controller::MSIMysticLight761Controller
|
||||
(
|
||||
hid_device* handle,
|
||||
const char *path,
|
||||
unsigned short pid
|
||||
const char* path,
|
||||
unsigned short pid,
|
||||
std::string dev_name
|
||||
)
|
||||
{
|
||||
dev = handle;
|
||||
dev = handle;
|
||||
location = path;
|
||||
name = dev_name;
|
||||
|
||||
supported_zones = new std::vector<MSI_ZONE>;
|
||||
const mystic_light_761_config * board_config = nullptr;
|
||||
supported_zones = new std::vector<MSI_ZONE>;
|
||||
|
||||
const mystic_light_761_config * board_config = nullptr;
|
||||
|
||||
for(std::size_t i = 0; i < NUM_CONFS; i++)
|
||||
{
|
||||
|
|
@ -87,50 +91,51 @@ MSIMysticLight761Controller::MSIMysticLight761Controller
|
|||
|
||||
if(board_config != nullptr)
|
||||
{
|
||||
supported_zones = (std::vector<MSI_ZONE>*) board_config->supported_zones;
|
||||
unsigned int max = 0;
|
||||
supported_zones = (std::vector<MSI_ZONE>*) board_config->supported_zones;
|
||||
unsigned int max = 0;
|
||||
|
||||
for(std::size_t i = 0; i < board_config->supported_zones[0].size(); i++)
|
||||
{
|
||||
unsigned int curr_val = (unsigned int) (board_config->supported_zones[0][i]);
|
||||
if( (unsigned int) curr_val > max )
|
||||
|
||||
if((unsigned int) curr_val > max)
|
||||
{
|
||||
max = curr_val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(MSI_ZONE supp_zone : *supported_zones )
|
||||
for(MSI_ZONE supp_zone : *supported_zones)
|
||||
{
|
||||
ZoneConfig conf;
|
||||
conf.msi_zone = supp_zone;
|
||||
ZoneData * dat = new ZoneData;
|
||||
conf.zone_data = dat;
|
||||
|
||||
conf.msi_zone = supp_zone;
|
||||
ZoneData * dat = new ZoneData;
|
||||
conf.zone_data = dat;
|
||||
|
||||
zone_configs.push_back(conf);
|
||||
}
|
||||
|
||||
if(dev)
|
||||
{
|
||||
location = path;
|
||||
|
||||
ReadName();
|
||||
ReadFwVersion();
|
||||
ReadSettings();
|
||||
data = new FeaturePacket_761;
|
||||
data = new FeaturePacket_761;
|
||||
|
||||
data->jaf.zone = MSI_ZONE_JAF;
|
||||
data->jargb1.zone = MSI_ZONE_JARGB_1;
|
||||
data->jargb2.zone = MSI_ZONE_JARGB_2;
|
||||
data->jargb3.zone = MSI_ZONE_JARGB_3;
|
||||
data->jaf.zone = MSI_ZONE_JAF;
|
||||
data->jargb1.zone = MSI_ZONE_JARGB_1;
|
||||
data->jargb2.zone = MSI_ZONE_JARGB_2;
|
||||
data->jargb3.zone = MSI_ZONE_JARGB_3;
|
||||
|
||||
data->jaf.packet.hdr0 = 0x08;
|
||||
data->jargb1.packet.hdr0 = 0x04;
|
||||
data->jargb2.packet.hdr0 = 0x04;
|
||||
data->jargb3.packet.hdr0 = 0x04;
|
||||
data->jaf.packet.hdr0 = 0x08;
|
||||
data->jargb1.packet.hdr0 = 0x04;
|
||||
data->jargb2.packet.hdr0 = 0x04;
|
||||
data->jargb3.packet.hdr0 = 0x04;
|
||||
|
||||
data->jaf.packet.hdr1 = 0x00;
|
||||
data->jargb1.packet.hdr1 = 0x00;
|
||||
data->jargb2.packet.hdr1 = 0x01;
|
||||
data->jargb3.packet.hdr1 = 0x02;
|
||||
data->jaf.packet.hdr1 = 0x00;
|
||||
data->jargb1.packet.hdr1 = 0x00;
|
||||
data->jargb2.packet.hdr1 = 0x01;
|
||||
data->jargb3.packet.hdr1 = 0x02;
|
||||
|
||||
init_packet(&data->jaf);
|
||||
init_packet(&data->jargb1);
|
||||
|
|
@ -330,31 +335,6 @@ bool MSIMysticLight761Controller::ReadFwVersion()
|
|||
return true;
|
||||
}
|
||||
|
||||
void MSIMysticLight761Controller::ReadName()
|
||||
{
|
||||
wchar_t tname[256];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Get the manufacturer string from HID |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_get_manufacturer_string(dev, tname, 256);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Convert to std::string |
|
||||
\*-----------------------------------------------------*/
|
||||
name = StringUtils::wstring_to_string(tname);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Get the product string from HID |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_get_product_string(dev, tname, 256);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Append the product string to the manufacturer string |
|
||||
\*-----------------------------------------------------*/
|
||||
name.append(" ").append(StringUtils::wstring_to_string(tname));
|
||||
}
|
||||
|
||||
MSI_MODE MSIMysticLight761Controller::GetMode()
|
||||
{
|
||||
return MSI_MODE_DIRECT_DUMMY;
|
||||
|
|
|
|||
|
|
@ -27,9 +27,11 @@ public:
|
|||
MSIMysticLight761Controller
|
||||
(
|
||||
hid_device* handle,
|
||||
const char *path,
|
||||
unsigned short pid
|
||||
const char* path,
|
||||
unsigned short pid,
|
||||
std::string dev_name
|
||||
);
|
||||
|
||||
~MSIMysticLight761Controller();
|
||||
|
||||
void SetMode
|
||||
|
|
@ -117,11 +119,17 @@ public:
|
|||
};
|
||||
|
||||
private:
|
||||
std::string name;
|
||||
std::vector<MSIMysticLight761Controller::ZoneConfig> zone_configs;
|
||||
std::vector<MSI_ZONE>* supported_zones;
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string version_APROM;
|
||||
std::string version_LDROM;
|
||||
FeaturePacket_761* data;
|
||||
|
||||
bool ReadSettings();
|
||||
bool ReadFwVersion();
|
||||
void ReadName();
|
||||
std::string name;
|
||||
std::vector<MSIMysticLight761Controller::ZoneConfig> zone_configs;
|
||||
|
||||
ZoneData* GetZoneData
|
||||
(
|
||||
|
|
@ -134,16 +142,4 @@ private:
|
|||
MSI_ZONE zone
|
||||
);
|
||||
void SelectPerLedProtocol();
|
||||
|
||||
std::vector<MSI_ZONE>* supported_zones;
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string version_APROM;
|
||||
std::string version_LDROM;
|
||||
FeaturePacket_761* data;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -47,9 +47,9 @@ static int IndexOfZoneForType(MSI_ZONE zone_type)
|
|||
RGBController_MSIMysticLight761::RGBController_MSIMysticLight761
|
||||
(
|
||||
MSIMysticLight761Controller* controller_ptr
|
||||
)
|
||||
)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetDeviceName();
|
||||
vendor = "MSI";
|
||||
|
|
|
|||
|
|
@ -50,35 +50,37 @@ void DetectMSIMysticLightControllers
|
|||
if(dev != nullptr)
|
||||
{
|
||||
unsigned char temp_buffer[200];
|
||||
temp_buffer[0] = 0x52;
|
||||
size_t packet_length = hid_get_feature_report(dev, temp_buffer, 200);
|
||||
DMIInfo dmi;
|
||||
temp_buffer[0] = 0x52;
|
||||
|
||||
if((packet_length >= sizeof(FeaturePacket_185)) && (packet_length <= (sizeof(FeaturePacket_185) + 1))) //WHY r we doing this ? why not ==
|
||||
size_t packet_length = hid_get_feature_report(dev, temp_buffer, 200);
|
||||
|
||||
DMIInfo dmi;
|
||||
std::string dmi_name = "MSI " + dmi.getMainboard();
|
||||
|
||||
if((packet_length >= sizeof(FeaturePacket_185)) && (packet_length <= (sizeof(FeaturePacket_185) + 1))) //WHY r we doing this ? why not ==
|
||||
{
|
||||
MSIMysticLight185Controller* controller = new MSIMysticLight185Controller(dev, info->path, info->product_id);
|
||||
MSIMysticLight185Controller* controller = new MSIMysticLight185Controller(dev, info->path, info->product_id, dmi_name);
|
||||
RGBController_MSIMysticLight185* rgb_controller = new RGBController_MSIMysticLight185(controller);
|
||||
rgb_controller->name = "MSI " + dmi.getMainboard();
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
else if((packet_length >= sizeof(FeaturePacket_162)) && (packet_length <= (sizeof(FeaturePacket_162) + 1)))
|
||||
{
|
||||
MSIMysticLight162Controller* controller = new MSIMysticLight162Controller(dev, info->path, info->product_id);
|
||||
MSIMysticLight162Controller* controller = new MSIMysticLight162Controller(dev, info->path, info->product_id, dmi_name);
|
||||
RGBController_MSIMysticLight162* rgb_controller = new RGBController_MSIMysticLight162(controller);
|
||||
rgb_controller->name = "MSI " + dmi.getMainboard();
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
else if((packet_length >= sizeof(FeaturePacket_112)) && (packet_length <= (sizeof(FeaturePacket_112) + 1)))
|
||||
{
|
||||
MSIMysticLight112Controller* controller = new MSIMysticLight112Controller(dev, info->path);
|
||||
MSIMysticLight112Controller* controller = new MSIMysticLight112Controller(dev, info->path, dmi_name);
|
||||
RGBController_MSIMysticLight112* rgb_controller = new RGBController_MSIMysticLight112(controller);
|
||||
rgb_controller->name = "MSI " + dmi.getMainboard();
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
else // no supported length returned
|
||||
{
|
||||
|
||||
unsigned char second_buffer [1000];
|
||||
unsigned char second_buffer[1000];
|
||||
second_buffer[0] = 0x51;
|
||||
|
||||
for(int i = 1; i < 1000; i++)
|
||||
|
|
@ -88,25 +90,23 @@ void DetectMSIMysticLightControllers
|
|||
|
||||
size_t packet_length_new_attempt = hid_get_feature_report(dev, second_buffer, 1000);
|
||||
|
||||
if(packet_length_new_attempt >=290 && packet_length_new_attempt <= 291)
|
||||
if(packet_length_new_attempt >=290 && packet_length_new_attempt <= 291)
|
||||
{
|
||||
MSIMysticLight761Controller* controller = new MSIMysticLight761Controller(dev, info->path, info->product_id);
|
||||
MSIMysticLight761Controller* controller = new MSIMysticLight761Controller(dev, info->path, info->product_id, dmi_name);
|
||||
RGBController_MSIMysticLight761* rgb_controller = new RGBController_MSIMysticLight761(controller);
|
||||
rgb_controller->name = "MSI " + dmi.getMainboard();
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string name = "MSI " + dmi.getMainboard();
|
||||
LOG_INFO("No matching driver found for %s, packet length = %d", name.c_str(), packet_length);
|
||||
LOG_INFO("No matching driver found for %s, packet length = %d", dmi_name.c_str(), packet_length);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DetectMSIMysticLight64Controllers
|
||||
(
|
||||
hid_device_info* info,
|
||||
|
|
@ -114,10 +114,12 @@ void DetectMSIMysticLight64Controllers
|
|||
)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev != nullptr)
|
||||
{
|
||||
MSIMysticLight64Controller* controller = new MSIMysticLight64Controller(dev, info->path);
|
||||
RGBController_MSIMysticLight64* rgb_controller = new RGBController_MSIMysticLight64(controller);
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue