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

@@ -1,274 +1,274 @@
/*---------------------------------------------------------*\
| GigabyteAorusLaptopController.cpp |
| |
| Driver for Gigabyte Aorus laptop |
| |
| Morgan Guimard (morg) 05 Jun 2023 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include <cmath>
#include <string.h>
#include "GigabyteAorusLaptopController.h"
#include "StringUtils.h"
/*---------------------------------------------------------*\
| Indexed colors mapping |
| blue 04 |
| green 02 |
| orange 05 |
| purple 06 |
| red 01 |
| white 07 |
| yellow 03 |
\*---------------------------------------------------------*/
static unsigned char argb_colour_index_data[2][2][2] =
{ //B0 B1
{ { 0x01, 0x04 }, //G0 R0
{ 0x02, 0x04 }, }, //G1 R0
{ { 0x01, 0x06 }, //G0 R1
{ 0x05, 0x07 }, } //G1 R1
};
GigabyteAorusLaptopController::GigabyteAorusLaptopController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name)
{
dev = dev_handle;
location = info.path;
name = dev_name;
}
GigabyteAorusLaptopController::~GigabyteAorusLaptopController()
{
hid_close(dev);
}
std::string GigabyteAorusLaptopController::GetNameString()
{
return(name);
}
std::string GigabyteAorusLaptopController::GetDeviceLocation()
{
return("HID: " + location);
}
std::string GigabyteAorusLaptopController::GetSerialString()
{
wchar_t serial_string[128];
int ret = hid_get_serial_number_string(dev, serial_string, 128);
if(ret != 0)
{
return("");
}
return(StringUtils::wstring_to_string(serial_string));
}
void GigabyteAorusLaptopController::SetDirect(uint8_t brightness, RGBColor color)
{
/*---------------------------------------------------------*\
| Direct mode protocol |
| ID C R G B Br C Ch |
| 08 01 00 00 FF 32 00 C5 |
| |
| C = constant |
| RGB = color |
| Br= brightness |
| Ch = checksum: 0xFF - all bytes |
\*---------------------------------------------------------*/
unsigned char usb_buf[GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1];
memset(usb_buf, 0x00, GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1);
usb_buf[1] = GIGABYTE_AORUS_LAPTOP_REPORT_ID;
usb_buf[2] = 0x01;
usb_buf[3] = RGBGetRValue(color);
usb_buf[4] = RGBGetGValue(color);
usb_buf[5] = RGBGetBValue(color);
usb_buf[6] = brightness;
unsigned char checksum = 0xFF;
for(unsigned int i = 1; i < 8; i++)
{
checksum -= usb_buf[i];
}
usb_buf[8] = checksum;
hid_send_feature_report(dev, usb_buf, GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1);
}
void GigabyteAorusLaptopController::SetMode(uint8_t mode_value, uint8_t speed, uint8_t brightness, uint8_t direction, RGBColor color)
{
/*---------------------------------------------------------*\
| Hardware mode protocol |
| ID C M Sp Br Cl Dr Ch |
| 08 00 01 08 32 01 00 XX |
| |
| C = constant |
| M = mode |
| Sp = speed |
| Br = brightness |
| Cl = Indexed color |
| Dr = Direction |
| Ch = checksum: 0xFF - all bytes |
\*---------------------------------------------------------*/
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
unsigned char indexed_color = GetColourIndex(red,grn,blu);
unsigned char usb_buf[GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1];
memset(usb_buf, 0x00, GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1);
usb_buf[1] = GIGABYTE_AORUS_LAPTOP_REPORT_ID; // report id
usb_buf[3] = mode_value; // mode value
usb_buf[4] = speed; // speed 0x01 -> 0x09
usb_buf[5] = brightness; // brightness 0x00 -> 0x32
usb_buf[6] = indexed_color; // color (red, orange, yellow, green, blue, purple, white)
usb_buf[7] = direction; // direction 0x01: right, 0x02 left, 0x03 up , 0x04 down
unsigned char checksum = 0xFF;
for(unsigned int i = 1; i < 8; i++)
{
checksum -= usb_buf[i];
}
usb_buf[8] = checksum; // checksum
hid_send_feature_report(dev, usb_buf, GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1);
}
unsigned char GigabyteAorusLaptopController::GetColourIndex(unsigned char red, unsigned char green, unsigned char blue)
{
/*-----------------------------------------------------*\
| This device uses a limited colour pallette referenced |
| by an index |
| 0x01 red |
| 0x02 orange |
| 0x03 yellow |
| 0x04 green |
| 0x05 blue |
| 0x06 purple |
| 0x07 white |
\*-----------------------------------------------------*/
unsigned int divisor = GetLargestColour( red, green, blue);
unsigned int r = (int)round( red / divisor );
unsigned int g = (int)round( green / divisor );
unsigned int b = (int)round( blue / divisor );
unsigned char idx = argb_colour_index_data[r][g][b];
return idx;
}
unsigned int GigabyteAorusLaptopController::GetLargestColour(unsigned int red, unsigned int green, unsigned int blue)
{
unsigned int largest;
if ( red > green )
{
( red > blue ) ? largest = red : largest = blue;
}
else
{
( green > blue ) ? largest = green : largest = blue;
}
return (largest == 0) ? 1 : largest;
}
void GigabyteAorusLaptopController::SetCustom(std::vector<RGBColor> colors, std::vector<unsigned int> positions, unsigned char brightness)
{
/*---------------------------------------------------------*\
| Custom mode protocol |
| ID C M Sp Br Cl Dr Ch |
| 08 00 33 01 2D 05 01 90 |
| 92 00 00 00 00 00 00 6D -> |
| GET REPORT REQUEST <- |
| read 8x64 bytes <- |
| 12 00 00 08 00 00 00 E5 -> |
| 00 RR GG BB ..... -> data (8 * 64 bytes) |
\*---------------------------------------------------------*/
/*---------------------------------------------------------*\
| Sends mode packet |
\*---------------------------------------------------------*/
unsigned char usb_buf[GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1];
memset(usb_buf, 0x00, GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1);
usb_buf[1] = GIGABYTE_AORUS_LAPTOP_REPORT_ID;
usb_buf[3] = GIGABYTE_AORUS_LAPTOP_CUSTOM_MODE_VALUE;
usb_buf[4] = 0x01;
usb_buf[5] = brightness;
usb_buf[6] = 0x05;
usb_buf[7] = 0x01;
unsigned char checksum = 0xFF;
for(unsigned int i = 1; i < 8; i++)
{
checksum -= usb_buf[i];
}
usb_buf[8] = checksum;
hid_send_feature_report(dev, usb_buf, GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1);
/*---------------------------------------------------------*\
| Sends first packet |
\*---------------------------------------------------------*/
unsigned char start_packet[GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1] =
{
0x00, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6D
};
hid_send_feature_report(dev, start_packet, GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1);
/*---------------------------------------------------------*\
| GET REPORT REQUEST |
\*---------------------------------------------------------*/
unsigned char report_packet[GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1];
memset(report_packet, 0x00, GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1);
report_packet[1] = GIGABYTE_AORUS_LAPTOP_REPORT_ID;
hid_get_feature_report(dev, report_packet, GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1);
/*---------------------------------------------------------*\
| Sends 2nd packet |
\*---------------------------------------------------------*/
unsigned char second_packet[GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1] =
{
0x00, 0x12, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xE5
};
hid_send_feature_report(dev, second_packet, GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1);
/*---------------------------------------------------------*\
| Creates the data packets |
\*---------------------------------------------------------*/
unsigned char color_data[64 * 8];
memset(color_data, 0x00, 64 * 8);
for(unsigned int i = 0; i < positions.size(); i++)
{
color_data[positions[i] * 4 + 1] = RGBGetRValue(colors[i]);
color_data[positions[i] * 4 + 2] = RGBGetGValue(colors[i]);
color_data[positions[i] * 4 + 3] = RGBGetBValue(colors[i]);
}
unsigned char color_buf[64 + 1];
color_buf[0] = 0;
for(unsigned int i = 0; i < 8; i++)
{
memcpy(&color_buf[1], &(color_data[64*i]), 64);
hid_write(dev, color_buf, 65);
}
}
/*---------------------------------------------------------*\
| GigabyteAorusLaptopController.cpp |
| |
| Driver for Gigabyte Aorus laptop |
| |
| Morgan Guimard (morg) 05 Jun 2023 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include <cmath>
#include <string.h>
#include "GigabyteAorusLaptopController.h"
#include "StringUtils.h"
/*---------------------------------------------------------*\
| Indexed colors mapping |
| blue 04 |
| green 02 |
| orange 05 |
| purple 06 |
| red 01 |
| white 07 |
| yellow 03 |
\*---------------------------------------------------------*/
static unsigned char argb_colour_index_data[2][2][2] =
{ //B0 B1
{ { 0x01, 0x04 }, //G0 R0
{ 0x02, 0x04 }, }, //G1 R0
{ { 0x01, 0x06 }, //G0 R1
{ 0x05, 0x07 }, } //G1 R1
};
GigabyteAorusLaptopController::GigabyteAorusLaptopController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name)
{
dev = dev_handle;
location = info.path;
name = dev_name;
}
GigabyteAorusLaptopController::~GigabyteAorusLaptopController()
{
hid_close(dev);
}
std::string GigabyteAorusLaptopController::GetNameString()
{
return(name);
}
std::string GigabyteAorusLaptopController::GetDeviceLocation()
{
return("HID: " + location);
}
std::string GigabyteAorusLaptopController::GetSerialString()
{
wchar_t serial_string[128];
int ret = hid_get_serial_number_string(dev, serial_string, 128);
if(ret != 0)
{
return("");
}
return(StringUtils::wstring_to_string(serial_string));
}
void GigabyteAorusLaptopController::SetDirect(uint8_t brightness, RGBColor color)
{
/*---------------------------------------------------------*\
| Direct mode protocol |
| ID C R G B Br C Ch |
| 08 01 00 00 FF 32 00 C5 |
| |
| C = constant |
| RGB = color |
| Br= brightness |
| Ch = checksum: 0xFF - all bytes |
\*---------------------------------------------------------*/
unsigned char usb_buf[GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1];
memset(usb_buf, 0x00, GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1);
usb_buf[1] = GIGABYTE_AORUS_LAPTOP_REPORT_ID;
usb_buf[2] = 0x01;
usb_buf[3] = RGBGetRValue(color);
usb_buf[4] = RGBGetGValue(color);
usb_buf[5] = RGBGetBValue(color);
usb_buf[6] = brightness;
unsigned char checksum = 0xFF;
for(unsigned int i = 1; i < 8; i++)
{
checksum -= usb_buf[i];
}
usb_buf[8] = checksum;
hid_send_feature_report(dev, usb_buf, GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1);
}
void GigabyteAorusLaptopController::SetMode(uint8_t mode_value, uint8_t speed, uint8_t brightness, uint8_t direction, RGBColor color)
{
/*---------------------------------------------------------*\
| Hardware mode protocol |
| ID C M Sp Br Cl Dr Ch |
| 08 00 01 08 32 01 00 XX |
| |
| C = constant |
| M = mode |
| Sp = speed |
| Br = brightness |
| Cl = Indexed color |
| Dr = Direction |
| Ch = checksum: 0xFF - all bytes |
\*---------------------------------------------------------*/
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
unsigned char indexed_color = GetColourIndex(red,grn,blu);
unsigned char usb_buf[GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1];
memset(usb_buf, 0x00, GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1);
usb_buf[1] = GIGABYTE_AORUS_LAPTOP_REPORT_ID; // report id
usb_buf[3] = mode_value; // mode value
usb_buf[4] = speed; // speed 0x01 -> 0x09
usb_buf[5] = brightness; // brightness 0x00 -> 0x32
usb_buf[6] = indexed_color; // color (red, orange, yellow, green, blue, purple, white)
usb_buf[7] = direction; // direction 0x01: right, 0x02 left, 0x03 up , 0x04 down
unsigned char checksum = 0xFF;
for(unsigned int i = 1; i < 8; i++)
{
checksum -= usb_buf[i];
}
usb_buf[8] = checksum; // checksum
hid_send_feature_report(dev, usb_buf, GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1);
}
unsigned char GigabyteAorusLaptopController::GetColourIndex(unsigned char red, unsigned char green, unsigned char blue)
{
/*-----------------------------------------------------*\
| This device uses a limited colour pallette referenced |
| by an index |
| 0x01 red |
| 0x02 orange |
| 0x03 yellow |
| 0x04 green |
| 0x05 blue |
| 0x06 purple |
| 0x07 white |
\*-----------------------------------------------------*/
unsigned int divisor = GetLargestColour( red, green, blue);
unsigned int r = (int)round( red / divisor );
unsigned int g = (int)round( green / divisor );
unsigned int b = (int)round( blue / divisor );
unsigned char idx = argb_colour_index_data[r][g][b];
return idx;
}
unsigned int GigabyteAorusLaptopController::GetLargestColour(unsigned int red, unsigned int green, unsigned int blue)
{
unsigned int largest;
if ( red > green )
{
( red > blue ) ? largest = red : largest = blue;
}
else
{
( green > blue ) ? largest = green : largest = blue;
}
return (largest == 0) ? 1 : largest;
}
void GigabyteAorusLaptopController::SetCustom(std::vector<RGBColor> colors, std::vector<unsigned int> positions, unsigned char brightness)
{
/*---------------------------------------------------------*\
| Custom mode protocol |
| ID C M Sp Br Cl Dr Ch |
| 08 00 33 01 2D 05 01 90 |
| 92 00 00 00 00 00 00 6D -> |
| GET REPORT REQUEST <- |
| read 8x64 bytes <- |
| 12 00 00 08 00 00 00 E5 -> |
| 00 RR GG BB ..... -> data (8 * 64 bytes) |
\*---------------------------------------------------------*/
/*---------------------------------------------------------*\
| Sends mode packet |
\*---------------------------------------------------------*/
unsigned char usb_buf[GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1];
memset(usb_buf, 0x00, GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1);
usb_buf[1] = GIGABYTE_AORUS_LAPTOP_REPORT_ID;
usb_buf[3] = GIGABYTE_AORUS_LAPTOP_CUSTOM_MODE_VALUE;
usb_buf[4] = 0x01;
usb_buf[5] = brightness;
usb_buf[6] = 0x05;
usb_buf[7] = 0x01;
unsigned char checksum = 0xFF;
for(unsigned int i = 1; i < 8; i++)
{
checksum -= usb_buf[i];
}
usb_buf[8] = checksum;
hid_send_feature_report(dev, usb_buf, GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1);
/*---------------------------------------------------------*\
| Sends first packet |
\*---------------------------------------------------------*/
unsigned char start_packet[GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1] =
{
0x00, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6D
};
hid_send_feature_report(dev, start_packet, GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1);
/*---------------------------------------------------------*\
| GET REPORT REQUEST |
\*---------------------------------------------------------*/
unsigned char report_packet[GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1];
memset(report_packet, 0x00, GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1);
report_packet[1] = GIGABYTE_AORUS_LAPTOP_REPORT_ID;
hid_get_feature_report(dev, report_packet, GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1);
/*---------------------------------------------------------*\
| Sends 2nd packet |
\*---------------------------------------------------------*/
unsigned char second_packet[GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1] =
{
0x00, 0x12, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xE5
};
hid_send_feature_report(dev, second_packet, GIGABYTE_AORUS_LAPTOP_REPORT_SIZE+1);
/*---------------------------------------------------------*\
| Creates the data packets |
\*---------------------------------------------------------*/
unsigned char color_data[64 * 8];
memset(color_data, 0x00, 64 * 8);
for(unsigned int i = 0; i < positions.size(); i++)
{
color_data[positions[i] * 4 + 1] = RGBGetRValue(colors[i]);
color_data[positions[i] * 4 + 2] = RGBGetGValue(colors[i]);
color_data[positions[i] * 4 + 3] = RGBGetBValue(colors[i]);
}
unsigned char color_buf[64 + 1];
color_buf[0] = 0;
for(unsigned int i = 0; i < 8; i++)
{
memcpy(&color_buf[1], &(color_data[64*i]), 64);
hid_write(dev, color_buf, 65);
}
}
@@ -1,73 +1,73 @@
/*---------------------------------------------------------*\
| GigabyteAorusLaptopController.h |
| |
| Driver for Gigabyte Aorus laptop |
| |
| Morgan Guimard (morg) 05 Jun 2023 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include <string>
#include <hidapi.h>
#include "RGBController.h"
#define GIGABYTE_AORUS_LAPTOP_REPORT_SIZE 8
#define GIGABYTE_AORUS_LAPTOP_REPORT_ID 0x08
enum
{
GIGABYTE_AORUS_LAPTOP_BRIGHTNESS_MIN = 0x00,
GIGABYTE_AORUS_LAPTOP_BRIGHTNESS_MAX = 0x32,
GIGABYTE_AORUS_LAPTOP_SPEED_MIN = 0x01,
GIGABYTE_AORUS_LAPTOP_SPEED_MAX = 0x09
};
enum
{
GIGABYTE_AORUS_LAPTOP_DIRECT_MODE_VALUE = 0x00,
GIGABYTE_AORUS_LAPTOP_STATIC_MODE_VALUE = 0x01,
GIGABYTE_AORUS_LAPTOP_PULSE_MODE_VALUE = 0x02,
GIGABYTE_AORUS_LAPTOP_WAVE_MODE_VALUE = 0x03,
GIGABYTE_AORUS_LAPTOP_REACTIVE_MODE_VALUE = 0x04,
GIGABYTE_AORUS_LAPTOP_MARQUEE_MODE_VALUE = 0x05,
GIGABYTE_AORUS_LAPTOP_RIPPLE_MODE_VALUE = 0x06,
GIGABYTE_AORUS_LAPTOP_CYCLE_MODE_VALUE = 0x08,
GIGABYTE_AORUS_LAPTOP_RAINBOW_MARQUEE_MODE_VALUE = 0x09,
GIGABYTE_AORUS_LAPTOP_DROPLET_MODE_VALUE = 0x0A,
GIGABYTE_AORUS_LAPTOP_CIRCLE_MARQUEE_MODE_VALUE = 0x0B,
GIGABYTE_AORUS_LAPTOP_HEDGE_MODE_VALUE = 0x0C,
GIGABYTE_AORUS_LAPTOP_SPIRAL_MODE_VALUE = 0x0D,
GIGABYTE_AORUS_LAPTOP_CURTAIN_MODE_VALUE = 0x40,
GIGABYTE_AORUS_LAPTOP_COMET_MODE_VALUE = 0x41,
GIGABYTE_AORUS_LAPTOP_CHASE_MODE_VALUE = 0x43,
GIGABYTE_AORUS_LAPTOP_CUSTOM_MODE_VALUE = 0x33
};
class GigabyteAorusLaptopController
{
public:
GigabyteAorusLaptopController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name);
~GigabyteAorusLaptopController();
std::string GetNameString();
std::string GetSerialString();
std::string GetDeviceLocation();
void SetDirect(uint8_t brightness, RGBColor color);
void SetMode(uint8_t mode_value, uint8_t speed, uint8_t brightness, uint8_t direction, RGBColor color);
void SetCustom(std::vector<RGBColor> colors, std::vector<unsigned int> positions, unsigned char brightness);
protected:
hid_device* dev;
private:
unsigned int GetLargestColour(unsigned int red, unsigned int green, unsigned int blue);
unsigned char GetColourIndex(unsigned char red, unsigned char green, unsigned char blue);
std::string location;
std::string name;
};
/*---------------------------------------------------------*\
| GigabyteAorusLaptopController.h |
| |
| Driver for Gigabyte Aorus laptop |
| |
| Morgan Guimard (morg) 05 Jun 2023 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include <string>
#include <hidapi.h>
#include "RGBController.h"
#define GIGABYTE_AORUS_LAPTOP_REPORT_SIZE 8
#define GIGABYTE_AORUS_LAPTOP_REPORT_ID 0x08
enum
{
GIGABYTE_AORUS_LAPTOP_BRIGHTNESS_MIN = 0x00,
GIGABYTE_AORUS_LAPTOP_BRIGHTNESS_MAX = 0x32,
GIGABYTE_AORUS_LAPTOP_SPEED_MIN = 0x01,
GIGABYTE_AORUS_LAPTOP_SPEED_MAX = 0x09
};
enum
{
GIGABYTE_AORUS_LAPTOP_DIRECT_MODE_VALUE = 0x00,
GIGABYTE_AORUS_LAPTOP_STATIC_MODE_VALUE = 0x01,
GIGABYTE_AORUS_LAPTOP_PULSE_MODE_VALUE = 0x02,
GIGABYTE_AORUS_LAPTOP_WAVE_MODE_VALUE = 0x03,
GIGABYTE_AORUS_LAPTOP_REACTIVE_MODE_VALUE = 0x04,
GIGABYTE_AORUS_LAPTOP_MARQUEE_MODE_VALUE = 0x05,
GIGABYTE_AORUS_LAPTOP_RIPPLE_MODE_VALUE = 0x06,
GIGABYTE_AORUS_LAPTOP_CYCLE_MODE_VALUE = 0x08,
GIGABYTE_AORUS_LAPTOP_RAINBOW_MARQUEE_MODE_VALUE = 0x09,
GIGABYTE_AORUS_LAPTOP_DROPLET_MODE_VALUE = 0x0A,
GIGABYTE_AORUS_LAPTOP_CIRCLE_MARQUEE_MODE_VALUE = 0x0B,
GIGABYTE_AORUS_LAPTOP_HEDGE_MODE_VALUE = 0x0C,
GIGABYTE_AORUS_LAPTOP_SPIRAL_MODE_VALUE = 0x0D,
GIGABYTE_AORUS_LAPTOP_CURTAIN_MODE_VALUE = 0x40,
GIGABYTE_AORUS_LAPTOP_COMET_MODE_VALUE = 0x41,
GIGABYTE_AORUS_LAPTOP_CHASE_MODE_VALUE = 0x43,
GIGABYTE_AORUS_LAPTOP_CUSTOM_MODE_VALUE = 0x33
};
class GigabyteAorusLaptopController
{
public:
GigabyteAorusLaptopController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name);
~GigabyteAorusLaptopController();
std::string GetNameString();
std::string GetSerialString();
std::string GetDeviceLocation();
void SetDirect(uint8_t brightness, RGBColor color);
void SetMode(uint8_t mode_value, uint8_t speed, uint8_t brightness, uint8_t direction, RGBColor color);
void SetCustom(std::vector<RGBColor> colors, std::vector<unsigned int> positions, unsigned char brightness);
protected:
hid_device* dev;
private:
unsigned int GetLargestColour(unsigned int red, unsigned int green, unsigned int blue);
unsigned char GetColourIndex(unsigned char red, unsigned char green, unsigned char blue);
std::string location;
std::string name;
};
@@ -1,56 +1,56 @@
/*---------------------------------------------------------*\
| GigabyteAorusLaptopControllerDetect.cpp |
| |
| Detector for Gigabyte Aorus laptop |
| |
| Morgan Guimard (morg) 05 Jun 2023 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "Detector.h"
#include "GigabyteAorusLaptopController.h"
#include "RGBController_GigabyteAorusLaptop.h"
/*---------------------------------------------------------*\
| Gigabyte vendor ID |
\*---------------------------------------------------------*/
#define GIGABYTE_AORUS_LAPTOP_VID 0x0414
/*---------------------------------------------------------*\
| AORUS Laptops PID |
\*---------------------------------------------------------*/
#define AORUS_17X_BACKLIGHT_PID 0x7A42
#define AORUS_17X_KEYBOARD_PID 0x7A3F
#define AORUS_15BKF_BACKLIGHT_PID 0x7A44
#define AORUS_15BKF_KEYBOARD_PID 0x7A43
void DetectGigabyteAorusLaptopControllers(hid_device_info* info, const std::string& name, GIGABYTE_AORUS_LAPTOP_DEV_TYPE dev_type)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
GigabyteAorusLaptopController* controller = new GigabyteAorusLaptopController(dev, *info, name);
RGBController_GigabyteAorusLaptop* rgb_controller = new RGBController_GigabyteAorusLaptop(controller, dev_type);
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
void DetectGigabyteAorusLaptopKeyboardControllers(hid_device_info* info, const std::string& name)
{
DetectGigabyteAorusLaptopControllers(info, name, GIGABYTE_AORUS_LAPTOP_KEYBOARD_TYPE);
}
void DetectGigabyteAorusLaptopBacklightControllers(hid_device_info* info, const std::string& name)
{
DetectGigabyteAorusLaptopControllers(info, name, GIGABYTE_AORUS_LAPTOP_BACKLIGHT_TYPE);
}
REGISTER_HID_DETECTOR_IPU("Gigabyte Aorus 17X Keyboard", DetectGigabyteAorusLaptopKeyboardControllers, GIGABYTE_AORUS_LAPTOP_VID, AORUS_17X_KEYBOARD_PID, 3, 0xFF01, 0x01);
REGISTER_HID_DETECTOR_IPU("Gigabyte Aorus 17X Backlight", DetectGigabyteAorusLaptopBacklightControllers, GIGABYTE_AORUS_LAPTOP_VID, AORUS_17X_BACKLIGHT_PID, 3, 0xFF01, 0x01);
REGISTER_HID_DETECTOR_IPU("Gigabyte Aorus 15BKF Keyboard", DetectGigabyteAorusLaptopKeyboardControllers, GIGABYTE_AORUS_LAPTOP_VID, AORUS_15BKF_KEYBOARD_PID, 3, 0xFF01, 0x01);
REGISTER_HID_DETECTOR_IPU("Gigabyte Aorus 15BKF Backlight", DetectGigabyteAorusLaptopBacklightControllers, GIGABYTE_AORUS_LAPTOP_VID, AORUS_15BKF_BACKLIGHT_PID, 3, 0xFF01, 0x01);
/*---------------------------------------------------------*\
| GigabyteAorusLaptopControllerDetect.cpp |
| |
| Detector for Gigabyte Aorus laptop |
| |
| Morgan Guimard (morg) 05 Jun 2023 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "Detector.h"
#include "GigabyteAorusLaptopController.h"
#include "RGBController_GigabyteAorusLaptop.h"
/*---------------------------------------------------------*\
| Gigabyte vendor ID |
\*---------------------------------------------------------*/
#define GIGABYTE_AORUS_LAPTOP_VID 0x0414
/*---------------------------------------------------------*\
| AORUS Laptops PID |
\*---------------------------------------------------------*/
#define AORUS_17X_BACKLIGHT_PID 0x7A42
#define AORUS_17X_KEYBOARD_PID 0x7A3F
#define AORUS_15BKF_BACKLIGHT_PID 0x7A44
#define AORUS_15BKF_KEYBOARD_PID 0x7A43
void DetectGigabyteAorusLaptopControllers(hid_device_info* info, const std::string& name, GIGABYTE_AORUS_LAPTOP_DEV_TYPE dev_type)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
GigabyteAorusLaptopController* controller = new GigabyteAorusLaptopController(dev, *info, name);
RGBController_GigabyteAorusLaptop* rgb_controller = new RGBController_GigabyteAorusLaptop(controller, dev_type);
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
void DetectGigabyteAorusLaptopKeyboardControllers(hid_device_info* info, const std::string& name)
{
DetectGigabyteAorusLaptopControllers(info, name, GIGABYTE_AORUS_LAPTOP_KEYBOARD_TYPE);
}
void DetectGigabyteAorusLaptopBacklightControllers(hid_device_info* info, const std::string& name)
{
DetectGigabyteAorusLaptopControllers(info, name, GIGABYTE_AORUS_LAPTOP_BACKLIGHT_TYPE);
}
REGISTER_HID_DETECTOR_IPU("Gigabyte Aorus 17X Keyboard", DetectGigabyteAorusLaptopKeyboardControllers, GIGABYTE_AORUS_LAPTOP_VID, AORUS_17X_KEYBOARD_PID, 3, 0xFF01, 0x01);
REGISTER_HID_DETECTOR_IPU("Gigabyte Aorus 17X Backlight", DetectGigabyteAorusLaptopBacklightControllers, GIGABYTE_AORUS_LAPTOP_VID, AORUS_17X_BACKLIGHT_PID, 3, 0xFF01, 0x01);
REGISTER_HID_DETECTOR_IPU("Gigabyte Aorus 15BKF Keyboard", DetectGigabyteAorusLaptopKeyboardControllers, GIGABYTE_AORUS_LAPTOP_VID, AORUS_15BKF_KEYBOARD_PID, 3, 0xFF01, 0x01);
REGISTER_HID_DETECTOR_IPU("Gigabyte Aorus 15BKF Backlight", DetectGigabyteAorusLaptopBacklightControllers, GIGABYTE_AORUS_LAPTOP_VID, AORUS_15BKF_BACKLIGHT_PID, 3, 0xFF01, 0x01);
File diff suppressed because it is too large. Load diff
@@ -1,41 +1,41 @@
/*---------------------------------------------------------*\
| RGBController_GigabyteAorusLaptop.h |
| |
| RGBController for Gigabyte Aorus laptop |
| |
| Morgan Guimard (morg) 05 Jun 2023 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include "RGBController.h"
#include "GigabyteAorusLaptopController.h"
enum GIGABYTE_AORUS_LAPTOP_DEV_TYPE
{
GIGABYTE_AORUS_LAPTOP_KEYBOARD_TYPE,
GIGABYTE_AORUS_LAPTOP_BACKLIGHT_TYPE
};
class RGBController_GigabyteAorusLaptop : public RGBController
{
public:
RGBController_GigabyteAorusLaptop(GigabyteAorusLaptopController* controller_ptr, GIGABYTE_AORUS_LAPTOP_DEV_TYPE dev_type);
~RGBController_GigabyteAorusLaptop();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void DeviceUpdateMode();
private:
GigabyteAorusLaptopController* controller;
GIGABYTE_AORUS_LAPTOP_DEV_TYPE dev_type;
};
/*---------------------------------------------------------*\
| RGBController_GigabyteAorusLaptop.h |
| |
| RGBController for Gigabyte Aorus laptop |
| |
| Morgan Guimard (morg) 05 Jun 2023 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include "RGBController.h"
#include "GigabyteAorusLaptopController.h"
enum GIGABYTE_AORUS_LAPTOP_DEV_TYPE
{
GIGABYTE_AORUS_LAPTOP_KEYBOARD_TYPE,
GIGABYTE_AORUS_LAPTOP_BACKLIGHT_TYPE
};
class RGBController_GigabyteAorusLaptop : public RGBController
{
public:
RGBController_GigabyteAorusLaptop(GigabyteAorusLaptopController* controller_ptr, GIGABYTE_AORUS_LAPTOP_DEV_TYPE dev_type);
~RGBController_GigabyteAorusLaptop();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void DeviceUpdateMode();
private:
GigabyteAorusLaptopController* controller;
GIGABYTE_AORUS_LAPTOP_DEV_TYPE dev_type;
};