Publish curated LumaOps source from c85ee9ef8f1454f5c305398902afbb9e6738de40
Managed validation / full (push) Failing after 8s

This commit is contained in:
Public Source Publisher committed 2026-09-30 00:26:45 +00:00
1 parent 91f8b3e3c1
commit def7920856
2271 files changed
+501225 -501178

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -1,132 +1,132 @@
/*---------------------------------------------------------*\
| Gigabyte_Fusion2_USB_Devices.h |
| |
| Gigabyte Fusion 2 USB Device layouts and |
| and mapping to the device IDs stored on chip |
| |
| megadjc 31 Jul 2025 |
| chrism 29 Aug 2025 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-only |
\*---------------------------------------------------------*/
#pragma once
#include <map>
#include "RGBController.h"
#define GB_FUSION2_ZONES_MAX 12
/*--------------------------------------------------------*\
| Base LED mappings found on all controllers. |
\*--------------------------------------------------------*/
enum GB_FUSION2_LED_IDX
{
LED1 = 0,
LED2 = 1,
LED3 = 2,
LED4 = 3,
LED5 = 4,
LED6 = 5,
LED7 = 6,
LED8 = 7,
/*--------------------------------------------------------*\
| IT8297/IT5701/IT5702 ARGB Headers |
\*--------------------------------------------------------*/
HDR_D_LED1 = 5,
HDR_D_LED2 = 6,
HDR_D_LED1_ARGB = 0x58,
HDR_D_LED2_ARGB = 0x59,
/*--------------------------------------------------------*\
| Additional LED mappings found on IT5711 controllers. |
\*--------------------------------------------------------*/
LED9 = 8,
LED10 = 9,
LED11 = 10,
/*--------------------------------------------------------*\
| IT5711 additional ARGB Headers. |
\*--------------------------------------------------------*/
HDR_D_LED3 = 7,
HDR_D_LED4 = 8,
HDR_D_LED3_ARGB = 0x62,
HDR_D_LED4_ARGB = 0x63,
};
/*-------------------------------------------------*\
| LED mapping |
\*-------------------------------------------------*/
using FwdLedHeaders = std::map<std::string, GB_FUSION2_LED_IDX>;
using RvrseLedHeaders = std::map<GB_FUSION2_LED_IDX, std::string>;
const FwdLedHeaders LedLookup =
{
{"LED1", LED1 },
{"LED2", LED2 },
{"LED3", LED3 },
{"LED4", LED4 },
{"LED5", LED5 },
{"LED6", LED6 },
{"LED7", LED7 },
{"LED8", LED8 },
{"LED9", LED9 },
{"LED10", LED10 },
{"LED11", LED11 },
{"HDR_D_LED1", HDR_D_LED1 },
{"HDR_D_LED2", HDR_D_LED2 },
{"HDR_D_LED3", HDR_D_LED3 },
{"HDR_D_LED4", HDR_D_LED4 },
/*-------------------------------------------------*\
| The DLED ARGB index is not required for parsing |
\*-------------------------------------------------*/
/*-------------------------------------------------*\
{"HDR_D_LED1_RGB", HDR_D_LED1_ARGB },
{"HDR_D_LED2_RGB", HDR_D_LED2_ARGB },
{"HDR_D_LED3_RGB", HDR_D_LED3_ARGB },
{"HDR_D_LED4_RGB", HDR_D_LED4_ARGB },
\*-------------------------------------------------*/
};
/*--------------------------------------------------------*\
| The layout_id masks for supported effects. |
\*--------------------------------------------------------*/
enum GB_LID_EFFECTS_MASKS : uint32_t
{
GB_EFF_BREATH = 0x001,
GB_EFF_BEAT = 0x002,
GB_EFF_CYCLE = 0x004,
GB_EFF_FLASH = 0x008,
GB_EFF_RANDOM = 0x010,
GB_EFF_WAVE = 0x020,
GB_EFF_DFLASH = 0x040,
GB_EFF_WAVE1 = 0x080,
GB_EFF_WAVE2 = 0x100,
GB_EFF_CORE_MASK = 0x1FF
};
typedef struct
{
GB_FUSION2_LED_IDX idx;
uint16_t leds_min;
uint16_t leds_max;
std::string name;
} gb_fusion2_zone;
typedef const gb_fusion2_zone* gb_fusion2_layout[GB_FUSION2_ZONES_MAX];
typedef struct
{
gb_fusion2_layout* zones;
uint32_t layout_id;
uint8_t device_num;
std::string name;
} gb_fusion2_device;
/*---------------------------------------------------------------------*\
| These constant values are defined in GigabyteFusion2USB_Devices.cpp |
\*---------------------------------------------------------------------*/
extern const unsigned int GB_FUSION2_DEVICE_COUNT;
extern const gb_fusion2_device** gb_fusion2_device_list;
/*---------------------------------------------------------*\
| Gigabyte_Fusion2_USB_Devices.h |
| |
| Gigabyte Fusion 2 USB Device layouts and |
| and mapping to the device IDs stored on chip |
| |
| megadjc 31 Jul 2025 |
| chrism 29 Aug 2025 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-only |
\*---------------------------------------------------------*/
#pragma once
#include <map>
#include "RGBController.h"
#define GB_FUSION2_ZONES_MAX 12
/*--------------------------------------------------------*\
| Base LED mappings found on all controllers. |
\*--------------------------------------------------------*/
enum GB_FUSION2_LED_IDX
{
LED1 = 0,
LED2 = 1,
LED3 = 2,
LED4 = 3,
LED5 = 4,
LED6 = 5,
LED7 = 6,
LED8 = 7,
/*--------------------------------------------------------*\
| IT8297/IT5701/IT5702 ARGB Headers |
\*--------------------------------------------------------*/
HDR_D_LED1 = 5,
HDR_D_LED2 = 6,
HDR_D_LED1_ARGB = 0x58,
HDR_D_LED2_ARGB = 0x59,
/*--------------------------------------------------------*\
| Additional LED mappings found on IT5711 controllers. |
\*--------------------------------------------------------*/
LED9 = 8,
LED10 = 9,
LED11 = 10,
/*--------------------------------------------------------*\
| IT5711 additional ARGB Headers. |
\*--------------------------------------------------------*/
HDR_D_LED3 = 7,
HDR_D_LED4 = 8,
HDR_D_LED3_ARGB = 0x62,
HDR_D_LED4_ARGB = 0x63,
};
/*-------------------------------------------------*\
| LED mapping |
\*-------------------------------------------------*/
using FwdLedHeaders = std::map<std::string, GB_FUSION2_LED_IDX>;
using RvrseLedHeaders = std::map<GB_FUSION2_LED_IDX, std::string>;
const FwdLedHeaders LedLookup =
{
{"LED1", LED1 },
{"LED2", LED2 },
{"LED3", LED3 },
{"LED4", LED4 },
{"LED5", LED5 },
{"LED6", LED6 },
{"LED7", LED7 },
{"LED8", LED8 },
{"LED9", LED9 },
{"LED10", LED10 },
{"LED11", LED11 },
{"HDR_D_LED1", HDR_D_LED1 },
{"HDR_D_LED2", HDR_D_LED2 },
{"HDR_D_LED3", HDR_D_LED3 },
{"HDR_D_LED4", HDR_D_LED4 },
/*-------------------------------------------------*\
| The DLED ARGB index is not required for parsing |
\*-------------------------------------------------*/
/*-------------------------------------------------*\
{"HDR_D_LED1_RGB", HDR_D_LED1_ARGB },
{"HDR_D_LED2_RGB", HDR_D_LED2_ARGB },
{"HDR_D_LED3_RGB", HDR_D_LED3_ARGB },
{"HDR_D_LED4_RGB", HDR_D_LED4_ARGB },
\*-------------------------------------------------*/
};
/*--------------------------------------------------------*\
| The layout_id masks for supported effects. |
\*--------------------------------------------------------*/
enum GB_LID_EFFECTS_MASKS : uint32_t
{
GB_EFF_BREATH = 0x001,
GB_EFF_BEAT = 0x002,
GB_EFF_CYCLE = 0x004,
GB_EFF_FLASH = 0x008,
GB_EFF_RANDOM = 0x010,
GB_EFF_WAVE = 0x020,
GB_EFF_DFLASH = 0x040,
GB_EFF_WAVE1 = 0x080,
GB_EFF_WAVE2 = 0x100,
GB_EFF_CORE_MASK = 0x1FF
};
typedef struct
{
GB_FUSION2_LED_IDX idx;
uint16_t leds_min;
uint16_t leds_max;
std::string name;
} gb_fusion2_zone;
typedef const gb_fusion2_zone* gb_fusion2_layout[GB_FUSION2_ZONES_MAX];
typedef struct
{
gb_fusion2_layout* zones;
uint32_t layout_id;
uint8_t device_num;
std::string name;
} gb_fusion2_device;
/*---------------------------------------------------------------------*\
| These constant values are defined in GigabyteFusion2USB_Devices.cpp |
\*---------------------------------------------------------------------*/
extern const unsigned int GB_FUSION2_DEVICE_COUNT;
extern const gb_fusion2_device** gb_fusion2_device_list;
File diff suppressed because it is too large. Load diff
@@ -1,386 +1,386 @@
/*---------------------------------------------------------*\
| GigabyteRGBFusion2USBController.h |
| |
| 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-or-later |
\*---------------------------------------------------------*/
#pragma once
#include <algorithm>
#include <cstring>
#include <hidapi.h>
#include <map>
#include "RGBController.h"
#include "GigabyteFusion2USB_Devices.h"
#define FUSION2_USB_BUFFER_SIZE 64
/*--------------------------------------------------------*\
| Gen2 scan/info opcode base |
\*--------------------------------------------------------*/
#define GEN2_LED_BASE_SCAN 0x38
/*---------------------------------------------------------*\
| Effects mode list |
\*---------------------------------------------------------*/
enum EffectType
{
EFFECT_NONE = 0,
EFFECT_STATIC = 1,
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,
LEDS_64,
LEDS_256,
LEDS_512,
LEDS_1024,
};
/*---------------------------------------------------------*\
| Defines the RGB led data structure. |
\*---------------------------------------------------------*/
struct LEDs
{
uint8_t r;
uint8_t g;
uint8_t b;
};
/*---------------------------------------------------------*\
| Defines structure for low level calibration data. |
\*---------------------------------------------------------*/
struct CalibrationData
{
uint32_t dled[4] = {0, 0, 0, 0};
uint32_t spare[4] = {0, 0, 0, 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;
};
/*---------------------------------------------------------*\
| High level struct to contain Gen2 Header Data |
\*---------------------------------------------------------*/
struct Gen2StripInfo
{
uint8_t numStrip = 0;
std::vector<uint16_t> LedsOfStrip;
uint32_t totalLeds = 0;
};
#pragma pack(push, 1)
/*---------------------------------------------------------*\
| Packet structure for applying effects |
\*---------------------------------------------------------*/
union PktEffectApply
{
unsigned char buffer[FUSION2_USB_BUFFER_SIZE];
struct apply_data
{
uint8_t report_id = 0xCC;
uint8_t command_id = 0x28;
uint32_t zone_sel0 = 0;
uint32_t zone_sel1 = 0;
uint8_t padding[54];
} a;
PktEffectApply() : a {}
{
std::memset(a.padding, 0, sizeof(a.padding));
}
};
/*---------------------------------------------------------*\
| Single LED Calibration struct |
\*---------------------------------------------------------*/
struct RGBA
{
union
{
uint8_t raw[4];
struct
{
uint8_t blue;
uint8_t green;
uint8_t red;
uint8_t alpha;
};
};
};
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[FUSION2_USB_BUFFER_SIZE];
struct RGBData
{
uint8_t report_id;
uint8_t header;
uint16_t boffset;
uint8_t bcount;
LEDs leds[19];
uint16_t padding0;
} s;
PktRGB() : s {}
{
}
void Init(uint8_t header, uint8_t report_id)
{
switch(header)
{
case LED4:
case HDR_D_LED2:
header = HDR_D_LED2_ARGB;
break;
case HDR_D_LED3:
header = HDR_D_LED3_ARGB;
break;
case HDR_D_LED4:
header = HDR_D_LED4_ARGB;
break;
default:
header = HDR_D_LED1_ARGB;
break;
}
s.report_id = report_id;
s.header = header;
s.boffset = 0;
s.bcount = 0;
memset(s.leds, 0, sizeof(s.leds));
}
};
/*---------------------------------------------------------*\
| 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[FUSION2_USB_BUFFER_SIZE];
struct Effect
{
uint8_t report_id = 0;
uint8_t header = 0;
uint32_t zone0 = 0; // RGB Fusion sets it to pow(2, led)
uint32_t zone1 = 0;
uint8_t reserved0 = 0;
uint8_t effect_type = EFFECT_STATIC;
uint8_t max_brightness = 255;
uint8_t min_brightness = 0;
uint32_t color0 = 0;
uint32_t color1 = 0;
uint16_t period0 = 0; // Fade in - Rising Timer - Needs to be 0 for "Direct"
uint16_t period1 = 0; // Fade out
uint16_t period2 = 0; // Hold
uint16_t period3 = 0;
uint8_t effect_param0 = 0; // ex color count to cycle through (max seems to be 7)
uint8_t effect_param1 = 0;
uint8_t effect_param2 = 0; // ex flash repeat count
uint8_t effect_param3 = 0;
uint8_t padding0[30];
} e;
PktEffect() : e {}
{
}
void Init(int led, uint8_t report_id, uint16_t pid)
{
memset(buffer, 0, sizeof(buffer));
e.report_id = report_id;
if(led == -1)
{
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.zone0 = 0;
e.header = 0;
}
}
};
/*---------------------------------------------------------*\
| Basic Controller Init Struct |
\*---------------------------------------------------------*/
struct IT8297Report
{
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;
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 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 |
\*---------------------------------------------------------*/
union CMD_0x33
{
unsigned char buffer[FUSION2_USB_BUFFER_SIZE];
struct Calibration
{
uint8_t report_id = 0xCC;
uint8_t command_id = 0x33;
uint32_t d_strip_c0 = 0;
uint32_t d_strip_c1 = 0;
uint32_t rgb_cali = 0;
uint32_t c_spare0 = 0;
uint32_t c_spare1 = 0;
uint32_t d_strip_c2 = 0;
uint32_t d_strip_c3 = 0;
uint32_t c_spare2 = 0;
uint32_t c_spare3 = 0;
uint8_t reserved[25];
} c;
CMD_0x33() : c{}
{
memset(c.reserved, 0, sizeof(c.reserved));
}
};
#pragma pack(pop)
class RGBFusion2USBController
{
public:
RGBFusion2USBController(hid_device* handle, const char *path, std::string mb_name, uint16_t pid);
~RGBFusion2USBController();
bool ApplyEffect(bool batch_commit = false);
bool SetCalibration(const EncodedCalibration& cal, bool refresh_from_hw);
void SetLedCount(unsigned int c0, unsigned int c1, unsigned int c2, unsigned int c3);
void SetLEDEffect(int led, int mode, unsigned int speed, unsigned char brightness, bool random, uint32_t* color);
bool SetStripBuiltinEffectState(int hdr, bool enable);
void SetStripColors(unsigned int hdr, RGBColor * colors, unsigned int num_colors, int single_led = -1);
bool SupportsGen2() const;
bool ScanGen2Strips();
EncodedCalibration GetCalibration(bool refresh_from_hw = false);
std::string GetDeviceName();
uint8_t GetDeviceNum();
std::string GetDeviceDescription();
std::string GetDeviceLocation();
std::string GetFWVersion();
uint16_t GetProductID();
std::string GetSerial();
std::vector<Gen2StripInfo> ExportGen2Strips() const;
Gen2StripInfo g2_strip_info[4];
private:
std::string DecodeCalibrationBuffer(uint32_t value) const;
bool EnableLampArray(bool enable);
bool EnableBeat(bool enable);
uint32_t EncodeCalibrationBuffer(const std::string& rgb_order);
bool RefreshHardwareInfo();
void ResetController();
bool SaveLEDState(bool enable);
bool SaveCalState();
bool SendCCReport(uint8_t a, uint8_t b, uint8_t c = 0);
bool SendReport(uint8_t id, uint8_t a, uint8_t b, uint8_t c = 0);
int SendPacket(unsigned char* packet);
hid_device* dev;
uint8_t device_num;
uint16_t product_id;
uint32_t effect_zone_mask = 0;
int mode;
IT8297Report report;
CalibrationData cal_data;
std::string name;
std::string description;
std::string location;
std::string version;
std::string chip_id;
int effect_disabled = -1;
int report_id = 0xCC;
bool report_loaded = false;
bool cali_loaded = false;
LEDCount D_LED1_count;
LEDCount D_LED2_count;
LEDCount D_LED3_count;
LEDCount D_LED4_count;
};
/*---------------------------------------------------------*\
| GigabyteRGBFusion2USBController.h |
| |
| 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-or-later |
\*---------------------------------------------------------*/
#pragma once
#include <algorithm>
#include <cstring>
#include <hidapi.h>
#include <map>
#include "RGBController.h"
#include "GigabyteFusion2USB_Devices.h"
#define FUSION2_USB_BUFFER_SIZE 64
/*--------------------------------------------------------*\
| Gen2 scan/info opcode base |
\*--------------------------------------------------------*/
#define GEN2_LED_BASE_SCAN 0x38
/*---------------------------------------------------------*\
| Effects mode list |
\*---------------------------------------------------------*/
enum EffectType
{
EFFECT_NONE = 0,
EFFECT_STATIC = 1,
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,
LEDS_64,
LEDS_256,
LEDS_512,
LEDS_1024,
};
/*---------------------------------------------------------*\
| Defines the RGB led data structure. |
\*---------------------------------------------------------*/
struct LEDs
{
uint8_t r;
uint8_t g;
uint8_t b;
};
/*---------------------------------------------------------*\
| Defines structure for low level calibration data. |
\*---------------------------------------------------------*/
struct CalibrationData
{
uint32_t dled[4] = {0, 0, 0, 0};
uint32_t spare[4] = {0, 0, 0, 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;
};
/*---------------------------------------------------------*\
| High level struct to contain Gen2 Header Data |
\*---------------------------------------------------------*/
struct Gen2StripInfo
{
uint8_t numStrip = 0;
std::vector<uint16_t> LedsOfStrip;
uint32_t totalLeds = 0;
};
#pragma pack(push, 1)
/*---------------------------------------------------------*\
| Packet structure for applying effects |
\*---------------------------------------------------------*/
union PktEffectApply
{
unsigned char buffer[FUSION2_USB_BUFFER_SIZE];
struct apply_data
{
uint8_t report_id = 0xCC;
uint8_t command_id = 0x28;
uint32_t zone_sel0 = 0;
uint32_t zone_sel1 = 0;
uint8_t padding[54];
} a;
PktEffectApply() : a {}
{
std::memset(a.padding, 0, sizeof(a.padding));
}
};
/*---------------------------------------------------------*\
| Single LED Calibration struct |
\*---------------------------------------------------------*/
struct RGBA
{
union
{
uint8_t raw[4];
struct
{
uint8_t blue;
uint8_t green;
uint8_t red;
uint8_t alpha;
};
};
};
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[FUSION2_USB_BUFFER_SIZE];
struct RGBData
{
uint8_t report_id;
uint8_t header;
uint16_t boffset;
uint8_t bcount;
LEDs leds[19];
uint16_t padding0;
} s;
PktRGB() : s {}
{
}
void Init(uint8_t header, uint8_t report_id)
{
switch(header)
{
case LED4:
case HDR_D_LED2:
header = HDR_D_LED2_ARGB;
break;
case HDR_D_LED3:
header = HDR_D_LED3_ARGB;
break;
case HDR_D_LED4:
header = HDR_D_LED4_ARGB;
break;
default:
header = HDR_D_LED1_ARGB;
break;
}
s.report_id = report_id;
s.header = header;
s.boffset = 0;
s.bcount = 0;
memset(s.leds, 0, sizeof(s.leds));
}
};
/*---------------------------------------------------------*\
| 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[FUSION2_USB_BUFFER_SIZE];
struct Effect
{
uint8_t report_id = 0;
uint8_t header = 0;
uint32_t zone0 = 0; // RGB Fusion sets it to pow(2, led)
uint32_t zone1 = 0;
uint8_t reserved0 = 0;
uint8_t effect_type = EFFECT_STATIC;
uint8_t max_brightness = 255;
uint8_t min_brightness = 0;
uint32_t color0 = 0;
uint32_t color1 = 0;
uint16_t period0 = 0; // Fade in - Rising Timer - Needs to be 0 for "Direct"
uint16_t period1 = 0; // Fade out
uint16_t period2 = 0; // Hold
uint16_t period3 = 0;
uint8_t effect_param0 = 0; // ex color count to cycle through (max seems to be 7)
uint8_t effect_param1 = 0;
uint8_t effect_param2 = 0; // ex flash repeat count
uint8_t effect_param3 = 0;
uint8_t padding0[30];
} e;
PktEffect() : e {}
{
}
void Init(int led, uint8_t report_id, uint16_t pid)
{
memset(buffer, 0, sizeof(buffer));
e.report_id = report_id;
if(led == -1)
{
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.zone0 = 0;
e.header = 0;
}
}
};
/*---------------------------------------------------------*\
| Basic Controller Init Struct |
\*---------------------------------------------------------*/
struct IT8297Report
{
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;
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 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 |
\*---------------------------------------------------------*/
union CMD_0x33
{
unsigned char buffer[FUSION2_USB_BUFFER_SIZE];
struct Calibration
{
uint8_t report_id = 0xCC;
uint8_t command_id = 0x33;
uint32_t d_strip_c0 = 0;
uint32_t d_strip_c1 = 0;
uint32_t rgb_cali = 0;
uint32_t c_spare0 = 0;
uint32_t c_spare1 = 0;
uint32_t d_strip_c2 = 0;
uint32_t d_strip_c3 = 0;
uint32_t c_spare2 = 0;
uint32_t c_spare3 = 0;
uint8_t reserved[25];
} c;
CMD_0x33() : c{}
{
memset(c.reserved, 0, sizeof(c.reserved));
}
};
#pragma pack(pop)
class RGBFusion2USBController
{
public:
RGBFusion2USBController(hid_device* handle, const char *path, std::string mb_name, uint16_t pid);
~RGBFusion2USBController();
bool ApplyEffect(bool batch_commit = false);
bool SetCalibration(const EncodedCalibration& cal, bool refresh_from_hw);
void SetLedCount(unsigned int c0, unsigned int c1, unsigned int c2, unsigned int c3);
void SetLEDEffect(int led, int mode, unsigned int speed, unsigned char brightness, bool random, uint32_t* color);
bool SetStripBuiltinEffectState(int hdr, bool enable);
void SetStripColors(unsigned int hdr, RGBColor * colors, unsigned int num_colors, int single_led = -1);
bool SupportsGen2() const;
bool ScanGen2Strips();
EncodedCalibration GetCalibration(bool refresh_from_hw = false);
std::string GetDeviceName();
uint8_t GetDeviceNum();
std::string GetDeviceDescription();
std::string GetDeviceLocation();
std::string GetFWVersion();
uint16_t GetProductID();
std::string GetSerial();
std::vector<Gen2StripInfo> ExportGen2Strips() const;
Gen2StripInfo g2_strip_info[4];
private:
std::string DecodeCalibrationBuffer(uint32_t value) const;
bool EnableLampArray(bool enable);
bool EnableBeat(bool enable);
uint32_t EncodeCalibrationBuffer(const std::string& rgb_order);
bool RefreshHardwareInfo();
void ResetController();
bool SaveLEDState(bool enable);
bool SaveCalState();
bool SendCCReport(uint8_t a, uint8_t b, uint8_t c = 0);
bool SendReport(uint8_t id, uint8_t a, uint8_t b, uint8_t c = 0);
int SendPacket(unsigned char* packet);
hid_device* dev;
uint8_t device_num;
uint16_t product_id;
uint32_t effect_zone_mask = 0;
int mode;
IT8297Report report;
CalibrationData cal_data;
std::string name;
std::string description;
std::string location;
std::string version;
std::string chip_id;
int effect_disabled = -1;
int report_id = 0xCC;
bool report_loaded = false;
bool cali_loaded = false;
LEDCount D_LED1_count;
LEDCount D_LED2_count;
LEDCount D_LED3_count;
LEDCount D_LED4_count;
};
@@ -1,54 +1,54 @@
/*---------------------------------------------------------*\
| GigabyteRGBFusion2USBControllerDetect.cpp |
| |
| Detector 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-or-later |
\*---------------------------------------------------------*/
#include "Detector.h"
#include "GigabyteRGBFusion2USBController.h"
#include "RGBController_GigabyteRGBFusion2USB.h"
#include "dmiinfo.h"
#define DETECTOR_NAME "Gigabyte RGB Fusion 2 USB"
#define IT8297_VID 0x048D
#define IT8297_IFC 0
#define IT8297_U 0xCC
#define IT8297_UPG 0xFF89
/*---------------------------------------------------------*\
| Detector for Gigabyte RGB Fusion USB controllers |
\*---------------------------------------------------------*/
void DetectGigabyteRGBFusion2USBControllers(hid_device_info* info, const std::string&)
{
DMIInfo MB_info;
hid_device* dev = hid_open_path(info->path);
if(dev)
{
RGBFusion2USBController* controller = new RGBFusion2USBController(dev, info->path, MB_info.getMainboard(), info->product_id);
RGBController_RGBFusion2USB* rgb_controller = new RGBController_RGBFusion2USB(controller, DETECTOR_NAME);
// Constructor sets the name
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
#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
/*---------------------------------------------------------*\
| GigabyteRGBFusion2USBControllerDetect.cpp |
| |
| Detector 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-or-later |
\*---------------------------------------------------------*/
#include "Detector.h"
#include "GigabyteRGBFusion2USBController.h"
#include "RGBController_GigabyteRGBFusion2USB.h"
#include "dmiinfo.h"
#define DETECTOR_NAME "Gigabyte RGB Fusion 2 USB"
#define IT8297_VID 0x048D
#define IT8297_IFC 0
#define IT8297_U 0xCC
#define IT8297_UPG 0xFF89
/*---------------------------------------------------------*\
| Detector for Gigabyte RGB Fusion USB controllers |
\*---------------------------------------------------------*/
void DetectGigabyteRGBFusion2USBControllers(hid_device_info* info, const std::string&)
{
DMIInfo MB_info;
hid_device* dev = hid_open_path(info->path);
if(dev)
{
RGBFusion2USBController* controller = new RGBFusion2USBController(dev, info->path, MB_info.getMainboard(), info->product_id);
RGBController_RGBFusion2USB* rgb_controller = new RGBController_RGBFusion2USB(controller, DETECTOR_NAME);
// Constructor sets the name
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
#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
File diff suppressed because it is too large. Load diff
@@ -1,97 +1,97 @@
/*---------------------------------------------------------*\
| RGBController_GigabyteRGBFusion2USB.h |
| |
| RGBController 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-or-later |
\*---------------------------------------------------------*/
#pragma once
#include <map>
#include "RGBController.h"
#include "GigabyteFusion2USB_Devices.h"
#include "GigabyteRGBFusion2USBController.h"
#include "SettingsManager.h"
#define RGBFUSION2_DIGITAL_LEDS_MIN 0
#define RGBFUSION2_DIGITAL_LEDS_MAX 1024
#define RGBFUSION2_BRIGHTNESS_MIN 0
#define RGBFUSION2_BRIGHTNESS_MAX 255
#define RGBFUSION2_SPEED_MIN 9
#define RGBFUSION2_SPEED_MID 4
#define RGBFUSION2_SPEED_MAX 0
#define GET_JSON_VAL_ELSE_OFF(obj, key) obj.contains(key) ? obj.at(key).get<std::string>() : std::string("OFF")
template<typename K, typename V>
static std::map<V, K> reverse_map(const std::map<K, V>& map)
{
std::map<V, K> reversed_map;
for(const std::pair<K, V> entry : map)
{
reversed_map[entry.second] = entry.first;
}
return reversed_map;
}
class RGBController_RGBFusion2USB: public RGBController
{
public:
RGBController_RGBFusion2USB(RGBFusion2USBController* controller_ptr, std::string _detector_name);
~RGBController_RGBFusion2USB();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void DeviceUpdateMode();
private:
std::string detector_name;
RGBFusion2USBController* controller;
uint8_t device_num;
RGBColor null_color = 0;
bool supports_gen2 = 0;
/*---------------------------------------------------------*\
| The intial value of device_index should point to the |
| layout for the generic_device |
\*---------------------------------------------------------*/
uint32_t device_index = 0;
uint16_t product_id = 0;
uint32_t effects_mask = 0;
void Init_Controller();
int GetLED_Zone(int led_idx);
/*---------------------------------------------------------*\
| Per instance layout lookup tables. |
\*---------------------------------------------------------*/
gb_fusion2_device instance_layout{};
gb_fusion2_layout instance_zones{};
std::vector<gb_fusion2_zone*> allocated_zones;
nlohmann::json WriteCalJsonFrom(
const EncodedCalibration& src);
void FillMissingWith(
nlohmann::json& dst,
const EncodedCalibration& fb);
nlohmann::json BuildCustomLayoutJson(
const gb_fusion2_device* layout,
const RvrseLedHeaders& reverseLookup);
void LoadCustomLayoutFromJson(
const nlohmann::json& json_custom,
const FwdLedHeaders& forwardLookup,
gb_fusion2_device* layout);
};
/*---------------------------------------------------------*\
| RGBController_GigabyteRGBFusion2USB.h |
| |
| RGBController 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-or-later |
\*---------------------------------------------------------*/
#pragma once
#include <map>
#include "RGBController.h"
#include "GigabyteFusion2USB_Devices.h"
#include "GigabyteRGBFusion2USBController.h"
#include "SettingsManager.h"
#define RGBFUSION2_DIGITAL_LEDS_MIN 0
#define RGBFUSION2_DIGITAL_LEDS_MAX 1024
#define RGBFUSION2_BRIGHTNESS_MIN 0
#define RGBFUSION2_BRIGHTNESS_MAX 255
#define RGBFUSION2_SPEED_MIN 9
#define RGBFUSION2_SPEED_MID 4
#define RGBFUSION2_SPEED_MAX 0
#define GET_JSON_VAL_ELSE_OFF(obj, key) obj.contains(key) ? obj.at(key).get<std::string>() : std::string("OFF")
template<typename K, typename V>
static std::map<V, K> reverse_map(const std::map<K, V>& map)
{
std::map<V, K> reversed_map;
for(const std::pair<K, V> entry : map)
{
reversed_map[entry.second] = entry.first;
}
return reversed_map;
}
class RGBController_RGBFusion2USB: public RGBController
{
public:
RGBController_RGBFusion2USB(RGBFusion2USBController* controller_ptr, std::string _detector_name);
~RGBController_RGBFusion2USB();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void DeviceUpdateMode();
private:
std::string detector_name;
RGBFusion2USBController* controller;
uint8_t device_num;
RGBColor null_color = 0;
bool supports_gen2 = 0;
/*---------------------------------------------------------*\
| The intial value of device_index should point to the |
| layout for the generic_device |
\*---------------------------------------------------------*/
uint32_t device_index = 0;
uint16_t product_id = 0;
uint32_t effects_mask = 0;
void Init_Controller();
int GetLED_Zone(int led_idx);
/*---------------------------------------------------------*\
| Per instance layout lookup tables. |
\*---------------------------------------------------------*/
gb_fusion2_device instance_layout{};
gb_fusion2_layout instance_zones{};
std::vector<gb_fusion2_zone*> allocated_zones;
nlohmann::json WriteCalJsonFrom(
const EncodedCalibration& src);
void FillMissingWith(
nlohmann::json& dst,
const EncodedCalibration& fb);
nlohmann::json BuildCustomLayoutJson(
const gb_fusion2_device* layout,
const RvrseLedHeaders& reverseLookup);
void LoadCustomLayoutFromJson(
const nlohmann::json& json_custom,
const FwdLedHeaders& forwardLookup,
gb_fusion2_device* layout);
};