Merge rework of IT8297, IT5702, IT5711 driver code. Adds new controller IT82950.

This commit is contained in:
Daniel Clark 2025-08-18 19:46:00 +00:00 committed by Adam Honse
parent 1be1656ce8
commit 503ad36256
9 changed files with 3598 additions and 1128 deletions

View file

@ -4,6 +4,7 @@
| Driver for Gigabyte Aorus RGB Fusion 2 USB motherboard |
| |
| jackun 08 Jan 2020 |
| megadjc 31 Jul 2025 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-only |
@ -14,6 +15,7 @@
#include "SettingsManager.h"
/*-------------------------------------------------------------------------*\
| Low level RGB value conversion table |
| This is stored as a uint32_t in the chip so is trasmitted LSB to MSB |
| Therefore the numbers represent the index where the controller will find |
| respective colour in a regular packet |
@ -28,14 +30,9 @@ static RGBCalibration GigabyteCalibrationsLookup
{ "RBG", {{{0x01, 0x02, 0x00, 0x00}}}}
};
static calibration GigabyteBoardCalibration
{
{ "D_LED1", "GRB" },
{ "D_LED2/D_LED3", "GRB" },
{ "Mainboard", "BGR" },
{ "Spare", "BGR" }
};
/*---------------------------------------------------------*\
| Converts LED counts to divisions in hardware |
\*---------------------------------------------------------*/
static LEDCount LedCountToEnum(unsigned int c)
{
if(c <= 32)
@ -60,49 +57,21 @@ static LEDCount LedCountToEnum(unsigned int c)
}
}
RGBFusion2USBController::RGBFusion2USBController(hid_device* handle, const char *path, std::string mb_name, uint16_t pid) : dev(handle), product_id(pid)
RGBFusion2USBController::RGBFusion2USBController(hid_device* handle, const char* path, std::string mb_name, uint16_t pid): dev(handle), product_id(pid)
{
int res = 0;
char text[64] = { 0x00 };
unsigned char buffer[64] = { 0x00 };
if(dev)
name = mb_name;
location = path;
if(!RefreshHardwareInfo())
{
SetCalibration();
name = mb_name;
/*---------------------------------------------------------*\
| HID report read needs 0x60 packet or it gives IO error |
\*---------------------------------------------------------*/
SendPacket(0x60, 0x00);
buffer[0] = report_id;
res = hid_get_feature_report(dev, buffer, 64);
if(res > 0)
{
report = *reinterpret_cast<IT8297Report*>(buffer);
description = std::string(report.str_product, 32);
description.erase(std::find(description.begin(), description.end(), '\0'), description.end());
snprintf(text, 11, "0x%08X", report.fw_ver);
version = text;
snprintf(text, 11, "0x%08X", report.chip_id);
chip_id = text;
D_LED1_count = LedCountToEnum(report.curr_led_count_low & 0x0F);
D_LED2_count = LedCountToEnum((report.curr_led_count_low >> 4) & 0x0F);
D_LED3_count = LedCountToEnum(report.curr_led_count_high & 0x0F);
}
location = path;
ResetController(pid);
EnableBeat(false);
return;
}
if(report.support_cmd_flag >= 0x02)
{
EnableLampArray(false);
}
ResetController();
EnableBeat(false);
}
RGBFusion2USBController::~RGBFusion2USBController()
@ -110,141 +79,382 @@ RGBFusion2USBController::~RGBFusion2USBController()
hid_close(dev);
}
/*---------------------------------------------------------*\
| Read configuration data from hardware. |
| Returns false if read fails. |
\*---------------------------------------------------------*/
bool RGBFusion2USBController::RefreshHardwareInfo()
{
unsigned char buffer[64] = {0};
SendPacket(0x60, 0x00);
buffer[0] = report_id;
int res = hid_get_feature_report(dev, buffer, sizeof(buffer));
if(res < static_cast<int>(sizeof(IT8297Report)))
{
report_loaded = false;
return false;
}
std::memcpy(&report, buffer, sizeof(IT8297Report));
report_loaded = true;
description = std::string(report.str_product, 28);
if(std::string::iterator nul = std::find(description.begin(), description.end(), '\0');
nul != description.end())
{
description.erase(nul, description.end());
}
{
char text[32]{};
uint32_t fw_ver = ((report.fw_ver & 0x000000FFu) << 24)
| ((report.fw_ver & 0x0000FF00u) << 8)
| ((report.fw_ver & 0x00FF0000u) >> 8)
| ((report.fw_ver & 0xFF000000u) >> 24);
uint8_t b0 = static_cast<uint8_t>((fw_ver >> 24) & 0xFFu);
uint8_t b1 = static_cast<uint8_t>((fw_ver >> 16) & 0xFFu);
uint8_t b2 = static_cast<uint8_t>((fw_ver >> 8) & 0xFFu);
uint8_t b3 = static_cast<uint8_t>( fw_ver & 0xFFu);
std::snprintf(text, sizeof(text), "%u.%u.%u.%u", b0, b1, b2, b3);
version = text;
std::snprintf(text, sizeof(text), "0x%08X", report.chip_id);
chip_id = text;
}
D_LED1_count = LedCountToEnum(report.curr_led_count_low & 0x0F);
D_LED2_count = LedCountToEnum((report.curr_led_count_low >> 4) & 0x0F);
D_LED3_count = LedCountToEnum(report.curr_led_count_high & 0x0F);
D_LED4_count = LedCountToEnum((report.curr_led_count_high >> 4) & 0x0F);
cal_data.dled[0] = report.cal_strip0;
cal_data.dled[1] = report.cal_strip1;
cal_data.mainboard = report.rgb_cali;
cal_data.spare[0] = report.cal_spare0;
cal_data.spare[1] = report.cal_spare1;
cali_loaded = false;
if(product_id == 0x5711)
{
unsigned char buffer2[64] = {0};
SendPacket(0x61, 0x00);
buffer2[0] = report_id;
int res2 = hid_get_feature_report(dev, buffer2, sizeof(buffer2));
if(res2 >= static_cast<int>(sizeof(IT5711Calibration)))
{
std::memcpy(&cali, buffer2, sizeof(IT5711Calibration));
cali_loaded = true;
cal_data.dled[2] = cali.cal_strip2;
cal_data.dled[3] = cali.cal_strip3;
cal_data.spare[2] = cali.cal_spare2;
cal_data.spare[3] = cali.cal_spare3;
}
else
{
cal_data.dled[2] = 0;
cal_data.dled[3] = 0;
cal_data.spare[2] = 0;
cal_data.spare[3] = 0;
cali_loaded = false;
}
}
else
{
cal_data.dled[2] = 0;
cal_data.dled[3] = 0;
cal_data.spare[2] = 0;
cal_data.spare[3] = 0;
}
return report_loaded;
}
void RGBFusion2USBController::SetMode(int m)
{
mode = m;
}
RGBA RGBFusion2USBController::GetCalibration(std::string rgb_order)
std::string RGBFusion2USBController::DecodeCalibrationBuffer(uint32_t value) const
{
/*-------------------------------------------------*\
| Check for RGB order string in calibration table |
| If not found return the "BGR" calibration |
\*-------------------------------------------------*/
if(GigabyteCalibrationsLookup.count(rgb_order))
if(value==0) return "OFF";
uint8_t bo_b = value & 0xFF;
uint8_t bo_g = (value >> 8) & 0xFF;
uint8_t bo_r = (value >> 16) & 0xFF;
bool in_range = (bo_r<3 && bo_g<3 && bo_b<3);
bool distinct = (bo_r!=bo_g && bo_r!=bo_b && bo_g!=bo_b);
if(in_range && distinct)
{
return GigabyteCalibrationsLookup.find(rgb_order)->second;
std::string out(3, '?');
out[bo_r] = 'R';
out[bo_g] = 'G';
out[bo_b] = 'B';
return out;
}
return "BAD";
}
uint32_t RGBFusion2USBController::EncodeCalibrationBuffer(const std::string& rgb_order)
{
if(rgb_order.empty())
{
return 0u;
}
std::string key = rgb_order;
std::transform(key.begin(), key.end(), key.begin(),
[](unsigned char c){ return char(std::toupper(c)); });
if(key=="OFF" || key=="0")
{
return 0u;
}
RGBCalibration::const_iterator it = GigabyteCalibrationsLookup.find(key);
if(it == GigabyteCalibrationsLookup.end())
{
return 0u;
}
const RGBA &rgb_cal = it->second;
return (uint32_t(rgb_cal.raw[0]))
| (uint32_t(rgb_cal.raw[1]) << 8)
| (uint32_t(rgb_cal.raw[2]) << 16)
| (uint32_t(rgb_cal.raw[3]) << 24);
}
EncodedCalibration RGBFusion2USBController::GetCalibration(bool refresh_from_hw)
{
if(refresh_from_hw || !report_loaded || (product_id == 0x5711 && !cali_loaded))
{
if(!RefreshHardwareInfo())
{
return EncodedCalibration{};
}
}
EncodedCalibration out{};
out.dled[0] = DecodeCalibrationBuffer(cal_data.dled[0]);
out.dled[1] = DecodeCalibrationBuffer(cal_data.dled[1]);
out.spare[0] = DecodeCalibrationBuffer(cal_data.spare[0]);
out.spare[1] = DecodeCalibrationBuffer(cal_data.spare[1]);
out.mainboard = DecodeCalibrationBuffer(cal_data.mainboard);
if(product_id == 0x5711)
{
out.dled[2] = DecodeCalibrationBuffer(cal_data.dled[2]);
out.dled[3] = DecodeCalibrationBuffer(cal_data.dled[3]);
out.spare[2] = DecodeCalibrationBuffer(cal_data.spare[2]);
out.spare[3] = DecodeCalibrationBuffer(cal_data.spare[3]);
}
else
{
return GigabyteCalibrationsLookup.find("BGR")->second;
out.dled[2] = "OFF";
out.dled[3] = "OFF";
out.spare[2] = "OFF";
out.spare[3] = "OFF";
}
return out;
}
void RGBFusion2USBController::SetCalibrationBuffer(std::string rgb_order, uint8_t* buffer, uint8_t offset)
bool RGBFusion2USBController::SetCalibration(const EncodedCalibration& cal, bool refresh_from_hw)
{
RGBA rgb_cal;
int raw_size = sizeof(rgb_cal.raw) / sizeof(rgb_cal.raw[0]);
rgb_cal = GetCalibration(rgb_order);
for(int i = 0; i < raw_size; i++)
if(refresh_from_hw)
{
buffer[offset + i] = rgb_cal.raw[i];
if(!RefreshHardwareInfo())
{
return false;
}
}
if(EncodeCalibrationBuffer(cal.dled[0]) == cal_data.dled[0]
&& EncodeCalibrationBuffer(cal.dled[1]) == cal_data.dled[1]
&& EncodeCalibrationBuffer(cal.mainboard) == cal_data.mainboard
&& EncodeCalibrationBuffer(cal.spare[0]) == cal_data.spare[0]
&& EncodeCalibrationBuffer(cal.spare[1]) == cal_data.spare[1]
&& (product_id != 0x5711
|| (EncodeCalibrationBuffer(cal.dled[2]) == cal_data.dled[2]
&& EncodeCalibrationBuffer(cal.dled[3]) == cal_data.dled[3]
&& EncodeCalibrationBuffer(cal.spare[2]) == cal_data.spare[2]
&& EncodeCalibrationBuffer(cal.spare[3]) == cal_data.spare[3])))
{
return true;
}
CMD_0x33 desired{};
std::memset(&desired, 0, sizeof(desired));
desired.report_id = report_id;
desired.command_id = 0x33;
desired.d_strip_c0 = EncodeCalibrationBuffer(cal.dled[0]);
desired.d_strip_c1 = EncodeCalibrationBuffer(cal.dled[1]);
desired.rgb_cali = EncodeCalibrationBuffer(cal.mainboard);
desired.c_spare0 = EncodeCalibrationBuffer(cal.spare[0]);
desired.c_spare1 = EncodeCalibrationBuffer(cal.spare[1]);
if(product_id == 0x5711)
{
desired.d_strip_c2 = EncodeCalibrationBuffer(cal.dled[2]);
desired.d_strip_c3 = EncodeCalibrationBuffer(cal.dled[3]);
desired.c_spare2 = EncodeCalibrationBuffer(cal.spare[2]);
desired.c_spare3 = EncodeCalibrationBuffer(cal.spare[3]);
}
std::memset(desired.reserved, 0, sizeof(desired.reserved));
int rc = SendPacket(reinterpret_cast<unsigned char*>(&desired));
if(rc < 0)
{
return false;
}
ResetController();
std::this_thread::sleep_for(std::chrono::milliseconds(20));
SaveCalState();
std::this_thread::sleep_for(std::chrono::milliseconds(20));
cal_data.dled[0] = desired.d_strip_c0;
cal_data.dled[1] = desired.d_strip_c1;
cal_data.mainboard = desired.rgb_cali;
cal_data.spare[0] = desired.c_spare0;
cal_data.spare[1] = desired.c_spare1;
if(product_id == 0x5711)
{
cal_data.dled[2] = desired.d_strip_c2;
cal_data.dled[3] = desired.d_strip_c3;
cal_data.spare[2] = desired.c_spare2;
cal_data.spare[3] = desired.c_spare3;
}
else
{
cal_data.dled[2] = 0u;
cal_data.dled[3] = 0u;
cal_data.spare[2] = 0u;
cal_data.spare[3] = 0u;
}
return true;
}
/*---------------------------------------------------------------------------------------------*\
| Sets RGB color mapping to LED pins. |
| "Custom" RGB packets don't seem to get remapped so use report.byteorderN and do it manually. |
| Of course it all depends how we send data to the controller, but bios/rgb fusion 2 itself |
| set it up like this. |
\*---------------------------------------------------------------------------------------------*/
void RGBFusion2USBController::SetCalibration()
void RGBFusion2USBController::SetLedCount(unsigned int c0, unsigned int c1, unsigned int c2, unsigned int c3)
{
const std::string detector_name = "Gigabyte RGB Fusion 2 USB";
const std::string json_cal = "Calibration";
SettingsManager* settings_manager = ResourceManager::get()->GetSettingsManager();
json device_settings = settings_manager->GetSettings(detector_name);
new_d1 = LedCountToEnum(c0);
new_d2 = LedCountToEnum(c1);
new_d3 = LedCountToEnum(c2);
new_d4 = LedCountToEnum(c3);
/*---------------------------------------------------------*\
| Get Layouts from the settings manager |
| If Calibration settings are not found then write them out |
| Calibration will only be executed if it is explicitly |
| enabled by the user |
| *Note IT5711 calibration is only partially functional. |
| *Use Calibration at your own risk. |
\*---------------------------------------------------------*/
if(!device_settings.contains(json_cal))
if(new_d1 == D_LED1_count && new_d2 == D_LED2_count && new_d3 == D_LED3_count && new_d4 == D_LED4_count)
{
device_settings[json_cal]["Enabled"] = false;
device_settings[json_cal]["Data"] = GigabyteBoardCalibration;
settings_manager->SetSettings(detector_name, device_settings);
settings_manager->SaveSettings();
return;
}
else if(device_settings[json_cal]["Enabled"])
{
GigabyteBoardCalibration["D_LED1"] = device_settings[json_cal]["Data"]["D_LED1"];
GigabyteBoardCalibration["D_LED2/D_LED3"] = device_settings[json_cal]["Data"]["D_LED2/D_LED3"];
GigabyteBoardCalibration["Mainboard"] = device_settings[json_cal]["Data"]["Mainboard"];
GigabyteBoardCalibration["Spare"] = device_settings[json_cal]["Data"]["Spare"];
uint8_t buffer[64] = { 0x00 };
buffer[0] = report_id;
buffer[1] = 0x33;
D_LED1_count = new_d1;
D_LED2_count = new_d2;
D_LED3_count = new_d3;
D_LED4_count = new_d4;
SetCalibrationBuffer(GigabyteBoardCalibration["D_LED1"], buffer, 2);
SetCalibrationBuffer(GigabyteBoardCalibration["D_LED2/D_LED3"], buffer, 6);
SetCalibrationBuffer(GigabyteBoardCalibration["Mainboard"], buffer, 10);
SetCalibrationBuffer(GigabyteBoardCalibration["Spare"], buffer, 14);
SendPacket(buffer);
}
}
void RGBFusion2USBController::SetLedCount(unsigned int led, unsigned int count)
{
/*-----------------------------------------------------------------*\
| Check which Digital LED we're setting then send the value of each |
\*-----------------------------------------------------------------*/
if(led == HDR_D_LED1)
{
D_LED1_count = LedCountToEnum(count);
}
else if(led == HDR_D_LED2)
{
D_LED2_count = LedCountToEnum(count);
}
else if(led == HDR_D_LED3)
{
D_LED3_count = LedCountToEnum(count);
}
unsigned char buffer[64] = { 0 };
buffer[0] = report_id; // 0xCC
buffer[1] = 0x34; // CC34 command
buffer[2] = (D_LED2_count << 4) | D_LED1_count;
buffer[3] = D_LED3_count;
SendPacket(buffer); // Send full HID feature report
buffer[0] = report_id;
buffer[1] = 0x34;
buffer[2] = (new_d2 << 4) | new_d1;
buffer[3] = (new_d4 << 4) | new_d3;
SendPacket(buffer);
}
bool RGBFusion2USBController::DisableBuiltinEffect(int enable_bit, int mask)
/*---------------------------------------------------------*\
| Switch ARGB header mode (single/addressable) |
\*---------------------------------------------------------*/
bool RGBFusion2USBController::SetStripBuiltinEffectState(int hdr, bool enable)
{
if(effect_disabled & enable_bit)
static bool first_call = true;
int bitmask = 0;
if(hdr == -1)
{
return(true);
bitmask = 0x01 | 0x02 | 0x08 | 0x10;
}
else
{
switch(hdr)
{
case LED4:
case HDR_D_LED2:
case HDR_D_LED2_RGB:
bitmask = 0x02;
break;
case HDR_D_LED3:
case HDR_D_LED3_RGB:
bitmask = 0x08;
break;
case HDR_D_LED4:
case HDR_D_LED4_RGB:
bitmask = 0x10;
break;
default:
bitmask = 0x01;
break;
}
}
effect_disabled &= ~mask;
effect_disabled |= enable_bit;
int new_effect_disabled = enable
? (effect_disabled & ~bitmask)
: (effect_disabled | bitmask);
if(!first_call && new_effect_disabled == effect_disabled)
{
return true;
}
first_call = false;
effect_disabled = new_effect_disabled;
int res = SendPacket(0x32, effect_disabled);
/*-----------------------------------------------------------------*\
| Sometimes effect doesn't apply at first, delay a little and let |
| MCU react, if this packet is the cause |
\*-----------------------------------------------------------------*/
std::this_thread::sleep_for(std::chrono::milliseconds(50));
return res;
}
/*---------------------------------------------------------*\
| Persist LED config data |
\*---------------------------------------------------------*/
bool RGBFusion2USBController::SaveLEDState(bool e)
{
return SendPacket(0x47, e ? 1 : 0);
}
/*---------------------------------------------------------*\
| Persist calibration |
\*---------------------------------------------------------*/
bool RGBFusion2USBController::SaveCalState()
{
return SendPacket(0x5E, 0);
}
/*---------------------------------------------------------*\
| Set beat mode (hardware audio sync mode) |
\*---------------------------------------------------------*/
bool RGBFusion2USBController::EnableBeat(bool e)
{
return SendPacket(0x31, e ? 1 : 0);
}
/*---------------------------------------------------------*\
| Set Lamp Array mode (MSDL) |
\*---------------------------------------------------------*/
bool RGBFusion2USBController::EnableLampArray(bool enable)
{
return SendPacket(0x48, enable ? 1 : 0);
}
std::string RGBFusion2USBController::GetDeviceName()
{
return(name);
@ -270,30 +480,45 @@ std::string RGBFusion2USBController::GetSerial()
return(chip_id);
}
void RGBFusion2USBController::SetStripColors
(
unsigned int hdr,
RGBColor * colors,
unsigned int num_colors,
int single_led
)
/*---------------------------------------------------------*\
| PID (controller feature support) |
\*---------------------------------------------------------*/
uint16_t RGBFusion2USBController::GetProductID()
{
return (product_id);
}
/*---------------------------------------------------------*\
| Low level controller number (multi-controller) |
\*---------------------------------------------------------*/
uint8_t RGBFusion2USBController::GetDeviceNum()
{
return (device_num);
}
/*---------------------------------------------------------*\
| Set ARGB strips (addressable) |
\*---------------------------------------------------------*/
void RGBFusion2USBController::SetStripColors(unsigned int hdr, RGBColor* colors, unsigned int num_colors, int single_led)
{
PktRGB pkt;
pkt.Init(hdr, report_id);
/*------------------------------------------------------------------------------------*\
| byte order is correct for it5711 though there is more work to do. |
| For IT5711 defaults to byteorder1/2 for LED strips (Current Behavior is Functional) |
\*------------------------------------------------------------------------------------*/
uint32_t byteorder;
if(hdr == HDR_D_LED1_RGB)
switch(pkt.s.header)
{
byteorder = report.byteorder1;
}
else
{
byteorder = report.byteorder2;
case HDR_D_LED2_RGB:
byteorder = cal_data.dled[1];
break;
case HDR_D_LED3_RGB:
byteorder = cal_data.dled[2];
break;
case HDR_D_LED4_RGB:
byteorder = cal_data.dled[3];
break;
default:
byteorder = cal_data.dled[0];
break;
}
unsigned char bo_r = byteorder >> 16;
@ -306,10 +531,6 @@ void RGBFusion2USBController::SetStripColors
int k = 0;
int leds_in_pkt = sizeof(pkt.s.leds) / sizeof(*pkt.s.leds); /* 19 */
/*-------------------------------------------------------------------------*\
| Other leds stay at whatever the builtin effect was doing at that moment |
| if breathing/pulse effect faded out then they stay dark |
\*-------------------------------------------------------------------------*/
if(single_led > -1)
{
leds_left = 1;
@ -347,140 +568,123 @@ void RGBFusion2USBController::SetStripColors
return;
}
}
if(hdr == HDR_D_LED1_RGB)
{
DisableBuiltinEffect(0x01, 0x01);
}
else if(hdr == HDR_D_LED2_RGB)
{
DisableBuiltinEffect(0x02, 0x02);
}
else if(hdr == HDR_D_LED3_RGB)
{
DisableBuiltinEffect(0x08, 0x08);
}
}
static const std::array< std::array<int, 3>, 5> speeds =
{
{
{1600, 1600, 200},
{1200, 1200, 200},
{800, 800, 200},
{400, 400, 200},
{200, 200, 200},
},
};
void RGBFusion2USBController::SetLEDEffect(unsigned int led, int mode, unsigned int speed, unsigned char brightness, bool random, unsigned char r, unsigned char g, unsigned char b)
/*---------------------------------------------------------*\
| Set hardware effects (single) |
| Note: Effects paramters match that of gigabyte software. |
| -(2)Gigabyte breathe ranges are 400-1000ms in 100ms steps |
| and 1000-1600ms in 200ms steps |
| -(3)Gigabyte flash ranges are 600-2400ms in 200ms steps |
| -(4)Gigabyte color cycle ranges are 300-2400ms for period0|
| and 100-2200ms for period1 in 100ms steps. |
| the follow this trend between 300-1100/100-1000ms |
| then jump to 2400ms and 2200ms respective on speed 9. |
| -(6)Gigabyte Wave ranges are 30-300ms in steps following |
| the following formula. 2.5(s+1)^2 + 2.5(s+1) + 25. |
| -(15)Gigabyte dflash ranges are 800-2600ms in 200ms steps |
| -(3)(15)flash and dflash parameters were combined. |
\*---------------------------------------------------------*/
void RGBFusion2USBController::SetLEDEffect(int led, int mode, unsigned int speed, unsigned char brightness, bool random, unsigned char r, unsigned char g, unsigned char b)
{
PktEffect pkt;
pkt.Init(led, report_id);
/*-------------------------------------------------------------------------*\
| Add handling for different parts of the controller |
| IT8297, IT5702, and IT5711 seems to only support 5 levels of brightness |
\*-------------------------------------------------------------------------*/
if(led >= 0x20 && led <= 0x27)
pkt.Init(led, report_id, product_id);
if(led == -1)
{
pkt.e.zone0 = static_cast<uint32_t>(1 << (led - 0x20));
effect_zone_mask = pkt.e.zone0;
}
else if(led >= 0x90 && led <= 0x92)
else if((effect_zone_mask & pkt.e.zone0) == 0)
{
pkt.e.zone0 = static_cast<uint32_t>(1 << (led - 0x90));
effect_zone_mask |= pkt.e.zone0;
}
pkt.e.effect_type = mode;
pkt.e.color0 = r << 16 | g << 8 | b;
/*--------------------------------------------------------------------*\
| Adjust brightness for 0x20-0x27 and 0x90-0x92 |
| Brightness values supported are as follows: |
| 0xFF = Max Brightness |
| 0xB3 = -1 Brightness |
| 0x80 = -2 Brightness |
| 0x4D = -3 Brightness |
| 0x1a = -4 Brightness |
| 0x00 = Min Brightness |
\*--------------------------------------------------------------------*/
if(brightness == 0)
pkt.e.max_brightness = 0x00;
else if(brightness == 1)
pkt.e.max_brightness = 0x1A;
else if(brightness == 2)
pkt.e.max_brightness = 0x4D;
else if(brightness == 3)
pkt.e.max_brightness = 0x80;
else if(brightness == 4)
pkt.e.max_brightness = 0xB3;
else
pkt.e.max_brightness = 0xFF;
pkt.e.max_brightness = brightness;
pkt.e.effect_type = mode;
pkt.e.color0 = r << 16 | g << 8 | b;
switch(mode)
{
case 0: // Direct
case 1: // Static zero out other effect parameters (IT5711 needs this)
pkt.e.period0 = 0;
pkt.e.period1 = 0;
pkt.e.period2 = 0;
pkt.e.period3 = 0;
pkt.e.effect_param0 = 0;
pkt.e.effect_param1 = 0;
pkt.e.effect_param2 = 0;
pkt.e.effect_param3 = 0;
break;
case 2: //Breathing
case 3: //Blink
case 4: // Color Cycle
if(speed < speeds.size())
{
const std::array<int, 3>& s = speeds[speed];
pkt.e.period0 = s[0];
pkt.e.period1 = s[1];
pkt.e.period2 = s[2];
}
if(random)
{
pkt.e.effect_param0 = 7; // cycle through up to 7 (max?) colors
}
break;
// "Fake" effects
case 10: // flashing, flashing color cycle
pkt.e.period0 = 200;
pkt.e.period1 = 200;
pkt.e.period2 = 5000 - 1000 * speed; // time between flashing, doesn't seem to be affected by period0/period1
pkt.e.effect_type = 3;
pkt.e.effect_param2 = 2; // flash twice
case 2:
pkt.e.period0 = pkt.e.period1 = (speed <= 6) ? (400 + speed * 100) : (1000 + (speed - 6) * 200);
pkt.e.period2 = 200;
if(random)
{
pkt.e.effect_param0 = 7;
}
break;
}
/*----------------------------------------*\
| Adjust offset formatting for 0x90-0x92 |
\*----------------------------------------*/
if(led >= 0x90 && led <= 0x92)
{
pkt.buffer[1] = led;
pkt.buffer[2] = 0x00;
pkt.buffer[3] = 1 << (led - 0x90);
case 15:
pkt.e.effect_type = 3;
pkt.e.effect_param1 = 1;
pkt.e.effect_param2 = 2;
case 3:
pkt.e.period0 = 100;
pkt.e.period1 = 100;
pkt.e.period2 = (speed * 200) + 700;
if(random)
{
pkt.e.effect_param0 = 7;
}
break;
case 4:
pkt.e.period0 = (speed * 100 + 300) + (speed > 8 ? 1300 * (speed - 8) : 0);
pkt.e.period1 = pkt.e.period0 -200;
pkt.e.effect_param0 = 7;
break;
case 6:
pkt.e.period0 = ((speed + 1)^2 + (speed + 1) + 10) * 5 / 2;
pkt.e.effect_param0 = 7;
pkt.e.effect_param1 = 1;
break;
case 8:
pkt.e.period0 = 100;
pkt.e.effect_param0 = 1;
pkt.e.effect_param1 = 5;
break;
case 9:
pkt.e.period0 = 1200;
pkt.e.period1 = 100;
pkt.e.period2 = 360;
pkt.e.period3 = 1200;
break;
case 10:
pkt.e.period0 = 200;
pkt.e.effect_param0 = 7;
break;
case 11:
pkt.e.period0 = 840;
pkt.e.period1 = 20;
pkt.e.period2 = 200;
pkt.e.period3 = 840;
break;
case 12:
pkt.e.period0 = 200;
pkt.e.effect_param0 = 7;
break;
}
SendPacket(pkt.buffer);
}
/*--------------------------------------------------*\
| IT8297 and IT5702 seem happy with sending 0x28FF |
| IT5711 needs 0x28FF07 to work properly (?) |
\*--------------------------------------------------*/
bool RGBFusion2USBController::ApplyEffect()
/*---------------------------------------------------------*\
| Apply hardware effects (single) |
\*---------------------------------------------------------*/
bool RGBFusion2USBController::ApplyEffect(bool fast_apply)
{
return SendPacket(0x28, 0xFF, 0x07);
if(fast_apply)
{
if(product_id == 0x5711)
{
return SendPacket(0x28, 0xFF, 0x07);
}
else
{
return SendPacket(0x28, 0xFF, 0x00);
}
}
PktEffectApply pkt = {};
pkt.a.zone_sel0 = effect_zone_mask;
effect_zone_mask = 0;
return SendPacket(pkt.buffer());
}
bool RGBFusion2USBController::SendPacket(uint8_t a, uint8_t b, uint8_t c)
@ -500,28 +704,22 @@ int RGBFusion2USBController::SendPacket(unsigned char* packet)
return hid_send_feature_report(dev, packet, 64);
}
/*-----------------------------------------------------------------------------------------*\
| Init routine to zero out all registers before setting up the controllers. |
| This is required to prevent weird behaviors due to an inconsistent controller state. |
\*-----------------------------------------------------------------------------------------*/
void RGBFusion2USBController::ResetController(uint16_t pid)
/*---------------------------------------------------------*\
| Reset controller parameters |
\*---------------------------------------------------------*/
void RGBFusion2USBController::ResetController()
{
for(uint8_t reg = 0x20; reg <= 0x27; ++reg)
SendPacket(reg, 0x00, 0x00);
SendPacket(0x32, 0x00, 0x00);
SendPacket(0x34, 0x00, 0x00);
if(pid == 0x5711)
{
for(uint8_t reg = 0x90; reg <= 0x92; ++reg)
SendPacket(reg, 0x00, 0x00);
SendPacket(reg, 0x00, 0x00);
}
SendPacket(0x28, 0xFF, 0x07);
}
uint16_t RGBFusion2USBController::GetProductID() const
{
return product_id;
if(product_id == 0x5711)
{
for(uint8_t reg = 0x90; reg <= 0x92; ++reg)
{
SendPacket(reg, 0x00, 0x00);
}
}
ApplyEffect(true);
}

View file

@ -4,6 +4,7 @@
| Driver for Gigabyte Aorus RGB Fusion 2 USB motherboard |
| |
| jackun 08 Jan 2020 |
| megadjc 31 Jul 2025 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-only |
@ -20,50 +21,44 @@
#include <hidapi.h>
#include "RGBController.h"
#define GB_CALIBRATION_SIZE (sizeof(GB_Calibrations) / sizeof(GB_Calibrations[0]))
/*--------------------------------------------------------*\
| Base LED mappings found on all controllers. |
\*--------------------------------------------------------*/
const uint8_t LED1 = 0;
const uint8_t LED2 = 1;
const uint8_t LED3 = 2;
const uint8_t LED4 = 3;
const uint8_t LED5 = 4;
const uint8_t LED6 = 5;
const uint8_t LED7 = 6;
const uint8_t LED8 = 7;
/*-------------------------------------------------------------*\
| Standardising LED naming for external config layout |
\*-------------------------------------------------------------*/
const uint8_t LED1 = 0x20;
const uint8_t LED2 = 0x21;
const uint8_t LED3 = 0x22;
const uint8_t LED4 = 0x23;
const uint8_t LED5 = 0x24;
const uint8_t LED6 = 0x25;
const uint8_t LED7 = 0x26;
const uint8_t LED8 = 0x27;
/*-------------------------------------------------------------*\
| LED "headers" 0x20..0x27, As seen on Gigabyte X570 Elite board|
| Internal legacy shorthand naming and possibly deprecated |
\*-------------------------------------------------------------*/
const uint8_t HDR_BACK_IO = LED1;
const uint8_t HDR_CPU = LED2;
const uint8_t HDR_LED_2 = LED3;
const uint8_t HDR_PCIE = LED4;
const uint8_t HDR_LED_C1C2 = LED5;
/*--------------------------------------------------------*\
| IT8297/IT5701/IT5702 ARGB Headers |
\*--------------------------------------------------------*/
const uint8_t HDR_D_LED1 = LED6;
const uint8_t HDR_D_LED2 = LED7;
const uint8_t HDR_LED_7 = LED8;
/*-------------------------------------------------------------*\
| IT8297/IT5702 ARGB Headers |
\*-------------------------------------------------------------*/
const uint8_t HDR_D_LED1_RGB = 0x58;
const uint8_t HDR_D_LED2_RGB = 0x59;
/*-------------------------------------------------------------*\
| 0x62 & 0x90-92 found on the new IT5711 controller chip |
\*-------------------------------------------------------------*/
const uint8_t LED9 = 0x90;
const uint8_t LED10 = 0x91;
const uint8_t LED11 = 0x92;
const uint8_t HDR_D_LED3_RGB = 0x62;
/*------------------------------------------*\
|Defines new mapping for third argb header |
\*------------------------------------------*/
const uint8_t HDR_D_LED3 = LED8;
/*--------------------------------------------------------*\
| Additional LED mappings found on IT5711 controllers. |
\*--------------------------------------------------------*/
const uint8_t LED9 = 8;
const uint8_t LED10 = 9;
const uint8_t LED11 = 10;
/*--------------------------------------------------------*\
| IT5711 additional ARGB Headers. |
\*--------------------------------------------------------*/
const uint8_t HDR_D_LED3 = LED8;
const uint8_t HDR_D_LED4 = LED9;
const uint8_t HDR_D_LED3_RGB = 0x62;
const uint8_t HDR_D_LED4_RGB = 0x63;
/*---------------------------------------------------------*\
| Effects mode list |
\*---------------------------------------------------------*/
enum EffectType
{
EFFECT_NONE = 0,
@ -71,9 +66,19 @@ enum EffectType
EFFECT_PULSE = 2,
EFFECT_BLINKING = 3,
EFFECT_COLORCYCLE = 4,
EFFECT_WAVE = 6,
EFFECT_RANDOM = 8,
EFFECT_WAVE1 = 9,
EFFECT_WAVE2 = 10,
EFFECT_WAVE3 = 11,
EFFECT_WAVE4 = 12,
EFFECT_DFLASH = 15,
// to be continued...
};
/*---------------------------------------------------------*\
| Low level strip length divisions |
\*---------------------------------------------------------*/
enum LEDCount
{
LEDS_32 = 0,
@ -83,6 +88,9 @@ enum LEDCount
LEDS_1024,
};
/*---------------------------------------------------------*\
| Defines the RGB led data structure. |
\*---------------------------------------------------------*/
struct LEDs
{
uint8_t r;
@ -90,8 +98,62 @@ struct LEDs
uint8_t b;
};
/*---------------------------------------------------------*\
| Defines structure for low level calibration data. |
\*---------------------------------------------------------*/
struct CalibrationData
{
uint32_t dled[4] = {0};
uint32_t spare[4] = {0};
uint32_t mainboard = 0;
};
/*---------------------------------------------------------*\
| Defines structure for high level calibration data. |
\*---------------------------------------------------------*/
struct EncodedCalibration
{
std::string dled[4];
std::string spare[4];
std::string mainboard;
};
#pragma pack(push, 1)
/*---------------------------------------------------------*\
| Packet structure for applying effects |
\*---------------------------------------------------------*/
struct ApplyEffects
{
uint8_t report_id;
uint8_t command_id;
uint32_t zone_sel0;
uint32_t zone_sel1;
uint8_t padding[54];
ApplyEffects()
{
report_id = 0xCC;
command_id = 0x28;
zone_sel0 = 0;
zone_sel1 = 0;
std::memset(padding, 0, sizeof(padding));
}
};
struct PktEffectApply
{
ApplyEffects a;
uint8_t* buffer()
{
return reinterpret_cast<uint8_t*>(&a);
}
};
/*---------------------------------------------------------*\
| Single LED Calibration struct |
\*---------------------------------------------------------*/
struct RGBA
{
union
@ -110,6 +172,9 @@ struct RGBA
typedef std::map< std::string, RGBA > RGBCalibration;
typedef std::map< std::string, std::string> calibration;
/*---------------------------------------------------------*\
| Packet structure for ARGB headers (addressable) |
\*---------------------------------------------------------*/
union PktRGB
{
unsigned char buffer[64];
@ -117,7 +182,7 @@ union PktRGB
{
uint8_t report_id;
uint8_t header;
uint16_t boffset; // In bytes, absolute
uint16_t boffset;
uint8_t bcount;
LEDs leds[19];
uint16_t padding0;
@ -129,6 +194,22 @@ union PktRGB
void Init(uint8_t header, uint8_t report_id)
{
switch(header)
{
case LED4:
case HDR_D_LED2:
header = HDR_D_LED2_RGB;
break;
case HDR_D_LED3:
header = HDR_D_LED3_RGB;
break;
case HDR_D_LED4:
header = HDR_D_LED4_RGB;
break;
default:
header = HDR_D_LED1_RGB;
break;
}
s.report_id = report_id;
s.header = header;
s.boffset = 0;
@ -137,6 +218,17 @@ union PktRGB
}
};
/*---------------------------------------------------------*\
| Packet structure for hardware effects |
| Default values for Hardware Effects mode. |
| Old init values. |
| (All values 0 unless otherwise noted below) |
| e.color0 = 0x00FF2100; //orange |
| e.period1 = 1200; |
| e.period2 = 200; |
| e.period3 = 200; |
| e.effect_param2 = 1; |
\*---------------------------------------------------------*/
union PktEffect
{
unsigned char buffer[64];
@ -144,7 +236,7 @@ union PktEffect
{
uint8_t report_id;
uint8_t header;
uint32_t zone0; // RGB Fusion seems to set it to pow(2, header - 0x20)
uint32_t zone0; // RGB Fusion sets it to pow(2, led)
uint32_t zone1;
uint8_t reserved0;
uint8_t effect_type;
@ -167,65 +259,100 @@ union PktEffect
{
}
void Init(int header, uint8_t report_id)
void Init(int led, uint8_t report_id, uint16_t pid)
{
memset(buffer, 0, sizeof(buffer));
e.report_id = report_id;
if(header < 8)
if(led == -1)
{
e.header = 32 + header; // Set as default
e.zone0 = (pid == 0x5711) ? 0x07FF : 0xFF;
e.header = 0x20;
}
else if(led < 8)
{
e.zone0 = 1U << led;
e.header = 0x20 + led;
}
else if(led < 11)
{
e.zone0 = 1U << led;
e.header = 0x90 + (led - 8);
}
else
{
e.header = header;
e.zone0 = 0;
e.header = 0;
}
e.zone0 = (uint32_t)(1 << (e.header - 32));
e.effect_type = EFFECT_STATIC;
e.max_brightness = 255;
e.min_brightness = 0;
e.color0 = 0x00FF2100; //orange
e.color0 = 0;
e.period0 = 0; //Rising Timer - Needs to be 0 for "Direct"
e.period1 = 1200;
e.period2 = 200;
e.period3 = 200;
e.period1 = 0;
e.period2 = 0;
e.period3 = 0;
e.effect_param0 = 0; // ex color count to cycle through (max seems to be 7)
e.effect_param1 = 0;
e.effect_param2 = 1; // ex flash repeat count
e.effect_param2 = 0; // ex flash repeat count
e.effect_param3 = 0;
}
};
/*--------------------------------------------------------------------------------------*\
| Definitions for Initial controller response struct. |
| curr_led_count_high and curr_led_count_low contain the numbers of leds in each header. |
| Byte orders are little endian little-endian 0x00RRGGBB? |
| byteorder0 is location of "Spare" calibration location. |
| byteorder1 is location of "D_LED1" calibration location. |
| byteorder2 is location of "D_LED2/D_LED3" calibration location. |
| byteorder3 is location of "Mainboard" calibration location. |
| byteorder4 is location of fifth calibration location. |
| *Note that the calibration locations aren't fully understood yet for the IT5711. |
\*--------------------------------------------------------------------------------------*/
/*---------------------------------------------------------*\
| Basic Controller Init Struct |
\*---------------------------------------------------------*/
struct IT8297Report
{
uint8_t report_id;
uint8_t product;
uint8_t device_num;
uint8_t total_leds;
uint8_t report_id;
uint8_t product;
uint8_t device_num;
uint8_t strip_detect;
uint32_t fw_ver;
uint8_t curr_led_count_high;
uint8_t curr_led_count_low;
uint16_t reserved0;
char str_product[28];
uint32_t byteorder0;
uint32_t byteorder1;
uint32_t byteorder2;
uint32_t byteorder3;
uint8_t curr_led_count_high;
uint8_t curr_led_count_low;
uint8_t strip_ctrl_length1;
uint8_t support_cmd_flag;
char str_product[28];
uint32_t cal_spare0;
uint32_t cal_strip0;
uint32_t cal_strip1;
uint32_t rgb_cali;
uint32_t chip_id;
uint32_t byteorder4;
uint32_t cal_spare1;
};
/*---------------------------------------------------------*\
| CC61 Calibration Struct (For IT5711) |
\*---------------------------------------------------------*/
struct IT5711Calibration
{
uint8_t report_id;
uint8_t reserved[3];
uint32_t cal_strip2;
uint32_t cal_strip3;
uint32_t cal_spare2;
uint32_t cal_spare3;
uint8_t padding[44];
};
/*---------------------------------------------------------*\
| CC33 Set Calibration Struct |
\*---------------------------------------------------------*/
struct CMD_0x33
{
uint8_t report_id;
uint8_t command_id;
uint32_t d_strip_c0;
uint32_t d_strip_c1;
uint32_t rgb_cali;
uint32_t c_spare0;
uint32_t c_spare1;
uint32_t d_strip_c2;
uint32_t d_strip_c3;
uint32_t c_spare2;
uint32_t c_spare3;
uint8_t reserved[25];
};
#pragma pack(pop)
@ -236,39 +363,41 @@ public:
RGBFusion2USBController(hid_device* handle, const char *path, std::string mb_name, uint16_t pid);
~RGBFusion2USBController();
void SetStripColors
(
unsigned int hdr,
RGBColor * colors,
unsigned int num_colors,
int single_led = -1
);
void ResetController(uint16_t pid);
uint16_t GetProductID() const;
void SetLEDEffect(unsigned int led, int mode, unsigned int speed, unsigned char brightness, bool random, unsigned char red, unsigned char green, unsigned char blue);
void SetLedCount(unsigned int led, unsigned int count);
void SetMode(int mode);
bool ApplyEffect();
bool DisableBuiltinEffect(int enable_bit, int mask);
void SetCalibration();
std::string GetDeviceName();
std::string GetDeviceDescription();
std::string GetDeviceLocation();
std::string GetFWVersion();
std::string GetSerial();
bool RefreshHardwareInfo();
void ResetController();
uint16_t GetProductID();
uint8_t GetDeviceNum();
void SetStripColors(unsigned int hdr, RGBColor * colors, unsigned int num_colors, int single_led = -1);
void SetLEDEffect(int led, int mode, unsigned int speed, unsigned char brightness, bool random, unsigned char red, unsigned char green, unsigned char blue);
void SetLedCount(unsigned int c0, unsigned int c1, unsigned int c2, unsigned int c3);
void SetMode(int mode);
bool ApplyEffect(bool batch_commit = false);
bool SetStripBuiltinEffectState(int hdr, bool enable);
EncodedCalibration GetCalibration(bool refresh_from_hw = false);
bool SetCalibration(const EncodedCalibration& cal, bool refresh_from_hw);
std::string GetDeviceName();
std::string GetDeviceDescription();
std::string GetDeviceLocation();
std::string GetFWVersion();
std::string GetSerial();
private:
bool EnableBeat(bool enable);
bool SendPacket(uint8_t a, uint8_t b, uint8_t c = 0);
int SendPacket(unsigned char* packet);
RGBA GetCalibration( std::string rgb_order);
void SetCalibrationBuffer(std::string rgb_order, uint8_t* buffer, uint8_t offset);
bool SaveLEDState(bool enable);
bool SaveCalState();
bool EnableLampArray(bool enable);
bool EnableBeat(bool enable);
bool SendPacket(uint8_t a, uint8_t b, uint8_t c = 0);
int SendPacket(unsigned char* packet);
uint32_t EncodeCalibrationBuffer(const std::string& rgb_order);
std::string DecodeCalibrationBuffer(uint32_t value) const;
hid_device* dev;
int device_num;
uint16_t product_id;
uint32_t effect_zone_mask = 0;
int mode;
IT8297Report report;
IT5711Calibration cali;
CalibrationData cal_data;
std::string name;
std::string description;
std::string location;
@ -276,7 +405,14 @@ private:
std::string chip_id;
int effect_disabled = 0;
int report_id = 0xCC;
bool report_loaded = false;
bool cali_loaded = false;
LEDCount new_d1;
LEDCount new_d2;
LEDCount new_d3;
LEDCount new_d4;
LEDCount D_LED1_count;
LEDCount D_LED2_count;
LEDCount D_LED3_count; //Third ARGB header count
LEDCount D_LED3_count;
LEDCount D_LED4_count;
};

View file

@ -5,6 +5,7 @@
| motherboard |
| |
| jackun 08 Jan 2020 |
| megadjc 31 Jul 2025 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-only |
@ -22,14 +23,9 @@
#define IT8297_U 0xCC
#define IT8297_UPG 0xFF89
/******************************************************************************************\
* *
* DetectGigabyteRGBFusion2USBControllers *
* *
* Detect GigabyteRGB Fusion 2 devices that use IT8297 RGB controller *
* *
\******************************************************************************************/
/*---------------------------------------------------------*\
| Detector for Gigabyte RGB Fusion USB controllers |
\*---------------------------------------------------------*/
void DetectGigabyteRGBFusion2USBControllers(hid_device_info* info, const std::string&)
{
DMIInfo MB_info;
@ -42,14 +38,16 @@ void DetectGigabyteRGBFusion2USBControllers(hid_device_info* info, const std::st
// Constructor sets the name
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
} /* DetectRGBFusion2USBControllers() */
}
#ifdef USE_HID_USAGE
REGISTER_HID_DETECTOR_PU(DETECTOR_NAME, DetectGigabyteRGBFusion2USBControllers, IT8297_VID, 0x8297, IT8297_UPG, IT8297_U);
REGISTER_HID_DETECTOR_PU(DETECTOR_NAME, DetectGigabyteRGBFusion2USBControllers, IT8297_VID, 0x8950, IT8297_UPG, IT8297_U);
REGISTER_HID_DETECTOR_PU(DETECTOR_NAME, DetectGigabyteRGBFusion2USBControllers, IT8297_VID, 0x5702, IT8297_UPG, IT8297_U);
REGISTER_HID_DETECTOR_PU(DETECTOR_NAME, DetectGigabyteRGBFusion2USBControllers, IT8297_VID, 0x5711, IT8297_UPG, IT8297_U);
#else
REGISTER_HID_DETECTOR_I(DETECTOR_NAME, DetectGigabyteRGBFusion2USBControllers, IT8297_VID, 0x8297, IT8297_IFC);
REGISTER_HID_DETECTOR_I(DETECTOR_NAME, DetectGigabyteRGBFusion2USBControllers, IT8297_VID, 0x8950, IT8297_IFC);
REGISTER_HID_DETECTOR_I(DETECTOR_NAME, DetectGigabyteRGBFusion2USBControllers, IT8297_VID, 0x5702, IT8297_IFC);
REGISTER_HID_DETECTOR_I(DETECTOR_NAME, DetectGigabyteRGBFusion2USBControllers, IT8297_VID, 0x5711, IT8297_IFC);
#endif

View file

@ -5,6 +5,7 @@
| motherboard |
| |
| jackun 08 Jan 2020 |
| megadjc 31 Jul 2025 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-only |
@ -16,11 +17,13 @@
#include <vector>
#include "RGBController.h"
#include "GigabyteRGBFusion2USBController.h"
#include "RGBController_GigabyteRGBFusion2USBBoards.h"
#include "RGBController_GigabyteRGBFusion2USBLayouts.h"
#define RGBFusion2_Digital_LEDS_Min 0;
#define RGBFusion2_Digital_LEDS_Max 1024;
#define RGBFUSION2_BRIGHTNESS_MIN 0;
#define RGBFUSION2_BRIGHTNESS_MAX 5;
#define RGBFUSION2_BRIGHTNESS_MAX 255;
template<typename K, typename V>
static std::map<V, K> reverse_map(const std::map<K, V>& map)
@ -35,20 +38,6 @@ static std::map<V, K> reverse_map(const std::map<K, V>& map)
return reversed_map;
}
typedef std::map< std::string, int > FwdLedHeaders;
typedef std::map< int, std::string > RvrseLedHeaders;
struct LedPort
{
std::string name;
int header;
int count;
};
typedef std::map< std::string, std::string > MBName;
typedef std::map< std::string, std::vector<LedPort> > ZoneLeds;
typedef std::map< std::string, ZoneLeds> KnownLayout;
class RGBController_RGBFusion2USB: public RGBController
{
public:
@ -72,7 +61,8 @@ private:
RGBFusion2USBController* controller;
ZoneLeds layout;
uint16_t pid;
int device_num;
void Load_Device_Config();
void Init_Controller();
int GetLED_Zone(int led_idx);

View file

@ -0,0 +1,315 @@
/*---------------------------------------------------------*\
| RGBController_GigabyteRGBFusion2USBBoards.cpp |
| |
| RGBController for Gigabyte Aorus RGB Fusion 2 USB |
| motherboard |
| |
| megadjc 31 Jul 2025 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-only |
\*---------------------------------------------------------*/
#include "RGBController_GigabyteRGBFusion2USBBoards.h"
#include "GigabyteRGBFusion2USBController.h"
/*---------------------------------------------------------*\
| This is a list of known layouts listed by controller |
\*---------------------------------------------------------*/
const MBName MBName2LayoutLookup8297 =
{
{"X570 AORUS ELITE", "STD_ATX" },
{"X570 AORUS ELITE WIFI", "STD_ATX" },
{"X570 AORUS MASTER", "MSTR_ATX_3" },
{"X570 AORUS PRO", "STD_ATX" },
{"X570 AORUS PRO WIFI", "STD_ATX" },
{"X570 AORUS ULTRA", "STD_ATX" },
{"X570 I AORUS PRO WIFI", "B550I-AORUS-PRO-AX" },
{"Z390 AORUS MASTER-CF", "MSTR_ATX" },
};
const MBName MBName2LayoutLookup8950 =
{
{"H810M GAMING WIFI6", "H810M" },
{"H810M H", "H810M" },
{"H810M S2H", "H810M" },
};
const MBName MBName2LayoutLookup5702 =
{
{"A620I AX", "B650-C-V2" },
{"A620M C", "B650-D2H" },
{"A620M D2H", "B650-D2H" },
{"A620M DS3H", "A620M-H" },
{"A620M GAMING X", "A620M-H" },
{"A620M GAMING X AX", "A620M-H" },
{"A620M H", "A620M-H" },
{"A620M S2H", "B650-C-V2" },
{"B550 AORUS ELITE", "STD_ATX" },
{"B550 AORUS PRO", "STD_ATX" },
{"B550I AORUS PRO AX", "B550I-AORUS-PRO-AX" },
{"B650 AERO G", "X670-ELITE" },
{"B650 AORUS ELITE", "B650-ELITE" },
{"B650 AORUS ELITE AX", "B650-ELITE" },
{"B650 AORUS ELITE AX ICE", "B650-ELITE-V2" },
{"B650 AORUS ELITE AX V2", "B650-ELITE-V2" },
{"B650 AORUS ELITE V2", "B650-ELITE-V2" },
{"B650 AORUS PRO AX", "B650-PRO" },
{"B650 EAGLE", "B650-Eagle-AX" },
{"B650 EAGLE AX", "B650-Eagle-AX" },
{"B650 GAMING X", "B650-PRO" },
{"B650 GAMING X AX", "B650-PRO" },
{"B650 GAMING X AX V2", "B650-PRO" },
{"B650 GAMING X V2", "B650-PRO" },
{"B650 UD AC", "B650-UD" },
{"B650 UD AX", "B650-UD" },
{"B650E AORUS ELITE X AX ICE", "B650-ELITE-V2" },
{"B650E AORUS MASTER", "MSTR_ATX_2" },
{"B650E AORUS PRO X USB4", "B650-USB4" },
{"B650E AORUS TACHYON", "B650-TACH" },
{"B650I AORUS ULTRA", "B650-D2H" },
{"B650I AX", "B650-C-V2" },
{"B650M AORUS ELITE", "B650-ELITE" },
{"B650M AORUS ELITE AX", "B650-ELITE" },
{"B650M AORUS ELITE AX ICE", "B650-ELITE" },
{"B650M AORUS PRO", "B650-ELITE" },
{"B650M AORUS PRO AX", "B650-ELITE" },
{"B650M C V2", "B650-C-V2" },
{"B650M C V3", "B650-C-V2" },
{"B650M D2H", "B650-D2H" },
{"B650M D2HP", "B650M-DS3H" },
{"B650M D3HP", "B650M-DS3H" },
{"B650M D3HP AX", "B650M-DS3H" },
{"B650M DS3H", "B650M-DS3H" },
{"B650M GAMING PLUS WIFI", "B650M-DS3H" },
{"B650M GAMING WIFI", "B650M-DS3H" },
{"B650M GAMING WIFI6", "B650M-DS3H" },
{"B650M GAMING X AX", "B650M-DS3H" },
{"B650M H", "B650-D2H" },
{"B650M K", "B650M-DS3H" },
{"B650M S2H", "B650-D2H" },
{"B760 AORUS ELITE", "Z790-S-DDR4" },
{"B760 AORUS ELITE AX", "Z790-S-DDR4" },
{"B760 AORUS MASTER DDR4", "Z690-ELITE" },
{"B760 DS3H", "Z790-S-DDR4" },
{"B760 DS3H AC", "Z790-S-DDR4" },
{"B760 DS3H AC DDR4", "Z790-S-DDR4" },
{"B760 DS3H AX", "Z790-S-DDR4" },
{"B760 DS3H AX DDR4", "Z790-S-DDR4" },
{"B760 DS3H AX V2", "Z790-S-DDR4" },
{"B760 DS3H DDR4", "Z790-S-DDR4" },
{"B760 GAMING X", "Z790-S-DDR4" },
{"B760 GAMING X AX", "Z790-S-DDR4" },
{"B760 GAMING X AX DDR4", "Z790-S-DDR4" },
{"B760 GAMING X DDR4", "Z790-S-DDR4" },
{"B760I AORUS PRO", "B550I-AORUS-PRO-AX" },
{"B760I AORUS PRO DDR4", "B550I-AORUS-PRO-AX" },
{"B760M AORUS ELITE", "Z790-XTRM" },
{"B760M AORUS ELITE AX", "Z790-XTRM" },
{"B760M AORUS ELITE AX DDR4", "Z790-XTRM" },
{"B760M AORUS ELITE DDR4", "Z790-XTRM" },
{"B760M AORUS ELITE X AX", "B760M-EXAX" },
{"B760M AORUS PRO", "Z790-XTRM" },
{"B760M AORUS PRO AX", "Z790-XTRM" },
{"B760M AORUS PRO AX DDR4", "Z790-XTRM" },
{"B760M AORUS PRO DDR4", "Z790-XTRM" },
{"B760M C", "Z790-S-DDR4" },
{"B760M C V2", "Z790-S-DDR4" },
{"B760M D2H", "B760M-D2H" },
{"B760M D2H DDR4", "B760M-D2H" },
{"B760M D3H", "B760M-D2H" },
{"B760M D3H DDR4", "B760M-D2H" },
{"B760M D3HP", "B760M-D2H" },
{"B760M D3HP DDR4", "B760M-D2H" },
{"B760M D3HP WIFI6", "B760M-D2H" },
{"B760M DS3H", "B760M-D2H" },
{"B760M DS3H AX", "B760M-D2H" },
{"B760M DS3H AX DDR4", "B760M-D2H" },
{"B760M DS3H DDR4", "B760M-D2H" },
{"B760M DS3H GEN 5", "B760M-DS3H-DR-G5" },
{"B760M G AX", "B760M-GAX" },
{"B760M GAMING", "B760M-GAX" },
{"B760M GAMING AC", "B760M-GAX" },
{"B760M GAMING AC DDR4", "B760M-D2H" },
{"B760M GAMING DDR4", "B760M-D2H" },
{"B760M GAMING PLUS WIFI DDR4", "B760M-D2H" },
{"B760M GAMING WIFI", "B760M-GAX" },
{"B760M GAMING WIFI PLUS", "B760M-GAX" },
{"B760M GAMING X", "Z790-S-DDR4" },
{"B760M GAMING X AX", "Z790-S-DDR4" },
{"B760M GAMING X AX DDR4", "Z790-S-DDR4" },
{"B760M GAMING X DDR4", "Z790-S-DDR4" },
{"B760M POWER", "B760M-D2H" },
{"B760M POWER DDR4", "B760M-D2H" },
{"H610M D3H DDR4", "B860I-Pro" },
{"H610M D3H WIFI DDR4", "B860I-Pro" },
{"H610M GAMING WIFI DDR4", "B860I-Pro" },
{"TRX50 AERO D", "TRX50-AERO-D" },
{"X570S AERO G", "X670-ELITE" },
{"X570S AORUS ELITE", "X570S-ELITE" },
{"X570S AORUS ELITE AX", "X570S-ELITE" },
{"X570S AORUS MASTER", "X570S-A-MSTR" },
{"X570S AORUS PRO AX", "X570S-PRO-AX" },
{"X570S GAMING X", "X570S-ELITE" },
{"X570S UD", "X670-ELITE" },
{"X570SI AORUS PRO AX", "B550I-AORUS-PRO-AX" },
{"X670 AORUS ELITE AX", "X670-ELITE" },
{"X670 GAMING X AX", "X670-ELITE" },
{"X670 GAMING X AX V2", "B650-Eagle-AX" },
{"X670E AORUS MASTER", "MSTR_ATX_2" },
{"X670E AORUS PRO X", "X670-A-PRO-X" },
{"X670E AORUS XTREME", "MSTR_ATX_2" },
{"Z690 AORUS ELITE", "Z690-ELITE" },
{"Z690 AORUS ELITE AX", "Z690-ELITE" },
{"Z690 AORUS ELITE AX DDR4", "Z690-ELITE" },
{"Z690 AORUS ELITE DDR4", "Z690-ELITE" },
{"Z790 AERO G", "Z790-S-DDR4" },
{"Z790 AORUS ELITE", "Z790-ELITE" },
{"Z790 AORUS ELITE AX", "Z790-ELITE" },
{"Z790 AORUS ELITE AX DDR4", "Z790-ELITE" },
{"Z790 AORUS ELITE AX ICE", "Z790-ELITE" },
{"Z790 AORUS ELITE AX-W", "Z790-ELITE" },
{"Z790 AORUS ELITE DDR4", "Z790-ELITE" },
{"Z790 AORUS ELITE X", "TRX50-AERO-D" },
{"Z790 AORUS ELITE X AX", "TRX50-AERO-D" },
{"Z790 AORUS ELITE X WIFI7", "TRX50-AERO-D" },
{"Z790 AORUS MASTER", "Z790-MSTR" },
{"Z790 AORUS MASTER X", "Z790-MSTR-X" },
{"Z790 AORUS PRO X", "Z790-PRO-X" },
{"Z790 AORUS PRO X WIFI7", "Z790-PRO-X" },
{"Z790 AORUS TACHYON", "Z790-XTRM" },
{"Z790 AORUS TACHYON X", "Z790-MSTR-X" },
{"Z790 AORUS XTREME", "Z790-XTRM" },
{"Z790 AORUS XTREME X", "Z790-XTRM-X" },
{"Z790 AORUS XTREME X ICE", "Z790-XTRM-X" },
{"Z790 D", "Z790-D" },
{"Z790 D AC", "Z790-D" },
{"Z790 D AX", "Z790-D" },
{"Z790 D WIFI", "Z790-D" },
{"Z790 EAGLE", "Z790-D" },
{"Z790 EAGLE AX", "Z790-D" },
{"Z790 GAMING PLUS AX", "Z790-S-DDR4" },
{"Z790 GAMING X", "Z790-S-DDR4" },
{"Z790 GAMING X AX", "Z790-S-DDR4" },
{"Z790 S DDR4", "Z790-S-DDR4" },
{"Z790 S WIFI DDR4", "Z790-S-DDR4" },
{"Z790 UD", "Z790-D" },
{"Z790 UD AC", "Z790-D" },
{"Z790 UD AX", "Z790-D" },
{"Z790I AORUS ULTRA", "B550I-AORUS-PRO-AX" },
{"Z790M AORUS ELITE", "Z790-ELITE" },
{"Z790M AORUS ELITE AX", "Z790-ELITE" },
{"Z790M AORUS ELITE AX ICE", "Z790-ELITE" },
};
const MBName MBName2LayoutLookup5711 =
{
{"A620I AX", "B650-D2H" },
{"A620M DS3H", "B650M-DS3H" },
{"A620M GAMING X", "B650M-DS3H" },
{"A620M GAMING X AX", "B650M-DS3H" },
{"A620M H", "B650M-DS3H" },
{"A620M S2H", "B650M-DS3H" },
{"B650E AORUS STEALTH ICE", "B650E-AORUS-STEALTH" },
{"B760 DS3H GEN5", "B840M-DS3H" },
{"B760 DS3H WIFI6E GEN5", "B840M-DS3H" },
{"B760 GAMING X DDR4 GEN5", "B840M-DS3H" },
{"B760 GAMING X GEN5", "B840M-DS3H" },
{"B760 GAMING X WIFI6 GEN5", "B840M-DS3H" },
{"B760M AORUS ELITE DDR4 GEN5", "X870-WIFI7" },
{"B760M AORUS ELITE GEN5", "X870-WIFI7" },
{"B760M AORUS ELITE WIFI6 DDR4 GEN5", "X870-WIFI7" },
{"B760M AORUS ELITE WIFI6 GEN5", "X870-WIFI7" },
{"B760M C V3", "B850-EGL-WIFI6" },
{"B760M DS3H DDR4 GEN 5", "B760M-DS3H-DR-G5" },
{"B760M DS3H WIFI6E DDR4 GEN 5", "B760M-DS3H-DR-G5" },
{"B760M GAMING WIFI6 PLUS GEN5", "B760M-DS3H-DR-G5" },
{"B760M GAMING WIFI6E GEN 5", "B760M-DS3H-DR-G5" },
{"B760M GAMING X DDR4 GEN5", "B850-AI-TOP" },
{"B760M GAMING X GEN5", "B850-AI-TOP" },
{"B760M GAMING X WIFI6E DDR4 GEN5", "B850-AI-TOP" },
{"B760M GAMING X WIFI6E GEN5", "B850-AI-TOP" },
{"B840M AORUS ELITE WIFI6E", "B840M-WIFI6E" },
{"B840M D2H", "B840M-DS3H" },
{"B840M DS3H", "B840M-DS3H" },
{"B840M EAGLE WIFI6", "B840M-DS3H" },
{"B850 AI Top", "B850-AI-TOP" },
{"B850 AORUS ELITE WIFI7", "X870-WIFI7" },
{"B850 AORUS ELITE WIFI7 ICE", "X870-WIFI7" },
{"B850 EAGLE ICE", "B850-EGL-WIFI6" },
{"B850 EAGLE WIFI6E", "B850-EGL-WIFI6" },
{"B850 EAGLE WIFI7 ICE", "B850-EGL-WIFI6" },
{"B850 GAMING WIFI6", "B850-EGL-WIFI6" },
{"B850 GAMING X WIFI6E", "B850-GMX-WIFI6" },
{"B850I AORUS PRO", "X870I-PRO" },
{"B850M AORUS ELITE", "B850-GMX-WIFI6" },
{"B850M AORUS ELITE WIFI6E", "B850-GMX-WIFI6" },
{"B850M AORUS ELITE WIFI6E ICE", "B850-GMX-WIFI6" },
{"B850M AORUS PRO WIFI7", "Z890-WIFI7" },
{"B850M D3HP", "X870I-PRO" },
{"B850M DS3H", "B850-EGL-WIFI6" },
{"B850M DS3H ICE", "B850-EGL-WIFI6" },
{"B850M EAGLE WIFI6E", "B850-EGL-WIFI6" },
{"B850M EAGLE WIFI6E ICE", "B850-EGL-WIFI6" },
{"B850M FORCE", "B850-EGL-WIFI6" },
{"B850M FORCE WIFI6E", "B850-EGL-WIFI6" },
{"B850M GAMING X WIFI6E", "B850-GMX-WIFI6" },
{"B860 AORUS ELITE WIFI7 ICE", "B860-WIFI7" },
{"B860 DS3H", "B860-DS3H" },
{"B860 DS3H WIFI6E", "B860-DS3H" },
{"B860 EAGLE WIFI6E", "B860-EGL-WIFI6" },
{"B860 GAMING X WIFI6E", "B860-DS3H" },
{"B860I AORUS PRO ICE", "B860I-Pro" },
{"B860M AORUS ELITE", "B860-WIFI7" },
{"B860M AORUS ELITE WIFI6E", "B860-WIFI7" },
{"B860M AORUS ELITE WIFI6E ICE", "B860-WIFI7" },
{"B860M AORUS PRO WIFI7", "B860-WIFI7" },
{"B860M D2H", "B860M-D2H" },
{"B860M EAGLE", "B860-EGL-P-WIFI6" },
{"B860M EAGLE DS3H", "B860-EGL-P-WIFI6" },
{"B860M EAGLE DS3H WIFI6E", "B860-EGL-P-WIFI6" },
{"B860M EAGLE PLUS WIFI6E", "B860-EGL-P-WIFI6" },
{"B860M EAGLE WIFI6", "B860-EGL-P-WIFI6" },
{"B860M EAGLE WIFI6 V2", "B860-EGL-P-WIFI6" },
{"B860M GAMING WIFI6", "B860M-D2H" },
{"B860M GAMING X", "B860-EGL-P-WIFI6" },
{"B860M GAMING X WIFI6E", "B860-EGL-P-WIFI6" },
{"B860M POWER", "B860-EGL-P-WIFI6" },
{"TRX50 AI TOP", "TRX50-A-TP" },
{"W790 AI TOP", "B850-AI-TOP" },
{"W880 AI TOP", "B850-AI-TOP" },
{"X870 AORUS ELITE WIFI7", "X870-WIFI7" },
{"X870 AORUS ELITE WIFI7 ICE", "X870-WIFI7" },
{"X870 EAGLE WIFI7", "X870-WIFI7" },
{"X870 GAMING WIFI6", "X870-WIFI7" },
{"X870 GAMING X WIFI", "X870-WIFI7" },
{"X870E AORUS ELITE WIFI7", "X870E-WIFI7" },
{"X870E AORUS ELITE WIFI7 ICE", "X870E-WIFI7" },
{"X870E AORUS MASTER", "X870E-MSTR" },
{"X870E AORUS PRO", "X870E-PRO" },
{"X870E AORUS PRO ICE", "X870E-PRO" },
{"X870E AORUS XTREME AI TOP", "X870E-XTRM-AI-TOP" },
{"X870I AORUS PRO", "X870I-PRO" },
{"X870I AORUS PRO ICE", "X870I-PRO" },
{"Z890 AERO D", "B850-AI-TOP" },
{"Z890 AERO G", "B850-AI-TOP" },
{"Z890 AI TOP", "B850-AI-TOP" },
{"Z890 AORUS ELITE WIFI7", "Z890-WIFI7" },
{"Z890 AORUS ELITE WIFI7 ICE", "Z890-WIFI7" },
{"Z890 AORUS ELITE X ICE", "Z890-WIFI7" },
{"Z890 AORUS MASTER", "Z890-MSTR" },
{"Z890 AORUS MASTER AI TOP", "Z890-MSTR-AI-TOP" },
{"Z890 AORUS PRO ICE", "Z890-WIFI7" },
{"Z890 AORUS TACHYON ICE", "B850-AI-TOP" },
{"Z890 AORUS XTREME AI TOP", "Z890-XTRM-AI-TOP" },
{"Z890 EAGLE", "Z890-WIFI7" },
{"Z890 EAGLE WIFI7", "Z890-WIFI7" },
{"Z890 GAMING X WIFI7", "Z890-WIFI7" },
{"Z890 UD WIFI6E", "B850-AI-TOP" },
{"Z890I AORUS ULTRA", "Z890-A-ULTRA" },
{"Z890M AORUS ELITE WIFI7", "Z890-WIFI7" },
{"Z890M AORUS ELITE WIFI7 ICE", "Z890-WIFI7" },
{"Z890M GAMING X", "X870I-PRO" },
};

View file

@ -0,0 +1,26 @@
/*---------------------------------------------------------*\
| RGBController_GigabyteRGBFusion2USBBoards.h |
| |
| RGBController for Gigabyte Aorus RGB Fusion 2 USB |
| motherboard |
| |
| megadjc 31 Jul 2025 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-only |
\*---------------------------------------------------------*/
#pragma once
#include <map>
#include <string>
#include <vector>
using MBName = std::map<std::string, std::string>;
extern const MBName MBName2LayoutLookup8297;
extern const MBName MBName2LayoutLookup8950;
extern const MBName MBName2LayoutLookup5702;
extern const MBName MBName2LayoutLookup5711;

View file

@ -0,0 +1,36 @@
/*---------------------------------------------------------*\
| RGBController_GigabyteRGBFusion2USBLayouts.h |
| |
| RGBController for Gigabyte Aorus RGB Fusion 2 USB |
| motherboard |
| |
| megadjc 31 Jul 2025 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-only |
\*---------------------------------------------------------*/
#pragma once
#include <map>
#include <string>
#include <vector>
/* LED port definition */
struct LedPort
{
std::string name;
int header;
int count;
};
/* Type aliases */
using FwdLedHeaders = std::map<std::string, int>;
using RvrseLedHeaders = std::map<int, std::string>;
using ZoneLeds = std::map<std::string, std::vector<LedPort>>;
using KnownLayout = std::map<std::string, ZoneLeds>;
extern const KnownLayout HardcodedCustom_Gen1;
extern const KnownLayout HardcodedCustom_Gen2;
extern const KnownLayout knownLayoutsLookup;
extern const FwdLedHeaders LedLookup;