Compare commits
74
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd31956aaa | ||
|
|
c3bd47fe60 | ||
|
|
c6fe1e7023 | ||
|
|
407c304eab | ||
|
|
7c87d97889 | ||
|
|
6f3a6f1404 | ||
|
|
775e47774e | ||
|
|
1dc9b2ed53 | ||
|
|
0a494f6a12 | ||
|
|
5177acb4e7 | ||
|
|
fe1b5a7256 | ||
|
|
00e2b92ab6 | ||
|
|
4319150412 | ||
|
|
6dcddd2f8a | ||
|
|
30a1c332d3 | ||
|
|
c9cd346713 | ||
|
|
59051c7524 | ||
|
|
5e9469fe82 | ||
|
|
055b937ff7 | ||
|
|
0a95989edb | ||
|
|
ef3e48884d | ||
|
|
0f637c30e5 | ||
|
|
82d40f2d97 | ||
|
|
df6a498885 | ||
|
|
b252fe8629 | ||
|
|
c837fa2b7e | ||
|
|
41749dce59 | ||
|
|
08fbd285dc | ||
|
|
af7e3e150c | ||
|
|
bb9a3e8730 | ||
|
|
c69f7fdf57 | ||
|
|
aba88f1fe2 | ||
|
|
54a07077e1 | ||
|
|
0e288f3670 | ||
|
|
cf990ece4e | ||
|
|
ee52d2a7b0 | ||
|
|
a884aca165 | ||
|
|
464a590865 | ||
|
|
98767252e6 | ||
|
|
cbead40b32 | ||
|
|
b4be3b1a88 | ||
|
|
67c2e53221 | ||
|
|
4b90142d84 | ||
|
|
e3408ee9d0 | ||
|
|
643bfa880f | ||
|
|
f370eb79b4 | ||
|
|
0e45370b76 | ||
|
|
73ef9f5fb2 | ||
|
|
95512d56f1 | ||
|
|
405869fefe | ||
|
|
526d0bd2ca | ||
|
|
1b5a1aa561 | ||
|
|
8bafba65fd | ||
|
|
b26e3f25fd | ||
|
|
9c8c57cc39 | ||
|
|
d358f1d2da | ||
|
|
f4cd06df38 | ||
|
|
15d2c30fa6 | ||
|
|
4f3eb52e18 | ||
|
|
4c52e4bfba | ||
|
|
d586324885 | ||
|
|
5dd0c18194 | ||
|
|
f6f3633ec0 | ||
|
|
985120903b | ||
|
|
614f95a30a | ||
|
|
f732f57a4c | ||
|
|
7b299d7d7f | ||
|
|
ab3edd6df5 | ||
|
|
e6d1c37306 | ||
|
|
b083537b36 | ||
|
|
0c431c8340 | ||
|
|
e606b57acd | ||
|
|
77c70776cb | ||
|
|
cf79a04f05 |
No files matched your search
@@ -205,7 +205,6 @@ void RGBController_BloodyB820R::SetupZones()
|
|||||||
{
|
{
|
||||||
led new_led;
|
led new_led;
|
||||||
new_led.name = led_names[led_index];
|
new_led.name = led_names[led_index];
|
||||||
new_led.value = led_index;
|
|
||||||
leds.push_back(new_led);
|
leds.push_back(new_led);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,13 +67,13 @@ void BloodyMouseController::InitDevice()
|
|||||||
hid_send_feature_report(dev, buffer, BLOODYMOUSE_WRITE_PACKET_SIZE);
|
hid_send_feature_report(dev, buffer, BLOODYMOUSE_WRITE_PACKET_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BloodyMouseController::SetLedsDirect(std::vector<RGBColor> colors)
|
void BloodyMouseController::SetLedsDirect(std::vector<RGBColor> colors, std::vector<uint8_t> offsets)
|
||||||
{
|
{
|
||||||
uint8_t buffer[BLOODYMOUSE_WRITE_PACKET_SIZE] = { 0x07, 0x03, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00 };
|
uint8_t buffer[BLOODYMOUSE_WRITE_PACKET_SIZE] = { 0x07, 0x03, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00 };
|
||||||
|
|
||||||
for(uint8_t i = 0; i < colors.size(); i++)
|
for(uint8_t i = 0; i < colors.size(); i++)
|
||||||
{
|
{
|
||||||
uint8_t offset = 3 * (colors[i] >> 24) + BLOODYMOUSE_DATA_BYTE;
|
uint8_t offset = 3 * (offsets[i]) + BLOODYMOUSE_DATA_BYTE;
|
||||||
|
|
||||||
buffer[offset] = RGBGetRValue(colors[i]);
|
buffer[offset] = RGBGetRValue(colors[i]);
|
||||||
buffer[offset + 1] = RGBGetGValue(colors[i]);
|
buffer[offset + 1] = RGBGetGValue(colors[i]);
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public:
|
|||||||
std::string GetLocation();
|
std::string GetLocation();
|
||||||
std::string GetName();
|
std::string GetName();
|
||||||
|
|
||||||
void SetLedsDirect(std::vector<RGBColor> colors);
|
void SetLedsDirect(std::vector<RGBColor> colors, std::vector<uint8_t> offsets);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint16_t pid;
|
uint16_t pid;
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ void RGBController_BloodyMouse::SetupZones()
|
|||||||
{
|
{
|
||||||
led new_led;
|
led new_led;
|
||||||
|
|
||||||
new_led.value = mz.zone_leds[lp_idx];
|
offsets.push_back(mz.zone_leds[lp_idx]);
|
||||||
|
|
||||||
if(bool_single)
|
if(bool_single)
|
||||||
{
|
{
|
||||||
@@ -163,14 +163,7 @@ void RGBController_BloodyMouse::SetupZones()
|
|||||||
|
|
||||||
void RGBController_BloodyMouse::DeviceUpdateLEDs()
|
void RGBController_BloodyMouse::DeviceUpdateLEDs()
|
||||||
{
|
{
|
||||||
std::vector<RGBColor> colour;
|
controller->SetLedsDirect(colors, offsets);
|
||||||
for(size_t i = 0; i < colors.size(); i++)
|
|
||||||
{
|
|
||||||
RGBColor c = colors[i] | (leds[i].value << 24);
|
|
||||||
colour.push_back(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
controller->SetLedsDirect(colour);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RGBController_BloodyMouse::DeviceUpdateZoneLEDs(int /*zone*/)
|
void RGBController_BloodyMouse::DeviceUpdateZoneLEDs(int /*zone*/)
|
||||||
|
|||||||
@@ -39,4 +39,5 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
BloodyMouseController* controller;
|
BloodyMouseController* controller;
|
||||||
|
std::vector<uint8_t> offsets;
|
||||||
};
|
};
|
||||||
@@ -186,7 +186,7 @@ void AMBXController::SetLEDColor(unsigned int led, RGBColor color)
|
|||||||
std::this_thread::sleep_for(std::chrono::milliseconds(2));
|
std::this_thread::sleep_for(std::chrono::milliseconds(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMBXController::SetLEDColors(unsigned int* leds, RGBColor* colors, unsigned int count)
|
void AMBXController::SetLEDColors(const unsigned int* leds, RGBColor* colors, unsigned int count)
|
||||||
{
|
{
|
||||||
for(unsigned int i = 0; i < count; i++)
|
for(unsigned int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public:
|
|||||||
|
|
||||||
bool IsInitialized();
|
bool IsInitialized();
|
||||||
void SetLEDColor(unsigned int led, RGBColor color);
|
void SetLEDColor(unsigned int led, RGBColor color);
|
||||||
void SetLEDColors(unsigned int* leds, RGBColor* colors, unsigned int count);
|
void SetLEDColors(const unsigned int* leds, RGBColor* colors, unsigned int count);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
libusb_context* usb_context;
|
libusb_context* usb_context;
|
||||||
|
|||||||
@@ -9,6 +9,15 @@
|
|||||||
|
|
||||||
#include "RGBController_AMBX.h"
|
#include "RGBController_AMBX.h"
|
||||||
|
|
||||||
|
static const unsigned int led_values[] =
|
||||||
|
{
|
||||||
|
AMBX_LIGHT_LEFT,
|
||||||
|
AMBX_LIGHT_RIGHT,
|
||||||
|
AMBX_LIGHT_WALL_LEFT,
|
||||||
|
AMBX_LIGHT_WALL_CENTER,
|
||||||
|
AMBX_LIGHT_WALL_RIGHT
|
||||||
|
};
|
||||||
|
|
||||||
/**------------------------------------------------------------------*\
|
/**------------------------------------------------------------------*\
|
||||||
@name Philips amBX
|
@name Philips amBX
|
||||||
@category Accessory
|
@category Accessory
|
||||||
@@ -71,27 +80,22 @@ void RGBController_AMBX::SetupZones()
|
|||||||
// Set up LEDs
|
// Set up LEDs
|
||||||
led left_light;
|
led left_light;
|
||||||
left_light.name = "Left";
|
left_light.name = "Left";
|
||||||
left_light.value = AMBX_LIGHT_LEFT;
|
|
||||||
leds.push_back(left_light);
|
leds.push_back(left_light);
|
||||||
|
|
||||||
led right_light;
|
led right_light;
|
||||||
right_light.name = "Right";
|
right_light.name = "Right";
|
||||||
right_light.value = AMBX_LIGHT_RIGHT;
|
|
||||||
leds.push_back(right_light);
|
leds.push_back(right_light);
|
||||||
|
|
||||||
led wall_left;
|
led wall_left;
|
||||||
wall_left.name = "Wall Left";
|
wall_left.name = "Wall Left";
|
||||||
wall_left.value = AMBX_LIGHT_WALL_LEFT;
|
|
||||||
leds.push_back(wall_left);
|
leds.push_back(wall_left);
|
||||||
|
|
||||||
led wall_center;
|
led wall_center;
|
||||||
wall_center.name = "Wall Center";
|
wall_center.name = "Wall Center";
|
||||||
wall_center.value = AMBX_LIGHT_WALL_CENTER;
|
|
||||||
leds.push_back(wall_center);
|
leds.push_back(wall_center);
|
||||||
|
|
||||||
led wall_right;
|
led wall_right;
|
||||||
wall_right.name = "Wall Right";
|
wall_right.name = "Wall Right";
|
||||||
wall_right.value = AMBX_LIGHT_WALL_RIGHT;
|
|
||||||
leds.push_back(wall_right);
|
leds.push_back(wall_right);
|
||||||
|
|
||||||
SetupColors();
|
SetupColors();
|
||||||
@@ -104,16 +108,7 @@ void RGBController_AMBX::DeviceUpdateLEDs()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int led_values[5];
|
controller->SetLEDColors(led_values, colors.data(), static_cast<unsigned int>(colors.size()));
|
||||||
RGBColor led_colors[5];
|
|
||||||
|
|
||||||
for(unsigned int led_idx = 0; led_idx < leds.size(); led_idx++)
|
|
||||||
{
|
|
||||||
led_values[led_idx] = leds[led_idx].value;
|
|
||||||
led_colors[led_idx] = colors[led_idx];
|
|
||||||
}
|
|
||||||
|
|
||||||
controller->SetLEDColors(led_values, led_colors, static_cast<unsigned int>(leds.size()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RGBController_AMBX::DeviceUpdateZoneLEDs(int zone)
|
void RGBController_AMBX::DeviceUpdateZoneLEDs(int zone)
|
||||||
@@ -138,17 +133,17 @@ void RGBController_AMBX::DeviceUpdateZoneLEDs(int zone)
|
|||||||
start_idx += zones[z_idx].leds_count;
|
start_idx += zones[z_idx].leds_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int led_values[5];
|
unsigned int tmp_values[5];
|
||||||
RGBColor led_colors[5];
|
RGBColor tmp_colors[5];
|
||||||
|
|
||||||
for(unsigned int led_idx = 0; led_idx < zone_size; led_idx++)
|
for(unsigned int led_idx = 0; led_idx < zone_size; led_idx++)
|
||||||
{
|
{
|
||||||
unsigned int current_idx = start_idx + led_idx;
|
unsigned int current_idx = start_idx + led_idx;
|
||||||
led_values[led_idx] = leds[current_idx].value;
|
tmp_values[led_idx] = led_values[current_idx];
|
||||||
led_colors[led_idx] = colors[current_idx];
|
tmp_colors[led_idx] = colors[current_idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
controller->SetLEDColors(led_values, led_colors, zone_size);
|
controller->SetLEDColors(tmp_values, tmp_colors, zone_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RGBController_AMBX::DeviceUpdateSingleLED(int led)
|
void RGBController_AMBX::DeviceUpdateSingleLED(int led)
|
||||||
@@ -158,7 +153,7 @@ void RGBController_AMBX::DeviceUpdateSingleLED(int led)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int led_value = leds[led].value;
|
unsigned int led_value = led_values[led];
|
||||||
RGBColor color = colors[led];
|
RGBColor color = colors[led];
|
||||||
controller->SetLEDColor(led_value, color);
|
controller->SetLEDColor(led_value, color);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,33 @@
|
|||||||
|
|
||||||
#include "RGBController_AMDWraithPrism.h"
|
#include "RGBController_AMDWraithPrism.h"
|
||||||
|
|
||||||
|
/*---------------------------------------------------------*\
|
||||||
|
| LED maps |
|
||||||
|
\*---------------------------------------------------------*/
|
||||||
|
const unsigned char led_values[] =
|
||||||
|
{
|
||||||
|
// Logo
|
||||||
|
0x00,
|
||||||
|
// Fan
|
||||||
|
0x01,
|
||||||
|
// Ring
|
||||||
|
0x08,
|
||||||
|
0x07,
|
||||||
|
0x06,
|
||||||
|
0x05,
|
||||||
|
0x04,
|
||||||
|
0x03,
|
||||||
|
0x02,
|
||||||
|
0x10,
|
||||||
|
0x0F,
|
||||||
|
0x0E,
|
||||||
|
0x0D,
|
||||||
|
0x0C,
|
||||||
|
0x0B,
|
||||||
|
0x0A,
|
||||||
|
0x09
|
||||||
|
};
|
||||||
|
|
||||||
/**------------------------------------------------------------------*\
|
/**------------------------------------------------------------------*\
|
||||||
@name AMD Wraith Prism
|
@name AMD Wraith Prism
|
||||||
@category Cooler
|
@category Cooler
|
||||||
@@ -139,14 +166,6 @@ RGBController_AMDWraithPrism::~RGBController_AMDWraithPrism()
|
|||||||
|
|
||||||
void RGBController_AMDWraithPrism::SetupZones()
|
void RGBController_AMDWraithPrism::SetupZones()
|
||||||
{
|
{
|
||||||
/*-----------------------------------------------------*\
|
|
||||||
| LED maps |
|
|
||||||
\*-----------------------------------------------------*/
|
|
||||||
const unsigned int logo_leds[1] = { 0x00 };
|
|
||||||
const unsigned int fan_leds[1] = { 0x01 };
|
|
||||||
const unsigned int ring_leds[15] = { 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x10,
|
|
||||||
0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09 };
|
|
||||||
|
|
||||||
/*-----------------------------------------------------*\
|
/*-----------------------------------------------------*\
|
||||||
| Set up zones |
|
| Set up zones |
|
||||||
\*-----------------------------------------------------*/
|
\*-----------------------------------------------------*/
|
||||||
@@ -181,7 +200,6 @@ void RGBController_AMDWraithPrism::SetupZones()
|
|||||||
{
|
{
|
||||||
led logo_led;
|
led logo_led;
|
||||||
logo_led.name = "Logo LED";
|
logo_led.name = "Logo LED";
|
||||||
logo_led.value = logo_leds[led_idx];
|
|
||||||
leds.push_back(logo_led);
|
leds.push_back(logo_led);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,7 +207,6 @@ void RGBController_AMDWraithPrism::SetupZones()
|
|||||||
{
|
{
|
||||||
led fan_led;
|
led fan_led;
|
||||||
fan_led.name = "Fan LED";
|
fan_led.name = "Fan LED";
|
||||||
fan_led.value = fan_leds[led_idx];
|
|
||||||
leds.push_back(fan_led);
|
leds.push_back(fan_led);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,7 +214,6 @@ void RGBController_AMDWraithPrism::SetupZones()
|
|||||||
{
|
{
|
||||||
led ring_led;
|
led ring_led;
|
||||||
ring_led.name = "Ring LED";
|
ring_led.name = "Ring LED";
|
||||||
ring_led.value = ring_leds[led_idx];
|
|
||||||
leds.push_back(ring_led);
|
leds.push_back(ring_led);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,7 +234,7 @@ void RGBController_AMDWraithPrism::DeviceUpdateLEDs()
|
|||||||
leds_count = 0;
|
leds_count = 0;
|
||||||
for(std::size_t led_idx = 0; led_idx < 2; led_idx++)
|
for(std::size_t led_idx = 0; led_idx < 2; led_idx++)
|
||||||
{
|
{
|
||||||
led_ids[leds_count] = (unsigned char)leds[led_idx].value;
|
led_ids[leds_count] = led_values[led_idx];
|
||||||
color_buf[leds_count] = colors[led_idx];
|
color_buf[leds_count] = colors[led_idx];
|
||||||
|
|
||||||
leds_count++;
|
leds_count++;
|
||||||
@@ -231,7 +247,7 @@ void RGBController_AMDWraithPrism::DeviceUpdateLEDs()
|
|||||||
leds_count = 0;
|
leds_count = 0;
|
||||||
for(std::size_t led_idx = 0; led_idx < ( colors.size() - 2 ); led_idx++)
|
for(std::size_t led_idx = 0; led_idx < ( colors.size() - 2 ); led_idx++)
|
||||||
{
|
{
|
||||||
led_ids[leds_count] = (unsigned char)leds[led_idx + 2].value;
|
led_ids[leds_count] = led_values[led_idx + 2];
|
||||||
color_buf[leds_count] = colors[led_idx + 2];
|
color_buf[leds_count] = colors[led_idx + 2];
|
||||||
|
|
||||||
leds_count++;
|
leds_count++;
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ void RGBController_AOCKeyboard::SetupZones()
|
|||||||
led new_led;
|
led new_led;
|
||||||
|
|
||||||
new_led.name = new_kb.GetKeyNameAt(led_idx);
|
new_led.name = new_kb.GetKeyNameAt(led_idx);
|
||||||
new_led.value = new_kb.GetKeyValueAt(led_idx);
|
led_values.push_back(new_kb.GetKeyValueAt(led_idx));
|
||||||
leds.push_back(new_led);
|
leds.push_back(new_led);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,7 +303,7 @@ void RGBController_AOCKeyboard::DeviceUpdateLEDs()
|
|||||||
|
|
||||||
for(unsigned int led_idx = 0; led_idx < leds.size(); led_idx++)
|
for(unsigned int led_idx = 0; led_idx < leds.size(); led_idx++)
|
||||||
{
|
{
|
||||||
color_buf[leds[led_idx].value] = colors[led_idx];
|
color_buf[led_values[led_idx]] = colors[led_idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
controller->SetCustom(&color_buf[0]);
|
controller->SetCustom(&color_buf[0]);
|
||||||
|
|||||||
@@ -29,5 +29,6 @@ public:
|
|||||||
void DeviceUpdateMode();
|
void DeviceUpdateMode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AOCKeyboardController* controller;
|
AOCKeyboardController* controller;
|
||||||
|
std::vector<unsigned int> led_values;
|
||||||
};
|
};
|
||||||
@@ -269,9 +269,9 @@ void RGBController_PolychromeUSB::SetupZones()
|
|||||||
new_led.name = zones[channel_idx].name;
|
new_led.name = zones[channel_idx].name;
|
||||||
new_led.name.append(", LED ");
|
new_led.name.append(", LED ");
|
||||||
new_led.name.append(std::to_string(led_ch_idx + 1));
|
new_led.name.append(std::to_string(led_ch_idx + 1));
|
||||||
new_led.value = (unsigned int)channel_idx;
|
|
||||||
|
|
||||||
leds.push_back(new_led);
|
leds.push_back(new_led);
|
||||||
|
led_values.push_back(channel_idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,7 +296,7 @@ void RGBController_PolychromeUSB::SetupZones()
|
|||||||
\*---------------------------------------------------------*/
|
\*---------------------------------------------------------*/
|
||||||
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
||||||
{
|
{
|
||||||
unsigned char led = (unsigned char)leds[led_idx].value;
|
unsigned char led = (unsigned char)led_values[led_idx];
|
||||||
|
|
||||||
colors[led_idx] = zones_info[led].color;
|
colors[led_idx] = zones_info[led].color;
|
||||||
}
|
}
|
||||||
@@ -359,7 +359,7 @@ void RGBController_PolychromeUSB::DeviceUpdateZoneLEDs(int zone)
|
|||||||
|
|
||||||
void RGBController_PolychromeUSB::DeviceUpdateSingleLED(int led)
|
void RGBController_PolychromeUSB::DeviceUpdateSingleLED(int led)
|
||||||
{
|
{
|
||||||
unsigned int channel = leds[led].value;
|
unsigned int channel = led_values[led];
|
||||||
unsigned char set_mode = zones_info[channel].mode;
|
unsigned char set_mode = zones_info[channel].mode;
|
||||||
|
|
||||||
if(set_mode > modes.size())
|
if(set_mode > modes.size())
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
PolychromeUSBController* controller;
|
PolychromeUSBController* controller;
|
||||||
|
std::vector<unsigned int> led_values;
|
||||||
std::vector<PolychromeZoneInfo> zones_info;
|
std::vector<PolychromeZoneInfo> zones_info;
|
||||||
|
|
||||||
unsigned char GetDeviceMode(unsigned char zone);
|
unsigned char GetDeviceMode(unsigned char zone);
|
||||||
|
|||||||
+7
-2
@@ -158,6 +158,11 @@ void RGBController_ASRockASRRGBSMBus::SetupZones()
|
|||||||
\*---------------------------------------------------------*/
|
\*---------------------------------------------------------*/
|
||||||
leds.push_back(*new_led);
|
leds.push_back(*new_led);
|
||||||
|
|
||||||
|
/*---------------------------------------------------------*\
|
||||||
|
| Initialize led_values vector |
|
||||||
|
\*---------------------------------------------------------*/
|
||||||
|
led_values.push_back(0);
|
||||||
|
|
||||||
SetupColors();
|
SetupColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,9 +189,9 @@ void RGBController_ASRockASRRGBSMBus::DeviceUpdateSingleLED(int led)
|
|||||||
| If the LED value is non-zero, this LED overrides the LED |
|
| If the LED value is non-zero, this LED overrides the LED |
|
||||||
| index |
|
| index |
|
||||||
\*---------------------------------------------------------*/
|
\*---------------------------------------------------------*/
|
||||||
if(leds[led].value != 0)
|
if(led_values[led] != 0)
|
||||||
{
|
{
|
||||||
led = leds[led].value;
|
led = led_values[led];
|
||||||
}
|
}
|
||||||
|
|
||||||
controller->SetColorsAndSpeed(led, red, grn, blu);
|
controller->SetColorsAndSpeed(led, red, grn, blu);
|
||||||
|
|||||||
+1
@@ -30,4 +30,5 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
ASRockASRRGBSMBusController* controller;
|
ASRockASRRGBSMBusController* controller;
|
||||||
|
std::vector<unsigned int> led_values;
|
||||||
};
|
};
|
||||||
+1
-1
@@ -285,13 +285,13 @@ void RGBController_ASRockPolychromeV1SMBus::SetupZones()
|
|||||||
led* new_led = new led();
|
led* new_led = new led();
|
||||||
|
|
||||||
new_led->name = polychrome_v1_zone_names[zone_idx];
|
new_led->name = polychrome_v1_zone_names[zone_idx];
|
||||||
new_led->value = zone_idx;
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
/*---------------------------------------------------------*\
|
||||||
| Push new LED to LEDs vector |
|
| Push new LED to LEDs vector |
|
||||||
\*---------------------------------------------------------*/
|
\*---------------------------------------------------------*/
|
||||||
leds.push_back(*new_led);
|
leds.push_back(*new_led);
|
||||||
zoneIndexMap.push_back(zone_idx);
|
zoneIndexMap.push_back(zone_idx);
|
||||||
|
led_values.push_back(zone_idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-3
@@ -32,7 +32,9 @@ public:
|
|||||||
void DeviceUpdateMode();
|
void DeviceUpdateMode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ASRockPolychromeV1SMBusController* controller;
|
ASRockPolychromeV1SMBusController* controller;
|
||||||
uint8_t getModeIndex(uint8_t mode_value);
|
std::vector<unsigned int> led_values;
|
||||||
std::vector<uint8_t> zoneIndexMap;
|
std::vector<uint8_t> zoneIndexMap;
|
||||||
|
|
||||||
|
uint8_t getModeIndex(uint8_t mode_value);
|
||||||
};
|
};
|
||||||
+10
-4
@@ -238,6 +238,7 @@ void RGBController_ASRockPolychromeV2SMBus::SetupZones()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int led_count = 0;
|
||||||
/*---------------------------------------------------------*\
|
/*---------------------------------------------------------*\
|
||||||
| Set up LEDs |
|
| Set up LEDs |
|
||||||
\*---------------------------------------------------------*/
|
\*---------------------------------------------------------*/
|
||||||
@@ -255,11 +256,14 @@ void RGBController_ASRockPolychromeV2SMBus::SetupZones()
|
|||||||
new_led->name = polychrome_v2_zone_names[zone_idx];
|
new_led->name = polychrome_v2_zone_names[zone_idx];
|
||||||
|
|
||||||
new_led->name.append(" " + std::to_string(led_idx + 1));
|
new_led->name.append(" " + std::to_string(led_idx + 1));
|
||||||
new_led->value = 0;
|
|
||||||
|
|
||||||
if(zone_idx == POLYCHROME_V2_ZONE_ADDRESSABLE)
|
if(zone_idx == POLYCHROME_V2_ZONE_ADDRESSABLE)
|
||||||
{
|
{
|
||||||
new_led->value = 0x19;
|
led_values.push_back(0x19);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
led_values.push_back(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
/*---------------------------------------------------------*\
|
||||||
@@ -267,6 +271,8 @@ void RGBController_ASRockPolychromeV2SMBus::SetupZones()
|
|||||||
\*---------------------------------------------------------*/
|
\*---------------------------------------------------------*/
|
||||||
leds.push_back(*new_led);
|
leds.push_back(*new_led);
|
||||||
|
|
||||||
|
led_count++;
|
||||||
|
|
||||||
if(zone_idx == POLYCHROME_V2_ZONE_ADDRESSABLE)
|
if(zone_idx == POLYCHROME_V2_ZONE_ADDRESSABLE)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
@@ -308,9 +314,9 @@ void RGBController_ASRockPolychromeV2SMBus::DeviceUpdateSingleLED(int led)
|
|||||||
| If the LED value is non-zero, this LED overrides the LED |
|
| If the LED value is non-zero, this LED overrides the LED |
|
||||||
| index |
|
| index |
|
||||||
\*---------------------------------------------------------*/
|
\*---------------------------------------------------------*/
|
||||||
if(leds[led].value != 0)
|
if(led_values[led] != 0)
|
||||||
{
|
{
|
||||||
led = leds[led].value;
|
led = led_values[led];
|
||||||
}
|
}
|
||||||
|
|
||||||
controller->SetColorsAndSpeed(led, red, grn, blu);
|
controller->SetColorsAndSpeed(led, red, grn, blu);
|
||||||
|
|||||||
+2
-1
@@ -32,5 +32,6 @@ public:
|
|||||||
void DeviceUpdateMode();
|
void DeviceUpdateMode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ASRockPolychromeV2SMBusController* controller;
|
ASRockPolychromeV2SMBusController* controller;
|
||||||
|
std::vector<unsigned int> led_values;
|
||||||
};
|
};
|
||||||
+8
-8
@@ -313,7 +313,7 @@ void RGBController_AlienwareAW410K::SetupZones()
|
|||||||
{
|
{
|
||||||
led new_led;
|
led new_led;
|
||||||
new_led.name = led_names[led_idx].name;
|
new_led.name = led_names[led_idx].name;
|
||||||
new_led.value = led_names[led_idx].idx;
|
led_values.push_back(led_names[led_idx].idx);
|
||||||
leds.push_back(new_led);
|
leds.push_back(new_led);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,14 +329,14 @@ void RGBController_AlienwareAW410K::DeviceUpdateLEDs()
|
|||||||
|
|
||||||
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
||||||
{
|
{
|
||||||
SelectedButtons key;
|
SelectedButtons key;
|
||||||
|
|
||||||
key.idx = (unsigned char)leds[led_idx].value;
|
key.idx = led_values[led_idx];
|
||||||
key.red = RGBGetRValue(colors[led_idx]);
|
key.red = RGBGetRValue(colors[led_idx]);
|
||||||
key.green = RGBGetGValue(colors[led_idx]);
|
key.green = RGBGetGValue(colors[led_idx]);
|
||||||
key.blue = RGBGetBValue(colors[led_idx]);
|
key.blue = RGBGetBValue(colors[led_idx]);
|
||||||
|
|
||||||
frame_buf_keys.push_back(key);
|
frame_buf_keys.push_back(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
controller->SendInitialize();
|
controller->SendInitialize();
|
||||||
@@ -358,7 +358,7 @@ void RGBController_AlienwareAW410K::DeviceUpdateZoneLEDs(int zone)
|
|||||||
|
|
||||||
void RGBController_AlienwareAW410K::DeviceUpdateSingleLED(int led)
|
void RGBController_AlienwareAW410K::DeviceUpdateSingleLED(int led)
|
||||||
{
|
{
|
||||||
controller->DeviceUpdateSingleLED(leds[led].value, RGBGetRValue(colors[led]), RGBGetGValue(colors[led]), RGBGetBValue(colors[led]));
|
controller->DeviceUpdateSingleLED(led_values[led], RGBGetRValue(colors[led]), RGBGetGValue(colors[led]), RGBGetBValue(colors[led]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RGBController_AlienwareAW410K::DeviceUpdateMode()
|
void RGBController_AlienwareAW410K::DeviceUpdateMode()
|
||||||
|
|||||||
+1
@@ -32,4 +32,5 @@ public:
|
|||||||
private:
|
private:
|
||||||
AlienwareAW410KController* controller;
|
AlienwareAW410KController* controller;
|
||||||
std::vector<RGBColor> current_colors;
|
std::vector<RGBColor> current_colors;
|
||||||
|
std::vector<unsigned char> led_values;
|
||||||
};
|
};
|
||||||
+9
-23
@@ -312,7 +312,7 @@ void RGBController_AlienwareAW510K::SetupZones()
|
|||||||
{
|
{
|
||||||
led new_led;
|
led new_led;
|
||||||
new_led.name = led_names[led_idx].name;
|
new_led.name = led_names[led_idx].name;
|
||||||
new_led.value = led_names[led_idx].idx;
|
led_values.push_back(led_names[led_idx].idx);
|
||||||
leds.push_back(new_led);
|
leds.push_back(new_led);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -328,7 +328,7 @@ void RGBController_AlienwareAW510K::DeviceUpdateLEDs()
|
|||||||
|
|
||||||
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
||||||
{
|
{
|
||||||
if (current_colors[led_idx]==new_colors[led_idx])
|
if(current_colors[led_idx] == new_colors[led_idx])
|
||||||
{
|
{
|
||||||
/*-------------------------------------------------*\
|
/*-------------------------------------------------*\
|
||||||
| Don't send if key color is not changed |
|
| Don't send if key color is not changed |
|
||||||
@@ -336,28 +336,14 @@ void RGBController_AlienwareAW510K::DeviceUpdateLEDs()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(RGBGetRValue(colors[led_idx]) != 0x00 || RGBGetBValue(colors[led_idx]) != 0x00 || RGBGetBValue(colors[led_idx]) != 0x00)
|
SelectedKeys key;
|
||||||
{
|
|
||||||
SelectedKeys key;
|
|
||||||
|
|
||||||
key.idx = (unsigned char)leds[led_idx].value;
|
key.idx = led_values[led_idx];
|
||||||
key.red = RGBGetRValue(colors[led_idx]);
|
key.red = RGBGetRValue(colors[led_idx]);
|
||||||
key.green = RGBGetGValue(colors[led_idx]);
|
key.green = RGBGetGValue(colors[led_idx]);
|
||||||
key.blue = RGBGetBValue(colors[led_idx]);
|
key.blue = RGBGetBValue(colors[led_idx]);
|
||||||
|
|
||||||
frame_buf_keys.push_back(key);
|
frame_buf_keys.push_back(key);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SelectedKeys key;
|
|
||||||
|
|
||||||
key.idx = (unsigned char)leds[led_idx].value;
|
|
||||||
key.red = RGBGetRValue(colors[led_idx]);
|
|
||||||
key.green = RGBGetGValue(colors[led_idx]);
|
|
||||||
key.blue = RGBGetBValue(colors[led_idx]);
|
|
||||||
|
|
||||||
frame_buf_keys.push_back(key);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
controller->SendInitialize();
|
controller->SendInitialize();
|
||||||
@@ -379,7 +365,7 @@ void RGBController_AlienwareAW510K::DeviceUpdateZoneLEDs(int zone)
|
|||||||
|
|
||||||
void RGBController_AlienwareAW510K::DeviceUpdateSingleLED(int led)
|
void RGBController_AlienwareAW510K::DeviceUpdateSingleLED(int led)
|
||||||
{
|
{
|
||||||
controller->DeviceUpdateSingleLED(leds[led].value, RGBGetRValue(colors[led]), RGBGetGValue(colors[led]), RGBGetBValue(colors[led]));
|
controller->DeviceUpdateSingleLED(led_values[led], RGBGetRValue(colors[led]), RGBGetGValue(colors[led]), RGBGetBValue(colors[led]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RGBController_AlienwareAW510K::DeviceUpdateMode()
|
void RGBController_AlienwareAW510K::DeviceUpdateMode()
|
||||||
|
|||||||
+1
@@ -31,4 +31,5 @@ public:
|
|||||||
private:
|
private:
|
||||||
AlienwareAW510KController* controller;
|
AlienwareAW510KController* controller;
|
||||||
std::vector<RGBColor> current_colors;
|
std::vector<RGBColor> current_colors;
|
||||||
|
std::vector<unsigned char> led_values;
|
||||||
};
|
};
|
||||||
@@ -11,6 +11,13 @@
|
|||||||
|
|
||||||
#include "RGBController_AlienwareAW3423DWF.h"
|
#include "RGBController_AlienwareAW3423DWF.h"
|
||||||
|
|
||||||
|
static const unsigned char led_values[] =
|
||||||
|
{
|
||||||
|
0x01,
|
||||||
|
0x02,
|
||||||
|
0x08
|
||||||
|
};
|
||||||
|
|
||||||
/**------------------------------------------------------------------*\
|
/**------------------------------------------------------------------*\
|
||||||
@name AW3423DWF
|
@name AW3423DWF
|
||||||
@category Accessory
|
@category Accessory
|
||||||
@@ -63,7 +70,6 @@ void RGBController_AlienwareAW3423DWF::SetupZones()
|
|||||||
|
|
||||||
led Logo_LED;
|
led Logo_LED;
|
||||||
Logo_LED.name = "Logo";
|
Logo_LED.name = "Logo";
|
||||||
Logo_LED.value = 0x01;
|
|
||||||
leds.push_back(Logo_LED);
|
leds.push_back(Logo_LED);
|
||||||
|
|
||||||
zone Number;
|
zone Number;
|
||||||
@@ -76,7 +82,6 @@ void RGBController_AlienwareAW3423DWF::SetupZones()
|
|||||||
|
|
||||||
led Number_LED;
|
led Number_LED;
|
||||||
Number_LED.name = "Number";
|
Number_LED.name = "Number";
|
||||||
Number_LED.value = 0x02;
|
|
||||||
leds.push_back(Number_LED);
|
leds.push_back(Number_LED);
|
||||||
|
|
||||||
zone PowerButton;
|
zone PowerButton;
|
||||||
@@ -89,7 +94,6 @@ void RGBController_AlienwareAW3423DWF::SetupZones()
|
|||||||
|
|
||||||
led PowerButton_LED;
|
led PowerButton_LED;
|
||||||
PowerButton_LED.name = "Power Button";
|
PowerButton_LED.name = "Power Button";
|
||||||
PowerButton_LED.value = 0x08;
|
|
||||||
leds.push_back(PowerButton_LED);
|
leds.push_back(PowerButton_LED);
|
||||||
|
|
||||||
SetupColors();
|
SetupColors();
|
||||||
@@ -128,7 +132,7 @@ void RGBController_AlienwareAW3423DWF::DeviceUpdateSingleLED(int led)
|
|||||||
unsigned char red = RGBGetRValue(colors[led]);
|
unsigned char red = RGBGetRValue(colors[led]);
|
||||||
unsigned char grn = RGBGetGValue(colors[led]);
|
unsigned char grn = RGBGetGValue(colors[led]);
|
||||||
unsigned char blu = RGBGetBValue(colors[led]);
|
unsigned char blu = RGBGetBValue(colors[led]);
|
||||||
controller->SendColor(leds[led].value, red, grn, blu);
|
controller->SendColor(led_values[led], red, grn, blu);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RGBController_AlienwareAW3423DWF::DeviceUpdateMode()
|
void RGBController_AlienwareAW3423DWF::DeviceUpdateMode()
|
||||||
|
|||||||
@@ -11,6 +11,13 @@
|
|||||||
|
|
||||||
#include "RGBController_AlienwareMonitor.h"
|
#include "RGBController_AlienwareMonitor.h"
|
||||||
|
|
||||||
|
static const unsigned char led_values[] =
|
||||||
|
{
|
||||||
|
0x01,
|
||||||
|
0x02,
|
||||||
|
0x08
|
||||||
|
};
|
||||||
|
|
||||||
/**------------------------------------------------------------------*\
|
/**------------------------------------------------------------------*\
|
||||||
@name Alienware Monitor
|
@name Alienware Monitor
|
||||||
@category Accessory
|
@category Accessory
|
||||||
@@ -63,7 +70,6 @@ void RGBController_AlienwareMonitor::SetupZones()
|
|||||||
|
|
||||||
led Logo_LED;
|
led Logo_LED;
|
||||||
Logo_LED.name = "Logo";
|
Logo_LED.name = "Logo";
|
||||||
Logo_LED.value = 0x01;
|
|
||||||
leds.push_back(Logo_LED);
|
leds.push_back(Logo_LED);
|
||||||
|
|
||||||
zone Number;
|
zone Number;
|
||||||
@@ -76,7 +82,6 @@ void RGBController_AlienwareMonitor::SetupZones()
|
|||||||
|
|
||||||
led Number_LED;
|
led Number_LED;
|
||||||
Number_LED.name = "Number";
|
Number_LED.name = "Number";
|
||||||
Number_LED.value = 0x02;
|
|
||||||
leds.push_back(Number_LED);
|
leds.push_back(Number_LED);
|
||||||
|
|
||||||
zone PowerButton;
|
zone PowerButton;
|
||||||
@@ -89,7 +94,6 @@ void RGBController_AlienwareMonitor::SetupZones()
|
|||||||
|
|
||||||
led PowerButton_LED;
|
led PowerButton_LED;
|
||||||
PowerButton_LED.name = "Power Button";
|
PowerButton_LED.name = "Power Button";
|
||||||
PowerButton_LED.value = 0x08;
|
|
||||||
leds.push_back(PowerButton_LED);
|
leds.push_back(PowerButton_LED);
|
||||||
|
|
||||||
SetupColors();
|
SetupColors();
|
||||||
@@ -128,7 +132,7 @@ void RGBController_AlienwareMonitor::DeviceUpdateSingleLED(int led)
|
|||||||
unsigned char red = RGBGetRValue(colors[led]);
|
unsigned char red = RGBGetRValue(colors[led]);
|
||||||
unsigned char grn = RGBGetGValue(colors[led]);
|
unsigned char grn = RGBGetGValue(colors[led]);
|
||||||
unsigned char blu = RGBGetBValue(colors[led]);
|
unsigned char blu = RGBGetBValue(colors[led]);
|
||||||
controller->SendColor(leds[led].value, red, grn, blu);
|
controller->SendColor(led_values[led], red, grn, blu);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RGBController_AlienwareMonitor::DeviceUpdateMode()
|
void RGBController_AlienwareMonitor::DeviceUpdateMode()
|
||||||
|
|||||||
@@ -38,76 +38,69 @@ static const unsigned int zone_sizes[] =
|
|||||||
LED_COUNT,
|
LED_COUNT,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct
|
static const char* led_names[] =
|
||||||
{
|
{
|
||||||
const char * name;
|
KEY_EN_ESCAPE,
|
||||||
const unsigned char idx;
|
KEY_EN_1,
|
||||||
} annepro2_led_type;
|
KEY_EN_2,
|
||||||
|
KEY_EN_3,
|
||||||
static const annepro2_led_type led_names[] =
|
KEY_EN_4,
|
||||||
{
|
KEY_EN_5,
|
||||||
/* Key Label Index */
|
KEY_EN_6,
|
||||||
{ KEY_EN_ESCAPE, 0 },
|
KEY_EN_7,
|
||||||
{ KEY_EN_1, 1 },
|
KEY_EN_8,
|
||||||
{ KEY_EN_2, 2 },
|
KEY_EN_9,
|
||||||
{ KEY_EN_3, 3 },
|
KEY_EN_0,
|
||||||
{ KEY_EN_4, 4 },
|
KEY_EN_MINUS,
|
||||||
{ KEY_EN_5, 5 },
|
KEY_EN_EQUALS,
|
||||||
{ KEY_EN_6, 6 },
|
KEY_EN_BACKSPACE,
|
||||||
{ KEY_EN_7, 7 },
|
KEY_EN_TAB,
|
||||||
{ KEY_EN_8, 8 },
|
KEY_EN_Q,
|
||||||
{ KEY_EN_9, 9 },
|
KEY_EN_W,
|
||||||
{ KEY_EN_0, 10 },
|
KEY_EN_E,
|
||||||
{ KEY_EN_MINUS, 11 },
|
KEY_EN_R,
|
||||||
{ KEY_EN_EQUALS, 12 },
|
KEY_EN_T,
|
||||||
{ KEY_EN_BACKSPACE, 13 },
|
KEY_EN_Y,
|
||||||
{ KEY_EN_TAB, 14 },
|
KEY_EN_U,
|
||||||
{ KEY_EN_Q, 15 },
|
KEY_EN_I,
|
||||||
{ KEY_EN_W, 16 },
|
KEY_EN_O,
|
||||||
{ KEY_EN_E, 17 },
|
KEY_EN_P,
|
||||||
{ KEY_EN_R, 18 },
|
KEY_EN_LEFT_BRACKET,
|
||||||
{ KEY_EN_T, 19 },
|
KEY_EN_RIGHT_BRACKET,
|
||||||
{ KEY_EN_Y, 20 },
|
KEY_EN_ANSI_BACK_SLASH,
|
||||||
{ KEY_EN_U, 21 },
|
KEY_EN_CAPS_LOCK,
|
||||||
{ KEY_EN_I, 22 },
|
KEY_EN_A,
|
||||||
{ KEY_EN_O, 23 },
|
KEY_EN_S,
|
||||||
{ KEY_EN_P, 24 },
|
KEY_EN_D,
|
||||||
{ KEY_EN_LEFT_BRACKET, 25 },
|
KEY_EN_F,
|
||||||
{ KEY_EN_RIGHT_BRACKET, 26 },
|
KEY_EN_G,
|
||||||
{ KEY_EN_ANSI_BACK_SLASH, 27 },
|
KEY_EN_H,
|
||||||
{ KEY_EN_CAPS_LOCK, 28 },
|
KEY_EN_J,
|
||||||
{ KEY_EN_A, 29 },
|
KEY_EN_K,
|
||||||
{ KEY_EN_S, 30 },
|
KEY_EN_L,
|
||||||
{ KEY_EN_D, 31 },
|
KEY_EN_SEMICOLON,
|
||||||
{ KEY_EN_F, 32 },
|
KEY_EN_QUOTE,
|
||||||
{ KEY_EN_G, 33 },
|
KEY_EN_ANSI_ENTER,
|
||||||
{ KEY_EN_H, 34 },
|
KEY_EN_LEFT_SHIFT,
|
||||||
{ KEY_EN_J, 35 },
|
KEY_EN_Z,
|
||||||
{ KEY_EN_K, 36 },
|
KEY_EN_X,
|
||||||
{ KEY_EN_L, 37 },
|
KEY_EN_C,
|
||||||
{ KEY_EN_SEMICOLON, 38 },
|
KEY_EN_V,
|
||||||
{ KEY_EN_QUOTE, 39 },
|
KEY_EN_B,
|
||||||
{ KEY_EN_ANSI_ENTER, 40 },
|
KEY_EN_N,
|
||||||
{ KEY_EN_LEFT_SHIFT, 41 },
|
KEY_EN_M,
|
||||||
{ KEY_EN_Z, 42 },
|
KEY_EN_COMMA,
|
||||||
{ KEY_EN_X, 43 },
|
KEY_EN_PERIOD,
|
||||||
{ KEY_EN_C, 44 },
|
KEY_EN_FORWARD_SLASH,
|
||||||
{ KEY_EN_V, 45 },
|
KEY_EN_RIGHT_SHIFT,
|
||||||
{ KEY_EN_B, 46 },
|
KEY_EN_LEFT_CONTROL,
|
||||||
{ KEY_EN_N, 47 },
|
KEY_EN_LEFT_WINDOWS,
|
||||||
{ KEY_EN_M, 48 },
|
KEY_EN_LEFT_ALT,
|
||||||
{ KEY_EN_COMMA, 49 },
|
KEY_EN_SPACE,
|
||||||
{ KEY_EN_PERIOD, 50 },
|
KEY_EN_RIGHT_ALT,
|
||||||
{ KEY_EN_FORWARD_SLASH, 51 },
|
KEY_EN_RIGHT_FUNCTION,
|
||||||
{ KEY_EN_RIGHT_SHIFT, 52 },
|
KEY_EN_MENU,
|
||||||
{ KEY_EN_LEFT_CONTROL, 53 },
|
KEY_EN_RIGHT_CONTROL,
|
||||||
{ KEY_EN_LEFT_WINDOWS, 54 },
|
|
||||||
{ KEY_EN_LEFT_ALT, 55 },
|
|
||||||
{ KEY_EN_SPACE, 56 },
|
|
||||||
{ KEY_EN_RIGHT_ALT, 57 },
|
|
||||||
{ KEY_EN_RIGHT_FUNCTION, 58 },
|
|
||||||
{ KEY_EN_MENU, 59 },
|
|
||||||
{ KEY_EN_RIGHT_CONTROL, 60 },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**------------------------------------------------------------------*\
|
/**------------------------------------------------------------------*\
|
||||||
@@ -177,8 +170,7 @@ void RGBController_AnnePro2::SetupZones()
|
|||||||
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
|
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
|
||||||
{
|
{
|
||||||
led new_led;
|
led new_led;
|
||||||
new_led.name = led_names[led_idx].name;
|
new_led.name = led_names[led_idx];
|
||||||
new_led.value = led_names[led_idx].idx;
|
|
||||||
leds.push_back(new_led);
|
leds.push_back(new_led);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,7 +186,7 @@ void RGBController_AnnePro2::DeviceUpdateLEDs()
|
|||||||
| TODO: Send packets with multiple LED frames |
|
| TODO: Send packets with multiple LED frames |
|
||||||
\*---------------------------------------------------------*/
|
\*---------------------------------------------------------*/
|
||||||
std::size_t led_real_idx = 0;
|
std::size_t led_real_idx = 0;
|
||||||
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
for(std::size_t led_idx = 0; led_idx < colors.size(); led_idx++)
|
||||||
{
|
{
|
||||||
frame_buf[(led_real_idx * 3) + 0] = RGBGetRValue(colors[led_idx]);
|
frame_buf[(led_real_idx * 3) + 0] = RGBGetRValue(colors[led_idx]);
|
||||||
frame_buf[(led_real_idx * 3) + 1] = RGBGetGValue(colors[led_idx]);
|
frame_buf[(led_real_idx * 3) + 1] = RGBGetGValue(colors[led_idx]);
|
||||||
|
|||||||
@@ -21,13 +21,13 @@
|
|||||||
DetectedControllers DetectArcticControllers()
|
DetectedControllers DetectArcticControllers()
|
||||||
{
|
{
|
||||||
DetectedControllers detected_controllers;
|
DetectedControllers detected_controllers;
|
||||||
std::vector<std::string> ports;
|
std::vector<std::string *> ports;
|
||||||
|
|
||||||
ports = find_usb_serial_port(CH341_VID, CH341_PID);
|
ports = find_usb_serial_port(CH341_VID, CH341_PID);
|
||||||
|
|
||||||
for(unsigned int device = 0; device < ports.size(); device++)
|
for(unsigned int device = 0; device < ports.size(); device++)
|
||||||
{
|
{
|
||||||
ArcticController *controller = new ArcticController(ports[device]);
|
ArcticController *controller = new ArcticController(*ports[device]);
|
||||||
|
|
||||||
if(controller->IsPresent())
|
if(controller->IsPresent())
|
||||||
{
|
{
|
||||||
@@ -38,6 +38,8 @@ DetectedControllers DetectArcticControllers()
|
|||||||
{
|
{
|
||||||
delete controller;
|
delete controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete ports[device];
|
||||||
}
|
}
|
||||||
|
|
||||||
return(detected_controllers);
|
return(detected_controllers);
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ void RGBController_Arctic::SetupZones()
|
|||||||
|
|
||||||
led Led;
|
led Led;
|
||||||
Led.name = LedZone.name + " LED";
|
Led.name = LedZone.name + " LED";
|
||||||
Led.value = channel;
|
|
||||||
|
|
||||||
zones.push_back(LedZone);
|
zones.push_back(LedZone);
|
||||||
leds.push_back(Led);
|
leds.push_back(Led);
|
||||||
|
|||||||
+7
-16
@@ -351,11 +351,14 @@ void RGBController_AsusAuraCoreLaptop::SetupZones()
|
|||||||
new_zone.leds_count = new_kb.GetKeyCount();
|
new_zone.leds_count = new_kb.GetKeyCount();
|
||||||
for(unsigned int led_idx = 0; led_idx < new_zone.leds_count; led_idx++)
|
for(unsigned int led_idx = 0; led_idx < new_zone.leds_count; led_idx++)
|
||||||
{
|
{
|
||||||
led new_led;
|
led new_led;
|
||||||
|
unsigned int new_led_value;
|
||||||
|
|
||||||
new_led.name = new_kb.GetKeyNameAt(led_idx);
|
new_led.name = new_kb.GetKeyNameAt(led_idx);
|
||||||
new_led.value = new_kb.GetKeyValueAt(led_idx);
|
new_led_value = new_kb.GetKeyValueAt(led_idx);
|
||||||
max_led_value = std::max(max_led_value, new_led.value);
|
max_led_value = std::max(max_led_value, new_led_value);
|
||||||
|
|
||||||
|
led_values.push_back(new_led_value);
|
||||||
leds.push_back(new_led);
|
leds.push_back(new_led);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -385,24 +388,12 @@ void RGBController_AsusAuraCoreLaptop::SetupZones()
|
|||||||
|
|
||||||
for(size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
for(size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
||||||
{
|
{
|
||||||
buffer_map[leds[led_idx].value] = &colors[led_idx];
|
buffer_map[led_values[led_idx]] = &colors[led_idx];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RGBController_AsusAuraCoreLaptop::DeviceUpdateLEDs()
|
void RGBController_AsusAuraCoreLaptop::DeviceUpdateLEDs()
|
||||||
{
|
{
|
||||||
for(size_t i = 85; i < leds.size(); i++)
|
|
||||||
{
|
|
||||||
LOG_DEBUG("[%s] Setting %s @ LED index %d and buffer index %d to R: %02X G: %02X B: %02X",
|
|
||||||
name.c_str(),
|
|
||||||
leds[i].name.c_str(),
|
|
||||||
i,
|
|
||||||
leds[i].value,
|
|
||||||
RGBGetRValue(colors[i]),
|
|
||||||
RGBGetGValue(colors[i]),
|
|
||||||
RGBGetBValue(colors[i]));
|
|
||||||
}
|
|
||||||
|
|
||||||
controller->SetLedsDirect(buffer_map);
|
controller->SetLedsDirect(buffer_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
@@ -33,6 +33,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
RGBColor null_color = 0;
|
RGBColor null_color = 0;
|
||||||
std::vector<RGBColor *> buffer_map;
|
std::vector<RGBColor *> buffer_map;
|
||||||
|
std::vector<unsigned int> led_values;
|
||||||
|
|
||||||
AsusAuraCoreLaptopController* controller;
|
AsusAuraCoreLaptopController* controller;
|
||||||
};
|
};
|
||||||
+2
-2
@@ -471,8 +471,8 @@ void RGBController_AuraKeyboard::SetupZones()
|
|||||||
{
|
{
|
||||||
led new_led;
|
led new_led;
|
||||||
new_led.name = led_names[led_idx].name;
|
new_led.name = led_names[led_idx].name;
|
||||||
new_led.value = led_names[led_idx].idx;
|
|
||||||
|
|
||||||
|
led_values.push_back(led_names[led_idx].idx);
|
||||||
leds.push_back(new_led);
|
leds.push_back(new_led);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -493,7 +493,7 @@ void RGBController_AuraKeyboard::DeviceUpdateLEDs()
|
|||||||
\*---------------------------------------------------------*/
|
\*---------------------------------------------------------*/
|
||||||
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
||||||
{
|
{
|
||||||
frame_buf[(led_idx * 4) + 0] = leds[led_idx].value;
|
frame_buf[(led_idx * 4) + 0] = led_values[led_idx];
|
||||||
frame_buf[(led_idx * 4) + 1] = RGBGetRValue(colors[led_idx]);
|
frame_buf[(led_idx * 4) + 1] = RGBGetRValue(colors[led_idx]);
|
||||||
frame_buf[(led_idx * 4) + 2] = RGBGetGValue(colors[led_idx]);
|
frame_buf[(led_idx * 4) + 2] = RGBGetGValue(colors[led_idx]);
|
||||||
frame_buf[(led_idx * 4) + 3] = RGBGetBValue(colors[led_idx]);
|
frame_buf[(led_idx * 4) + 3] = RGBGetBValue(colors[led_idx]);
|
||||||
|
|||||||
+1
@@ -54,4 +54,5 @@ public:
|
|||||||
private:
|
private:
|
||||||
AuraKeyboardController* controller;
|
AuraKeyboardController* controller;
|
||||||
AuraKeyboardMappingLayoutType layout;
|
AuraKeyboardMappingLayoutType layout;
|
||||||
|
std::vector<unsigned char> led_values;
|
||||||
};
|
};
|
||||||
+2
-2
@@ -207,8 +207,8 @@ void RGBController_AuraMouse::SetupZones()
|
|||||||
led mouse_led;
|
led mouse_led;
|
||||||
|
|
||||||
mouse_led.name = mouse_zone.name + " LED";
|
mouse_led.name = mouse_zone.name + " LED";
|
||||||
mouse_led.value = *zone_it;
|
|
||||||
|
|
||||||
|
led_values.push_back(*zone_it);
|
||||||
leds.push_back(mouse_led);
|
leds.push_back(mouse_led);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,7 +247,7 @@ void RGBController_AuraMouse::DeviceUpdateSingleLED(int led)
|
|||||||
uint8_t grn = RGBGetGValue(colors[led]);
|
uint8_t grn = RGBGetGValue(colors[led]);
|
||||||
uint8_t blu = RGBGetBValue(colors[led]);
|
uint8_t blu = RGBGetBValue(colors[led]);
|
||||||
|
|
||||||
controller->SendUpdate(leds[led].value, modes[active_mode].value, red, grn, blu, 0, false, 0, modes[active_mode].brightness);
|
controller->SendUpdate(led_values[led], modes[active_mode].value, red, grn, blu, 0, false, 0, modes[active_mode].brightness);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RGBController_AuraMouse::DeviceUpdateMode()
|
void RGBController_AuraMouse::DeviceUpdateMode()
|
||||||
|
|||||||
+1
@@ -31,5 +31,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
AuraMouseController* controller;
|
AuraMouseController* controller;
|
||||||
|
std::vector<uint8_t> led_values;
|
||||||
uint16_t pid;
|
uint16_t pid;
|
||||||
};
|
};
|
||||||
-1
@@ -141,7 +141,6 @@ void RGBController_AsusROGSpatha::SetupZones()
|
|||||||
led spatha_led;
|
led spatha_led;
|
||||||
|
|
||||||
spatha_led.name = zones_names[i];
|
spatha_led.name = zones_names[i];
|
||||||
spatha_led.value = 1;
|
|
||||||
|
|
||||||
leds.push_back(spatha_led);
|
leds.push_back(spatha_led);
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -99,7 +99,6 @@ void RGBController_AsusROGStrixEvolve::SetupZones()
|
|||||||
led mouse_led;
|
led mouse_led;
|
||||||
|
|
||||||
mouse_led.name = "Underglow";
|
mouse_led.name = "Underglow";
|
||||||
mouse_led.value = 1;
|
|
||||||
|
|
||||||
leds.push_back(mouse_led);
|
leds.push_back(mouse_led);
|
||||||
|
|
||||||
|
|||||||
-1
@@ -163,7 +163,6 @@ void RGBController_AsusAuraRyuoAIO::SetupZones()
|
|||||||
|
|
||||||
new_led.name = zones[zone_idx].name;
|
new_led.name = zones[zone_idx].name;
|
||||||
new_led.name.append(" LED " + std::to_string(lp_idx));
|
new_led.name.append(" LED " + std::to_string(lp_idx));
|
||||||
new_led.value = lp_idx;
|
|
||||||
|
|
||||||
leds.push_back(new_led);
|
leds.push_back(new_led);
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -520,7 +520,7 @@ void RGBController_AuraTUFKeyboard::SetupZones()
|
|||||||
{
|
{
|
||||||
led new_led;
|
led new_led;
|
||||||
new_led.name = keyboard[layout].led_names[led_id].name;
|
new_led.name = keyboard[layout].led_names[led_id].name;
|
||||||
new_led.value = keyboard[layout].led_names[led_id].id;
|
led_values.push_back(keyboard[layout].led_names[led_id].id);
|
||||||
leds.push_back(new_led);
|
leds.push_back(new_led);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -538,7 +538,7 @@ void RGBController_AuraTUFKeyboard::DeviceUpdateLEDs()
|
|||||||
|
|
||||||
for(size_t i = 0; i < colors.size(); i++)
|
for(size_t i = 0; i < colors.size(); i++)
|
||||||
{
|
{
|
||||||
led_color_list.push_back({ leds[i].value, colors[i] });
|
led_color_list.push_back({ led_values[i], colors[i] });
|
||||||
}
|
}
|
||||||
|
|
||||||
controller->UpdateLeds(led_color_list);
|
controller->UpdateLeds(led_color_list);
|
||||||
@@ -560,7 +560,7 @@ void RGBController_AuraTUFKeyboard::DeviceUpdateSingleLED(int led)
|
|||||||
unsigned char green = RGBGetGValue(colors[led]);
|
unsigned char green = RGBGetGValue(colors[led]);
|
||||||
unsigned char blue = RGBGetBValue(colors[led]);
|
unsigned char blue = RGBGetBValue(colors[led]);
|
||||||
|
|
||||||
controller->UpdateSingleLed(leds[led].value, red, green, blue);
|
controller->UpdateSingleLed(led_values[led], red, green, blue);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const uint8_t direction_map[2][6] =
|
static const uint8_t direction_map[2][6] =
|
||||||
|
|||||||
+1
@@ -53,4 +53,5 @@ public:
|
|||||||
private:
|
private:
|
||||||
AuraTUFKeyboardController* controller;
|
AuraTUFKeyboardController* controller;
|
||||||
uint16_t pid;
|
uint16_t pid;
|
||||||
|
std::vector<uint8_t> led_values;
|
||||||
};
|
};
|
||||||
+1
-1
@@ -221,7 +221,7 @@ void RGBController_AuraUSB::SetupZones()
|
|||||||
|
|
||||||
new_led.name.append(std::to_string(led_idx));
|
new_led.name.append(std::to_string(led_idx));
|
||||||
|
|
||||||
new_led.value = (unsigned int)channel_idx;
|
new_led.value = channel_idx;
|
||||||
|
|
||||||
leds.push_back(new_led);
|
leds.push_back(new_led);
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -164,7 +164,6 @@ void RGBController_AsusROGStrixLC::SetupZones()
|
|||||||
|
|
||||||
new_led.name = zones[zone_idx].name;
|
new_led.name = zones[zone_idx].name;
|
||||||
new_led.name.append(" LED " + std::to_string(lp_idx));
|
new_led.name.append(" LED " + std::to_string(lp_idx));
|
||||||
new_led.value = lp_idx;
|
|
||||||
|
|
||||||
leds.push_back(new_led);
|
leds.push_back(new_led);
|
||||||
}
|
}
|
||||||
|
|||||||
-2
@@ -71,7 +71,6 @@ void RGBController_StrixClaw::SetupZones()
|
|||||||
led scroll_wheel_led;
|
led scroll_wheel_led;
|
||||||
|
|
||||||
scroll_wheel_led.name = "Scroll Wheel LED";
|
scroll_wheel_led.name = "Scroll Wheel LED";
|
||||||
scroll_wheel_led.value = 1;
|
|
||||||
|
|
||||||
leds.push_back(scroll_wheel_led);
|
leds.push_back(scroll_wheel_led);
|
||||||
|
|
||||||
@@ -88,7 +87,6 @@ void RGBController_StrixClaw::SetupZones()
|
|||||||
led logo_led;
|
led logo_led;
|
||||||
|
|
||||||
logo_led.name = "Logo LED";
|
logo_led.name = "Logo LED";
|
||||||
logo_led.value = 1;
|
|
||||||
|
|
||||||
leds.push_back(logo_led);
|
leds.push_back(logo_led);
|
||||||
|
|
||||||
|
|||||||
@@ -24,12 +24,12 @@
|
|||||||
DetectedControllers DetectBlinkyTapeControllers()
|
DetectedControllers DetectBlinkyTapeControllers()
|
||||||
{
|
{
|
||||||
DetectedControllers detected_controllers;
|
DetectedControllers detected_controllers;
|
||||||
std::vector<std::string> device_locations = find_usb_serial_port(BLINKINLABS_VID, BLINKYTAPE_PID);
|
std::vector<std::string *> device_locations = find_usb_serial_port(BLINKINLABS_VID, BLINKYTAPE_PID);
|
||||||
|
|
||||||
for(unsigned int device_idx = 0; device_idx < device_locations.size(); device_idx++)
|
for(unsigned int device_idx = 0; device_idx < device_locations.size(); device_idx++)
|
||||||
{
|
{
|
||||||
BlinkyTapeController* controller = new BlinkyTapeController();
|
BlinkyTapeController* controller = new BlinkyTapeController();
|
||||||
controller->Initialize(device_locations[device_idx]);
|
controller->Initialize(*device_locations[device_idx]);
|
||||||
|
|
||||||
RGBController_BlinkyTape* rgb_controller = new RGBController_BlinkyTape(controller);
|
RGBController_BlinkyTape* rgb_controller = new RGBController_BlinkyTape(controller);
|
||||||
|
|
||||||
|
|||||||
@@ -241,9 +241,9 @@ void RGBController_ClevoKeyboard::SetupZones()
|
|||||||
led new_led;
|
led new_led;
|
||||||
|
|
||||||
new_led.name = new_kb.GetKeyNameAt(led_idx);
|
new_led.name = new_kb.GetKeyNameAt(led_idx);
|
||||||
new_led.value = new_kb.GetKeyValueAt(led_idx);
|
|
||||||
|
|
||||||
leds.push_back(new_led);
|
leds.push_back(new_led);
|
||||||
|
led_values.push_back(new_kb.GetKeyValueAt(led_idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
SetupColors();
|
SetupColors();
|
||||||
@@ -258,7 +258,7 @@ void RGBController_ClevoKeyboard::SetupZones()
|
|||||||
|
|
||||||
for(size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
for(size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
||||||
{
|
{
|
||||||
buffer_map[leds[led_idx].value] = &colors[led_idx];
|
buffer_map[led_values[led_idx]] = &colors[led_idx];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,5 +32,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
ClevoKeyboardController* controller;
|
ClevoKeyboardController* controller;
|
||||||
std::vector<RGBColor*> buffer_map;
|
std::vector<RGBColor*> buffer_map;
|
||||||
|
std::vector<unsigned int> led_values;
|
||||||
RGBColor null_color;
|
RGBColor null_color;
|
||||||
};
|
};
|
||||||
@@ -77,7 +77,6 @@ REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 4080 Ultra W OC-V", Detec
|
|||||||
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 4090 Advanced OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX4090_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_4090_ADVANCED_OCV, 0x61);
|
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 4090 Advanced OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX4090_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_4090_ADVANCED_OCV, 0x61);
|
||||||
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 4090 Advanced OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX4090_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_4090_ADVANCED_OCV2, 0x61);
|
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 4090 Advanced OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX4090_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_4090_ADVANCED_OCV2, 0x61);
|
||||||
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 5060 Ultra W OC", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX5060_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_5060_ULTRAW_OC, 0x61);
|
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 5060 Ultra W OC", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX5060_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_5060_ULTRAW_OC, 0x61);
|
||||||
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 5060 Ultra W OC", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX5060_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_5060_ULTRAW_OC_2, 0x61);
|
|
||||||
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 5060 Ti Ultra W DUO OC", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX5060TI_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_5060TI_ULTRAW_DUO_OC, 0x61);
|
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 5060 Ti Ultra W DUO OC", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX5060TI_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_5060TI_ULTRAW_DUO_OC, 0x61);
|
||||||
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 5060 Ti Ultra W DUO OC", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX5060TI_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_5060TI_ULTRAW_DUO_OC_2, 0x61);
|
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 5060 Ti Ultra W DUO OC", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX5060TI_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_5060TI_ULTRAW_DUO_OC_2, 0x61);
|
||||||
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 5070 Ultra W OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX5070_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_5070_ULTRAW_OCV, 0x61);
|
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 5070 Ultra W OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX5070_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_5070_ULTRAW_OCV, 0x61);
|
||||||
|
|||||||
+2
-2
@@ -159,7 +159,7 @@ void RGBController_CMGD160Controller::SetupZones()
|
|||||||
{
|
{
|
||||||
led l;
|
led l;
|
||||||
l.name = "Front LED " + std::to_string(i + 1);
|
l.name = "Front LED " + std::to_string(i + 1);
|
||||||
l.value = i;
|
|
||||||
leds.push_back(l);
|
leds.push_back(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ void RGBController_CMGD160Controller::SetupZones()
|
|||||||
{
|
{
|
||||||
led l;
|
led l;
|
||||||
l.name = "Back LED " + std::to_string(i + 1);
|
l.name = "Back LED " + std::to_string(i + 1);
|
||||||
l.value = i;
|
|
||||||
leds.push_back(l);
|
leds.push_back(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-2
@@ -146,12 +146,10 @@ void RGBController_CMMM711Controller::Init_Controller()
|
|||||||
|
|
||||||
led wheel_led;
|
led wheel_led;
|
||||||
wheel_led.name = "Scroll Wheel LED";
|
wheel_led.name = "Scroll Wheel LED";
|
||||||
wheel_led.value = 0;
|
|
||||||
leds.push_back(wheel_led);
|
leds.push_back(wheel_led);
|
||||||
|
|
||||||
led logo_led;
|
led logo_led;
|
||||||
logo_led.name = "Logo LED";
|
logo_led.name = "Logo LED";
|
||||||
logo_led.value = 1;
|
|
||||||
leds.push_back(logo_led);
|
leds.push_back(logo_led);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-1
@@ -139,7 +139,6 @@ void RGBController_CMMM712Controller::Init_Controller()
|
|||||||
|
|
||||||
led logo_led;
|
led logo_led;
|
||||||
logo_led.name = "Logo LED";
|
logo_led.name = "Logo LED";
|
||||||
logo_led.value = 0;
|
|
||||||
leds.push_back(logo_led);
|
leds.push_back(logo_led);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -183,28 +183,24 @@ void RGBController_CMMMController::Init_Controller()
|
|||||||
mouse_zone.leds_count = leds_count;
|
mouse_zone.leds_count = leds_count;
|
||||||
zones.push_back(mouse_zone);
|
zones.push_back(mouse_zone);
|
||||||
|
|
||||||
int value = 0;
|
|
||||||
uint16_t pid = controller->GetProductID();
|
uint16_t pid = controller->GetProductID();
|
||||||
|
|
||||||
led wheel_led;
|
led wheel_led;
|
||||||
wheel_led.name = "Scroll Wheel";
|
wheel_led.name = "Scroll Wheel";
|
||||||
wheel_led.value = value;
|
|
||||||
leds.push_back(wheel_led);
|
|
||||||
|
|
||||||
value++;
|
leds.push_back(wheel_led);
|
||||||
|
|
||||||
if(pid == 0x0065 || pid == 0x0097)
|
if(pid == 0x0065 || pid == 0x0097)
|
||||||
{
|
{
|
||||||
led buttons_led;
|
led buttons_led;
|
||||||
buttons_led.name = "Buttons";
|
buttons_led.name = "Buttons";
|
||||||
buttons_led.value = value;
|
|
||||||
leds.push_back(buttons_led);
|
leds.push_back(buttons_led);
|
||||||
value++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
led logo_led;
|
led logo_led;
|
||||||
logo_led.name = "Logo";
|
logo_led.name = "Logo";
|
||||||
logo_led.value = value;
|
|
||||||
leds.push_back(logo_led);
|
leds.push_back(logo_led);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -162,7 +162,7 @@ void RGBController_CMMonitorController::SetupZones()
|
|||||||
{
|
{
|
||||||
led l;
|
led l;
|
||||||
l.name = std::to_string(i + 1);
|
l.name = std::to_string(i + 1);
|
||||||
l.value = i;
|
|
||||||
leds.push_back(l);
|
leds.push_back(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-1
@@ -169,7 +169,6 @@ void RGBController_CMR6000Controller::SetupZones()
|
|||||||
|
|
||||||
led GP_led;
|
led GP_led;
|
||||||
GP_led.name = "Logo";
|
GP_led.name = "Logo";
|
||||||
GP_led.value = 0;
|
|
||||||
leds.push_back(GP_led);
|
leds.push_back(GP_led);
|
||||||
|
|
||||||
SetupColors();
|
SetupColors();
|
||||||
|
|||||||
@@ -340,6 +340,7 @@ void CorsairCommanderCoreController::SetDirectColor
|
|||||||
lastzones = zones;
|
lastzones = zones;
|
||||||
int packet_offset = 0;
|
int packet_offset = 0;
|
||||||
int led_idx = 0;
|
int led_idx = 0;
|
||||||
|
int channel_idx = 0;
|
||||||
int packet_len = CORSAIR_COMMANDER_CORE_RGB_DATA_LENGTH;
|
int packet_len = CORSAIR_COMMANDER_CORE_RGB_DATA_LENGTH;
|
||||||
|
|
||||||
if(pid == CORSAIR_COMMANDER_CORE_XT_PID)
|
if(pid == CORSAIR_COMMANDER_CORE_XT_PID)
|
||||||
@@ -368,6 +369,8 @@ void CorsairCommanderCoreController::SetDirectColor
|
|||||||
{
|
{
|
||||||
packet_offset += 3 * (34 - zones[zone_idx].leds_count);
|
packet_offset += 3 * (34 - zones[zone_idx].leds_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
channel_idx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------*\
|
/*-----------------------------------------------------*\
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ CorsairDRAMController::CorsairDRAMController(i2c_smbus_interface *bus, corsair_d
|
|||||||
this->bus = bus;
|
this->bus = bus;
|
||||||
this->dev = dev;
|
this->dev = dev;
|
||||||
device_index = 0;
|
device_index = 0;
|
||||||
direct_mode = true;
|
|
||||||
pid = 0;
|
pid = 0;
|
||||||
vid = 0;
|
vid = 0;
|
||||||
protocol_version = 0;
|
protocol_version = 0;
|
||||||
@@ -133,77 +132,13 @@ void CorsairDRAMController::SetColorsPerLED(RGBColor* colors)
|
|||||||
| bytes, use a second block write to the second |
|
| bytes, use a second block write to the second |
|
||||||
| block write address for the remaining data |
|
| block write address for the remaining data |
|
||||||
\*-------------------------------------------------*/
|
\*-------------------------------------------------*/
|
||||||
s32 ret = bus->i2c_smbus_write_block_data(dev, CORSAIR_DRAM_REG_COLOR_BUFFER_BLOCK_1, 32, direct_packet);
|
bus->i2c_smbus_write_block_data(dev, CORSAIR_DRAM_REG_COLOR_BUFFER_BLOCK_1, 32, direct_packet);
|
||||||
|
|
||||||
if((ret >= 0) && (direct_packet_size > 32))
|
if(direct_packet_size > 32)
|
||||||
{
|
{
|
||||||
bus->i2c_smbus_write_block_data(dev, CORSAIR_DRAM_REG_COLOR_BUFFER_BLOCK_2, direct_packet_size - 32, direct_packet + 32);
|
bus->i2c_smbus_write_block_data(dev, CORSAIR_DRAM_REG_COLOR_BUFFER_BLOCK_2, direct_packet_size - 32, direct_packet + 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------*\
|
|
||||||
| Corsair DRAM supports an alternate means of |
|
|
||||||
| writing block data without using SMBus block |
|
|
||||||
| operations. If block operations are not |
|
|
||||||
| available, fall back to this scheme. |
|
|
||||||
| |
|
|
||||||
| Blocks are split up into word data writes. |
|
|
||||||
| Some data bytes are packed into the lower nibble |
|
|
||||||
| of the register address byte. |
|
|
||||||
\*-------------------------------------------------*/
|
|
||||||
if(ret < 0)
|
|
||||||
{
|
|
||||||
unsigned int block_index = 0;
|
|
||||||
|
|
||||||
while(block_index < direct_packet_size)
|
|
||||||
{
|
|
||||||
unsigned char reg_value_0 = 0xA0;
|
|
||||||
unsigned char reg_value_1 = 0x00;
|
|
||||||
unsigned short word_value_0 = 0;
|
|
||||||
unsigned short word_value_1 = 0;
|
|
||||||
|
|
||||||
if(block_index == 0)
|
|
||||||
{
|
|
||||||
reg_value_0 = 0x90;
|
|
||||||
}
|
|
||||||
|
|
||||||
word_value_0 = (direct_packet[block_index]);
|
|
||||||
block_index++;
|
|
||||||
|
|
||||||
if(block_index < direct_packet_size)
|
|
||||||
{
|
|
||||||
word_value_0 |= (direct_packet[block_index] << 8);
|
|
||||||
block_index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(block_index < direct_packet_size)
|
|
||||||
{
|
|
||||||
reg_value_1 = 0xA0;
|
|
||||||
reg_value_0 |= (direct_packet[block_index] & 0x0F);
|
|
||||||
reg_value_1 |= (direct_packet[block_index] & 0xF0) >> 4;
|
|
||||||
block_index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(block_index < direct_packet_size)
|
|
||||||
{
|
|
||||||
word_value_1 = (direct_packet[block_index]);
|
|
||||||
block_index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(block_index < direct_packet_size)
|
|
||||||
{
|
|
||||||
word_value_1 |= (direct_packet[block_index] << 8);
|
|
||||||
block_index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
bus->i2c_smbus_write_word_data(dev, reg_value_0, word_value_0);
|
|
||||||
|
|
||||||
if(reg_value_1 > 0)
|
|
||||||
{
|
|
||||||
bus->i2c_smbus_write_word_data(dev, reg_value_1, word_value_1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*-------------------------------------------------*\
|
/*-------------------------------------------------*\
|
||||||
| Remember to delete the data buffer |
|
| Remember to delete the data buffer |
|
||||||
\*-------------------------------------------------*/
|
\*-------------------------------------------------*/
|
||||||
|
|||||||
@@ -24,15 +24,18 @@ using namespace std::chrono_literals;
|
|||||||
|
|
||||||
bool TestForCorsairDRAMController(i2c_smbus_interface *bus, unsigned char address)
|
bool TestForCorsairDRAMController(i2c_smbus_interface *bus, unsigned char address)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("[%s] Trying address %02X", CORSAIR_DRAM_NAME, address);
|
int res = bus->i2c_smbus_write_quick(address, I2C_SMBUS_WRITE);
|
||||||
|
|
||||||
int res = bus->i2c_smbus_read_byte_data(address, 0x43);
|
LOG_DEBUG("[%s] Trying address %02X", CORSAIR_DRAM_NAME, address);
|
||||||
|
|
||||||
if(res < 0)
|
if(res < 0)
|
||||||
{
|
{
|
||||||
|
LOG_DEBUG("[%s] Failed: res was %04X", CORSAIR_DRAM_NAME, res);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
res = bus->i2c_smbus_read_byte_data(address, 0x43);
|
||||||
|
|
||||||
if(!(res == 0x1A || res == 0x1B || res == 0x1C))
|
if(!(res == 0x1A || res == 0x1B || res == 0x1C))
|
||||||
{
|
{
|
||||||
LOG_DEBUG("[%s] Failed: expected 0x1A, 0x1B, or 0x1C, got %04X", CORSAIR_DRAM_NAME, res);
|
LOG_DEBUG("[%s] Failed: expected 0x1A, 0x1B, or 0x1C, got %04X", CORSAIR_DRAM_NAME, res);
|
||||||
|
|||||||
@@ -98,16 +98,7 @@ void RGBController_CorsairICueLink::SetupZones()
|
|||||||
lcd_zone.leds_min = controller->GetEndpoints()[lcd_idx]->led_channels;
|
lcd_zone.leds_min = controller->GetEndpoints()[lcd_idx]->led_channels;
|
||||||
lcd_zone.leds_max = lcd_zone.leds_min;
|
lcd_zone.leds_max = lcd_zone.leds_min;
|
||||||
lcd_zone.leds_count = lcd_zone.leds_min;
|
lcd_zone.leds_count = lcd_zone.leds_min;
|
||||||
|
|
||||||
zones.push_back(lcd_zone);
|
zones.push_back(lcd_zone);
|
||||||
|
|
||||||
for(unsigned int led_idx = 0; led_idx < lcd_zone.leds_count; led_idx++)
|
|
||||||
{
|
|
||||||
led new_led;
|
|
||||||
new_led.name = "LED " + std::to_string(led_idx + 1);
|
|
||||||
|
|
||||||
leds.push_back(new_led);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ void RGBController_CorsairLightingNode::SetupZones()
|
|||||||
new_led.name = zones[zone_idx].name + ", LED " + std::to_string(led_ch_idx + 1);
|
new_led.name = zones[zone_idx].name + ", LED " + std::to_string(led_ch_idx + 1);
|
||||||
|
|
||||||
leds.push_back(new_led);
|
leds.push_back(new_led);
|
||||||
leds_channel.push_back((unsigned int)zone_idx);
|
leds_channel.push_back(zone_idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,7 +413,7 @@ void RGBController_CorsairLightingNode::DeviceUpdateMode()
|
|||||||
{
|
{
|
||||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||||
{
|
{
|
||||||
DeviceUpdateZoneMode((int)zone_idx);
|
DeviceUpdateZoneMode(zone_idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,12 +35,6 @@ CorsairPeripheralV2Controller::CorsairPeripheralV2Controller(hid_device* dev_han
|
|||||||
write_cmd = CORSAIR_V2_WRITE_WIRELESS_ID;
|
write_cmd = CORSAIR_V2_WRITE_WIRELESS_ID;
|
||||||
pid = GetAddress(0x12);
|
pid = GetAddress(0x12);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CORSAIR_K57_RGB_WIRED_PID:
|
|
||||||
write_cmd = 0x80;
|
|
||||||
light_ctrl = CORSAIR_V2_LIGHT_CTRL1;
|
|
||||||
skip_reads = true;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
/*---------------------------------------------------------*\
|
||||||
@@ -99,17 +93,14 @@ CorsairPeripheralV2Controller::CorsairPeripheralV2Controller(hid_device* dev_han
|
|||||||
| If lighting control endpoint 2 is unavailable |
|
| If lighting control endpoint 2 is unavailable |
|
||||||
| then use endpoint 1. |
|
| then use endpoint 1. |
|
||||||
\*---------------------------------------------------------*/
|
\*---------------------------------------------------------*/
|
||||||
if(light_ctrl == CORSAIR_V2_LIGHT_CTRL2)
|
result = StartTransaction(0);
|
||||||
|
if(result > 0)
|
||||||
{
|
{
|
||||||
result = StartTransaction(0);
|
light_ctrl = CORSAIR_V2_LIGHT_CTRL1;
|
||||||
if(result > 0)
|
StartTransaction(0);
|
||||||
{
|
|
||||||
light_ctrl = CORSAIR_V2_LIGHT_CTRL1;
|
|
||||||
StartTransaction(0);
|
|
||||||
}
|
|
||||||
StopTransaction(0);
|
|
||||||
LOG_DEBUG("[%s] Lighting Endpoint set to %02X", device_name.c_str(), light_ctrl);
|
|
||||||
}
|
}
|
||||||
|
StopTransaction(0);
|
||||||
|
LOG_DEBUG("[%s] Lighting Endpoint set to %02X", device_name.c_str(), light_ctrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
CorsairPeripheralV2Controller::~CorsairPeripheralV2Controller()
|
CorsairPeripheralV2Controller::~CorsairPeripheralV2Controller()
|
||||||
@@ -180,11 +171,7 @@ void CorsairPeripheralV2Controller::SetRenderMode(corsair_v2_device_mode mode)
|
|||||||
buffer[5] = mode;
|
buffer[5] = mode;
|
||||||
|
|
||||||
hid_write(dev, buffer, CORSAIR_V2_WRITE_SIZE);
|
hid_write(dev, buffer, CORSAIR_V2_WRITE_SIZE);
|
||||||
|
hid_read_timeout(dev, buffer, CORSAIR_V2_WRITE_SIZE, CORSAIR_V2_TIMEOUT);
|
||||||
if(!skip_reads)
|
|
||||||
{
|
|
||||||
hid_read_timeout(dev, buffer, CORSAIR_V2_WRITE_SIZE, CORSAIR_V2_TIMEOUT);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CorsairPeripheralV2Controller::LightingControl(uint8_t opt1)
|
void CorsairPeripheralV2Controller::LightingControl(uint8_t opt1)
|
||||||
@@ -204,11 +191,7 @@ void CorsairPeripheralV2Controller::LightingControl(uint8_t opt1)
|
|||||||
buffer[5] = 0x00;
|
buffer[5] = 0x00;
|
||||||
|
|
||||||
hid_write(dev, buffer, CORSAIR_V2_WRITE_SIZE);
|
hid_write(dev, buffer, CORSAIR_V2_WRITE_SIZE);
|
||||||
|
hid_read_timeout(dev, buffer, CORSAIR_V2_WRITE_SIZE, CORSAIR_V2_TIMEOUT);
|
||||||
if(!skip_reads)
|
|
||||||
{
|
|
||||||
hid_read_timeout(dev, buffer, CORSAIR_V2_WRITE_SIZE, CORSAIR_V2_TIMEOUT);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CorsairPeripheralV2Controller::GetKeyboardLayout()
|
unsigned int CorsairPeripheralV2Controller::GetKeyboardLayout()
|
||||||
@@ -257,11 +240,7 @@ unsigned char CorsairPeripheralV2Controller::StartTransaction(uint8_t opt1)
|
|||||||
buffer[4] = light_ctrl;
|
buffer[4] = light_ctrl;
|
||||||
|
|
||||||
hid_write(dev, buffer, CORSAIR_V2_WRITE_SIZE);
|
hid_write(dev, buffer, CORSAIR_V2_WRITE_SIZE);
|
||||||
|
hid_read_timeout(dev, buffer, CORSAIR_V2_WRITE_SIZE, CORSAIR_V2_TIMEOUT);
|
||||||
if(!skip_reads)
|
|
||||||
{
|
|
||||||
hid_read_timeout(dev, buffer, CORSAIR_V2_WRITE_SIZE, CORSAIR_V2_TIMEOUT);
|
|
||||||
}
|
|
||||||
|
|
||||||
return buffer[2];
|
return buffer[2];
|
||||||
}
|
}
|
||||||
@@ -278,20 +257,11 @@ void CorsairPeripheralV2Controller::StopTransaction(uint8_t opt1)
|
|||||||
buffer[4] = opt1;
|
buffer[4] = opt1;
|
||||||
|
|
||||||
hid_write(dev, buffer, CORSAIR_V2_WRITE_SIZE);
|
hid_write(dev, buffer, CORSAIR_V2_WRITE_SIZE);
|
||||||
|
hid_read_timeout(dev, buffer, CORSAIR_V2_WRITE_SIZE, CORSAIR_V2_TIMEOUT);
|
||||||
if(!skip_reads)
|
|
||||||
{
|
|
||||||
hid_read_timeout(dev, buffer, CORSAIR_V2_WRITE_SIZE, CORSAIR_V2_TIMEOUT);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CorsairPeripheralV2Controller::ClearPacketBuffer()
|
void CorsairPeripheralV2Controller::ClearPacketBuffer()
|
||||||
{
|
{
|
||||||
if(skip_reads)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t result = 0;
|
uint8_t result = 0;
|
||||||
uint8_t buffer[CORSAIR_V2_PACKET_SIZE];
|
uint8_t buffer[CORSAIR_V2_PACKET_SIZE];
|
||||||
|
|
||||||
@@ -334,11 +304,7 @@ void CorsairPeripheralV2Controller::SetLEDs(uint8_t *data, uint16_t data_size)
|
|||||||
memcpy(&buffer[offset1], &data[0], copy_bytes);
|
memcpy(&buffer[offset1], &data[0], copy_bytes);
|
||||||
|
|
||||||
hid_write(dev, buffer, pkt_sze);
|
hid_write(dev, buffer, pkt_sze);
|
||||||
|
hid_read_timeout(dev, buffer, pkt_sze, CORSAIR_V2_TIMEOUT_SHORT);
|
||||||
if(!skip_reads)
|
|
||||||
{
|
|
||||||
hid_read_timeout(dev, buffer, pkt_sze, CORSAIR_V2_TIMEOUT_SHORT);
|
|
||||||
}
|
|
||||||
|
|
||||||
remaining -= copy_bytes;
|
remaining -= copy_bytes;
|
||||||
buffer[2] = CORSAIR_V2_CMD_BLK_WN;
|
buffer[2] = CORSAIR_V2_CMD_BLK_WN;
|
||||||
@@ -359,11 +325,7 @@ void CorsairPeripheralV2Controller::SetLEDs(uint8_t *data, uint16_t data_size)
|
|||||||
memcpy(&buffer[offset2], &data[index], copy_bytes);
|
memcpy(&buffer[offset2], &data[index], copy_bytes);
|
||||||
|
|
||||||
hid_write(dev, buffer, pkt_sze);
|
hid_write(dev, buffer, pkt_sze);
|
||||||
|
hid_read_timeout(dev, buffer, pkt_sze, CORSAIR_V2_TIMEOUT_SHORT);
|
||||||
if(!skip_reads)
|
|
||||||
{
|
|
||||||
hid_read_timeout(dev, buffer, pkt_sze, CORSAIR_V2_TIMEOUT_SHORT);
|
|
||||||
}
|
|
||||||
|
|
||||||
remaining -= copy_bytes;
|
remaining -= copy_bytes;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,7 +109,6 @@ private:
|
|||||||
|
|
||||||
uint8_t write_cmd = CORSAIR_V2_WRITE_WIRED_ID;
|
uint8_t write_cmd = CORSAIR_V2_WRITE_WIRED_ID;
|
||||||
uint16_t pkt_sze = CORSAIR_V2_WRITE_SIZE;
|
uint16_t pkt_sze = CORSAIR_V2_WRITE_SIZE;
|
||||||
bool skip_reads = false;
|
|
||||||
std::string firmware_version;
|
std::string firmware_version;
|
||||||
std::string location;
|
std::string location;
|
||||||
};
|
};
|
||||||
@@ -67,7 +67,6 @@ DetectedControllers DetectCorsairV2SoftwareControllers(hid_device_info* info, co
|
|||||||
| Keyboards |
|
| Keyboards |
|
||||||
\*---------------------------------------------------------*/
|
\*---------------------------------------------------------*/
|
||||||
REGISTER_HID_DETECTOR_IP("Corsair K55 RGB PRO", DetectCorsairV2SoftwareControllers, CORSAIR_VID, CORSAIR_K55_RGB_PRO_PID, 1, 0xFF42);
|
REGISTER_HID_DETECTOR_IP("Corsair K55 RGB PRO", DetectCorsairV2SoftwareControllers, CORSAIR_VID, CORSAIR_K55_RGB_PRO_PID, 1, 0xFF42);
|
||||||
REGISTER_HID_DETECTOR_IP("Corsair K57 RGB (Wired)", DetectCorsairV2SoftwareControllers, CORSAIR_VID, CORSAIR_K57_RGB_WIRED_PID, 1, 0xFF42);
|
|
||||||
REGISTER_HID_DETECTOR_IP("Corsair K60 RGB PRO", DetectCorsairV2SoftwareControllers, CORSAIR_VID, CORSAIR_K60_RGB_PRO_PID, 1, 0xFF42);
|
REGISTER_HID_DETECTOR_IP("Corsair K60 RGB PRO", DetectCorsairV2SoftwareControllers, CORSAIR_VID, CORSAIR_K60_RGB_PRO_PID, 1, 0xFF42);
|
||||||
REGISTER_HID_DETECTOR_IP("Corsair K60 RGB PRO Low Profile", DetectCorsairV2SoftwareControllers, CORSAIR_VID, CORSAIR_K60_RGB_PRO_LP_PID, 1, 0xFF42);
|
REGISTER_HID_DETECTOR_IP("Corsair K60 RGB PRO Low Profile", DetectCorsairV2SoftwareControllers, CORSAIR_VID, CORSAIR_K60_RGB_PRO_LP_PID, 1, 0xFF42);
|
||||||
REGISTER_HID_DETECTOR_IP("Corsair K60 RGB PRO TKL Black", DetectCorsairV2HardwareControllers, CORSAIR_VID, CORSAIR_K60_RGB_PRO_TKL_B_PID, 1, 0xFF42);
|
REGISTER_HID_DETECTOR_IP("Corsair K60 RGB PRO TKL Black", DetectCorsairV2HardwareControllers, CORSAIR_VID, CORSAIR_K60_RGB_PRO_TKL_B_PID, 1, 0xFF42);
|
||||||
|
|||||||
@@ -48,31 +48,6 @@ std::vector<unsigned int> corsair_full_size_values =
|
|||||||
/*-------------------------------------------------------------------------*\
|
/*-------------------------------------------------------------------------*\
|
||||||
| KEYMAPS |
|
| KEYMAPS |
|
||||||
\*-------------------------------------------------------------------------*/
|
\*-------------------------------------------------------------------------*/
|
||||||
keyboard_keymap_overlay_values corsair_K57_layout
|
|
||||||
{
|
|
||||||
KEYBOARD_SIZE::KEYBOARD_SIZE_FULL,
|
|
||||||
{
|
|
||||||
corsair_full_size_values,
|
|
||||||
{
|
|
||||||
/* Add more regional layout fixes here */
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
/*-------------------------------------------------------------------------------------------------------------------------------------*\
|
|
||||||
| Edit Keys |
|
|
||||||
| Zone, Row, Column, Value, Name, Alternate Name, OpCode |
|
|
||||||
\*-------------------------------------------------------------------------------------------------------------------------------------*/
|
|
||||||
{ 0, 0, 17, 0, "Power/Wireless Indicator", KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_ROW, }, // Insert Profile into new row
|
|
||||||
{ 0, 0, 18, 1, "Lock/Macro Indicator", KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_SHIFT_RIGHT, }, // Insert Light key
|
|
||||||
{ 0, 1, 0, 131, "Key: G1", KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_SHIFT_RIGHT, }, // Insert G1 key
|
|
||||||
{ 0, 2, 0, 132, "Key: G2", KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_SHIFT_RIGHT, }, // Insert G2 key
|
|
||||||
{ 0, 3, 0, 133, "Key: G3", KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_SHIFT_RIGHT, }, // Insert G3 key
|
|
||||||
{ 0, 4, 0, 134, "Key: G4", KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_SHIFT_RIGHT, }, // Insert G4 key
|
|
||||||
{ 0, 5, 0, 135, "Key: G5", KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_SHIFT_RIGHT, }, // Insert G5 key
|
|
||||||
{ 0, 6, 0, 136, "Key: G6", KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_SHIFT_RIGHT, }, // Insert G6 key
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
keyboard_keymap_overlay_values corsair_K60_layout
|
keyboard_keymap_overlay_values corsair_K60_layout
|
||||||
{
|
{
|
||||||
KEYBOARD_SIZE::KEYBOARD_SIZE_FULL,
|
KEYBOARD_SIZE::KEYBOARD_SIZE_FULL,
|
||||||
@@ -141,14 +116,12 @@ keyboard_keymap_overlay_values corsair_k70_pro_layout
|
|||||||
{ 0, 0, 0, 128, "Profile", KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_ROW, }, // Insert Profile into new row
|
{ 0, 0, 0, 128, "Profile", KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_ROW, }, // Insert Profile into new row
|
||||||
{ 0, 0, 1, 113, "Light", KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_SHIFT_RIGHT, }, // Insert Light key
|
{ 0, 0, 1, 113, "Light", KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_SHIFT_RIGHT, }, // Insert Light key
|
||||||
{ 0, 0, 2, 114, "Lock", KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_SHIFT_RIGHT, }, // Insert Lock Key
|
{ 0, 0, 2, 114, "Lock", KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_SHIFT_RIGHT, }, // Insert Lock Key
|
||||||
{ 0, 0, 10, 138, "Logo", KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_SHIFT_RIGHT, }, // Insert Logo
|
{ 0, 0, 10, 191, "Logo", KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_SHIFT_RIGHT, }, // Insert Logo
|
||||||
{ 0, 0, 18, 102, KEY_EN_MEDIA_MUTE, KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_SHIFT_RIGHT, }, // Insert Mute Key
|
{ 0, 0, 18, 102, KEY_EN_MEDIA_MUTE, KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_SHIFT_RIGHT, }, // Insert Mute Key
|
||||||
{ 0, 1, 17, 123, KEY_EN_MEDIA_STOP, KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_SHIFT_RIGHT, }, // Insert Stop Key
|
{ 0, 1, 17, 123, KEY_EN_MEDIA_STOP, KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_SHIFT_RIGHT, }, // Insert Stop Key
|
||||||
{ 0, 1, 18, 126, KEY_EN_MEDIA_PREVIOUS, KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_SHIFT_RIGHT, }, // Insert Previous Track Key
|
{ 0, 1, 18, 126, KEY_EN_MEDIA_PREVIOUS, KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_SHIFT_RIGHT, }, // Insert Previous Track Key
|
||||||
{ 0, 1, 19, 124, KEY_EN_MEDIA_PLAY_PAUSE, KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_SHIFT_RIGHT, }, // Insert Play Pause Key
|
{ 0, 1, 19, 124, KEY_EN_MEDIA_PLAY_PAUSE, KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_SHIFT_RIGHT, }, // Insert Play Pause Key
|
||||||
{ 0, 1, 20, 125, KEY_EN_MEDIA_NEXT, KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_SHIFT_RIGHT, }, // Insert Next Tack Key
|
{ 0, 1, 20, 125, KEY_EN_MEDIA_NEXT, KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_SHIFT_RIGHT, }, // Insert Next Tack Key
|
||||||
{ 0, 6, 5, 140, KEY_EN_SPACE, KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_SHIFT_RIGHT, }, // Insert spacebar L
|
|
||||||
{ 0, 6, 7, 141, KEY_EN_SPACE, KEY_EN_UNUSED, KEYBOARD_OPCODE_INSERT_SHIFT_RIGHT, }, // Insert spacebar R
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -799,38 +772,6 @@ static const corsair_v2_device k55_rgb_pro_device =
|
|||||||
nullptr
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
/*-------------------------------------------------------------*\
|
|
||||||
| Corsair K57 RGB (Wired) 1B1C:1B6E |
|
|
||||||
| |
|
|
||||||
| Zone "Keyboard" |
|
|
||||||
| Matrix |
|
|
||||||
| 7 Rows, 22 Columns |
|
|
||||||
\*-------------------------------------------------------------*/
|
|
||||||
static const corsair_v2_zone k57_rgb_wired_zone =
|
|
||||||
{
|
|
||||||
ZONE_EN_KEYBOARD,
|
|
||||||
ZONE_TYPE_MATRIX,
|
|
||||||
7,
|
|
||||||
22
|
|
||||||
};
|
|
||||||
|
|
||||||
static const corsair_v2_device k57_rgb_wired_device =
|
|
||||||
{
|
|
||||||
CORSAIR_K57_RGB_WIRED_PID,
|
|
||||||
DEVICE_TYPE_KEYBOARD,
|
|
||||||
7,
|
|
||||||
22,
|
|
||||||
{
|
|
||||||
&k57_rgb_wired_zone,
|
|
||||||
nullptr,
|
|
||||||
nullptr,
|
|
||||||
nullptr,
|
|
||||||
nullptr,
|
|
||||||
nullptr
|
|
||||||
},
|
|
||||||
&corsair_K57_layout
|
|
||||||
};
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------*\
|
/*-------------------------------------------------------------*\
|
||||||
| Corsair K60 RGB Pro 1B1C:1BA0 |
|
| Corsair K60 RGB Pro 1B1C:1BA0 |
|
||||||
| |
|
| |
|
||||||
@@ -1520,7 +1461,6 @@ const corsair_v2_device* corsair_v2_device_list_data[] =
|
|||||||
| KEYBOARDS |
|
| KEYBOARDS |
|
||||||
\*-----------------------------------------------------------------*/
|
\*-----------------------------------------------------------------*/
|
||||||
&k55_rgb_pro_device,
|
&k55_rgb_pro_device,
|
||||||
&k57_rgb_wired_device,
|
|
||||||
&k60_rgb_pro_device,
|
&k60_rgb_pro_device,
|
||||||
&k60_rgb_pro_lp_device,
|
&k60_rgb_pro_lp_device,
|
||||||
&k60_rgb_pro_tkl_device_b,
|
&k60_rgb_pro_tkl_device_b,
|
||||||
|
|||||||
@@ -69,8 +69,6 @@ typedef struct
|
|||||||
| Corsair V2 Protocol Keyboards |
|
| Corsair V2 Protocol Keyboards |
|
||||||
\*-----------------------------------------------------*/
|
\*-----------------------------------------------------*/
|
||||||
#define CORSAIR_K55_RGB_PRO_PID 0x1BA4
|
#define CORSAIR_K55_RGB_PRO_PID 0x1BA4
|
||||||
#define CORSAIR_K57_RGB_WIRED_PID 0x1B6E
|
|
||||||
#define CORSAIR_K57_RGB_WIRELESS_PID 0x1B62
|
|
||||||
#define CORSAIR_K60_RGB_PRO_PID 0x1BA0
|
#define CORSAIR_K60_RGB_PRO_PID 0x1BA0
|
||||||
#define CORSAIR_K60_RGB_PRO_LP_PID 0x1BAD
|
#define CORSAIR_K60_RGB_PRO_LP_PID 0x1BAD
|
||||||
#define CORSAIR_K60_RGB_PRO_TKL_B_PID 0x1BC7
|
#define CORSAIR_K60_RGB_PRO_TKL_B_PID 0x1BC7
|
||||||
|
|||||||
@@ -152,8 +152,8 @@ void RGBController_CorsairV2HW::SetupZones()
|
|||||||
led new_led;
|
led new_led;
|
||||||
|
|
||||||
new_led.name = new_kb.GetKeyNameAt(led_idx);
|
new_led.name = new_kb.GetKeyNameAt(led_idx);
|
||||||
new_led.value = new_kb.GetKeyValueAt(led_idx);
|
led_values.push_back(new_kb.GetKeyValueAt(led_idx));
|
||||||
max_led_value = std::max(max_led_value, new_led.value);
|
max_led_value = std::max(max_led_value, led_values.back());
|
||||||
leds.push_back(new_led);
|
leds.push_back(new_led);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -176,7 +176,7 @@ void RGBController_CorsairV2HW::SetupZones()
|
|||||||
|
|
||||||
new_led.name = new_zone.name + " ";
|
new_led.name = new_zone.name + " ";
|
||||||
new_led.name.append(std::to_string( led_idx ));
|
new_led.name.append(std::to_string( led_idx ));
|
||||||
new_led.value = (unsigned int)leds.size();
|
led_values.push_back((unsigned int)leds.size());
|
||||||
|
|
||||||
leds.push_back(new_led);
|
leds.push_back(new_led);
|
||||||
}
|
}
|
||||||
@@ -209,7 +209,7 @@ void RGBController_CorsairV2HW::SetupZones()
|
|||||||
|
|
||||||
for(size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
for(size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
||||||
{
|
{
|
||||||
buffer_map[leds[led_idx].value] = &colors[led_idx];
|
buffer_map[led_values[led_idx]] = &colors[led_idx];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
CorsairPeripheralV2Controller* controller;
|
CorsairPeripheralV2Controller* controller;
|
||||||
|
|
||||||
|
std::vector<unsigned int> led_values;
|
||||||
RGBColor null_color = 0;
|
RGBColor null_color = 0;
|
||||||
std::vector<RGBColor *> buffer_map;
|
std::vector<RGBColor *> buffer_map;
|
||||||
|
|
||||||
|
|||||||
@@ -139,8 +139,8 @@ void RGBController_CorsairV2SW::SetupZones()
|
|||||||
led new_led;
|
led new_led;
|
||||||
|
|
||||||
new_led.name = new_kb.GetKeyNameAt(led_idx);
|
new_led.name = new_kb.GetKeyNameAt(led_idx);
|
||||||
new_led.value = new_kb.GetKeyValueAt(led_idx);
|
led_values.push_back(new_kb.GetKeyValueAt(led_idx));
|
||||||
max_led_value = std::max(max_led_value, new_led.value);
|
max_led_value = std::max(max_led_value, led_values.back());
|
||||||
leds.push_back(new_led);
|
leds.push_back(new_led);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ void RGBController_CorsairV2SW::SetupZones()
|
|||||||
|
|
||||||
new_led.name = new_zone.name + " ";
|
new_led.name = new_zone.name + " ";
|
||||||
new_led.name.append(std::to_string( led_idx ));
|
new_led.name.append(std::to_string( led_idx ));
|
||||||
new_led.value = (unsigned int)leds.size();
|
led_values.push_back((unsigned int)leds.size());
|
||||||
|
|
||||||
leds.push_back(new_led);
|
leds.push_back(new_led);
|
||||||
}
|
}
|
||||||
@@ -196,7 +196,7 @@ void RGBController_CorsairV2SW::SetupZones()
|
|||||||
|
|
||||||
for(size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
for(size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
||||||
{
|
{
|
||||||
buffer_map[leds[led_idx].value] = &colors[led_idx];
|
buffer_map[led_values[led_idx]] = &colors[led_idx];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
CorsairPeripheralV2Controller* controller;
|
CorsairPeripheralV2Controller* controller;
|
||||||
|
|
||||||
|
std::vector<unsigned int> led_values;
|
||||||
RGBColor null_color = 0;
|
RGBColor null_color = 0;
|
||||||
std::vector<RGBColor *> buffer_map;
|
std::vector<RGBColor *> buffer_map;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,217 @@
|
|||||||
|
/*---------------------------------------------------------*\
|
||||||
|
| CorsairWirelessController.cpp |
|
||||||
|
| |
|
||||||
|
| Driver for Corsair wireless keyboard |
|
||||||
|
| |
|
||||||
|
| Adam Honse (CalcProgrammer1) 08 May 2021 |
|
||||||
|
| |
|
||||||
|
| This file is part of the OpenRGB project |
|
||||||
|
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||||
|
\*---------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
#include "CorsairWirelessController.h"
|
||||||
|
#include "StringUtils.h"
|
||||||
|
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
|
CorsairWirelessController::CorsairWirelessController(hid_device* dev_handle, const char* path)
|
||||||
|
{
|
||||||
|
dev = dev_handle;
|
||||||
|
location = path;
|
||||||
|
|
||||||
|
type = DEVICE_TYPE_KEYBOARD;
|
||||||
|
|
||||||
|
EnterDirectMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
CorsairWirelessController::~CorsairWirelessController()
|
||||||
|
{
|
||||||
|
hid_close(dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
device_type CorsairWirelessController::GetDeviceType()
|
||||||
|
{
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CorsairWirelessController::GetDeviceLocation()
|
||||||
|
{
|
||||||
|
return("HID: " + location);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CorsairWirelessController::GetFirmwareString()
|
||||||
|
{
|
||||||
|
return firmware_version;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CorsairWirelessController::GetName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CorsairWirelessController::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 CorsairWirelessController::SetLEDs(std::vector<RGBColor>colors)
|
||||||
|
{
|
||||||
|
unsigned char buf[3 * 137];
|
||||||
|
|
||||||
|
for(int color = 0; color < 137; color++)
|
||||||
|
{
|
||||||
|
buf[0 + color] = RGBGetRValue(colors[color]);
|
||||||
|
buf[137 + color] = RGBGetGValue(colors[color]);
|
||||||
|
buf[274+color] = RGBGetBValue(colors[color]);
|
||||||
|
}
|
||||||
|
|
||||||
|
StartDirectMode();
|
||||||
|
|
||||||
|
SendDirectFrame(true, &buf[0]);
|
||||||
|
SendDirectFrame(false, &buf[57]);
|
||||||
|
SendDirectFrame(false, &buf[118]);
|
||||||
|
SendDirectFrame(false, &buf[179]);
|
||||||
|
SendDirectFrame(false, &buf[240]);
|
||||||
|
SendDirectFrame(false, &buf[301]);
|
||||||
|
SendDirectFrame(false, &buf[362]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CorsairWirelessController::SetName(std::string device_name)
|
||||||
|
{
|
||||||
|
name = device_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-------------------------------------------------------------------------------------------------*\
|
||||||
|
| Private packet sending functions. |
|
||||||
|
\*-------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
void CorsairWirelessController::EnterDirectMode()
|
||||||
|
{
|
||||||
|
unsigned char usb_buf[65];
|
||||||
|
|
||||||
|
/*-----------------------------------------------------*\
|
||||||
|
| Zero out buffer |
|
||||||
|
\*-----------------------------------------------------*/
|
||||||
|
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||||
|
|
||||||
|
/*-----------------------------------------------------*\
|
||||||
|
| Set up Submit Mouse Colors packet |
|
||||||
|
\*-----------------------------------------------------*/
|
||||||
|
usb_buf[0x00] = 0x00;
|
||||||
|
usb_buf[0x01] = 0x80;
|
||||||
|
usb_buf[0x02] = 0x01;
|
||||||
|
usb_buf[0x03] = 0x03;
|
||||||
|
usb_buf[0x04] = 0x00;
|
||||||
|
usb_buf[0x05] = 0x02;
|
||||||
|
|
||||||
|
/*-----------------------------------------------------*\
|
||||||
|
| Send packet using feature reports, as headset stand |
|
||||||
|
| seems to not update completely using HID writes |
|
||||||
|
\*-----------------------------------------------------*/
|
||||||
|
hid_write(dev, usb_buf, 65);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CorsairWirelessController::StartDirectMode()
|
||||||
|
{
|
||||||
|
unsigned char usb_buf[65];
|
||||||
|
|
||||||
|
/*-----------------------------------------------------*\
|
||||||
|
| Zero out buffer |
|
||||||
|
\*-----------------------------------------------------*/
|
||||||
|
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||||
|
|
||||||
|
/*-----------------------------------------------------*\
|
||||||
|
| Set up Submit Mouse Colors packet |
|
||||||
|
\*-----------------------------------------------------*/
|
||||||
|
usb_buf[0x00] = 0x00;
|
||||||
|
usb_buf[0x01] = 0x80;
|
||||||
|
usb_buf[0x02] = 0x0D;
|
||||||
|
usb_buf[0x03] = 0x00;
|
||||||
|
usb_buf[0x04] = 0x01;
|
||||||
|
|
||||||
|
/*-----------------------------------------------------*\
|
||||||
|
| Send packet using feature reports, as headset stand |
|
||||||
|
| seems to not update completely using HID writes |
|
||||||
|
\*-----------------------------------------------------*/
|
||||||
|
hid_write(dev, usb_buf, 65);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CorsairWirelessController::ExitDirectMode()
|
||||||
|
{
|
||||||
|
unsigned char usb_buf[65];
|
||||||
|
|
||||||
|
/*-----------------------------------------------------*\
|
||||||
|
| Zero out buffer |
|
||||||
|
\*-----------------------------------------------------*/
|
||||||
|
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||||
|
|
||||||
|
/*-----------------------------------------------------*\
|
||||||
|
| Set up Submit Mouse Colors packet |
|
||||||
|
\*-----------------------------------------------------*/
|
||||||
|
usb_buf[0x00] = 0x00;
|
||||||
|
usb_buf[0x01] = 0x80;
|
||||||
|
usb_buf[0x02] = 0x01;
|
||||||
|
usb_buf[0x03] = 0x03;
|
||||||
|
usb_buf[0x04] = 0x00;
|
||||||
|
usb_buf[0x05] = 0x01;
|
||||||
|
|
||||||
|
/*-----------------------------------------------------*\
|
||||||
|
| Send packet using feature reports, as headset stand |
|
||||||
|
| seems to not update completely using HID writes |
|
||||||
|
\*-----------------------------------------------------*/
|
||||||
|
hid_write(dev, usb_buf, 65);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CorsairWirelessController::SendDirectFrame(bool first_frame, unsigned char* data)
|
||||||
|
{
|
||||||
|
unsigned char usb_buf[65];
|
||||||
|
|
||||||
|
/*-----------------------------------------------------*\
|
||||||
|
| Zero out buffer |
|
||||||
|
\*-----------------------------------------------------*/
|
||||||
|
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||||
|
|
||||||
|
/*-----------------------------------------------------*\
|
||||||
|
| Set up Submit Mouse Colors packet |
|
||||||
|
\*-----------------------------------------------------*/
|
||||||
|
usb_buf[0x00] = 0x00;
|
||||||
|
usb_buf[0x01] = 0x80;
|
||||||
|
usb_buf[0x02] = first_frame ? 0x06 : 0x07;
|
||||||
|
usb_buf[0x03] = 0x00;
|
||||||
|
|
||||||
|
if(first_frame)
|
||||||
|
{
|
||||||
|
usb_buf[0x04] = 0x9B;
|
||||||
|
usb_buf[0x05] = 0x01;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------*\
|
||||||
|
| Copy in colors in <RED> <GREEN> <BLUE> order |
|
||||||
|
\*-----------------------------------------------------*/
|
||||||
|
if(first_frame)
|
||||||
|
{
|
||||||
|
memcpy(&usb_buf[0x08], data, 57);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
memcpy(&usb_buf[0x04], data, 61);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------*\
|
||||||
|
| Send packet using feature reports, as headset stand |
|
||||||
|
| seems to not update completely using HID writes |
|
||||||
|
\*-----------------------------------------------------*/
|
||||||
|
hid_write(dev, usb_buf, 65);
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*---------------------------------------------------------*\
|
||||||
|
| CorsairWirelessController.h |
|
||||||
|
| |
|
||||||
|
| Driver for Corsair wireless keyboard |
|
||||||
|
| |
|
||||||
|
| Adam Honse (CalcProgrammer1) 08 May 2021 |
|
||||||
|
| |
|
||||||
|
| 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"
|
||||||
|
|
||||||
|
class CorsairWirelessController
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CorsairWirelessController(hid_device* dev_handle, const char* path);
|
||||||
|
~CorsairWirelessController();
|
||||||
|
|
||||||
|
device_type GetDeviceType();
|
||||||
|
std::string GetDeviceLocation();
|
||||||
|
std::string GetFirmwareString();
|
||||||
|
std::string GetName();
|
||||||
|
std::string GetSerialString();
|
||||||
|
|
||||||
|
void SetLEDs(std::vector<RGBColor> colors);
|
||||||
|
void SetName(std::string device_name);
|
||||||
|
|
||||||
|
private:
|
||||||
|
hid_device* dev;
|
||||||
|
|
||||||
|
std::string firmware_version;
|
||||||
|
std::string location;
|
||||||
|
std::string name;
|
||||||
|
device_type type;
|
||||||
|
|
||||||
|
void EnterDirectMode();
|
||||||
|
void ExitDirectMode();
|
||||||
|
void StartDirectMode();
|
||||||
|
void SendDirectFrame(bool first_frame, unsigned char* data);
|
||||||
|
};
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
/*---------------------------------------------------------*\
|
||||||
|
| CorsairWirelessControllerDetect.cpp |
|
||||||
|
| |
|
||||||
|
| Detector for Corsair wireless keyboard |
|
||||||
|
| |
|
||||||
|
| Adam Honse (CalcProgrammer1) 08 May 2021 |
|
||||||
|
| |
|
||||||
|
| This file is part of the OpenRGB project |
|
||||||
|
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||||
|
\*---------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <hidapi.h>
|
||||||
|
#include "DetectionManager.h"
|
||||||
|
#include "CorsairWirelessController.h"
|
||||||
|
#include "RGBController.h"
|
||||||
|
#include "RGBController_CorsairWireless.h"
|
||||||
|
|
||||||
|
/*---------------------------------------------------------*\
|
||||||
|
| Corsair vendor ID |
|
||||||
|
\*---------------------------------------------------------*/
|
||||||
|
#define CORSAIR_VID 0x1B1C
|
||||||
|
|
||||||
|
/*---------------------------------------------------------*\
|
||||||
|
| Keyboard product IDs |
|
||||||
|
\*---------------------------------------------------------*/
|
||||||
|
#define CORSAIR_K57_RGB_WIRED_PID 0x1B6E
|
||||||
|
#define CORSAIR_K57_RGB_WIRELESS_PID 0x1B62
|
||||||
|
|
||||||
|
DetectedControllers DetectCorsairWirelessControllers(hid_device_info* info, const std::string& name)
|
||||||
|
{
|
||||||
|
DetectedControllers detected_controllers;
|
||||||
|
hid_device* dev;
|
||||||
|
|
||||||
|
dev = hid_open_path(info->path);
|
||||||
|
|
||||||
|
if(dev)
|
||||||
|
{
|
||||||
|
CorsairWirelessController* controller = new CorsairWirelessController(dev, info->path);
|
||||||
|
controller->SetName(name);
|
||||||
|
|
||||||
|
if(controller->GetDeviceType() != DEVICE_TYPE_UNKNOWN)
|
||||||
|
{
|
||||||
|
RGBController_CorsairWireless* rgb_controller = new RGBController_CorsairWireless(controller);
|
||||||
|
detected_controllers.push_back(rgb_controller);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
delete controller;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return(detected_controllers);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------*\
|
||||||
|
| Keyboards |
|
||||||
|
\*---------------------------------------------------------*/
|
||||||
|
REGISTER_HID_DETECTOR_IPU("Corsair K57 RGB (Wired)", DetectCorsairWirelessControllers, CORSAIR_VID, CORSAIR_K57_RGB_WIRED_PID, 1, 0xFF42, 1);
|
||||||
|
//REGISTER_HID_DETECTOR_IPU("Corsair K57 RGB (Wireless)", DetectCorsairWirelessControllers, CORSAIR_VID, CORSAIR_K57_RGB_WIRELESS_PID, 1, 0xFF42, 1);
|
||||||
@@ -0,0 +1,319 @@
|
|||||||
|
/*---------------------------------------------------------*\
|
||||||
|
| RGBController_CorsairWireless.cpp |
|
||||||
|
| |
|
||||||
|
| RGBController for Corsair wireless keyboard |
|
||||||
|
| |
|
||||||
|
| Adam Honse (CalcProgrammer1) 08 May 2021 |
|
||||||
|
| |
|
||||||
|
| This file is part of the OpenRGB project |
|
||||||
|
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||||
|
\*---------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "RGBControllerKeyNames.h"
|
||||||
|
#include "RGBController_CorsairWireless.h"
|
||||||
|
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
|
//0xFFFFFFFF indicates an unused entry in matrix
|
||||||
|
#define NA 0xFFFFFFFF
|
||||||
|
|
||||||
|
static unsigned int matrix_map[7][24] =
|
||||||
|
{ { NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0, 1, NA, NA, NA },
|
||||||
|
{ 131, 41, NA, 58, 59, 60, 61, NA, 62, 63, 64, 65, NA, 66, 67, 68, 69, 70, 71, 72, NA, NA, NA, NA },
|
||||||
|
{ 132, 53, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, NA, 45, 46, 42, NA, 73, 74, 75, 83, 84, 85, 86 },
|
||||||
|
{ 133, 43, NA, 20, 26, 8, 21, NA, 23, 28, 24, 12, 18, 19, 47, 48, 49, 76, 77, 78, 95, 96, 97, 87 },
|
||||||
|
{ 134, 57, NA, 4, 22, 7, 9, NA, 10, 11, 13, 14, 15, 51, 52, NA, 40, NA, NA, NA, 92, 93, 94, NA },
|
||||||
|
{ 135, 106, NA, 29, 27, 6, 25, NA, 5, NA, 17, 16, 54, 55, 56, 110, NA, NA, 82, NA, 89, 90, 91, 88 },
|
||||||
|
{ 136, 105, 108, 107, NA, NA, NA, NA, 44, NA, NA, NA, NA, 111, 122, 101, 109, 80, 81, 79, 98, NA, 99, NA } };
|
||||||
|
|
||||||
|
static const char* zone_names[] =
|
||||||
|
{
|
||||||
|
ZONE_EN_KEYBOARD,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const unsigned int zone_sizes[] =
|
||||||
|
{
|
||||||
|
137
|
||||||
|
};
|
||||||
|
|
||||||
|
static const zone_type zone_types[] =
|
||||||
|
{
|
||||||
|
ZONE_TYPE_MATRIX,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char* led_names[] =
|
||||||
|
{
|
||||||
|
"Power/Wireless Indicator",
|
||||||
|
"Lock/Macro Indicator",
|
||||||
|
"N/A",
|
||||||
|
"N/A",
|
||||||
|
KEY_EN_A,
|
||||||
|
KEY_EN_B,
|
||||||
|
KEY_EN_C,
|
||||||
|
KEY_EN_D,
|
||||||
|
KEY_EN_E,
|
||||||
|
KEY_EN_F,
|
||||||
|
KEY_EN_G,
|
||||||
|
KEY_EN_H,
|
||||||
|
KEY_EN_I,
|
||||||
|
KEY_EN_J,
|
||||||
|
KEY_EN_K,
|
||||||
|
KEY_EN_L,
|
||||||
|
KEY_EN_M,
|
||||||
|
KEY_EN_N,
|
||||||
|
KEY_EN_O,
|
||||||
|
KEY_EN_P,
|
||||||
|
KEY_EN_Q,
|
||||||
|
KEY_EN_R,
|
||||||
|
KEY_EN_S,
|
||||||
|
KEY_EN_T,
|
||||||
|
KEY_EN_U,
|
||||||
|
KEY_EN_V,
|
||||||
|
KEY_EN_W,
|
||||||
|
KEY_EN_X,
|
||||||
|
KEY_EN_Y,
|
||||||
|
KEY_EN_Z,
|
||||||
|
KEY_EN_1,
|
||||||
|
KEY_EN_2,
|
||||||
|
KEY_EN_3,
|
||||||
|
KEY_EN_4,
|
||||||
|
KEY_EN_5,
|
||||||
|
KEY_EN_6,
|
||||||
|
KEY_EN_7,
|
||||||
|
KEY_EN_8,
|
||||||
|
KEY_EN_9,
|
||||||
|
KEY_EN_0,
|
||||||
|
KEY_EN_ANSI_ENTER,
|
||||||
|
KEY_EN_ESCAPE,
|
||||||
|
KEY_EN_BACKSPACE,
|
||||||
|
KEY_EN_TAB,
|
||||||
|
KEY_EN_SPACE,
|
||||||
|
KEY_EN_MINUS,
|
||||||
|
KEY_EN_EQUALS,
|
||||||
|
KEY_EN_LEFT_BRACKET,
|
||||||
|
KEY_EN_RIGHT_BRACKET,
|
||||||
|
KEY_EN_ANSI_BACK_SLASH,
|
||||||
|
KEY_EN_UNUSED,
|
||||||
|
KEY_EN_SEMICOLON,
|
||||||
|
KEY_EN_QUOTE,
|
||||||
|
KEY_EN_BACK_TICK,
|
||||||
|
KEY_EN_COMMA,
|
||||||
|
KEY_EN_PERIOD,
|
||||||
|
KEY_EN_FORWARD_SLASH,
|
||||||
|
KEY_EN_CAPS_LOCK,
|
||||||
|
KEY_EN_F1,
|
||||||
|
KEY_EN_F2,
|
||||||
|
KEY_EN_F3,
|
||||||
|
KEY_EN_F4,
|
||||||
|
KEY_EN_F5,
|
||||||
|
KEY_EN_F6,
|
||||||
|
KEY_EN_F7,
|
||||||
|
KEY_EN_F8,
|
||||||
|
KEY_EN_F9,
|
||||||
|
KEY_EN_F10,
|
||||||
|
KEY_EN_F11,
|
||||||
|
KEY_EN_F12,
|
||||||
|
KEY_EN_PRINT_SCREEN,
|
||||||
|
KEY_EN_SCROLL_LOCK,
|
||||||
|
KEY_EN_PAUSE_BREAK,
|
||||||
|
KEY_EN_INSERT,
|
||||||
|
KEY_EN_HOME,
|
||||||
|
KEY_EN_PAGE_UP,
|
||||||
|
KEY_EN_DELETE,
|
||||||
|
KEY_EN_END,
|
||||||
|
KEY_EN_PAGE_DOWN,
|
||||||
|
KEY_EN_RIGHT_ARROW,
|
||||||
|
KEY_EN_LEFT_ARROW,
|
||||||
|
KEY_EN_DOWN_ARROW,
|
||||||
|
KEY_EN_UP_ARROW,
|
||||||
|
KEY_EN_NUMPAD_LOCK,
|
||||||
|
KEY_EN_NUMPAD_DIVIDE,
|
||||||
|
KEY_EN_NUMPAD_TIMES,
|
||||||
|
KEY_EN_NUMPAD_MINUS,
|
||||||
|
KEY_EN_NUMPAD_PLUS,
|
||||||
|
KEY_EN_NUMPAD_ENTER,
|
||||||
|
KEY_EN_NUMPAD_1,
|
||||||
|
KEY_EN_NUMPAD_2,
|
||||||
|
KEY_EN_NUMPAD_3,
|
||||||
|
KEY_EN_NUMPAD_4,
|
||||||
|
KEY_EN_NUMPAD_5,
|
||||||
|
KEY_EN_NUMPAD_6,
|
||||||
|
KEY_EN_NUMPAD_7,
|
||||||
|
KEY_EN_NUMPAD_8,
|
||||||
|
KEY_EN_NUMPAD_9,
|
||||||
|
KEY_EN_NUMPAD_0,
|
||||||
|
KEY_EN_NUMPAD_PERIOD,
|
||||||
|
KEY_EN_UNUSED,
|
||||||
|
KEY_EN_MENU,
|
||||||
|
KEY_EN_UNUSED,
|
||||||
|
KEY_EN_UNUSED,
|
||||||
|
KEY_EN_UNUSED,
|
||||||
|
KEY_EN_LEFT_CONTROL,
|
||||||
|
KEY_EN_LEFT_SHIFT,
|
||||||
|
KEY_EN_LEFT_ALT,
|
||||||
|
KEY_EN_LEFT_WINDOWS,
|
||||||
|
KEY_EN_RIGHT_CONTROL,
|
||||||
|
KEY_EN_RIGHT_SHIFT,
|
||||||
|
KEY_EN_RIGHT_ALT,
|
||||||
|
KEY_EN_UNUSED,
|
||||||
|
KEY_EN_UNUSED,
|
||||||
|
KEY_EN_UNUSED,
|
||||||
|
KEY_EN_UNUSED,
|
||||||
|
KEY_EN_UNUSED,
|
||||||
|
KEY_EN_UNUSED,
|
||||||
|
KEY_EN_UNUSED,
|
||||||
|
KEY_EN_UNUSED,
|
||||||
|
KEY_EN_UNUSED,
|
||||||
|
KEY_EN_UNUSED,
|
||||||
|
KEY_EN_RIGHT_FUNCTION,
|
||||||
|
KEY_EN_UNUSED,
|
||||||
|
KEY_EN_UNUSED,
|
||||||
|
KEY_EN_UNUSED,
|
||||||
|
KEY_EN_UNUSED,
|
||||||
|
KEY_EN_UNUSED,
|
||||||
|
KEY_EN_UNUSED,
|
||||||
|
KEY_EN_UNUSED,
|
||||||
|
KEY_EN_UNUSED,
|
||||||
|
"Key: G1",
|
||||||
|
"Key: G2",
|
||||||
|
"Key: G3",
|
||||||
|
"Key: G4",
|
||||||
|
"Key: G5",
|
||||||
|
"Key: G6",
|
||||||
|
};
|
||||||
|
|
||||||
|
/**------------------------------------------------------------------*\
|
||||||
|
@name Corsair Wireless Peripheral
|
||||||
|
@category Keyboard
|
||||||
|
@type USB
|
||||||
|
@save :x:
|
||||||
|
@direct :white_check_mark:
|
||||||
|
@effects :x:
|
||||||
|
@detectors DetectCorsairWirelessControllers
|
||||||
|
@comment
|
||||||
|
\*-------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
RGBController_CorsairWireless::RGBController_CorsairWireless(CorsairWirelessController* controller_ptr)
|
||||||
|
{
|
||||||
|
controller = controller_ptr;
|
||||||
|
|
||||||
|
name = controller->GetName();
|
||||||
|
vendor = "Corsair";
|
||||||
|
description = "Corsair RGB Peripheral Device";
|
||||||
|
type = controller->GetDeviceType();
|
||||||
|
version = controller->GetFirmwareString();
|
||||||
|
location = controller->GetDeviceLocation();
|
||||||
|
serial = controller->GetSerialString();
|
||||||
|
|
||||||
|
mode Direct;
|
||||||
|
Direct.name = "Direct";
|
||||||
|
Direct.value = 0;
|
||||||
|
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||||
|
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||||
|
modes.push_back(Direct);
|
||||||
|
|
||||||
|
SetupZones();
|
||||||
|
|
||||||
|
/*-----------------------------------------------------*\
|
||||||
|
| The Corsair Lighting Node Pro requires a packet within|
|
||||||
|
| 20 seconds of sending the lighting change in order |
|
||||||
|
| to not revert back into rainbow mode. Start a thread |
|
||||||
|
| to continuously send a keepalive packet every 5s |
|
||||||
|
\*-----------------------------------------------------*/
|
||||||
|
keepalive_thread_run = true;
|
||||||
|
keepalive_thread = new std::thread(&RGBController_CorsairWireless::KeepaliveThread, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
RGBController_CorsairWireless::~RGBController_CorsairWireless()
|
||||||
|
{
|
||||||
|
Shutdown();
|
||||||
|
|
||||||
|
/*-----------------------------------------------------*\
|
||||||
|
| Close keepalive thread |
|
||||||
|
\*-----------------------------------------------------*/
|
||||||
|
keepalive_thread_run = false;
|
||||||
|
keepalive_thread->join();
|
||||||
|
delete keepalive_thread;
|
||||||
|
|
||||||
|
delete controller;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RGBController_CorsairWireless::SetupZones()
|
||||||
|
{
|
||||||
|
/*---------------------------------------------------------*\
|
||||||
|
| Determine number of zones |
|
||||||
|
| For now, keyboard has 2 zones and mousemat has 1 |
|
||||||
|
\*---------------------------------------------------------*/
|
||||||
|
unsigned int num_zones = 1;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------*\
|
||||||
|
| Set up zones |
|
||||||
|
\*---------------------------------------------------------*/
|
||||||
|
unsigned int total_led_count = 0;
|
||||||
|
for(unsigned int zone_idx = 0; zone_idx < num_zones; zone_idx++)
|
||||||
|
{
|
||||||
|
zone new_zone;
|
||||||
|
|
||||||
|
new_zone.name = zone_names[zone_idx];
|
||||||
|
new_zone.type = zone_types[zone_idx];
|
||||||
|
new_zone.leds_min = zone_sizes[zone_idx];
|
||||||
|
new_zone.leds_max = zone_sizes[zone_idx];
|
||||||
|
new_zone.leds_count = zone_sizes[zone_idx];
|
||||||
|
|
||||||
|
if(zone_types[zone_idx] == ZONE_TYPE_MATRIX)
|
||||||
|
{
|
||||||
|
new_zone.matrix_map.Set(7, 24, (unsigned int *)&matrix_map);
|
||||||
|
}
|
||||||
|
|
||||||
|
zones.push_back(new_zone);
|
||||||
|
total_led_count += new_zone.leds_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
|
||||||
|
{
|
||||||
|
led new_led;
|
||||||
|
|
||||||
|
new_led.name = led_names[led_idx];
|
||||||
|
|
||||||
|
leds.push_back(new_led);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetupColors();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RGBController_CorsairWireless::DeviceUpdateLEDs()
|
||||||
|
{
|
||||||
|
last_update_time = std::chrono::steady_clock::now();
|
||||||
|
|
||||||
|
controller->SetLEDs(colors);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RGBController_CorsairWireless::DeviceUpdateZoneLEDs(int /*zone*/)
|
||||||
|
{
|
||||||
|
controller->SetLEDs(colors);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RGBController_CorsairWireless::DeviceUpdateSingleLED(int /*led*/)
|
||||||
|
{
|
||||||
|
controller->SetLEDs(colors);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RGBController_CorsairWireless::DeviceUpdateMode()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void RGBController_CorsairWireless::KeepaliveThread()
|
||||||
|
{
|
||||||
|
while(keepalive_thread_run.load())
|
||||||
|
{
|
||||||
|
if(active_mode == 0)
|
||||||
|
{
|
||||||
|
if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(5000))
|
||||||
|
{
|
||||||
|
DeviceUpdateLEDs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::this_thread::sleep_for(1000ms);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/*---------------------------------------------------------*\
|
||||||
|
| RGBController_CorsairWireless.h |
|
||||||
|
| |
|
||||||
|
| RGBController for Corsair wireless keyboard |
|
||||||
|
| |
|
||||||
|
| Adam Honse (CalcProgrammer1) 08 May 2021 |
|
||||||
|
| |
|
||||||
|
| This file is part of the OpenRGB project |
|
||||||
|
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||||
|
\*---------------------------------------------------------*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "RGBController.h"
|
||||||
|
#include "CorsairWirelessController.h"
|
||||||
|
|
||||||
|
class RGBController_CorsairWireless : public RGBController
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RGBController_CorsairWireless(CorsairWirelessController* controller_ptr);
|
||||||
|
~RGBController_CorsairWireless();
|
||||||
|
|
||||||
|
int physical_layout;
|
||||||
|
int logical_layout;
|
||||||
|
|
||||||
|
void SetupZones();
|
||||||
|
|
||||||
|
void DeviceUpdateLEDs();
|
||||||
|
void DeviceUpdateZoneLEDs(int zone);
|
||||||
|
void DeviceUpdateSingleLED(int led);
|
||||||
|
|
||||||
|
void DeviceUpdateMode();
|
||||||
|
|
||||||
|
void KeepaliveThread();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CorsairWirelessController* controller;
|
||||||
|
std::thread* keepalive_thread;
|
||||||
|
std::atomic<bool> keepalive_thread_run;
|
||||||
|
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
|
||||||
|
};
|
||||||
+1
-1
@@ -409,7 +409,7 @@ void RGBController_CougarKeyboard::SetupZones()
|
|||||||
{
|
{
|
||||||
led new_led;
|
led new_led;
|
||||||
new_led.name = led_names[led_index];
|
new_led.name = led_names[led_index];
|
||||||
new_led.value = led_index;
|
|
||||||
leds.push_back(new_led);
|
leds.push_back(new_led);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,14 +134,7 @@ void CrucialController::CrucialRegisterWriteBlock(crucial_register reg, unsigned
|
|||||||
bus->i2c_smbus_write_word_data(dev, 0x00, ((reg << 8) & 0xFF00) | ((reg >> 8) & 0x00FF));
|
bus->i2c_smbus_write_word_data(dev, 0x00, ((reg << 8) & 0xFF00) | ((reg >> 8) & 0x00FF));
|
||||||
|
|
||||||
//Write Crucial block data
|
//Write Crucial block data
|
||||||
if(bus->i2c_smbus_write_block_data(dev, 0x03, sz, data) == -1)
|
bus->i2c_smbus_write_block_data(dev, 0x03, sz, data);
|
||||||
{
|
|
||||||
//Fall back to individual byte operations if the block operation fails
|
|
||||||
for(unsigned int block_byte = 0; block_byte < sz; block_byte++)
|
|
||||||
{
|
|
||||||
bus->i2c_smbus_write_byte_data(dev, 0x01, data[block_byte]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CrucialController::SendEffectColor
|
void CrucialController::SendEffectColor
|
||||||
|
|||||||
@@ -28,6 +28,12 @@ using namespace std::chrono_literals;
|
|||||||
|
|
||||||
static const unsigned char crucial_addresses[] =
|
static const unsigned char crucial_addresses[] =
|
||||||
{
|
{
|
||||||
|
/*---------------------------------------------------------*\
|
||||||
|
| These addresses have been disabled due to conflict with |
|
||||||
|
| ENE DRAM. Since the detection scheme is the same, ENE |
|
||||||
|
| RAM will be detected as Crucial. We need to improve the |
|
||||||
|
| Crucial detection scheme. |
|
||||||
|
\*---------------------------------------------------------*/
|
||||||
0x39,
|
0x39,
|
||||||
0x3A,
|
0x3A,
|
||||||
0x3B,
|
0x3B,
|
||||||
@@ -65,19 +71,19 @@ bool TestForCrucialController(i2c_smbus_interface* bus, unsigned char address)
|
|||||||
{
|
{
|
||||||
bool pass = false;
|
bool pass = false;
|
||||||
|
|
||||||
int res = bus->i2c_smbus_read_byte(address);
|
int res = bus->i2c_smbus_write_quick(address, I2C_SMBUS_WRITE);
|
||||||
|
|
||||||
if(res >= 0)
|
if (res >= 0)
|
||||||
{
|
{
|
||||||
pass = true;
|
pass = true;
|
||||||
|
|
||||||
LOG_DEBUG("[%s] Detected an I2C device at address %02X", CRUCIAL_CONTROLLER_NAME, address);
|
LOG_DEBUG("[%s] Detected an I2C device at address %02X", CRUCIAL_CONTROLLER_NAME, address);
|
||||||
|
|
||||||
for(int i = 0xA0; i < 0xB0; i++)
|
for (int i = 0xA0; i < 0xB0; i++)
|
||||||
{
|
{
|
||||||
res = bus->i2c_smbus_read_byte_data(address, i);
|
res = bus->i2c_smbus_read_byte_data(address, i);
|
||||||
|
|
||||||
if(res != (i - 0xA0))
|
if (res != (i - 0xA0))
|
||||||
{
|
{
|
||||||
LOG_VERBOSE("[%s] Detection failed testing register %02X. Expected %02X, got %02X.", CRUCIAL_CONTROLLER_NAME, i, (i - 0xA0), res);
|
LOG_VERBOSE("[%s] Detection failed testing register %02X. Expected %02X, got %02X.", CRUCIAL_CONTROLLER_NAME, i, (i - 0xA0), res);
|
||||||
|
|
||||||
@@ -143,7 +149,7 @@ DetectedControllers DetectCrucialControllers(std::vector<i2c_smbus_interface*> &
|
|||||||
{
|
{
|
||||||
for(unsigned int slot = 0; slot < 4; slot++)
|
for(unsigned int slot = 0; slot < 4; slot++)
|
||||||
{
|
{
|
||||||
int res = buses[bus]->i2c_smbus_read_byte(0x27);
|
int res = buses[bus]->i2c_smbus_write_quick(0x27, I2C_SMBUS_WRITE);
|
||||||
|
|
||||||
if(res < 0)
|
if(res < 0)
|
||||||
{
|
{
|
||||||
@@ -157,7 +163,7 @@ DetectedControllers DetectCrucialControllers(std::vector<i2c_smbus_interface*> &
|
|||||||
|
|
||||||
if(address_list_idx < CRUCIAL_ADDRESS_COUNT)
|
if(address_list_idx < CRUCIAL_ADDRESS_COUNT)
|
||||||
{
|
{
|
||||||
res = buses[bus]->i2c_smbus_read_byte(crucial_addresses[address_list_idx]);
|
res = buses[bus]->i2c_smbus_write_quick(crucial_addresses[address_list_idx], I2C_SMBUS_WRITE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ void RGBController_CryorigH7QuadLumi::SetupZones()
|
|||||||
new_led.name = zone_names[zone_idx];
|
new_led.name = zone_names[zone_idx];
|
||||||
new_led.name.append(", LED ");
|
new_led.name.append(", LED ");
|
||||||
new_led.name.append(std::to_string(led_idx + 1));
|
new_led.name.append(std::to_string(led_idx + 1));
|
||||||
new_led.value = zone_idx;
|
led_values.push_back(zone_idx);
|
||||||
|
|
||||||
leds.push_back(new_led);
|
leds.push_back(new_led);
|
||||||
}
|
}
|
||||||
@@ -233,7 +233,7 @@ void RGBController_CryorigH7QuadLumi::DeviceUpdateZoneLEDs(int zone)
|
|||||||
|
|
||||||
void RGBController_CryorigH7QuadLumi::DeviceUpdateSingleLED(int led)
|
void RGBController_CryorigH7QuadLumi::DeviceUpdateSingleLED(int led)
|
||||||
{
|
{
|
||||||
unsigned int zone_idx = leds[led].value;
|
unsigned int zone_idx = led_values[led];
|
||||||
|
|
||||||
DeviceUpdateZoneLEDs(zone_idx);
|
DeviceUpdateZoneLEDs(zone_idx);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,5 +33,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
CryorigH7QuadLumiController* controller;
|
CryorigH7QuadLumiController* controller;
|
||||||
std::vector<unsigned int> leds_channel;
|
std::vector<unsigned int> leds_channel;
|
||||||
|
std::vector<unsigned int> led_values;
|
||||||
std::vector<unsigned int> zones_channel;
|
std::vector<unsigned int> zones_channel;
|
||||||
};
|
};
|
||||||
@@ -76,7 +76,6 @@ void RGBController_DDP::SetupZones()
|
|||||||
{
|
{
|
||||||
led new_led;
|
led new_led;
|
||||||
new_led.name = zones[zone_idx].name + " LED " + std::to_string(led_idx + 1);
|
new_led.name = zones[zone_idx].name + " LED " + std::to_string(led_idx + 1);
|
||||||
new_led.value = 0;
|
|
||||||
leds.push_back(new_led);
|
leds.push_back(new_led);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ void RGBController_DRGB::SetupZones()
|
|||||||
led new_led;
|
led new_led;
|
||||||
new_led.name = zones[channel_idx].name + ", LED " + std::to_string(led_ch_idx);
|
new_led.name = zones[channel_idx].name + ", LED " + std::to_string(led_ch_idx);
|
||||||
leds.push_back(new_led);
|
leds.push_back(new_led);
|
||||||
leds_channel.push_back((unsigned int)channel_idx);
|
leds_channel.push_back(channel_idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -187,7 +187,6 @@ void RGBController_DarkProjectKeyboard::SetupZones()
|
|||||||
{
|
{
|
||||||
led new_led;
|
led new_led;
|
||||||
new_led.name = led_names[led_index];
|
new_led.name = led_names[led_index];
|
||||||
new_led.value = led_index;
|
|
||||||
leds.push_back(new_led);
|
leds.push_back(new_led);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -505,7 +505,7 @@ void RGBController_Debug::SetupZones()
|
|||||||
|
|
||||||
if(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_DEVICE_SPECIFIC)
|
if(zones[zone_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_DEVICE_SPECIFIC)
|
||||||
{
|
{
|
||||||
if(configuration_json.contains("zones") && (zone_idx < configuration_json["zones"].size()))
|
if(configuration_json.contains("zones") && (zone_idx < (int)configuration_json["zones"].size()))
|
||||||
{
|
{
|
||||||
if(configuration_json["zones"][zone_idx].contains("configuration"))
|
if(configuration_json["zones"][zone_idx].contains("configuration"))
|
||||||
{
|
{
|
||||||
@@ -767,7 +767,7 @@ void RGBController_Debug::DeviceUpdateDeviceSpecificConfiguration()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RGBController_Debug::DeviceUpdateDeviceSpecificZoneConfiguration(int /*zone*/)
|
void RGBController_Debug::DeviceUpdateDeviceSpecificZoneConfiguration(int zone)
|
||||||
{
|
{
|
||||||
SetupZones();
|
SetupZones();
|
||||||
}
|
}
|
||||||
@@ -21,14 +21,14 @@
|
|||||||
DetectedControllers DetectDygmaRaiseControllers()
|
DetectedControllers DetectDygmaRaiseControllers()
|
||||||
{
|
{
|
||||||
DetectedControllers detected_controllers;
|
DetectedControllers detected_controllers;
|
||||||
std::vector<std::string> ports = find_usb_serial_port(DYGMA_RAISE_VID, DYGMA_RAISE_PID);
|
std::vector<std::string *> ports = find_usb_serial_port(DYGMA_RAISE_VID, DYGMA_RAISE_PID);
|
||||||
|
|
||||||
for(std::size_t i = 0; i < ports.size(); i++)
|
for(std::size_t i = 0; i < ports.size(); i++)
|
||||||
{
|
{
|
||||||
if(ports[i] != "")
|
if(*ports[i] != "")
|
||||||
{
|
{
|
||||||
DygmaRaiseController* controller = new DygmaRaiseController();
|
DygmaRaiseController* controller = new DygmaRaiseController();
|
||||||
controller->Initialize((char *)ports[i].c_str());
|
controller->Initialize((char *)ports[i]->c_str());
|
||||||
|
|
||||||
RGBController_DygmaRaise* rgb_controller = new RGBController_DygmaRaise(controller);
|
RGBController_DygmaRaise* rgb_controller = new RGBController_DygmaRaise(controller);
|
||||||
|
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ DetectedControllers DetectENESMBusDRAMControllers(std::vector<i2c_smbus_interfac
|
|||||||
|
|
||||||
for(unsigned int slot = 0; slot < 8; slot++)
|
for(unsigned int slot = 0; slot < 8; slot++)
|
||||||
{
|
{
|
||||||
int res = buses[bus]->i2c_smbus_read_byte(0x77);
|
int res = buses[bus]->i2c_smbus_write_quick(0x77, I2C_SMBUS_WRITE);
|
||||||
|
|
||||||
if(res < 0)
|
if(res < 0)
|
||||||
{
|
{
|
||||||
@@ -176,7 +176,7 @@ DetectedControllers DetectENESMBusDRAMControllers(std::vector<i2c_smbus_interfac
|
|||||||
{
|
{
|
||||||
LOG_DEBUG("[ENE SMBus DRAM] Testing address %02X to see if there is a device there", ene_ram_addresses[address_list_idx]);
|
LOG_DEBUG("[ENE SMBus DRAM] Testing address %02X to see if there is a device there", ene_ram_addresses[address_list_idx]);
|
||||||
|
|
||||||
res = buses[bus]->i2c_smbus_read_byte(ene_ram_addresses[address_list_idx]);
|
res = buses[bus]->i2c_smbus_write_quick(ene_ram_addresses[address_list_idx], I2C_SMBUS_WRITE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -413,7 +413,6 @@ REGISTER_I2C_PCI_DETECTOR("ASUS ROG MATRIX PLATINUM GeForce RTX 4090",
|
|||||||
REGISTER_I2C_PCI_DETECTOR("ASUS TUF GeForce RTX 5060 Gaming OC", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5060_DEV, ASUS_SUB_VEN, ASUS_TUF_RTX_5060_O8G_GAMING, 0x67);
|
REGISTER_I2C_PCI_DETECTOR("ASUS TUF GeForce RTX 5060 Gaming OC", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5060_DEV, ASUS_SUB_VEN, ASUS_TUF_RTX_5060_O8G_GAMING, 0x67);
|
||||||
REGISTER_I2C_PCI_DETECTOR("ASUS TUF GeForce RTX 5070 Gaming OC", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5070_DEV, ASUS_SUB_VEN, ASUS_TUF_RTX_5070_O12G_GAMING, 0x67);
|
REGISTER_I2C_PCI_DETECTOR("ASUS TUF GeForce RTX 5070 Gaming OC", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5070_DEV, ASUS_SUB_VEN, ASUS_TUF_RTX_5070_O12G_GAMING, 0x67);
|
||||||
REGISTER_I2C_PCI_DETECTOR("ASUS TUF GeForce RTX 5070 Ti Gaming OC", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5070TI_DEV, ASUS_SUB_VEN, ASUS_TUF_RTX_5070TI_O16G_GAMING, 0x67);
|
REGISTER_I2C_PCI_DETECTOR("ASUS TUF GeForce RTX 5070 Ti Gaming OC", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5070TI_DEV, ASUS_SUB_VEN, ASUS_TUF_RTX_5070TI_O16G_GAMING, 0x67);
|
||||||
REGISTER_I2C_PCI_DETECTOR("ASUS TUF GeForce RTX 5070 Ti Gaming BTF White OC", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5070TI_DEV, ASUS_SUB_VEN, ASUS_TUF_RTX_5070TI_O16G_GAMING_BTF_WHITE, 0x67);
|
|
||||||
REGISTER_I2C_PCI_DETECTOR("ASUS TUF GeForce RTX 5070 Ti Gaming White OC", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5070TI_DEV, ASUS_SUB_VEN, ASUS_TUF_RTX_5070TI_O16G_GAMING_WHITE, 0x67);
|
REGISTER_I2C_PCI_DETECTOR("ASUS TUF GeForce RTX 5070 Ti Gaming White OC", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5070TI_DEV, ASUS_SUB_VEN, ASUS_TUF_RTX_5070TI_O16G_GAMING_WHITE, 0x67);
|
||||||
REGISTER_I2C_PCI_DETECTOR("ASUS ROG STRIX GeForce RTX 5070 Ti Gaming OC", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5070TI_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX_5070TI_O16G_GAMING_OC, 0x67);
|
REGISTER_I2C_PCI_DETECTOR("ASUS ROG STRIX GeForce RTX 5070 Ti Gaming OC", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5070TI_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX_5070TI_O16G_GAMING_OC, 0x67);
|
||||||
REGISTER_I2C_PCI_DETECTOR("ASUS TUF GeForce RTX 5080 Gaming OC", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5080_DEV, ASUS_SUB_VEN, ASUS_TUF_RTX_5080_O16G_GAMING, 0x67);
|
REGISTER_I2C_PCI_DETECTOR("ASUS TUF GeForce RTX 5080 Gaming OC", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5080_DEV, ASUS_SUB_VEN, ASUS_TUF_RTX_5080_O16G_GAMING, 0x67);
|
||||||
@@ -424,7 +423,6 @@ REGISTER_I2C_PCI_DETECTOR("ASUS ROG ASTRAL GeForce RTX 5080 OC WHITE",
|
|||||||
REGISTER_I2C_PCI_DETECTOR("ASUS ROG ASTRAL GeForce RTX 5080", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5080_DEV, ASUS_SUB_VEN, ASUS_ROG_ASTRAL_RTX_5080_16G_GAMING, 0x67);
|
REGISTER_I2C_PCI_DETECTOR("ASUS ROG ASTRAL GeForce RTX 5080", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5080_DEV, ASUS_SUB_VEN, ASUS_ROG_ASTRAL_RTX_5080_16G_GAMING, 0x67);
|
||||||
REGISTER_I2C_PCI_DETECTOR("ASUS ROG ASTRAL GeForce RTX 5080 WHITE", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5080_DEV, ASUS_SUB_VEN, ASUS_ROG_ASTRAL_RTX_5080_16G_GAMING_WHITE, 0x67);
|
REGISTER_I2C_PCI_DETECTOR("ASUS ROG ASTRAL GeForce RTX 5080 WHITE", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5080_DEV, ASUS_SUB_VEN, ASUS_ROG_ASTRAL_RTX_5080_16G_GAMING_WHITE, 0x67);
|
||||||
REGISTER_I2C_PCI_DETECTOR("ASUS ROG ASTRAL GeForce RTX 5090 OC", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5090_DEV, ASUS_SUB_VEN, ASUS_ROG_ASTRAL_RTX_5090_O32G_GAMING, 0x67);
|
REGISTER_I2C_PCI_DETECTOR("ASUS ROG ASTRAL GeForce RTX 5090 OC", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5090_DEV, ASUS_SUB_VEN, ASUS_ROG_ASTRAL_RTX_5090_O32G_GAMING, 0x67);
|
||||||
REGISTER_I2C_PCI_DETECTOR("ASUS ROG ASTRAL GeForce RTX 5090", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5090_DEV, ASUS_SUB_VEN, ASUS_ROG_ASTRAL_RTX_5090_O32G_GAMING_2, 0x67);
|
|
||||||
REGISTER_I2C_PCI_DETECTOR("ASUS ROG ASTRAL GeForce RTX 5090 OC BTF", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5090_DEV, ASUS_SUB_VEN, ASUS_ROG_ASTRAL_RTX_5090_O32G_GAMING_BTF, 0x67);
|
REGISTER_I2C_PCI_DETECTOR("ASUS ROG ASTRAL GeForce RTX 5090 OC BTF", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5090_DEV, ASUS_SUB_VEN, ASUS_ROG_ASTRAL_RTX_5090_O32G_GAMING_BTF, 0x67);
|
||||||
REGISTER_I2C_PCI_DETECTOR("ASUS ROG ASTRAL GeForce RTX 5090 OC WHITE", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5090_DEV, ASUS_SUB_VEN, ASUS_ROG_ASTRAL_RTX_5090_O32G_GAMING_WHITE, 0x67);
|
REGISTER_I2C_PCI_DETECTOR("ASUS ROG ASTRAL GeForce RTX 5090 OC WHITE", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5090_DEV, ASUS_SUB_VEN, ASUS_ROG_ASTRAL_RTX_5090_O32G_GAMING_WHITE, 0x67);
|
||||||
REGISTER_I2C_PCI_DETECTOR("ASUS ROG ASTRAL LC GeForce RTX 5090 OC", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5090_DEV, ASUS_SUB_VEN, ASUS_ROG_ASTRAL_LC_RTX_5090_O32G_GAMING, 0x67);
|
REGISTER_I2C_PCI_DETECTOR("ASUS ROG ASTRAL LC GeForce RTX 5090 OC", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5090_DEV, ASUS_SUB_VEN, ASUS_ROG_ASTRAL_LC_RTX_5090_O32G_GAMING, 0x67);
|
||||||
|
|||||||
@@ -61,12 +61,5 @@ void ENESMBusInterface_i2c_smbus::ENERegisterWriteBlock(ene_dev_id dev, ene_regi
|
|||||||
bus->i2c_smbus_write_word_data(dev, 0x00, ((reg << 8) & 0xFF00) | ((reg >> 8) & 0x00FF));
|
bus->i2c_smbus_write_word_data(dev, 0x00, ((reg << 8) & 0xFF00) | ((reg >> 8) & 0x00FF));
|
||||||
|
|
||||||
//Write ENE block data
|
//Write ENE block data
|
||||||
if(bus->i2c_smbus_write_block_data(dev, 0x03, sz, data) == -1)
|
bus->i2c_smbus_write_block_data(dev, 0x03, sz, data);
|
||||||
{
|
|
||||||
//Fall back to individual byte operations if the block operation fails
|
|
||||||
for(unsigned int block_byte = 0; block_byte < sz; block_byte++)
|
|
||||||
{
|
|
||||||
bus->i2c_smbus_write_byte_data(dev, 0x01, data[block_byte]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -265,7 +265,7 @@ int RGBController_ENESMBus::GetDeviceMode()
|
|||||||
\*---------------------------------------------------------*/
|
\*---------------------------------------------------------*/
|
||||||
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
||||||
{
|
{
|
||||||
unsigned int led = leds[led_idx].value;
|
unsigned int led = led_values[led_idx];
|
||||||
unsigned char red;
|
unsigned char red;
|
||||||
unsigned char grn;
|
unsigned char grn;
|
||||||
unsigned char blu;
|
unsigned char blu;
|
||||||
@@ -306,7 +306,7 @@ void RGBController_ENESMBus::DeviceUpdateZoneLEDs(int zone)
|
|||||||
{
|
{
|
||||||
for(std::size_t led_idx = 0; led_idx < zones[zone].leds_count; led_idx++)
|
for(std::size_t led_idx = 0; led_idx < zones[zone].leds_count; led_idx++)
|
||||||
{
|
{
|
||||||
int led = zones[zone].leds[led_idx].value;
|
int led = led_values[zones[zone].start_idx + led_idx];
|
||||||
RGBColor color = colors[led];
|
RGBColor color = colors[led];
|
||||||
unsigned char red = RGBGetRValue(color);
|
unsigned char red = RGBGetRValue(color);
|
||||||
unsigned char grn = RGBGetGValue(color);
|
unsigned char grn = RGBGetGValue(color);
|
||||||
@@ -435,7 +435,7 @@ void RGBController_ENESMBus::SetupZones()
|
|||||||
new_led->name = zones[zone_idx].name + " LED ";
|
new_led->name = zones[zone_idx].name + " LED ";
|
||||||
new_led->name.append(std::to_string(zone_led_idx + 1));
|
new_led->name.append(std::to_string(zone_led_idx + 1));
|
||||||
|
|
||||||
new_led->value = led_idx;
|
led_values.push_back(led_idx);
|
||||||
led_idx++;
|
led_idx++;
|
||||||
|
|
||||||
leds.push_back(*new_led);
|
leds.push_back(*new_led);
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ public:
|
|||||||
void DeviceSaveMode();
|
void DeviceSaveMode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ENESMBusController* controller;
|
ENESMBusController* controller;
|
||||||
|
std::vector<unsigned int> led_values;
|
||||||
|
|
||||||
int GetDeviceMode();
|
int GetDeviceMode();
|
||||||
};
|
};
|
||||||
@@ -174,17 +174,14 @@ void RGBController_EVGAMouse::Init_Controller()
|
|||||||
|
|
||||||
led front_led;
|
led front_led;
|
||||||
front_led.name = "Front LED";
|
front_led.name = "Front LED";
|
||||||
front_led.value = 0;
|
|
||||||
leds.push_back(front_led);
|
leds.push_back(front_led);
|
||||||
|
|
||||||
led wheel_led;
|
led wheel_led;
|
||||||
wheel_led.name = "Scroll Wheel LED";
|
wheel_led.name = "Scroll Wheel LED";
|
||||||
wheel_led.value = 1;
|
|
||||||
leds.push_back(wheel_led);
|
leds.push_back(wheel_led);
|
||||||
|
|
||||||
led back_led;
|
led back_led;
|
||||||
back_led.name = "Back LED";
|
back_led.name = "Back LED";
|
||||||
back_led.value = 2;
|
|
||||||
leds.push_back(back_led);
|
leds.push_back(back_led);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -806,7 +806,6 @@ void RGBController_EVisionV2Keyboard::SetupZones()
|
|||||||
{
|
{
|
||||||
led new_led;
|
led new_led;
|
||||||
new_led.name = led_names[led_index];
|
new_led.name = led_names[led_index];
|
||||||
new_led.value = led_index;
|
|
||||||
leds.push_back(new_led);
|
leds.push_back(new_led);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -389,7 +389,7 @@ void RGBController_EpomakerController::SetupZones()
|
|||||||
|
|
||||||
led keyboard_led;
|
led keyboard_led;
|
||||||
keyboard_led.name = "Keyboard LEDs";
|
keyboard_led.name = "Keyboard LEDs";
|
||||||
keyboard_led.value = 0x00;
|
|
||||||
leds.push_back(keyboard_led);
|
leds.push_back(keyboard_led);
|
||||||
|
|
||||||
SetupColors();
|
SetupColors();
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ void FnaticStreakController::SendRequest(const unsigned char* prefix, size_t pre
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FnaticStreakController::SetLEDsDirect(std::vector<led> leds, std::vector<RGBColor> colors, unsigned int brightness)
|
void FnaticStreakController::SetLEDsDirect(std::vector<unsigned int> led_values, std::vector<RGBColor> colors, unsigned int brightness)
|
||||||
{
|
{
|
||||||
unsigned int total_leds = GetLEDCount();
|
unsigned int total_leds = GetLEDCount();
|
||||||
|
|
||||||
@@ -199,11 +199,11 @@ void FnaticStreakController::SetLEDsDirect(std::vector<led> leds, std::vector<RG
|
|||||||
| in the keyboard hardware (0-123 for full, 0-105 mini) |
|
| in the keyboard hardware (0-123 for full, 0-105 mini) |
|
||||||
| Apply brightness scaling (0-100%) |
|
| Apply brightness scaling (0-100%) |
|
||||||
\*-----------------------------------------------------*/
|
\*-----------------------------------------------------*/
|
||||||
unsigned int leds_to_set = (unsigned int)std::min(colors.size(), leds.size());
|
unsigned int leds_to_set = (unsigned int)std::min(colors.size(), led_values.size());
|
||||||
|
|
||||||
for(unsigned int i = 0; i < leds_to_set; i++)
|
for(unsigned int i = 0; i < leds_to_set; i++)
|
||||||
{
|
{
|
||||||
unsigned int led_idx = leds[i].value;
|
unsigned int led_idx = led_values[i];
|
||||||
if(led_idx < total_leds)
|
if(led_idx < total_leds)
|
||||||
{
|
{
|
||||||
if(brightness >= 100)
|
if(brightness >= 100)
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public:
|
|||||||
unsigned int GetLEDCount();
|
unsigned int GetLEDCount();
|
||||||
|
|
||||||
void SetProfile(unsigned char profile);
|
void SetProfile(unsigned char profile);
|
||||||
void SetLEDsDirect(std::vector<led> leds, std::vector<RGBColor> colors, unsigned int brightness);
|
void SetLEDsDirect(std::vector<unsigned int> led_values, std::vector<RGBColor> colors, unsigned int brightness);
|
||||||
void SendRGBToDevice();
|
void SendRGBToDevice();
|
||||||
|
|
||||||
/*-----------------------------------------------------*\
|
/*-----------------------------------------------------*\
|
||||||
|
|||||||
@@ -525,7 +525,7 @@ void RGBController_FnaticStreak::SetupZones()
|
|||||||
{
|
{
|
||||||
led new_led;
|
led new_led;
|
||||||
new_led.name = led_name_ptr[led_idx];
|
new_led.name = led_name_ptr[led_idx];
|
||||||
new_led.value = led_idx;
|
led_values.push_back(led_idx);
|
||||||
leds.push_back(new_led);
|
leds.push_back(new_led);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -541,7 +541,7 @@ void RGBController_FnaticStreak::DeviceUpdateLEDs()
|
|||||||
| Apply brightness scaling to colors |
|
| Apply brightness scaling to colors |
|
||||||
\*-----------------------------------------------------*/
|
\*-----------------------------------------------------*/
|
||||||
unsigned int brightness = modes[active_mode].brightness;
|
unsigned int brightness = modes[active_mode].brightness;
|
||||||
controller->SetLEDsDirect(leds, colors, brightness);
|
controller->SetLEDsDirect(led_values, colors, brightness);
|
||||||
controller->SendRGBToDevice();
|
controller->SendRGBToDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,4 +36,5 @@ private:
|
|||||||
std::thread* keepalive_thread;
|
std::thread* keepalive_thread;
|
||||||
std::atomic<bool> keepalive_thread_run;
|
std::atomic<bool> keepalive_thread_run;
|
||||||
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
|
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
|
||||||
|
std::vector<unsigned int> led_values;
|
||||||
};
|
};
|
||||||
@@ -563,7 +563,7 @@ void RGBController_GaiZhongGaiKeyboard::SetupZones()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GAIZHONGGAI_RGB_HUB_GREEN_PID:
|
case GAIZHONGGAI_RGB_HUB_GREEN_PID:
|
||||||
temp = controller->GetChannelLen((uint8_t)zone_idx);//get led_len
|
temp = controller->GetChannelLen(zone_idx);//get led_len
|
||||||
zones[zone_idx].leds_min = 0;
|
zones[zone_idx].leds_min = 0;
|
||||||
zones[zone_idx].leds_max = 637;
|
zones[zone_idx].leds_max = 637;
|
||||||
|
|
||||||
@@ -600,7 +600,7 @@ void RGBController_GaiZhongGaiKeyboard::SetupZones()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GAIZHONGGAI_RGB_HUB_BLUE_PID:
|
case GAIZHONGGAI_RGB_HUB_BLUE_PID:
|
||||||
temp = controller->GetChannelLen((uint8_t)zone_idx);//get led_len
|
temp = controller->GetChannelLen(zone_idx);//get led_len
|
||||||
zones[zone_idx].leds_min = 0;
|
zones[zone_idx].leds_min = 0;
|
||||||
zones[zone_idx].leds_max = 633;
|
zones[zone_idx].leds_max = 633;
|
||||||
|
|
||||||
|
|||||||
@@ -1,238 +0,0 @@
|
|||||||
/*---------------------------------------------------------*\
|
|
||||||
| GigabyteCastor3Controller.cpp |
|
|
||||||
| |
|
|
||||||
| Driver for Gigabyte Aorus Waterforce X II 360 AIO |
|
|
||||||
| (Castor3 USB HID controller) |
|
|
||||||
| |
|
|
||||||
| RGB ring control only — LCD not implemented |
|
|
||||||
| |
|
|
||||||
| This file is part of the OpenRGB project |
|
|
||||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
#include "GigabyteCastor3Controller.h"
|
|
||||||
#include "StringUtils.h"
|
|
||||||
|
|
||||||
GigabyteCastor3Controller::GigabyteCastor3Controller(hid_device* dev_handle, const char* path)
|
|
||||||
{
|
|
||||||
dev = dev_handle;
|
|
||||||
location = path;
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Query firmware version via de 00 |
|
|
||||||
| Response: de [version_byte] |
|
|
||||||
| Observed: de 02 -> version 2 |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
unsigned char de_payload[] = { 0xDE, 0x00 };
|
|
||||||
SendPacket(de_payload, 2);
|
|
||||||
|
|
||||||
unsigned char response[CASTOR3_IN_SIZE];
|
|
||||||
int bytes_read = hid_read_timeout(dev, response, CASTOR3_IN_SIZE, CASTOR3_IN_TIMEOUT_MS);
|
|
||||||
|
|
||||||
if(bytes_read > 1)
|
|
||||||
{
|
|
||||||
/*-----------------------------------------------------*\
|
|
||||||
| Strip report ID 0x99 if present on IN packets |
|
|
||||||
\*-----------------------------------------------------*/
|
|
||||||
int offset = 0;
|
|
||||||
if(response[0] == CASTOR3_REPORT_ID)
|
|
||||||
{
|
|
||||||
offset = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(response[offset] == 0xDE && bytes_read > offset + 1)
|
|
||||||
{
|
|
||||||
firmware_version = std::to_string(response[offset + 1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GigabyteCastor3Controller::~GigabyteCastor3Controller()
|
|
||||||
{
|
|
||||||
hid_close(dev);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string GigabyteCastor3Controller::GetDeviceLocation()
|
|
||||||
{
|
|
||||||
return("HID: " + location);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string GigabyteCastor3Controller::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));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string GigabyteCastor3Controller::GetFirmwareVersion()
|
|
||||||
{
|
|
||||||
return firmware_version;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GigabyteCastor3Controller::SetEffect
|
|
||||||
(
|
|
||||||
unsigned char style,
|
|
||||||
unsigned char speed,
|
|
||||||
unsigned char brightness,
|
|
||||||
unsigned char b4,
|
|
||||||
unsigned char b5,
|
|
||||||
castor3_color_type color_type,
|
|
||||||
std::vector<RGBColor> colors
|
|
||||||
)
|
|
||||||
{
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Wire protocol for LED effect apply |
|
|
||||||
| (from castor3.py led_set_effect, confirmed from |
|
|
||||||
| led_profile.pcapng + .cled.dat cross-reference) |
|
|
||||||
| |
|
|
||||||
| Step 1: c9 [Style] [Speed*20] [Bright] [b4] [b5] |
|
|
||||||
| Step 2: cd [R] [G] [B] (single-color only) |
|
|
||||||
| -OR- b0..b3 palette registers (palette effects) |
|
|
||||||
| Step 3: b6 (commit) |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Step 1: c9 — effect select + parameters |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
unsigned char c9_payload[] =
|
|
||||||
{
|
|
||||||
0xC9,
|
|
||||||
style,
|
|
||||||
(unsigned char)(speed * 20),
|
|
||||||
brightness,
|
|
||||||
b4,
|
|
||||||
b5
|
|
||||||
};
|
|
||||||
SendPacket(c9_payload, sizeof(c9_payload));
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Step 2a: cd — primary color for single-color effects |
|
|
||||||
| Effects: static, pulse, flash, dflash, gradient, off |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
if(color_type == CASTOR3_COLORS_SINGLE)
|
|
||||||
{
|
|
||||||
unsigned char r = 0xFF, g = 0x66, b = 0x00;
|
|
||||||
|
|
||||||
if(colors.size() > 0)
|
|
||||||
{
|
|
||||||
r = RGBGetRValue(colors[0]);
|
|
||||||
g = RGBGetGValue(colors[0]);
|
|
||||||
b = RGBGetBValue(colors[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned char cd_payload[] = { 0xCD, r, g, b };
|
|
||||||
SendPacket(cd_payload, sizeof(cd_payload));
|
|
||||||
}
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Step 2b: b0..b3 — palette registers for multi-color |
|
|
||||||
| Each register carries 2 colors (6 bytes RGB + 1 pad): |
|
|
||||||
| bN [Style] [R1 G1 B1] [R2 G2 B2] 0x00 |
|
|
||||||
| b0=colors 1+2, b1=colors 3+4, b2=colors 5+6, b3=7+8 |
|
|
||||||
| |
|
|
||||||
| Effects: colorshift(8), tricolor(3), spin(3), switch(2) |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
else if(color_type == CASTOR3_COLORS_PALETTE)
|
|
||||||
{
|
|
||||||
/*-----------------------------------------------------*\
|
|
||||||
| Build palette: pad to 8 colors by repeating last |
|
|
||||||
\*-----------------------------------------------------*/
|
|
||||||
RGBColor palette[8];
|
|
||||||
|
|
||||||
for(int i = 0; i < 8; i++)
|
|
||||||
{
|
|
||||||
if(i < (int)colors.size())
|
|
||||||
{
|
|
||||||
palette[i] = colors[i];
|
|
||||||
}
|
|
||||||
else if(colors.size() > 0)
|
|
||||||
{
|
|
||||||
palette[i] = colors[colors.size() - 1];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
palette[i] = ToRGBColor(0xFF, 0x00, 0x00);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned char regs[] = { 0xB0, 0xB1, 0xB2, 0xB3 };
|
|
||||||
|
|
||||||
for(int i = 0; i < 4; i++)
|
|
||||||
{
|
|
||||||
RGBColor c1 = palette[i * 2];
|
|
||||||
RGBColor c2 = palette[i * 2 + 1];
|
|
||||||
|
|
||||||
unsigned char bN_payload[] =
|
|
||||||
{
|
|
||||||
regs[i],
|
|
||||||
style,
|
|
||||||
(unsigned char)RGBGetRValue(c1), (unsigned char)RGBGetGValue(c1), (unsigned char)RGBGetBValue(c1),
|
|
||||||
(unsigned char)RGBGetRValue(c2), (unsigned char)RGBGetGValue(c2), (unsigned char)RGBGetBValue(c2),
|
|
||||||
0x00
|
|
||||||
};
|
|
||||||
SendPacket(bN_payload, sizeof(bN_payload));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Step 3: b6 — commit/apply |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
unsigned char b6_payload[] = { 0xB6 };
|
|
||||||
SendPacket(b6_payload, sizeof(b6_payload));
|
|
||||||
}
|
|
||||||
|
|
||||||
void GigabyteCastor3Controller::SetOff()
|
|
||||||
{
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Off = Style 0x01 (Static) with Speed=0 |
|
|
||||||
| From castor3.py: off uses style 0x01, speed_wire=0 |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
std::vector<RGBColor> black;
|
|
||||||
black.push_back(ToRGBColor(0x00, 0x00, 0x00));
|
|
||||||
|
|
||||||
unsigned char c9_payload[] =
|
|
||||||
{
|
|
||||||
0xC9,
|
|
||||||
CASTOR3_STYLE_STATIC,
|
|
||||||
0x00, /* speed_wire = 0 for off */
|
|
||||||
CASTOR3_BRIGHTNESS_DEFAULT,
|
|
||||||
0x02, /* b4 */
|
|
||||||
0x01 /* b5 */
|
|
||||||
};
|
|
||||||
SendPacket(c9_payload, sizeof(c9_payload));
|
|
||||||
|
|
||||||
unsigned char cd_payload[] = { 0xCD, 0x00, 0x00, 0x00 };
|
|
||||||
SendPacket(cd_payload, sizeof(cd_payload));
|
|
||||||
|
|
||||||
unsigned char b6_payload[] = { 0xB6 };
|
|
||||||
SendPacket(b6_payload, sizeof(b6_payload));
|
|
||||||
}
|
|
||||||
|
|
||||||
void GigabyteCastor3Controller::SendPacket(const unsigned char* payload, unsigned int payload_len)
|
|
||||||
{
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Castor3 HID OUT transport: |
|
|
||||||
| - Byte 0: Report ID (0x99) |
|
|
||||||
| - Bytes 1..6143: payload, zero-padded |
|
|
||||||
| Total write size: 6144 bytes |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
unsigned char buf[CASTOR3_OUT_TOTAL];
|
|
||||||
memset(buf, 0x00, CASTOR3_OUT_TOTAL);
|
|
||||||
|
|
||||||
buf[0] = CASTOR3_REPORT_ID;
|
|
||||||
|
|
||||||
if(payload_len > CASTOR3_OUT_PAYLOAD)
|
|
||||||
{
|
|
||||||
payload_len = CASTOR3_OUT_PAYLOAD;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(&buf[1], payload, payload_len);
|
|
||||||
|
|
||||||
hid_write(dev, buf, CASTOR3_OUT_TOTAL);
|
|
||||||
}
|
|
||||||
@@ -1,123 +0,0 @@
|
|||||||
/*---------------------------------------------------------*\
|
|
||||||
| GigabyteCastor3Controller.h |
|
|
||||||
| |
|
|
||||||
| Driver for Gigabyte Aorus Waterforce X II 360 AIO |
|
|
||||||
| (Castor3 USB HID controller) |
|
|
||||||
| |
|
|
||||||
| RGB ring control only — LCD not implemented |
|
|
||||||
| |
|
|
||||||
| Protocol reference: castor3.py reverse engineering |
|
|
||||||
| VID=0x0414 PID=0x7A5E Report ID=0x99 |
|
|
||||||
| OUT size: 6144 (report ID + 6143 payload) |
|
|
||||||
| IN size: 255 |
|
|
||||||
| |
|
|
||||||
| This file is part of the OpenRGB project |
|
|
||||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <hidapi.h>
|
|
||||||
#include "RGBController.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Castor3 USB IDs |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
|
|
||||||
#define CASTOR3_VID 0x0414
|
|
||||||
#define CASTOR3_PID 0x7A5E
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Castor3 HID transport |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
|
|
||||||
#define CASTOR3_REPORT_ID 0x99
|
|
||||||
#define CASTOR3_OUT_PAYLOAD 6143 /* payload after report ID */
|
|
||||||
#define CASTOR3_OUT_TOTAL 6144 /* report ID + payload */
|
|
||||||
#define CASTOR3_IN_SIZE 255
|
|
||||||
#define CASTOR3_IN_TIMEOUT_MS 2000
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| LED effect style IDs (c9 byte[1]) |
|
|
||||||
| From castor3.py LED_EFFECTS, cross-referenced with |
|
|
||||||
| .cled.dat profile files and led_profile.pcapng |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
|
|
||||||
#define CASTOR3_STYLE_STATIC 0x01
|
|
||||||
#define CASTOR3_STYLE_PULSE 0x02
|
|
||||||
#define CASTOR3_STYLE_CYCLE 0x03
|
|
||||||
#define CASTOR3_STYLE_FLASH 0x04
|
|
||||||
#define CASTOR3_STYLE_DFLASH 0x05
|
|
||||||
#define CASTOR3_STYLE_GRADIENT 0x06
|
|
||||||
#define CASTOR3_STYLE_COLORSHIFT 0x07
|
|
||||||
#define CASTOR3_STYLE_WAVE 0x08
|
|
||||||
#define CASTOR3_STYLE_RAINBOW 0x0A
|
|
||||||
#define CASTOR3_STYLE_TRICOLOR 0x0B
|
|
||||||
#define CASTOR3_STYLE_SPIN 0x0C
|
|
||||||
#define CASTOR3_STYLE_SWITCH 0x0D
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| LED speed range: 1-5 (wire value = speed * 20) |
|
|
||||||
| LED brightness range: 1-10 (direct on wire) |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
|
|
||||||
#define CASTOR3_SPEED_MIN 1
|
|
||||||
#define CASTOR3_SPEED_MAX 5
|
|
||||||
#define CASTOR3_SPEED_DEFAULT 5
|
|
||||||
#define CASTOR3_BRIGHTNESS_MIN 1
|
|
||||||
#define CASTOR3_BRIGHTNESS_MAX 10
|
|
||||||
#define CASTOR3_BRIGHTNESS_DEFAULT 10
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Color type for effects |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
|
|
||||||
enum castor3_color_type
|
|
||||||
{
|
|
||||||
CASTOR3_COLORS_NONE = 0, /* cycle, wave, rainbow */
|
|
||||||
CASTOR3_COLORS_SINGLE = 1, /* static, pulse, flash... */
|
|
||||||
CASTOR3_COLORS_PALETTE = 2, /* colorshift, tricolor... */
|
|
||||||
};
|
|
||||||
|
|
||||||
class GigabyteCastor3Controller
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
GigabyteCastor3Controller(hid_device* dev_handle, const char* path);
|
|
||||||
~GigabyteCastor3Controller();
|
|
||||||
|
|
||||||
std::string GetDeviceLocation();
|
|
||||||
std::string GetSerialString();
|
|
||||||
std::string GetFirmwareVersion();
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| LED effect application |
|
|
||||||
| |
|
|
||||||
| Wire sequence per effect apply: |
|
|
||||||
| c9 [Style] [Speed*20] [Bright] [b4] [b5] |
|
|
||||||
| cd [R] [G] [B] — single-color only |
|
|
||||||
| b0 [Style] [R1G1B1] [R2G2B2] 00 — palette colors 1+2 |
|
|
||||||
| b1 [Style] [R3G3B3] [R4G4B4] 00 — colors 3+4 |
|
|
||||||
| b2 [Style] [R5G5B5] [R6G6B6] 00 — colors 5+6 |
|
|
||||||
| b3 [Style] [R7G7B7] [R8G8B8] 00 — colors 7+8 |
|
|
||||||
| b6 — commit/apply |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
|
|
||||||
void SetEffect(unsigned char style,
|
|
||||||
unsigned char speed,
|
|
||||||
unsigned char brightness,
|
|
||||||
unsigned char b4,
|
|
||||||
unsigned char b5,
|
|
||||||
castor3_color_type color_type,
|
|
||||||
std::vector<RGBColor> colors);
|
|
||||||
|
|
||||||
void SetOff();
|
|
||||||
|
|
||||||
private:
|
|
||||||
hid_device* dev;
|
|
||||||
std::string location;
|
|
||||||
std::string firmware_version;
|
|
||||||
|
|
||||||
void SendPacket(const unsigned char* payload, unsigned int payload_len);
|
|
||||||
};
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
/*---------------------------------------------------------*\
|
|
||||||
| GigabyteCastor3ControllerDetect.cpp |
|
|
||||||
| |
|
|
||||||
| Detector for Gigabyte Aorus Waterforce X II 360 AIO |
|
|
||||||
| (Castor3 USB HID controller) |
|
|
||||||
| |
|
|
||||||
| This file is part of the OpenRGB project |
|
|
||||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include <hidapi.h>
|
|
||||||
#include "DetectionManager.h"
|
|
||||||
#include "GigabyteCastor3Controller.h"
|
|
||||||
#include "RGBController_GigabyteCastor3.h"
|
|
||||||
|
|
||||||
#define GIGABYTE_CASTOR3_VID 0x0414
|
|
||||||
#define GIGABYTE_CASTOR3_PID 0x7A5E
|
|
||||||
|
|
||||||
DetectedControllers DetectGigabyteCastor3Controllers(hid_device_info* info, const std::string& /*name*/)
|
|
||||||
{
|
|
||||||
DetectedControllers detected_controllers;
|
|
||||||
hid_device* dev;
|
|
||||||
|
|
||||||
dev = hid_open_path(info->path);
|
|
||||||
|
|
||||||
if(dev)
|
|
||||||
{
|
|
||||||
GigabyteCastor3Controller* controller = new GigabyteCastor3Controller(dev, info->path);
|
|
||||||
RGBController_GigabyteCastor3* rgb_controller = new RGBController_GigabyteCastor3(controller);
|
|
||||||
|
|
||||||
detected_controllers.push_back(rgb_controller);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(detected_controllers);
|
|
||||||
}
|
|
||||||
|
|
||||||
REGISTER_HID_DETECTOR_IPU("Gigabyte Aorus Waterforce X II 360", DetectGigabyteCastor3Controllers, GIGABYTE_CASTOR3_VID, GIGABYTE_CASTOR3_PID, 0, 0x0000, 0x0002);
|
|
||||||
@@ -1,440 +0,0 @@
|
|||||||
/*---------------------------------------------------------*\
|
|
||||||
| RGBController_GigabyteCastor3.cpp |
|
|
||||||
| |
|
|
||||||
| RGBController for Gigabyte Aorus Waterforce X II 360 |
|
|
||||||
| AIO Cooler (Castor3 controller) |
|
|
||||||
| |
|
|
||||||
| This file is part of the OpenRGB project |
|
|
||||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "RGBController_GigabyteCastor3.h"
|
|
||||||
|
|
||||||
/**------------------------------------------------------------------*\
|
|
||||||
@name Gigabyte Aorus Waterforce X II 360
|
|
||||||
@category Cooler
|
|
||||||
@type USB
|
|
||||||
@save :o:
|
|
||||||
@direct :o:
|
|
||||||
@effects :white_check_mark:
|
|
||||||
@detectors DetectGigabyteCastor3Controllers
|
|
||||||
@comment Controls the LED ring on the pump head of the
|
|
||||||
Gigabyte Aorus Waterforce X II 360 AIO cooler.
|
|
||||||
Uses the Castor3 USB HID controller (VID 0x0414, PID 0x7A5E).
|
|
||||||
The LED ring and fans share the same controller — they are
|
|
||||||
not independently addressable and follow the same effect.
|
|
||||||
LCD display control is not implemented.
|
|
||||||
No direct/per-LED mode available — all modes are hardware
|
|
||||||
effects with a single color or palette.
|
|
||||||
\*-------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
RGBController_GigabyteCastor3::RGBController_GigabyteCastor3(GigabyteCastor3Controller* controller_ptr)
|
|
||||||
{
|
|
||||||
controller = controller_ptr;
|
|
||||||
|
|
||||||
name = "Gigabyte Aorus Waterforce X II 360";
|
|
||||||
vendor = "Gigabyte";
|
|
||||||
type = DEVICE_TYPE_COOLER;
|
|
||||||
description = "Gigabyte Aorus Waterforce X II 360 AIO Cooler";
|
|
||||||
location = controller->GetDeviceLocation();
|
|
||||||
serial = controller->GetSerialString();
|
|
||||||
version = controller->GetFirmwareVersion();
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| All modes from castor3.py LED_EFFECTS (12 effects + off) |
|
|
||||||
| |
|
|
||||||
| The Castor3 has no direct/per-LED mode. All effects are |
|
|
||||||
| hardware-driven, either single-color, palette, or |
|
|
||||||
| firmware-color (no user color). |
|
|
||||||
| |
|
|
||||||
| Speed: 1-5 mapped to MODE_FLAG_HAS_SPEED |
|
|
||||||
| Brightness: 1-10 mapped to MODE_FLAG_HAS_BRIGHTNESS |
|
|
||||||
| |
|
|
||||||
| mode.value stores the style byte for the c9 command. |
|
|
||||||
| mode.speed stores 1-5 (scaled to speed*20 on wire). |
|
|
||||||
| mode.brightness stores 1-10 (direct on wire). |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Off |
|
|
||||||
| Wire: Style=0x01 (Static) with speed_wire=0 |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
mode Off;
|
|
||||||
Off.name = "Off";
|
|
||||||
Off.value = 0xFF; /* sentinel — handled specially */
|
|
||||||
Off.flags = 0;
|
|
||||||
Off.color_mode = MODE_COLORS_NONE;
|
|
||||||
modes.push_back(Off);
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Static — single color, no speed |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
mode Static;
|
|
||||||
Static.name = "Static";
|
|
||||||
Static.value = CASTOR3_STYLE_STATIC;
|
|
||||||
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
|
||||||
Static.colors_min = 1;
|
|
||||||
Static.colors_max = 1;
|
|
||||||
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
|
||||||
Static.brightness_min = CASTOR3_BRIGHTNESS_MIN;
|
|
||||||
Static.brightness_max = CASTOR3_BRIGHTNESS_MAX;
|
|
||||||
Static.brightness = CASTOR3_BRIGHTNESS_DEFAULT;
|
|
||||||
Static.colors.resize(1);
|
|
||||||
modes.push_back(Static);
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Pulse — single color, speed + brightness |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
mode Pulse;
|
|
||||||
Pulse.name = "Pulse";
|
|
||||||
Pulse.value = CASTOR3_STYLE_PULSE;
|
|
||||||
Pulse.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
|
||||||
Pulse.speed_min = CASTOR3_SPEED_MIN;
|
|
||||||
Pulse.speed_max = CASTOR3_SPEED_MAX;
|
|
||||||
Pulse.speed = CASTOR3_SPEED_DEFAULT;
|
|
||||||
Pulse.colors_min = 1;
|
|
||||||
Pulse.colors_max = 1;
|
|
||||||
Pulse.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
|
||||||
Pulse.brightness_min = CASTOR3_BRIGHTNESS_MIN;
|
|
||||||
Pulse.brightness_max = CASTOR3_BRIGHTNESS_MAX;
|
|
||||||
Pulse.brightness = CASTOR3_BRIGHTNESS_DEFAULT;
|
|
||||||
Pulse.colors.resize(1);
|
|
||||||
modes.push_back(Pulse);
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Flash — single color, speed + brightness |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
mode Flash;
|
|
||||||
Flash.name = "Flash";
|
|
||||||
Flash.value = CASTOR3_STYLE_FLASH;
|
|
||||||
Flash.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
|
||||||
Flash.speed_min = CASTOR3_SPEED_MIN;
|
|
||||||
Flash.speed_max = CASTOR3_SPEED_MAX;
|
|
||||||
Flash.speed = CASTOR3_SPEED_DEFAULT;
|
|
||||||
Flash.colors_min = 1;
|
|
||||||
Flash.colors_max = 1;
|
|
||||||
Flash.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
|
||||||
Flash.brightness_min = CASTOR3_BRIGHTNESS_MIN;
|
|
||||||
Flash.brightness_max = CASTOR3_BRIGHTNESS_MAX;
|
|
||||||
Flash.brightness = CASTOR3_BRIGHTNESS_DEFAULT;
|
|
||||||
Flash.colors.resize(1);
|
|
||||||
modes.push_back(Flash);
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Double Flash — single color, speed + brightness |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
mode DFlash;
|
|
||||||
DFlash.name = "Double Flash";
|
|
||||||
DFlash.value = CASTOR3_STYLE_DFLASH;
|
|
||||||
DFlash.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
|
||||||
DFlash.speed_min = CASTOR3_SPEED_MIN;
|
|
||||||
DFlash.speed_max = CASTOR3_SPEED_MAX;
|
|
||||||
DFlash.speed = CASTOR3_SPEED_DEFAULT;
|
|
||||||
DFlash.colors_min = 1;
|
|
||||||
DFlash.colors_max = 1;
|
|
||||||
DFlash.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
|
||||||
DFlash.brightness_min = CASTOR3_BRIGHTNESS_MIN;
|
|
||||||
DFlash.brightness_max = CASTOR3_BRIGHTNESS_MAX;
|
|
||||||
DFlash.brightness = CASTOR3_BRIGHTNESS_DEFAULT;
|
|
||||||
DFlash.colors.resize(1);
|
|
||||||
modes.push_back(DFlash);
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Cycle — firmware colors, speed only |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
mode Cycle;
|
|
||||||
Cycle.name = "Spectrum Cycle";
|
|
||||||
Cycle.value = CASTOR3_STYLE_CYCLE;
|
|
||||||
Cycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
|
||||||
Cycle.speed_min = CASTOR3_SPEED_MIN;
|
|
||||||
Cycle.speed_max = CASTOR3_SPEED_MAX;
|
|
||||||
Cycle.speed = CASTOR3_SPEED_DEFAULT;
|
|
||||||
Cycle.color_mode = MODE_COLORS_NONE;
|
|
||||||
Cycle.brightness_min = CASTOR3_BRIGHTNESS_MIN;
|
|
||||||
Cycle.brightness_max = CASTOR3_BRIGHTNESS_MAX;
|
|
||||||
Cycle.brightness = CASTOR3_BRIGHTNESS_DEFAULT;
|
|
||||||
modes.push_back(Cycle);
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Gradient — single color, speed + brightness |
|
|
||||||
| Note: b4 = brightness on wire (special case) |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
mode Gradient;
|
|
||||||
Gradient.name = "Gradient";
|
|
||||||
Gradient.value = CASTOR3_STYLE_GRADIENT;
|
|
||||||
Gradient.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
|
||||||
Gradient.speed_min = CASTOR3_SPEED_MIN;
|
|
||||||
Gradient.speed_max = CASTOR3_SPEED_MAX;
|
|
||||||
Gradient.speed = CASTOR3_SPEED_DEFAULT;
|
|
||||||
Gradient.colors_min = 1;
|
|
||||||
Gradient.colors_max = 1;
|
|
||||||
Gradient.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
|
||||||
Gradient.brightness_min = CASTOR3_BRIGHTNESS_MIN;
|
|
||||||
Gradient.brightness_max = CASTOR3_BRIGHTNESS_MAX;
|
|
||||||
Gradient.brightness = CASTOR3_BRIGHTNESS_DEFAULT;
|
|
||||||
Gradient.colors.resize(1);
|
|
||||||
modes.push_back(Gradient);
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Color Shift — 8-color palette, speed + brightness |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
mode ColorShift;
|
|
||||||
ColorShift.name = "Color Shift";
|
|
||||||
ColorShift.value = CASTOR3_STYLE_COLORSHIFT;
|
|
||||||
ColorShift.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
|
||||||
ColorShift.speed_min = CASTOR3_SPEED_MIN;
|
|
||||||
ColorShift.speed_max = CASTOR3_SPEED_MAX;
|
|
||||||
ColorShift.speed = CASTOR3_SPEED_DEFAULT;
|
|
||||||
ColorShift.colors_min = 1;
|
|
||||||
ColorShift.colors_max = 8;
|
|
||||||
ColorShift.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
|
||||||
ColorShift.brightness_min = CASTOR3_BRIGHTNESS_MIN;
|
|
||||||
ColorShift.brightness_max = CASTOR3_BRIGHTNESS_MAX;
|
|
||||||
ColorShift.brightness = CASTOR3_BRIGHTNESS_DEFAULT;
|
|
||||||
ColorShift.colors.resize(8);
|
|
||||||
ColorShift.colors[0] = ToRGBColor(0xFF, 0x00, 0x00);
|
|
||||||
ColorShift.colors[1] = ToRGBColor(0xFF, 0x72, 0x00);
|
|
||||||
ColorShift.colors[2] = ToRGBColor(0xFF, 0xFF, 0x00);
|
|
||||||
ColorShift.colors[3] = ToRGBColor(0x00, 0xFF, 0x00);
|
|
||||||
ColorShift.colors[4] = ToRGBColor(0x00, 0xFF, 0xFF);
|
|
||||||
ColorShift.colors[5] = ToRGBColor(0x00, 0x00, 0xFF);
|
|
||||||
ColorShift.colors[6] = ToRGBColor(0xFF, 0x00, 0xFF);
|
|
||||||
ColorShift.colors[7] = ToRGBColor(0xFF, 0x80, 0x80);
|
|
||||||
modes.push_back(ColorShift);
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Wave — firmware colors, speed only |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
mode Wave;
|
|
||||||
Wave.name = "Wave";
|
|
||||||
Wave.value = CASTOR3_STYLE_WAVE;
|
|
||||||
Wave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
|
||||||
Wave.speed_min = CASTOR3_SPEED_MIN;
|
|
||||||
Wave.speed_max = CASTOR3_SPEED_MAX;
|
|
||||||
Wave.speed = CASTOR3_SPEED_DEFAULT;
|
|
||||||
Wave.color_mode = MODE_COLORS_NONE;
|
|
||||||
Wave.brightness_min = CASTOR3_BRIGHTNESS_MIN;
|
|
||||||
Wave.brightness_max = CASTOR3_BRIGHTNESS_MAX;
|
|
||||||
Wave.brightness = CASTOR3_BRIGHTNESS_DEFAULT;
|
|
||||||
modes.push_back(Wave);
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Rainbow — firmware colors, speed only |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
mode Rainbow;
|
|
||||||
Rainbow.name = "Rainbow";
|
|
||||||
Rainbow.value = CASTOR3_STYLE_RAINBOW;
|
|
||||||
Rainbow.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
|
||||||
Rainbow.speed_min = CASTOR3_SPEED_MIN;
|
|
||||||
Rainbow.speed_max = CASTOR3_SPEED_MAX;
|
|
||||||
Rainbow.speed = CASTOR3_SPEED_DEFAULT;
|
|
||||||
Rainbow.color_mode = MODE_COLORS_NONE;
|
|
||||||
Rainbow.brightness_min = CASTOR3_BRIGHTNESS_MIN;
|
|
||||||
Rainbow.brightness_max = CASTOR3_BRIGHTNESS_MAX;
|
|
||||||
Rainbow.brightness = CASTOR3_BRIGHTNESS_DEFAULT;
|
|
||||||
modes.push_back(Rainbow);
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Tri-Color — 3-color palette, speed + brightness |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
mode TriColor;
|
|
||||||
TriColor.name = "Tri-Color";
|
|
||||||
TriColor.value = CASTOR3_STYLE_TRICOLOR;
|
|
||||||
TriColor.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
|
||||||
TriColor.speed_min = CASTOR3_SPEED_MIN;
|
|
||||||
TriColor.speed_max = CASTOR3_SPEED_MAX;
|
|
||||||
TriColor.speed = CASTOR3_SPEED_DEFAULT;
|
|
||||||
TriColor.colors_min = 1;
|
|
||||||
TriColor.colors_max = 3;
|
|
||||||
TriColor.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
|
||||||
TriColor.brightness_min = CASTOR3_BRIGHTNESS_MIN;
|
|
||||||
TriColor.brightness_max = CASTOR3_BRIGHTNESS_MAX;
|
|
||||||
TriColor.brightness = CASTOR3_BRIGHTNESS_DEFAULT;
|
|
||||||
TriColor.colors.resize(3);
|
|
||||||
TriColor.colors[0] = ToRGBColor(0x00, 0x00, 0xFF);
|
|
||||||
TriColor.colors[1] = ToRGBColor(0x7D, 0x00, 0xFF);
|
|
||||||
TriColor.colors[2] = ToRGBColor(0xFF, 0x00, 0xFF);
|
|
||||||
modes.push_back(TriColor);
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Spin — 3-color palette, speed + brightness |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
mode Spin;
|
|
||||||
Spin.name = "Spin";
|
|
||||||
Spin.value = CASTOR3_STYLE_SPIN;
|
|
||||||
Spin.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
|
||||||
Spin.speed_min = CASTOR3_SPEED_MIN;
|
|
||||||
Spin.speed_max = CASTOR3_SPEED_MAX;
|
|
||||||
Spin.speed = CASTOR3_SPEED_DEFAULT;
|
|
||||||
Spin.colors_min = 1;
|
|
||||||
Spin.colors_max = 3;
|
|
||||||
Spin.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
|
||||||
Spin.brightness_min = CASTOR3_BRIGHTNESS_MIN;
|
|
||||||
Spin.brightness_max = CASTOR3_BRIGHTNESS_MAX;
|
|
||||||
Spin.brightness = CASTOR3_BRIGHTNESS_DEFAULT;
|
|
||||||
Spin.colors.resize(3);
|
|
||||||
Spin.colors[0] = ToRGBColor(0xFF, 0x00, 0xFE);
|
|
||||||
Spin.colors[1] = ToRGBColor(0x00, 0xFF, 0xFB);
|
|
||||||
Spin.colors[2] = ToRGBColor(0xFF, 0xFF, 0x00);
|
|
||||||
modes.push_back(Spin);
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Switch — 2-color palette, speed + brightness |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
mode Switch;
|
|
||||||
Switch.name = "Switch";
|
|
||||||
Switch.value = CASTOR3_STYLE_SWITCH;
|
|
||||||
Switch.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
|
||||||
Switch.speed_min = CASTOR3_SPEED_MIN;
|
|
||||||
Switch.speed_max = CASTOR3_SPEED_MAX;
|
|
||||||
Switch.speed = CASTOR3_SPEED_DEFAULT;
|
|
||||||
Switch.colors_min = 1;
|
|
||||||
Switch.colors_max = 2;
|
|
||||||
Switch.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
|
||||||
Switch.brightness_min = CASTOR3_BRIGHTNESS_MIN;
|
|
||||||
Switch.brightness_max = CASTOR3_BRIGHTNESS_MAX;
|
|
||||||
Switch.brightness = CASTOR3_BRIGHTNESS_DEFAULT;
|
|
||||||
Switch.colors.resize(2);
|
|
||||||
Switch.colors[0] = ToRGBColor(0xFF, 0x00, 0xFE);
|
|
||||||
Switch.colors[1] = ToRGBColor(0x00, 0xFF, 0xFB);
|
|
||||||
modes.push_back(Switch);
|
|
||||||
|
|
||||||
SetupZones();
|
|
||||||
}
|
|
||||||
|
|
||||||
RGBController_GigabyteCastor3::~RGBController_GigabyteCastor3()
|
|
||||||
{
|
|
||||||
Shutdown();
|
|
||||||
|
|
||||||
delete controller;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RGBController_GigabyteCastor3::SetupZones()
|
|
||||||
{
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Single zone: LED ring + fans (not independently |
|
|
||||||
| addressable — fans follow the pump ring effect) |
|
|
||||||
| |
|
|
||||||
| This is a SINGLE zone because the protocol does not |
|
|
||||||
| expose per-LED addressing. All LEDs display the same |
|
|
||||||
| hardware effect simultaneously. |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
zone led_ring;
|
|
||||||
led_ring.name = "LED Ring";
|
|
||||||
led_ring.type = ZONE_TYPE_SINGLE;
|
|
||||||
led_ring.leds_min = 1;
|
|
||||||
led_ring.leds_max = 1;
|
|
||||||
led_ring.leds_count = 1;
|
|
||||||
zones.push_back(led_ring);
|
|
||||||
|
|
||||||
led new_led;
|
|
||||||
new_led.name = "LED Ring";
|
|
||||||
leds.push_back(new_led);
|
|
||||||
|
|
||||||
SetupColors();
|
|
||||||
}
|
|
||||||
|
|
||||||
void RGBController_GigabyteCastor3::DeviceUpdateLEDs()
|
|
||||||
{
|
|
||||||
DeviceUpdateMode();
|
|
||||||
}
|
|
||||||
|
|
||||||
void RGBController_GigabyteCastor3::DeviceUpdateZoneLEDs(int /*zone*/)
|
|
||||||
{
|
|
||||||
DeviceUpdateLEDs();
|
|
||||||
}
|
|
||||||
|
|
||||||
void RGBController_GigabyteCastor3::DeviceUpdateSingleLED(int /*led*/)
|
|
||||||
{
|
|
||||||
DeviceUpdateLEDs();
|
|
||||||
}
|
|
||||||
|
|
||||||
void RGBController_GigabyteCastor3::DeviceUpdateMode()
|
|
||||||
{
|
|
||||||
unsigned char style = (unsigned char)modes[active_mode].value;
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Handle Off mode (sentinel value 0xFF) |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
if(style == 0xFF)
|
|
||||||
{
|
|
||||||
controller->SetOff();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Determine speed, brightness, b4, b5, and color type |
|
|
||||||
| from the effect lookup table matching castor3.py |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
unsigned char speed = CASTOR3_SPEED_DEFAULT;
|
|
||||||
unsigned char brightness = CASTOR3_BRIGHTNESS_DEFAULT;
|
|
||||||
|
|
||||||
if(modes[active_mode].flags & MODE_FLAG_HAS_SPEED)
|
|
||||||
{
|
|
||||||
speed = (unsigned char)modes[active_mode].speed;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(modes[active_mode].flags & MODE_FLAG_HAS_BRIGHTNESS)
|
|
||||||
{
|
|
||||||
brightness = (unsigned char)modes[active_mode].brightness;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
|
||||||
| Look up b4, b5, and color_type per effect |
|
|
||||||
| These match the LED_EFFECTS dict in castor3.py |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
unsigned char b4 = 0x02;
|
|
||||||
unsigned char b5 = 0x01;
|
|
||||||
castor3_color_type color_type = CASTOR3_COLORS_NONE;
|
|
||||||
|
|
||||||
switch(style)
|
|
||||||
{
|
|
||||||
case CASTOR3_STYLE_STATIC:
|
|
||||||
case CASTOR3_STYLE_PULSE:
|
|
||||||
case CASTOR3_STYLE_FLASH:
|
|
||||||
case CASTOR3_STYLE_DFLASH:
|
|
||||||
b4 = 0x02;
|
|
||||||
b5 = 0x01;
|
|
||||||
color_type = CASTOR3_COLORS_SINGLE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CASTOR3_STYLE_GRADIENT:
|
|
||||||
/*-------------------------------------------------*\
|
|
||||||
| Gradient: b4 = brightness on wire (special case) |
|
|
||||||
\*-------------------------------------------------*/
|
|
||||||
b4 = brightness;
|
|
||||||
b5 = 0x01;
|
|
||||||
color_type = CASTOR3_COLORS_SINGLE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CASTOR3_STYLE_CYCLE:
|
|
||||||
case CASTOR3_STYLE_WAVE:
|
|
||||||
case CASTOR3_STYLE_RAINBOW:
|
|
||||||
b4 = 0x02;
|
|
||||||
b5 = 0x01;
|
|
||||||
color_type = CASTOR3_COLORS_NONE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CASTOR3_STYLE_COLORSHIFT:
|
|
||||||
b4 = 0x08; /* ClrCount=8 */
|
|
||||||
b5 = 0x02; /* CmbIndex+1=2 */
|
|
||||||
color_type = CASTOR3_COLORS_PALETTE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CASTOR3_STYLE_TRICOLOR:
|
|
||||||
case CASTOR3_STYLE_SPIN:
|
|
||||||
b4 = 0x02;
|
|
||||||
b5 = 0x01;
|
|
||||||
color_type = CASTOR3_COLORS_PALETTE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CASTOR3_STYLE_SWITCH:
|
|
||||||
b4 = 0x02;
|
|
||||||
b5 = 0x01;
|
|
||||||
color_type = CASTOR3_COLORS_PALETTE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
controller->SetEffect(style, speed, brightness, b4, b5,
|
|
||||||
color_type, modes[active_mode].colors);
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
/*---------------------------------------------------------*\
|
|
||||||
| RGBController_GigabyteCastor3.h |
|
|
||||||
| |
|
|
||||||
| RGBController for Gigabyte Aorus Waterforce X II 360 |
|
|
||||||
| AIO Cooler (Castor3 controller) |
|
|
||||||
| |
|
|
||||||
| This file is part of the OpenRGB project |
|
|
||||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
|
||||||
\*---------------------------------------------------------*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "RGBController.h"
|
|
||||||
#include "GigabyteCastor3Controller.h"
|
|
||||||
|
|
||||||
class RGBController_GigabyteCastor3 : public RGBController
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
RGBController_GigabyteCastor3(GigabyteCastor3Controller* controller_ptr);
|
|
||||||
~RGBController_GigabyteCastor3();
|
|
||||||
|
|
||||||
void SetupZones();
|
|
||||||
|
|
||||||
void DeviceUpdateLEDs();
|
|
||||||
void DeviceUpdateZoneLEDs(int zone);
|
|
||||||
void DeviceUpdateSingleLED(int led);
|
|
||||||
|
|
||||||
void DeviceUpdateMode();
|
|
||||||
|
|
||||||
private:
|
|
||||||
GigabyteCastor3Controller* controller;
|
|
||||||
};
|
|
||||||
+2
-17
@@ -68,14 +68,9 @@ void RGBFusion2BlackwellGPUController::SetMode(uint8_t type, uint8_t zone, uint8
|
|||||||
if(zone_config.numberOfColors > 0)
|
if(zone_config.numberOfColors > 0)
|
||||||
{
|
{
|
||||||
int currentPos = 12;
|
int currentPos = 12;
|
||||||
switch(gpu_layout)
|
if(gpu_layout == RGB_FUSION2_BLACKWELL_GPU_AORUS_MASTER_5080_LAYOUT)
|
||||||
{
|
{
|
||||||
case RGB_FUSION2_BLACKWELL_GPU_AORUS_MASTER_5080_LAYOUT:
|
currentPos = 11;
|
||||||
case RGB_FUSION2_BLACKWELL_GPU_AORUS_MASTER_5090D_V2_ICE_LAYOUT:
|
|
||||||
currentPos = 11;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for(uint8_t i = 0; i < zone_config.numberOfColors; i++)
|
for(uint8_t i = 0; i < zone_config.numberOfColors; i++)
|
||||||
@@ -95,16 +90,6 @@ void RGBFusion2BlackwellGPUController::SetZone(uint8_t zone, uint8_t mode, fusio
|
|||||||
if(mode == RGB_FUSION2_BLACKWELL_GPU_MODE_BREATHING)
|
if(mode == RGB_FUSION2_BLACKWELL_GPU_MODE_BREATHING)
|
||||||
zone_config.brightness = RGB_FUSION2_BLACKWELL_GPU_BRIGHTNESS_MAX;
|
zone_config.brightness = RGB_FUSION2_BLACKWELL_GPU_BRIGHTNESS_MAX;
|
||||||
|
|
||||||
switch(gpu_layout)
|
|
||||||
{
|
|
||||||
case RGB_FUSION2_BLACKWELL_GPU_AORUS_MASTER_5090D_V2_ICE_LAYOUT:
|
|
||||||
if(mode == RGB_FUSION2_BLACKWELL_GPU_MODE_DIRECT)
|
|
||||||
mode = RGB_FUSION2_BLACKWELL_GPU_MODE_STATIC;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t type = RGB_FUSION2_BLACKWELL_GPU_REG_COLOR;
|
uint8_t type = RGB_FUSION2_BLACKWELL_GPU_REG_COLOR;
|
||||||
if(mode != RGB_FUSION2_BLACKWELL_GPU_MODE_DIRECT)
|
if(mode != RGB_FUSION2_BLACKWELL_GPU_MODE_DIRECT)
|
||||||
type = RGB_FUSION2_BLACKWELL_GPU_REG_MODE;
|
type = RGB_FUSION2_BLACKWELL_GPU_REG_MODE;
|
||||||
|
|||||||
+5
-6
@@ -62,12 +62,11 @@ enum
|
|||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
RGB_FUSION2_BLACKWELL_GPU_SINGLE_ZONE = 0,
|
RGB_FUSION2_BLACKWELL_GPU_SINGLE_ZONE = 0,
|
||||||
RGB_FUSION2_BLACKWELL_GPU_GAMING_LAYOUT = 1,
|
RGB_FUSION2_BLACKWELL_GPU_GAMING_LAYOUT = 1,
|
||||||
RGB_FUSION2_BLACKWELL_GPU_WATERFORCE_LAYOUT = 2,
|
RGB_FUSION2_BLACKWELL_GPU_WATERFORCE_LAYOUT = 2,
|
||||||
RGB_FUSION2_BLACKWELL_GPU_AORUS_WATERFORCE_LAYOUT = 3,
|
RGB_FUSION2_BLACKWELL_GPU_AORUS_WATERFORCE_LAYOUT = 3,
|
||||||
RGB_FUSION2_BLACKWELL_GPU_AORUS_MASTER_5080_LAYOUT = 4,
|
RGB_FUSION2_BLACKWELL_GPU_AORUS_MASTER_5080_LAYOUT = 4,
|
||||||
RGB_FUSION2_BLACKWELL_GPU_AORUS_MASTER_5090D_V2_ICE_LAYOUT = 5,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class RGBFusion2BlackwellGPUController
|
class RGBFusion2BlackwellGPUController
|
||||||
|
|||||||
Loaded 100 of 287 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user