Fix for Gigabyte Fusion2 USB detection

* Adjusted the selection criteria for  USE_HID_USAGE flags
* Slight changes to the Fusion2USB controller to avoid crashes
* Updated DMIInfo to return correct Motherboard name on windows
This commit is contained in:
Chris
2020-07-24 14:47:46 +10:00
committed by Adam Honse
parent 38b2cf03b0
commit 8b5717470a
3 changed files with 12 additions and 10 deletions

View File

@@ -29,14 +29,15 @@ static LEDCount LedCountToEnum(unsigned int c)
RGBFusion2USBController::RGBFusion2USBController(hid_device* handle, const char *path, std::string mb_name) : dev(handle)
{
int res = 0;
char text[64] {};
unsigned char buffer[64] {};
if( dev ) {
int res = 0;
char text[64] = { 0x00 };
unsigned char buffer[64] = { 0x00 };
if( dev )
{
SetCalibration();
name = mb_name;
// hid report read needs 0x60 packet or it gives IO error
SendPacket(0x60, 0x00);
@@ -46,9 +47,8 @@ RGBFusion2USBController::RGBFusion2USBController(hid_device* handle, const char
{
report = *reinterpret_cast<IT8297Report*>(buffer);
name = mb_name;
description = std::string(report.str_product, 32);
description.erase(std::find(name.begin(), name.end(), '\0'), name.end());
//description.erase(std::find(description.begin(), description.end(), '\0'), name.end());
snprintf(text, 11, "0x%08X", report.fw_ver);
version = text;
@@ -56,7 +56,6 @@ RGBFusion2USBController::RGBFusion2USBController(hid_device* handle, const char
snprintf(text, 11, "0x%08X", report.chip_id);
chip_id = text;
}
loc = path;
EnableBeat(false);

View File

@@ -4,6 +4,7 @@
#define IT8297_VID 0x048D
#define IT8297_IFC 0
#define IT8297_U 0xCC
#define IT8297_UPG 0xFF89
#define COUNT_RGBFUSION2_PIDS (sizeof(RGBFusion2_pids) / sizeof(RGBFusion2_pids[ 0 ]))
@@ -43,11 +44,12 @@ void DetectRGBFusion2USBControllers(std::vector<RGBController*> &rgb_controllers
while(info)
{
if((info->vendor_id == IT8297_VID)
&& (info->interface_number == IT8297_IFC)
#ifdef USE_HID_USAGE
&&(info->product_id == tmpPID)
&&(info->usage == IT8297_U) //Usage and usage page required to get the correct interface
&&(info->usage_page == IT8297_UPG))
#else
&&(info->interface_number == IT8297_IFC) //Interface is only valid on Windows where there is > 1 interface
&&(info->product_id == tmpPID))
#endif
{
@@ -57,6 +59,7 @@ void DetectRGBFusion2USBControllers(std::vector<RGBController*> &rgb_controllers
RGBFusion2USBController * controller = new RGBFusion2USBController(dev, info->path, MB_info.getMainboard());
RGBController_RGBFusion2USB * rgb_controller = new RGBController_RGBFusion2USB(controller);
rgb_controllers.push_back(rgb_controller);
break;
}
}
info = info->next;

View File

@@ -42,7 +42,7 @@ DMIInfo::DMIInfo()
for (QueryObj &i : q_res_BaseBoard)
{
manufacturer = i["Manufacturer"].c_str();
mainboard = i["Model"].c_str();
mainboard = i["Product"].c_str();
}
}
#else /* WIN32 */