Compare commits

..
Author SHA1 Message Date
Adam Honse b86be6b75d Use RGBControllerInterface for plugin API 2026-05-23 15:17:05 -05:00
Adam Honse c11090a4cf Add another thread in NetworkClient for handling ProfileManager requests outside of the main listener thread, to avoid deadlocking the waiting receivers 2026-05-20 08:13:17 -05:00
Adam Honse a69390e5a8 Update translation files and fix some translation related issues 2026-05-14 23:21:10 -05:00
Adam Honse a900d5c402 NetworkClient cleanup and internal API standardization 2026-05-14 17:26:12 -05:00
Adam Honse f870dcdc3a NetworkServer cleanup and internal API standardization 2026-05-14 17:26:12 -05:00
Adam Honse 9a105ccdaf Add indication of standalone or local client mode to about page 2026-05-14 17:26:12 -05:00
Adam Honse 1faa2b1d31 Implement network request to get list of I2C buses so that the Get Hardware IDs dialog works in local client mode 2026-05-14 17:26:12 -05:00
Adam Honse 91923f3a82 Add option to force compact tabs and option to move tabs from left to top 2026-05-14 17:26:12 -05:00
Adam Honse fcb594cb0e More LogManager cleanup, default to a log file count of 10, fix bug in log rotation 2026-05-14 17:26:12 -05:00
Adam Honse 32f0f1a9a2 Log manager SDK protocol 2026-05-14 17:26:12 -05:00
Adam Honse 4d379b97c6 Log Console Updates 2026-05-14 17:26:12 -05:00
Adam Honse a3e5296bf2 LogManager cleanup 2026-05-14 17:26:12 -05:00
Adam Honse 072d27d9dd Settings Rework
* Add JSON string configuration field to RGBController to store device-specific configurations
    * This JSON string holds both configuration and schema
    * Add settings schema tracking to SettingsManager
    * Implement dynamic settings widget that generates a settings UI based on a JSON schema
    * Implement SettingsManager callback for notifying of settings changes and settings schema updates
    * Always enable Entire Device zone option and use it to enable Edit Device
    * Rename SaveSizes to SaveConfiguration in ProfileManager and Sizes.json to Configuration.json
    * Add zone flag for indicating that a zone's geometry may change, informing profile manager to ignore this check
    * Remove Theme setting and Theme Manager, as this didn't work on most setups anyways and Qt6 has proper Windows dark theming
2026-05-14 17:25:35 -05:00
Dmitry Kychanov 201f2d7aba Fix losing software info upon changing language [next] 2026-05-07 17:24:47 -05:00
Dmitry Kychanov 28cd45b8c0 Fix device tabs not applying compact mode when hotplugging 2026-05-07 17:24:46 -05:00
Adam Honse 7a9aab5a37 Close SDK connection if magic value is not correctly received 2026-05-07 17:24:46 -05:00
Adam Honse 24ea50df71 Implement size verification on RGBController set description functions 2026-05-07 17:24:46 -05:00
Adam Honse 75df39252b Clean up zone initialization dialog 2026-05-07 17:24:46 -05:00
Adam Honse 385f123816 Require local client permission for DeleteProfile, SaveProfile, UploadProfile, SetSettings, and SaveSettings operations, some general cleanup 2026-05-07 17:24:46 -05:00
Adam Honse e1fc54de85 Sanitize profile filenames 2026-05-07 17:24:46 -05:00
Adam Honse e22e88d97d Add RescanDevices to plugin API 2026-05-07 17:24:46 -05:00
Adam Honse 0ba254e38f Implement segment groups in zone editor 2026-05-07 17:24:46 -05:00
Adam Honse 9d35d28a6a Rework server initialization
* Only create server instance if server is actually needed
    * Pass initial server host and port through ResourceManager
    * Allow setting default server host and port in Server settings
2026-05-07 17:24:46 -05:00
stephen iacovelli b4b4f3b891 Sort profiles list alphabetically 2026-05-07 17:24:46 -05:00
Adam Honse e1086712ad Organize OpenRGBSettingsPage with Group Boxes 2026-05-07 17:24:46 -05:00
Kasslim fd7ccad1e6 Correct spelling Busses -> Buses
Commits merged by Adam Honse <[email protected]>
2026-05-07 17:24:46 -05:00
诺诺 8bc1a0cb8f Add Nollie controller OS2.1 2026-05-07 17:24:46 -05:00
Adam Honse 5112224240 Initial implementation of OpenRGB SDK protocol Wireshark dissector 2026-05-07 17:24:46 -05:00
Adam Honse 5e2cc42290 Add ACK to network packets processed by NetworkServer 2026-05-07 17:24:46 -05:00
Adam Honse b1436a8435 Only update device view when RGBController::UpdateLEDs signal is sent to OpenRGBDevicePage, fix device view not refreshing if multiple LEDs are selected 2026-05-07 17:24:46 -05:00
Adam Honse a8d4e25642 Don't emit selection update on mouse click event to avoid sending unnecessary events, also only send one type of event per mouse release event. Fix LED box not being updated 2026-05-07 17:24:46 -05:00
Adam Honse 2b3638ba57 Have dummy controller shut down its background thread immediately during constructor to save resources 2026-05-07 17:24:46 -05:00
Adam Honse 78369c2a92 DeviceView code cleanup, formatting, commenting 2026-05-07 17:24:46 -05:00
Adam Honse 03ce513254 Fix selecting LEDs in device view 2026-05-07 17:24:46 -05:00
Adam Honse 18503cccc6 TabLabel sets its own tooltip so all tabs have a tooltip rather than just devices 2026-05-07 17:24:46 -05:00
Adam Honse e1d46d3bb3 Resize tabs when width is small 2026-05-07 17:24:46 -05:00
Adam Honse 0466996970 Rework adding segments with ConfigureZone 2026-05-07 17:24:46 -05:00
Adam Honse 56bd7580ba Zone and Segment type updates
* Add zone flags to indicate if fields are manually configurable and if they have been manually configured
  * Add flags field to segment type
  * Add segment flags for group start and group member
  * Add color mode support flags to zone (RGB, RBG, GRB, GBR, BRG, BGR)
  * Add color mode enum to zone
  * Update zone and segment description functions to support new fields
  * Rename the effects-only configurable size flag
  * Remove zone type and matrix map configuration from E1.31 manual configuration, use zone editor instead
  * Rework DeviceResizeZone to DeviceConfigureZone
  * Rework most ARGB controllers to allow zone customizations
  * Rework DRGBController to define devices in DRGBDevices list (similar to RazerDevices)
  * Rework NollieController to define devices in NollieDevices list (similar to RazerDevices)
2026-05-07 17:24:46 -05:00
Adam Honse ca47047bf8 Add matrix map automatic generation to matrix map editor 2026-05-07 17:24:46 -05:00
Adam Honse cc00690dd4 RGBController API changes and segment configuration updates
* Make the Get/Set RGBControler descriptor functions static
  * Add functions for getting the matrix_map_type for zone and segment matrix maps
  * Rename zone resize dialog to zone editor dialog
  * Add additional segment types
  * Add option to import segments configuration from JSON file in zone editor dialog
  * Update device view to be able to display matrix segment types
  * Add matrix map editor dialog for creating/editing segment matrix maps
  * Add option to export segments configuration to JSON file in zone editor dialog
2026-05-07 17:24:46 -05:00
Adam Honse 973311aa48 When updating existing profile without profile editor dialog, keep saved states for unavailable controllers, base color, and only update plugins already part of the existing profile 2026-05-07 17:24:46 -05:00
Adam Honse 747afdf553 When saving sizes/manual configuration, keep any existing controllers that are not currently available 2026-05-07 17:24:46 -05:00
Adam Honse 8f11f8fd97 Rework how manual configuration (previously sizes) are loaded to newly detected controllers, load active profile to newly detected controllers 2026-05-07 17:24:45 -05:00
Adam Honse 2b11f6fe07 Profile editor dialog 2026-05-07 17:24:45 -05:00
Adam Honse 94981f107b Rework API interface passed into plugins from ResourceManagerInterface to OpenRGBPluginAPIInterface 2026-05-07 17:24:45 -05:00
Adam Honse 0144a6a150 [next] Active profile tracking 2026-05-07 17:24:45 -05:00
Adam Honse 6ec8b80e65 Apply profiles server-side rather than client-side, signal active profile update, forward loaded profile to local client for plugins 2026-05-07 17:24:45 -05:00
Adam Honse ddae1ed20a Split HID and wrapped HID detector lists into specific detectors (with exact VID/PID matching) and generic detectors (with only IPU matching) and prioritize specific detectors when detecting HID devices 2026-05-07 17:24:45 -05:00
Adam Honse 70f79e97b4 Move RGBController base destructor functionality into RGBController::Shutdown() so that update thread can be stopped before deleting the controller. Shutdown() must be called in every RGBController implementation before deleting the controller. Also some fixes to the NetworkServer to avoid deadlocking and disconnect issues 2026-05-07 17:24:45 -05:00
Adam Honse d05fe1bdf1 Add detectors for filtering on IPU only (no VID/PID) 2026-05-07 17:24:45 -05:00
Adam Honse e9e99a029d Drop support for old hidapi versions that don't support usage information 2026-05-07 17:24:45 -05:00
Adam Honse 98dd494f75 Add some validity checks to mode setters and getters in RGBController 2026-05-07 17:24:45 -05:00
Adam Honse 7b7f0aa0fe [next] SDK v6: Implement client and server flags to indicate capabilities and... 2026-05-07 17:24:45 -05:00
Adam Honse 70876193cf SDK documentation updates 2026-05-07 17:24:45 -05:00
Adam Honse f47a22fb2f Expose LogManager in ResourceManager so that plugins can use it 2026-05-07 17:24:45 -05:00
Adam Honse f24b56b64f Update NetworkClient to use log manager and use common name constant in server logs 2026-05-07 17:24:45 -05:00
Adam Honse 4e70949aec Use std::string.assign when setting strings in the SDK protocol and description handlers so that string size limit is enforced, then strip out null terminators 2026-05-07 17:24:45 -05:00
Adam Honse 5133887632 Add optional HID device hotplug support (requires https://gitlab.com/OpenRGBDevelopers/hidapi-hotplug) 2026-05-07 17:24:45 -05:00
Adam Honse 45950047cb SDK v6: Use unique IDs for identifying RGBControllers in SDK protocol 2026-05-07 17:24:45 -05:00
Adam Honse a56a08411f Rework list handling in ResourceManager by having NetworkClient own its own list rather than sharing ResourceManager's list 2026-05-07 17:24:45 -05:00
Adam Honse 52f0049025 Move HID detector calls to RunHIDDetector/RunHIDWrappedDetector functions and return controller list from detector functions 2026-05-07 17:24:45 -05:00
Adam Honse f6f317d487 Detection progress SDK integration, NetworkClient callback rework 2026-05-07 17:24:45 -05:00
Adam Honse ad364871c6 Split out detection system from ResourceManager into DetectionManager
* Split detection system out into its own class, DetectionManager
    * Clean up ResourceManger's many callbacks into just two, one for detection and one general purpose
2026-05-07 17:24:45 -05:00
Adam Honse 58582202cf SDK Version 6 Updates
* SDK Protocol
    * Server sends its name to client
    * ProfileManager
      * Rename existing profile commands
      * Add Upload Profile, Download Profile, and Get Active Profile commands
    * SettingsManager
      * Add Get, Set, and Save Settings commands
    * Add zone::active_mode, zone::mode fields for zone-specific modes
    * Add NET_PACKET_ID_RGBCONTROLLER_UPDATEZONEMODE packet for updating zone modes
    * Add segment::matrix_map to segment packet
    * Add NET_PACKET_ID_RGBCONTROLLER_SIGNALUPDATE packet for passing SignalUpdate signal from server to clients
  * NetworkServer
    * Formatting cleanup
    * Use per-controller threads for handling NetworkServer controller-specific packets to avoid delays from controller mutexes
  * NetworkClient
    * Formatting cleanup
  * RGBController
    * Clean up and modularize descriptor functions
2026-05-07 17:24:44 -05:00
Adam Honse 57cde755c1 Rework Profiles to use JSON format
* Update OpenRGB Plugin Interface to include functions for loading/saving profile JSON data into OpenRGB profiles
    * Update ProfileManager to handle auto-load profiles (Exit, Open, Resume, Suspend) and move their settings to ProfileManager section
    * Update ProfileManager to store profiles in "profiles" folder in .json format
    * Update ProfileManager to store size profile in sizes.json
    * Update ProfileManager to perform device UpdateMode/UpdateColors when loading profile
    * Code cleanup of ProfileManager and profile-related code
2026-05-07 17:24:44 -05:00
Adam Honse b0c7dba441 RGBController API Overhaul
* Reorganize and clean up RGBController API functions
    * Add functions to get protected RGBController member values
    * Make NetworkClient, ProfileManager, and ResourceManager friend classes so they can access protected members
    * Protected previously-public RGBController members
        * Information strings (name, vendor, description, version, serial location)
        * Device type
        * Active mode
        * Flags
        * LEDs vector
        * LED alternate names vector
        * Modes vector
        * Colors vector
        * Zones vector
    * Add CONTROLLER_FLAG_HIDDEN to allow plugins to hide controllers from control GUI
    * Add update reason codes to RGBController update callback and signal updates on more RGBController events
    * Add loop zone types and segmented zone type
    * Add matrix map field to segments
    * Rework matrix_map_type from using pointers to vector to prevent memory leaks
    * Rework KeyboardLayoutManager to return new matrix_map_type
    * Add access mutex to RGBController API
    * Add per-zone modes ot RGBController API
    * Add JSON description functions to RGBController API
2026-05-07 17:24:44 -05:00
Adam Honse d763f7ecc7 Move plugin SDK integration from callback into plugin API and PluginManager 2026-05-07 17:24:44 -05:00
Adam Honse 4ec4df8741 Update Plugin API to 5 and SDK Protocol to 6 2026-05-07 17:24:44 -05:00
Adam Honse 5d055d30a3 Update default builds to Qt6
* Update Debian packages to use Qt6
  * Update Fedora packages to use Qt6
  * Update default AppImage builds to use Qt6
  * Update default Windows builds to use Qt6
  * Update default MacOS builds to use Qt6
2026-05-07 17:24:44 -05:00
Adam Honse fc73fe0b4c Revert "Nollie 2.1 firmware for Master"
This reverts commit 07e7feca56.
2026-05-07 17:24:44 -05:00
170 changed files with 1253 additions and 5621 deletions
@@ -205,6 +205,7 @@ void RGBController_BloodyB820R::SetupZones()
{
led new_led;
new_led.name = led_names[led_index];
new_led.value = led_index;
leds.push_back(new_led);
}
@@ -67,13 +67,13 @@ void BloodyMouseController::InitDevice()
hid_send_feature_report(dev, buffer, BLOODYMOUSE_WRITE_PACKET_SIZE);
}
void BloodyMouseController::SetLedsDirect(std::vector<RGBColor> colors, std::vector<uint8_t> offsets)
void BloodyMouseController::SetLedsDirect(std::vector<RGBColor> colors)
{
uint8_t buffer[BLOODYMOUSE_WRITE_PACKET_SIZE] = { 0x07, 0x03, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00 };
for(uint8_t i = 0; i < colors.size(); i++)
{
uint8_t offset = 3 * (offsets[i]) + BLOODYMOUSE_DATA_BYTE;
uint8_t offset = 3 * (colors[i] >> 24) + BLOODYMOUSE_DATA_BYTE;
buffer[offset] = RGBGetRValue(colors[i]);
buffer[offset + 1] = RGBGetGValue(colors[i]);
@@ -58,7 +58,7 @@ public:
std::string GetLocation();
std::string GetName();
void SetLedsDirect(std::vector<RGBColor> colors, std::vector<uint8_t> offsets);
void SetLedsDirect(std::vector<RGBColor> colors);
private:
uint16_t pid;
@@ -142,7 +142,7 @@ void RGBController_BloodyMouse::SetupZones()
{
led new_led;
offsets.push_back(mz.zone_leds[lp_idx]);
new_led.value = mz.zone_leds[lp_idx];
if(bool_single)
{
@@ -163,7 +163,14 @@ void RGBController_BloodyMouse::SetupZones()
void RGBController_BloodyMouse::DeviceUpdateLEDs()
{
controller->SetLedsDirect(colors, offsets);
std::vector<RGBColor> colour;
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*/)
@@ -39,5 +39,4 @@ public:
private:
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));
}
void AMBXController::SetLEDColors(const unsigned int* leds, RGBColor* colors, unsigned int count)
void AMBXController::SetLEDColors(unsigned int* leds, RGBColor* colors, unsigned int count)
{
for(unsigned int i = 0; i < count; i++)
{
+1 -1
View File
@@ -44,7 +44,7 @@ public:
bool IsInitialized();
void SetLEDColor(unsigned int led, RGBColor color);
void SetLEDColors(const unsigned int* leds, RGBColor* colors, unsigned int count);
void SetLEDColors(unsigned int* leds, RGBColor* colors, unsigned int count);
private:
libusb_context* usb_context;
@@ -9,15 +9,6 @@
#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
@category Accessory
@@ -80,22 +71,27 @@ void RGBController_AMBX::SetupZones()
// Set up LEDs
led left_light;
left_light.name = "Left";
left_light.value = AMBX_LIGHT_LEFT;
leds.push_back(left_light);
led right_light;
right_light.name = "Right";
right_light.value = AMBX_LIGHT_RIGHT;
leds.push_back(right_light);
led wall_left;
wall_left.name = "Wall Left";
wall_left.value = AMBX_LIGHT_WALL_LEFT;
leds.push_back(wall_left);
led wall_center;
wall_center.name = "Wall Center";
wall_center.value = AMBX_LIGHT_WALL_CENTER;
leds.push_back(wall_center);
led wall_right;
wall_right.name = "Wall Right";
wall_right.value = AMBX_LIGHT_WALL_RIGHT;
leds.push_back(wall_right);
SetupColors();
@@ -108,7 +104,16 @@ void RGBController_AMBX::DeviceUpdateLEDs()
return;
}
controller->SetLEDColors(led_values, colors.data(), static_cast<unsigned int>(colors.size()));
unsigned int led_values[5];
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)
@@ -133,17 +138,17 @@ void RGBController_AMBX::DeviceUpdateZoneLEDs(int zone)
start_idx += zones[z_idx].leds_count;
}
unsigned int tmp_values[5];
RGBColor tmp_colors[5];
unsigned int led_values[5];
RGBColor led_colors[5];
for(unsigned int led_idx = 0; led_idx < zone_size; led_idx++)
{
unsigned int current_idx = start_idx + led_idx;
tmp_values[led_idx] = led_values[current_idx];
tmp_colors[led_idx] = colors[current_idx];
led_values[led_idx] = leds[current_idx].value;
led_colors[led_idx] = colors[current_idx];
}
controller->SetLEDColors(tmp_values, tmp_colors, zone_size);
controller->SetLEDColors(led_values, led_colors, zone_size);
}
void RGBController_AMBX::DeviceUpdateSingleLED(int led)
@@ -153,7 +158,7 @@ void RGBController_AMBX::DeviceUpdateSingleLED(int led)
return;
}
unsigned int led_value = led_values[led];
unsigned int led_value = leds[led].value;
RGBColor color = colors[led];
controller->SetLEDColor(led_value, color);
}
@@ -11,33 +11,6 @@
#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
@category Cooler
@@ -166,6 +139,14 @@ RGBController_AMDWraithPrism::~RGBController_AMDWraithPrism()
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 |
\*-----------------------------------------------------*/
@@ -200,6 +181,7 @@ void RGBController_AMDWraithPrism::SetupZones()
{
led logo_led;
logo_led.name = "Logo LED";
logo_led.value = logo_leds[led_idx];
leds.push_back(logo_led);
}
@@ -207,6 +189,7 @@ void RGBController_AMDWraithPrism::SetupZones()
{
led fan_led;
fan_led.name = "Fan LED";
fan_led.value = fan_leds[led_idx];
leds.push_back(fan_led);
}
@@ -214,6 +197,7 @@ void RGBController_AMDWraithPrism::SetupZones()
{
led ring_led;
ring_led.name = "Ring LED";
ring_led.value = ring_leds[led_idx];
leds.push_back(ring_led);
}
@@ -234,7 +218,7 @@ void RGBController_AMDWraithPrism::DeviceUpdateLEDs()
leds_count = 0;
for(std::size_t led_idx = 0; led_idx < 2; led_idx++)
{
led_ids[leds_count] = led_values[led_idx];
led_ids[leds_count] = (unsigned char)leds[led_idx].value;
color_buf[leds_count] = colors[led_idx];
leds_count++;
@@ -247,7 +231,7 @@ void RGBController_AMDWraithPrism::DeviceUpdateLEDs()
leds_count = 0;
for(std::size_t led_idx = 0; led_idx < ( colors.size() - 2 ); led_idx++)
{
led_ids[leds_count] = led_values[led_idx + 2];
led_ids[leds_count] = (unsigned char)leds[led_idx + 2].value;
color_buf[leds_count] = colors[led_idx + 2];
leds_count++;
@@ -286,7 +286,7 @@ void RGBController_AOCKeyboard::SetupZones()
led new_led;
new_led.name = new_kb.GetKeyNameAt(led_idx);
led_values.push_back(new_kb.GetKeyValueAt(led_idx));
new_led.value = new_kb.GetKeyValueAt(led_idx);
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++)
{
color_buf[led_values[led_idx]] = colors[led_idx];
color_buf[leds[led_idx].value] = colors[led_idx];
}
controller->SetCustom(&color_buf[0]);
@@ -29,6 +29,5 @@ public:
void DeviceUpdateMode();
private:
AOCKeyboardController* controller;
std::vector<unsigned int> led_values;
AOCKeyboardController* controller;
};
@@ -269,9 +269,9 @@ void RGBController_PolychromeUSB::SetupZones()
new_led.name = zones[channel_idx].name;
new_led.name.append(", LED ");
new_led.name.append(std::to_string(led_ch_idx + 1));
new_led.value = channel_idx;
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++)
{
unsigned char led = (unsigned char)led_values[led_idx];
unsigned char led = (unsigned char)leds[led_idx].value;
colors[led_idx] = zones_info[led].color;
}
@@ -359,7 +359,7 @@ void RGBController_PolychromeUSB::DeviceUpdateZoneLEDs(int zone)
void RGBController_PolychromeUSB::DeviceUpdateSingleLED(int led)
{
unsigned int channel = led_values[led];
unsigned int channel = leds[led].value;
unsigned char set_mode = zones_info[channel].mode;
if(set_mode > modes.size())
@@ -33,7 +33,6 @@ public:
private:
PolychromeUSBController* controller;
std::vector<unsigned int> led_values;
std::vector<PolychromeZoneInfo> zones_info;
unsigned char GetDeviceMode(unsigned char zone);
@@ -158,11 +158,6 @@ void RGBController_ASRockASRRGBSMBus::SetupZones()
\*---------------------------------------------------------*/
leds.push_back(*new_led);
/*---------------------------------------------------------*\
| Initialize led_values vector |
\*---------------------------------------------------------*/
led_values.push_back(0);
SetupColors();
}
@@ -189,9 +184,9 @@ void RGBController_ASRockASRRGBSMBus::DeviceUpdateSingleLED(int led)
| If the LED value is non-zero, this LED overrides the LED |
| index |
\*---------------------------------------------------------*/
if(led_values[led] != 0)
if(leds[led].value != 0)
{
led = led_values[led];
led = leds[led].value;
}
controller->SetColorsAndSpeed(led, red, grn, blu);
@@ -30,5 +30,4 @@ public:
private:
ASRockASRRGBSMBusController* controller;
std::vector<unsigned int> led_values;
};
@@ -285,13 +285,13 @@ void RGBController_ASRockPolychromeV1SMBus::SetupZones()
led* new_led = new led();
new_led->name = polychrome_v1_zone_names[zone_idx];
new_led->value = zone_idx;
/*---------------------------------------------------------*\
| Push new LED to LEDs vector |
\*---------------------------------------------------------*/
leds.push_back(*new_led);
zoneIndexMap.push_back(zone_idx);
led_values.push_back(zone_idx);
}
}
@@ -32,9 +32,7 @@ public:
void DeviceUpdateMode();
private:
ASRockPolychromeV1SMBusController* controller;
std::vector<unsigned int> led_values;
std::vector<uint8_t> zoneIndexMap;
uint8_t getModeIndex(uint8_t mode_value);
ASRockPolychromeV1SMBusController* controller;
uint8_t getModeIndex(uint8_t mode_value);
std::vector<uint8_t> zoneIndexMap;
};
@@ -256,14 +256,11 @@ void RGBController_ASRockPolychromeV2SMBus::SetupZones()
new_led->name = polychrome_v2_zone_names[zone_idx];
new_led->name.append(" " + std::to_string(led_idx + 1));
new_led->value = 0;
if(zone_idx == POLYCHROME_V2_ZONE_ADDRESSABLE)
{
led_values.push_back(0x19);
}
else
{
led_values.push_back(0);
new_led->value = 0x19;
}
/*---------------------------------------------------------*\
@@ -314,9 +311,9 @@ void RGBController_ASRockPolychromeV2SMBus::DeviceUpdateSingleLED(int led)
| If the LED value is non-zero, this LED overrides the LED |
| index |
\*---------------------------------------------------------*/
if(led_values[led] != 0)
if(leds[led].value != 0)
{
led = led_values[led];
led = leds[led].value;
}
controller->SetColorsAndSpeed(led, red, grn, blu);
@@ -32,6 +32,5 @@ public:
void DeviceUpdateMode();
private:
ASRockPolychromeV2SMBusController* controller;
std::vector<unsigned int> led_values;
ASRockPolychromeV2SMBusController* controller;
};
@@ -313,7 +313,7 @@ void RGBController_AlienwareAW410K::SetupZones()
{
led new_led;
new_led.name = led_names[led_idx].name;
led_values.push_back(led_names[led_idx].idx);
new_led.value = led_names[led_idx].idx;
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++)
{
SelectedButtons key;
SelectedButtons key;
key.idx = led_values[led_idx];
key.red = RGBGetRValue(colors[led_idx]);
key.green = RGBGetGValue(colors[led_idx]);
key.blue = RGBGetBValue(colors[led_idx]);
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);
frame_buf_keys.push_back(key);
}
controller->SendInitialize();
@@ -358,7 +358,7 @@ void RGBController_AlienwareAW410K::DeviceUpdateZoneLEDs(int zone)
void RGBController_AlienwareAW410K::DeviceUpdateSingleLED(int led)
{
controller->DeviceUpdateSingleLED(led_values[led], RGBGetRValue(colors[led]), RGBGetGValue(colors[led]), RGBGetBValue(colors[led]));
controller->DeviceUpdateSingleLED(leds[led].value, RGBGetRValue(colors[led]), RGBGetGValue(colors[led]), RGBGetBValue(colors[led]));
}
void RGBController_AlienwareAW410K::DeviceUpdateMode()
@@ -32,5 +32,4 @@ public:
private:
AlienwareAW410KController* controller;
std::vector<RGBColor> current_colors;
std::vector<unsigned char> led_values;
};
@@ -312,7 +312,7 @@ void RGBController_AlienwareAW510K::SetupZones()
{
led new_led;
new_led.name = led_names[led_idx].name;
led_values.push_back(led_names[led_idx].idx);
new_led.value = led_names[led_idx].idx;
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++)
{
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 |
@@ -336,14 +336,28 @@ void RGBController_AlienwareAW510K::DeviceUpdateLEDs()
continue;
}
SelectedKeys key;
if(RGBGetRValue(colors[led_idx]) != 0x00 || RGBGetBValue(colors[led_idx]) != 0x00 || RGBGetBValue(colors[led_idx]) != 0x00)
{
SelectedKeys key;
key.idx = led_values[led_idx];
key.red = RGBGetRValue(colors[led_idx]);
key.green = RGBGetGValue(colors[led_idx]);
key.blue = RGBGetBValue(colors[led_idx]);
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);
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();
@@ -365,7 +379,7 @@ void RGBController_AlienwareAW510K::DeviceUpdateZoneLEDs(int zone)
void RGBController_AlienwareAW510K::DeviceUpdateSingleLED(int led)
{
controller->DeviceUpdateSingleLED(led_values[led], RGBGetRValue(colors[led]), RGBGetGValue(colors[led]), RGBGetBValue(colors[led]));
controller->DeviceUpdateSingleLED(leds[led].value, RGBGetRValue(colors[led]), RGBGetGValue(colors[led]), RGBGetBValue(colors[led]));
}
void RGBController_AlienwareAW510K::DeviceUpdateMode()
@@ -31,5 +31,4 @@ public:
private:
AlienwareAW510KController* controller;
std::vector<RGBColor> current_colors;
std::vector<unsigned char> led_values;
};
@@ -11,13 +11,6 @@
#include "RGBController_AlienwareAW3423DWF.h"
static const unsigned char led_values[] =
{
0x01,
0x02,
0x08
};
/**------------------------------------------------------------------*\
@name AW3423DWF
@category Accessory
@@ -70,6 +63,7 @@ void RGBController_AlienwareAW3423DWF::SetupZones()
led Logo_LED;
Logo_LED.name = "Logo";
Logo_LED.value = 0x01;
leds.push_back(Logo_LED);
zone Number;
@@ -82,6 +76,7 @@ void RGBController_AlienwareAW3423DWF::SetupZones()
led Number_LED;
Number_LED.name = "Number";
Number_LED.value = 0x02;
leds.push_back(Number_LED);
zone PowerButton;
@@ -94,6 +89,7 @@ void RGBController_AlienwareAW3423DWF::SetupZones()
led PowerButton_LED;
PowerButton_LED.name = "Power Button";
PowerButton_LED.value = 0x08;
leds.push_back(PowerButton_LED);
SetupColors();
@@ -132,7 +128,7 @@ void RGBController_AlienwareAW3423DWF::DeviceUpdateSingleLED(int led)
unsigned char red = RGBGetRValue(colors[led]);
unsigned char grn = RGBGetGValue(colors[led]);
unsigned char blu = RGBGetBValue(colors[led]);
controller->SendColor(led_values[led], red, grn, blu);
controller->SendColor(leds[led].value, red, grn, blu);
}
void RGBController_AlienwareAW3423DWF::DeviceUpdateMode()
@@ -11,13 +11,6 @@
#include "RGBController_AlienwareMonitor.h"
static const unsigned char led_values[] =
{
0x01,
0x02,
0x08
};
/**------------------------------------------------------------------*\
@name Alienware Monitor
@category Accessory
@@ -70,6 +63,7 @@ void RGBController_AlienwareMonitor::SetupZones()
led Logo_LED;
Logo_LED.name = "Logo";
Logo_LED.value = 0x01;
leds.push_back(Logo_LED);
zone Number;
@@ -82,6 +76,7 @@ void RGBController_AlienwareMonitor::SetupZones()
led Number_LED;
Number_LED.name = "Number";
Number_LED.value = 0x02;
leds.push_back(Number_LED);
zone PowerButton;
@@ -94,6 +89,7 @@ void RGBController_AlienwareMonitor::SetupZones()
led PowerButton_LED;
PowerButton_LED.name = "Power Button";
PowerButton_LED.value = 0x08;
leds.push_back(PowerButton_LED);
SetupColors();
@@ -132,7 +128,7 @@ void RGBController_AlienwareMonitor::DeviceUpdateSingleLED(int led)
unsigned char red = RGBGetRValue(colors[led]);
unsigned char grn = RGBGetGValue(colors[led]);
unsigned char blu = RGBGetBValue(colors[led]);
controller->SendColor(led_values[led], red, grn, blu);
controller->SendColor(leds[led].value, red, grn, blu);
}
void RGBController_AlienwareMonitor::DeviceUpdateMode()
@@ -38,69 +38,76 @@ static const unsigned int zone_sizes[] =
LED_COUNT,
};
static const char* led_names[] =
typedef struct
{
KEY_EN_ESCAPE,
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_MINUS,
KEY_EN_EQUALS,
KEY_EN_BACKSPACE,
KEY_EN_TAB,
KEY_EN_Q,
KEY_EN_W,
KEY_EN_E,
KEY_EN_R,
KEY_EN_T,
KEY_EN_Y,
KEY_EN_U,
KEY_EN_I,
KEY_EN_O,
KEY_EN_P,
KEY_EN_LEFT_BRACKET,
KEY_EN_RIGHT_BRACKET,
KEY_EN_ANSI_BACK_SLASH,
KEY_EN_CAPS_LOCK,
KEY_EN_A,
KEY_EN_S,
KEY_EN_D,
KEY_EN_F,
KEY_EN_G,
KEY_EN_H,
KEY_EN_J,
KEY_EN_K,
KEY_EN_L,
KEY_EN_SEMICOLON,
KEY_EN_QUOTE,
KEY_EN_ANSI_ENTER,
KEY_EN_LEFT_SHIFT,
KEY_EN_Z,
KEY_EN_X,
KEY_EN_C,
KEY_EN_V,
KEY_EN_B,
KEY_EN_N,
KEY_EN_M,
KEY_EN_COMMA,
KEY_EN_PERIOD,
KEY_EN_FORWARD_SLASH,
KEY_EN_RIGHT_SHIFT,
KEY_EN_LEFT_CONTROL,
KEY_EN_LEFT_WINDOWS,
KEY_EN_LEFT_ALT,
KEY_EN_SPACE,
KEY_EN_RIGHT_ALT,
KEY_EN_RIGHT_FUNCTION,
KEY_EN_MENU,
KEY_EN_RIGHT_CONTROL,
const char * name;
const unsigned char idx;
} annepro2_led_type;
static const annepro2_led_type led_names[] =
{
/* Key Label Index */
{ KEY_EN_ESCAPE, 0 },
{ KEY_EN_1, 1 },
{ KEY_EN_2, 2 },
{ KEY_EN_3, 3 },
{ KEY_EN_4, 4 },
{ KEY_EN_5, 5 },
{ KEY_EN_6, 6 },
{ KEY_EN_7, 7 },
{ KEY_EN_8, 8 },
{ KEY_EN_9, 9 },
{ KEY_EN_0, 10 },
{ KEY_EN_MINUS, 11 },
{ KEY_EN_EQUALS, 12 },
{ KEY_EN_BACKSPACE, 13 },
{ KEY_EN_TAB, 14 },
{ KEY_EN_Q, 15 },
{ KEY_EN_W, 16 },
{ KEY_EN_E, 17 },
{ KEY_EN_R, 18 },
{ KEY_EN_T, 19 },
{ KEY_EN_Y, 20 },
{ KEY_EN_U, 21 },
{ KEY_EN_I, 22 },
{ KEY_EN_O, 23 },
{ KEY_EN_P, 24 },
{ KEY_EN_LEFT_BRACKET, 25 },
{ KEY_EN_RIGHT_BRACKET, 26 },
{ KEY_EN_ANSI_BACK_SLASH, 27 },
{ KEY_EN_CAPS_LOCK, 28 },
{ KEY_EN_A, 29 },
{ KEY_EN_S, 30 },
{ KEY_EN_D, 31 },
{ KEY_EN_F, 32 },
{ KEY_EN_G, 33 },
{ KEY_EN_H, 34 },
{ KEY_EN_J, 35 },
{ KEY_EN_K, 36 },
{ KEY_EN_L, 37 },
{ KEY_EN_SEMICOLON, 38 },
{ KEY_EN_QUOTE, 39 },
{ KEY_EN_ANSI_ENTER, 40 },
{ KEY_EN_LEFT_SHIFT, 41 },
{ KEY_EN_Z, 42 },
{ KEY_EN_X, 43 },
{ KEY_EN_C, 44 },
{ KEY_EN_V, 45 },
{ KEY_EN_B, 46 },
{ KEY_EN_N, 47 },
{ KEY_EN_M, 48 },
{ KEY_EN_COMMA, 49 },
{ KEY_EN_PERIOD, 50 },
{ KEY_EN_FORWARD_SLASH, 51 },
{ KEY_EN_RIGHT_SHIFT, 52 },
{ KEY_EN_LEFT_CONTROL, 53 },
{ 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 },
};
/**------------------------------------------------------------------*\
@@ -170,7 +177,8 @@ void RGBController_AnnePro2::SetupZones()
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
{
led new_led;
new_led.name = led_names[led_idx];
new_led.name = led_names[led_idx].name;
new_led.value = led_names[led_idx].idx;
leds.push_back(new_led);
}
@@ -186,7 +194,7 @@ void RGBController_AnnePro2::DeviceUpdateLEDs()
| TODO: Send packets with multiple LED frames |
\*---------------------------------------------------------*/
std::size_t led_real_idx = 0;
for(std::size_t led_idx = 0; led_idx < colors.size(); led_idx++)
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
{
frame_buf[(led_real_idx * 3) + 0] = RGBGetRValue(colors[led_idx]);
frame_buf[(led_real_idx * 3) + 1] = RGBGetGValue(colors[led_idx]);
@@ -75,6 +75,7 @@ void RGBController_Arctic::SetupZones()
led Led;
Led.name = LedZone.name + " LED";
Led.value = channel;
zones.push_back(LedZone);
leds.push_back(Led);
@@ -351,14 +351,11 @@ void RGBController_AsusAuraCoreLaptop::SetupZones()
new_zone.leds_count = new_kb.GetKeyCount();
for(unsigned int led_idx = 0; led_idx < new_zone.leds_count; led_idx++)
{
led new_led;
unsigned int new_led_value;
led new_led;
new_led.name = new_kb.GetKeyNameAt(led_idx);
new_led_value = new_kb.GetKeyValueAt(led_idx);
max_led_value = std::max(max_led_value, new_led_value);
led_values.push_back(new_led_value);
new_led.value = new_kb.GetKeyValueAt(led_idx);
max_led_value = std::max(max_led_value, new_led.value);
leds.push_back(new_led);
}
}
@@ -388,12 +385,24 @@ void RGBController_AsusAuraCoreLaptop::SetupZones()
for(size_t led_idx = 0; led_idx < leds.size(); led_idx++)
{
buffer_map[led_values[led_idx]] = &colors[led_idx];
buffer_map[leds[led_idx].value] = &colors[led_idx];
}
}
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);
}
@@ -33,7 +33,6 @@ public:
private:
RGBColor null_color = 0;
std::vector<RGBColor *> buffer_map;
std::vector<unsigned int> led_values;
AsusAuraCoreLaptopController* controller;
};
@@ -471,8 +471,8 @@ void RGBController_AuraKeyboard::SetupZones()
{
led new_led;
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);
}
@@ -493,7 +493,7 @@ void RGBController_AuraKeyboard::DeviceUpdateLEDs()
\*---------------------------------------------------------*/
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
{
frame_buf[(led_idx * 4) + 0] = led_values[led_idx];
frame_buf[(led_idx * 4) + 0] = leds[led_idx].value;
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) + 3] = RGBGetBValue(colors[led_idx]);
@@ -54,5 +54,4 @@ public:
private:
AuraKeyboardController* controller;
AuraKeyboardMappingLayoutType layout;
std::vector<unsigned char> led_values;
};
@@ -22,7 +22,6 @@
#define AURA_ROG_GLADIUS_II_WIRELESS_1_PID 0x189E
#define AURA_ROG_GLADIUS_II_WIRELESS_2_PID 0x18A0
#define AURA_ROG_GLADIUS_III_PID 0x197B
#define AURA_ROG_GLADIUS_III_CORE_PID 0x1C8D
#define AURA_ROG_GLADIUS_III_WIRELESS_USB_PID 0x197D
#define AURA_ROG_GLADIUS_III_WIRELESS_2_4_PID 0x197F
#define AURA_ROG_GLADIUS_III_WIRELESS_BT_PID 0x1981
@@ -218,20 +217,6 @@ static std::map<int,mouse_type> aura_mouse_devices =
{ AURA_MOUSE_MODE_STATIC, AURA_MOUSE_MODE_BREATHING, AURA_MOUSE_MODE_SPECTRUM, AURA_MOUSE_MODE_WAVE, AURA_MOUSE_MODE_REACTIVE, AURA_MOUSE_MODE_COMET, AURA_MOUSE_MODE_BATTERY }
}
},
{
AURA_ROG_GLADIUS_III_CORE_PID, // ROG Gladius III Core
{
0,
0,
0,
100,
false,
1,
false,
{ AURA_MOUSE_ZONE_LOGO, AURA_MOUSE_ZONE_SCROLL },
{ AURA_MOUSE_MODE_STATIC, AURA_MOUSE_MODE_BREATHING, AURA_MOUSE_MODE_SPECTRUM, AURA_MOUSE_MODE_NONE, AURA_MOUSE_MODE_REACTIVE }
}
},
{
AURA_ROG_GLADIUS_III_WIRELESS_USB_PID, // ROG Gladius III Wireless USB
{
@@ -207,8 +207,8 @@ void RGBController_AuraMouse::SetupZones()
led mouse_led;
mouse_led.name = mouse_zone.name + " LED";
mouse_led.value = *zone_it;
led_values.push_back(*zone_it);
leds.push_back(mouse_led);
}
@@ -247,7 +247,7 @@ void RGBController_AuraMouse::DeviceUpdateSingleLED(int led)
uint8_t grn = RGBGetGValue(colors[led]);
uint8_t blu = RGBGetBValue(colors[led]);
controller->SendUpdate(led_values[led], modes[active_mode].value, red, grn, blu, 0, false, 0, modes[active_mode].brightness);
controller->SendUpdate(leds[led].value, modes[active_mode].value, red, grn, blu, 0, false, 0, modes[active_mode].brightness);
}
void RGBController_AuraMouse::DeviceUpdateMode()
@@ -31,6 +31,5 @@ public:
private:
AuraMouseController* controller;
std::vector<uint8_t> led_values;
uint16_t pid;
};
@@ -141,6 +141,7 @@ void RGBController_AsusROGSpatha::SetupZones()
led spatha_led;
spatha_led.name = zones_names[i];
spatha_led.value = 1;
leds.push_back(spatha_led);
}
@@ -99,6 +99,7 @@ void RGBController_AsusROGStrixEvolve::SetupZones()
led mouse_led;
mouse_led.name = "Underglow";
mouse_led.value = 1;
leds.push_back(mouse_led);
@@ -163,6 +163,7 @@ void RGBController_AsusAuraRyuoAIO::SetupZones()
new_led.name = zones[zone_idx].name;
new_led.name.append(" LED " + std::to_string(lp_idx));
new_led.value = lp_idx;
leds.push_back(new_led);
}
@@ -520,7 +520,7 @@ void RGBController_AuraTUFKeyboard::SetupZones()
{
led new_led;
new_led.name = keyboard[layout].led_names[led_id].name;
led_values.push_back(keyboard[layout].led_names[led_id].id);
new_led.value = keyboard[layout].led_names[led_id].id;
leds.push_back(new_led);
}
@@ -538,7 +538,7 @@ void RGBController_AuraTUFKeyboard::DeviceUpdateLEDs()
for(size_t i = 0; i < colors.size(); i++)
{
led_color_list.push_back({ led_values[i], colors[i] });
led_color_list.push_back({ leds[i].value, colors[i] });
}
controller->UpdateLeds(led_color_list);
@@ -560,7 +560,7 @@ void RGBController_AuraTUFKeyboard::DeviceUpdateSingleLED(int led)
unsigned char green = RGBGetGValue(colors[led]);
unsigned char blue = RGBGetBValue(colors[led]);
controller->UpdateSingleLed(led_values[led], red, green, blue);
controller->UpdateSingleLed(leds[led].value, red, green, blue);
}
static const uint8_t direction_map[2][6] =
@@ -53,5 +53,4 @@ public:
private:
AuraTUFKeyboardController* controller;
uint16_t pid;
std::vector<uint8_t> led_values;
};
@@ -464,7 +464,6 @@ REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius II Origin COD",
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius II Wireless", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_II_WIRELESS_1_PID, 1, 0xFF13);
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius II Wireless", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_II_WIRELESS_2_PID, 2, 0xFF01);
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius III", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_III_PID, 0, 0xFF01);
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius III Core", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_III_CORE_PID, 0, 0xFF01);
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius III Wireless USB", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_III_WIRELESS_USB_PID, 0, 0xFF01);
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius III Wireless 2.4Ghz", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_III_WIRELESS_2_4_PID, 0, 0xFF01);
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius III Wireless Bluetooth", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_III_WIRELESS_BT_PID, 0, 0xFF01);
@@ -164,6 +164,7 @@ void RGBController_AsusROGStrixLC::SetupZones()
new_led.name = zones[zone_idx].name;
new_led.name.append(" LED " + std::to_string(lp_idx));
new_led.value = lp_idx;
leds.push_back(new_led);
}
@@ -71,6 +71,7 @@ void RGBController_StrixClaw::SetupZones()
led scroll_wheel_led;
scroll_wheel_led.name = "Scroll Wheel LED";
scroll_wheel_led.value = 1;
leds.push_back(scroll_wheel_led);
@@ -87,6 +88,7 @@ void RGBController_StrixClaw::SetupZones()
led logo_led;
logo_led.name = "Logo LED";
logo_led.value = 1;
leds.push_back(logo_led);
@@ -241,9 +241,9 @@ void RGBController_ClevoKeyboard::SetupZones()
led new_led;
new_led.name = new_kb.GetKeyNameAt(led_idx);
new_led.value = new_kb.GetKeyValueAt(led_idx);
leds.push_back(new_led);
led_values.push_back(new_kb.GetKeyValueAt(led_idx));
}
SetupColors();
@@ -258,7 +258,7 @@ void RGBController_ClevoKeyboard::SetupZones()
for(size_t led_idx = 0; led_idx < leds.size(); led_idx++)
{
buffer_map[led_values[led_idx]] = &colors[led_idx];
buffer_map[leds[led_idx].value] = &colors[led_idx];
}
}
@@ -32,6 +32,5 @@ public:
private:
ClevoKeyboardController* controller;
std::vector<RGBColor*> buffer_map;
std::vector<unsigned int> led_values;
RGBColor null_color;
};
@@ -1,4 +1,4 @@
/*---------------------------------------------------------*\
/*---------------------------------------------------------*\
| ColorfulGPUControllerDetect.cpp |
| |
| Detector for Colorful GPU |
@@ -52,7 +52,7 @@ REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Advanced OC 12G L-V", Detec
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Ultra W OC 12G L-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX3060_LHR_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_3060_ULTRAW_OC_12G, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Ultra W OC 12G L-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX3060_GA106_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_3060_ULTRAW_OC_12G, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Ultra W OC 12G L-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX3060_LHR_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_3060_ULTRAW_OC_12G_2, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Ti Ultra W OC LHR-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX3060TI_LHR_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_3060_ULTRAW_OC_12G, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Ti Ultra W OC LHR-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX3060TI_LHR_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_3060_ULTRAW_OC_12G, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Ti Ultra W OC LHR-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX3060TI_LHR_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_3060_ULTRAW_OC_12G_2, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Ti Advanced OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX3060TI_LHR_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_3070_ADVANCED_OCV, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Ti Advanced OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX3060TI_LHR_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_3060TI_ADVANCED_OC, 0x61);
@@ -76,8 +76,6 @@ REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 4080 Ultra W OC-V", Detec
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 4080 Ultra W OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX4080_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_4080_ULTRAW_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_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 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 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, 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_OCV2, 0x61);
@@ -159,7 +159,7 @@ void RGBController_CMGD160Controller::SetupZones()
{
led l;
l.name = "Front LED " + std::to_string(i + 1);
l.value = i;
leds.push_back(l);
}
@@ -175,7 +175,7 @@ void RGBController_CMGD160Controller::SetupZones()
{
led l;
l.name = "Back LED " + std::to_string(i + 1);
l.value = i;
leds.push_back(l);
}
@@ -146,10 +146,12 @@ void RGBController_CMMM711Controller::Init_Controller()
led wheel_led;
wheel_led.name = "Scroll Wheel LED";
wheel_led.value = 0;
leds.push_back(wheel_led);
led logo_led;
logo_led.name = "Logo LED";
logo_led.value = 1;
leds.push_back(logo_led);
}
@@ -139,6 +139,7 @@ void RGBController_CMMM712Controller::Init_Controller()
led logo_led;
logo_led.name = "Logo LED";
logo_led.value = 0;
leds.push_back(logo_led);
}
@@ -183,24 +183,28 @@ void RGBController_CMMMController::Init_Controller()
mouse_zone.leds_count = leds_count;
zones.push_back(mouse_zone);
int value = 0;
uint16_t pid = controller->GetProductID();
led wheel_led;
wheel_led.name = "Scroll Wheel";
wheel_led.value = value;
leds.push_back(wheel_led);
value++;
if(pid == 0x0065 || pid == 0x0097)
{
led buttons_led;
buttons_led.name = "Buttons";
buttons_led.value = value;
leds.push_back(buttons_led);
value++;
}
led logo_led;
logo_led.name = "Logo";
logo_led.value = value;
leds.push_back(logo_led);
}
@@ -162,7 +162,7 @@ void RGBController_CMMonitorController::SetupZones()
{
led l;
l.name = std::to_string(i + 1);
l.value = i;
leds.push_back(l);
}
@@ -169,6 +169,7 @@ void RGBController_CMR6000Controller::SetupZones()
led GP_led;
GP_led.name = "Logo";
GP_led.value = 0;
leds.push_back(GP_led);
SetupColors();
@@ -152,8 +152,8 @@ void RGBController_CorsairV2HW::SetupZones()
led new_led;
new_led.name = new_kb.GetKeyNameAt(led_idx);
led_values.push_back(new_kb.GetKeyValueAt(led_idx));
max_led_value = std::max(max_led_value, led_values.back());
new_led.value = new_kb.GetKeyValueAt(led_idx);
max_led_value = std::max(max_led_value, new_led.value);
leds.push_back(new_led);
}
}
@@ -176,7 +176,7 @@ void RGBController_CorsairV2HW::SetupZones()
new_led.name = new_zone.name + " ";
new_led.name.append(std::to_string( led_idx ));
led_values.push_back((unsigned int)leds.size());
new_led.value = (unsigned int)leds.size();
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++)
{
buffer_map[led_values[led_idx]] = &colors[led_idx];
buffer_map[leds[led_idx].value] = &colors[led_idx];
}
}
@@ -34,7 +34,6 @@ public:
private:
CorsairPeripheralV2Controller* controller;
std::vector<unsigned int> led_values;
RGBColor null_color = 0;
std::vector<RGBColor *> buffer_map;
@@ -139,8 +139,8 @@ void RGBController_CorsairV2SW::SetupZones()
led new_led;
new_led.name = new_kb.GetKeyNameAt(led_idx);
led_values.push_back(new_kb.GetKeyValueAt(led_idx));
max_led_value = std::max(max_led_value, led_values.back());
new_led.value = new_kb.GetKeyValueAt(led_idx);
max_led_value = std::max(max_led_value, new_led.value);
leds.push_back(new_led);
}
}
@@ -163,7 +163,7 @@ void RGBController_CorsairV2SW::SetupZones()
new_led.name = new_zone.name + " ";
new_led.name.append(std::to_string( led_idx ));
led_values.push_back((unsigned int)leds.size());
new_led.value = (unsigned int)leds.size();
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++)
{
buffer_map[led_values[led_idx]] = &colors[led_idx];
buffer_map[leds[led_idx].value] = &colors[led_idx];
}
}
@@ -36,7 +36,6 @@ public:
private:
CorsairPeripheralV2Controller* controller;
std::vector<unsigned int> led_values;
RGBColor null_color = 0;
std::vector<RGBColor *> buffer_map;
@@ -409,7 +409,7 @@ void RGBController_CougarKeyboard::SetupZones()
{
led new_led;
new_led.name = led_names[led_index];
new_led.value = led_index;
leds.push_back(new_led);
}
}
@@ -206,7 +206,7 @@ void RGBController_CryorigH7QuadLumi::SetupZones()
new_led.name = zone_names[zone_idx];
new_led.name.append(", LED ");
new_led.name.append(std::to_string(led_idx + 1));
led_values.push_back(zone_idx);
new_led.value = zone_idx;
leds.push_back(new_led);
}
@@ -233,7 +233,7 @@ void RGBController_CryorigH7QuadLumi::DeviceUpdateZoneLEDs(int zone)
void RGBController_CryorigH7QuadLumi::DeviceUpdateSingleLED(int led)
{
unsigned int zone_idx = led_values[led];
unsigned int zone_idx = leds[led].value;
DeviceUpdateZoneLEDs(zone_idx);
}
@@ -33,6 +33,5 @@ public:
private:
CryorigH7QuadLumiController* controller;
std::vector<unsigned int> leds_channel;
std::vector<unsigned int> led_values;
std::vector<unsigned int> zones_channel;
};
@@ -76,6 +76,7 @@ void RGBController_DDP::SetupZones()
{
led new_led;
new_led.name = zones[zone_idx].name + " LED " + std::to_string(led_idx + 1);
new_led.value = 0;
leds.push_back(new_led);
}
}
@@ -187,6 +187,7 @@ void RGBController_DarkProjectKeyboard::SetupZones()
{
led new_led;
new_led.name = led_names[led_index];
new_led.value = led_index;
leds.push_back(new_led);
}
}
@@ -52,29 +52,6 @@ RGBController_Debug::RGBController_Debug(bool custom, json settings)
custom_controller = custom;
debug_settings = settings;
/*-----------------------------------------------------*\
| Create the mode |
\*-----------------------------------------------------*/
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);
SetupDevice();
SetupZones();
}
RGBController_Debug::~RGBController_Debug()
{
Shutdown();
}
void RGBController_Debug::SetupDevice()
{
if(custom_controller)
{
/*-------------------------------------------------*\
@@ -109,59 +86,52 @@ void RGBController_Debug::SetupDevice()
}
else
{
std::string name_value;
std::string name_setting = JsonUtils::JsonGetString(debug_settings, "name");
std::string type_setting = JsonUtils::JsonGetString(debug_settings, "type", "keyboard");
if(type_setting == "motherboard")
{
name_value = "Debug Motherboard";
name = "Debug Motherboard";
type = DEVICE_TYPE_MOTHERBOARD;
}
else if(type_setting == "dram")
{
name_value = "Debug DRAM";
name = "Debug DRAM";
type = DEVICE_TYPE_DRAM;
}
else if(type_setting == "gpu")
{
name_value = "Debug GPU";
name = "Debug GPU";
type = DEVICE_TYPE_GPU;
}
else if(type_setting == "keyboard")
{
name_value = "Debug Keyboard";
name = "Debug Keyboard";
type = DEVICE_TYPE_KEYBOARD;
}
else if(type_setting == "mouse")
else if(type_setting == "mouse")
{
name_value = "Debug Mouse";
name = "Debug Mouse";
type = DEVICE_TYPE_MOUSE;
}
else if(type_setting == "argb")
{
name_value = "Debug ARGB Controller";
name = "Debug ARGB Controller";
type = DEVICE_TYPE_LEDSTRIP;
}
/*---------------------------------------------------------*\
| Fill in debug controller information |
\*---------------------------------------------------------*/
description = name_value + " Device";
vendor = name_value + " Vendor String";
location = name_value + " Location String";
version = name_value + " Version String";
serial = name_value + " Serial String";
flags |= CONTROLLER_FLAG_MANUALLY_CONFIGURABLE_NAME | CONTROLLER_FLAG_MANUALLY_CONFIGURABLE_DEVICE_SPECIFIC;
description = name + " Device";
vendor = name + " Vendor String";
location = name + " Location String";
version = name + " Version String";
serial = name + " Serial String";
if(name_setting != "")
{
name_value = name_setting;
}
if((flags & CONTROLLER_FLAG_MANUALLY_CONFIGURED_NAME) == 0)
{
name = name_value;
name = name_setting;
}
/*---------------------------------------------------------*\
@@ -191,17 +161,33 @@ void RGBController_Debug::SetupDevice()
configuration_json["schema"]["test_int"]["title"] = "Integer Setting";
configuration_json["schema"]["test_int"]["type"] = "integer";
if((flags & CONTROLLER_FLAG_MANUALLY_CONFIGURED_DEVICE_SPECIFIC) == 0)
{
configuration_json["configuration"]["test_string"] = "This is a test";
configuration_json["configuration"]["test_bool"] = true;
configuration_json["configuration"]["test_enum"] = "Option 2";
configuration_json["configuration"]["test_enum_int"] = 4;
configuration_json["configuration"]["test_int"] = 12345;
}
configuration_json["configuration"]["test_string"] = "This is a test";
configuration_json["configuration"]["test_bool"] = true;
configuration_json["configuration"]["test_enum"] = "Option 2";
configuration_json["configuration"]["test_enum_int"] = 4;
configuration_json["configuration"]["test_int"] = 12345;
configuration = configuration_json.dump();
}
/*-----------------------------------------------------*\
| Create the mode |
\*-----------------------------------------------------*/
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();
}
RGBController_Debug::~RGBController_Debug()
{
Shutdown();
}
void RGBController_Debug::SetupZones()
@@ -220,7 +206,7 @@ void RGBController_Debug::SetupZones()
/*-------------------------------------------------*\
| Clear any existing color/LED configuration |
\*-------------------------------------------------*/
led_display_names.clear();
led_alt_names.clear();
leds.clear();
colors.clear();
@@ -409,7 +395,7 @@ void RGBController_Debug::SetupZones()
leds.push_back(single_led);
led_display_names.push_back("");
led_alt_names.push_back("");
nlohmann::json configuration_json;
JsonUtils::JsonParse(configuration, configuration_json);
@@ -461,7 +447,7 @@ void RGBController_Debug::SetupZones()
leds.push_back(linear_led);
led_display_names.push_back("");
led_alt_names.push_back("");
}
zone_idx++;
@@ -604,7 +590,7 @@ void RGBController_Debug::SetupZones()
leds.push_back(keyboard_led);
led_display_names.push_back(new_kb.GetKeyAltNameAt(led_idx));
led_alt_names.push_back(new_kb.GetKeyAltNameAt(led_idx));
}
if(first_run)
@@ -663,7 +649,7 @@ void RGBController_Debug::SetupZones()
leds.push_back(underglow_led);
led_display_names.push_back("");
led_alt_names.push_back("");
}
zone_idx++;
@@ -719,7 +705,7 @@ void RGBController_Debug::SetupZones()
leds.push_back(resizable_led);
led_display_names.push_back("");
led_alt_names.push_back("");
}
zone_idx++;
@@ -729,11 +715,6 @@ void RGBController_Debug::SetupZones()
SetupColors();
}
void RGBController_Debug::DeviceConfigureDevice()
{
SetupDevice();
}
void RGBController_Debug::DeviceConfigureZone(int zone_idx)
{
if((size_t)zone_idx < zones.size())
@@ -23,10 +23,8 @@ public:
RGBController_Debug(bool custom, json settings);
~RGBController_Debug();
void SetupDevice();
void SetupZones();
void DeviceConfigureDevice();
void DeviceConfigureZone(int zone_idx);
void DeviceUpdateLEDs();
@@ -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 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 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 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 5090 Gaming OC", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5090_DEV, ASUS_SUB_VEN, ASUS_TUF_RTX_5090_O32G_GAMING, 0x67);
@@ -421,7 +420,6 @@ REGISTER_I2C_PCI_DETECTOR("ASUS TUF GeForce RTX 5090 Gaming",
REGISTER_I2C_PCI_DETECTOR("ASUS ROG ASTRAL GeForce RTX 5080 OC", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5080_DEV, ASUS_SUB_VEN, ASUS_ROG_ASTRAL_RTX_5080_O16G_GAMING, 0x67);
REGISTER_I2C_PCI_DETECTOR("ASUS ROG ASTRAL GeForce RTX 5080 OC WHITE", DetectENESMBusGPUControllers, NVIDIA_VEN, NVIDIA_RTX5080_DEV, ASUS_SUB_VEN, ASUS_ROG_ASTRAL_RTX_5080_O16G_GAMING_WHITE, 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 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 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);
@@ -265,7 +265,7 @@ int RGBController_ENESMBus::GetDeviceMode()
\*---------------------------------------------------------*/
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
{
unsigned int led = led_values[led_idx];
unsigned int led = leds[led_idx].value;
unsigned char red;
unsigned char grn;
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++)
{
int led = led_values[zones[zone].start_idx + led_idx];
int led = zones[zone].leds[led_idx].value;
RGBColor color = colors[led];
unsigned char red = RGBGetRValue(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.append(std::to_string(zone_led_idx + 1));
led_values.push_back(led_idx);
new_led->value = led_idx;
led_idx++;
leds.push_back(*new_led);
@@ -30,8 +30,7 @@ public:
void DeviceSaveMode();
private:
ENESMBusController* controller;
std::vector<unsigned int> led_values;
ENESMBusController* controller;
int GetDeviceMode();
};
@@ -174,14 +174,17 @@ void RGBController_EVGAMouse::Init_Controller()
led front_led;
front_led.name = "Front LED";
front_led.value = 0;
leds.push_back(front_led);
led wheel_led;
wheel_led.name = "Scroll Wheel LED";
wheel_led.value = 1;
leds.push_back(wheel_led);
led back_led;
back_led.name = "Back LED";
back_led.value = 2;
leds.push_back(back_led);
}
@@ -806,6 +806,7 @@ void RGBController_EVisionV2Keyboard::SetupZones()
{
led new_led;
new_led.name = led_names[led_index];
new_led.value = led_index;
leds.push_back(new_led);
}
}
@@ -389,7 +389,7 @@ void RGBController_EpomakerController::SetupZones()
led keyboard_led;
keyboard_led.name = "Keyboard LEDs";
keyboard_led.value = 0x00;
leds.push_back(keyboard_led);
SetupColors();
@@ -183,7 +183,7 @@ void FnaticStreakController::SendRequest(const unsigned char* prefix, size_t pre
}
}
void FnaticStreakController::SetLEDsDirect(std::vector<unsigned int> led_values, std::vector<RGBColor> colors, unsigned int brightness)
void FnaticStreakController::SetLEDsDirect(std::vector<led> leds, std::vector<RGBColor> colors, unsigned int brightness)
{
unsigned int total_leds = GetLEDCount();
@@ -199,11 +199,11 @@ void FnaticStreakController::SetLEDsDirect(std::vector<unsigned int> led_values,
| in the keyboard hardware (0-123 for full, 0-105 mini) |
| Apply brightness scaling (0-100%) |
\*-----------------------------------------------------*/
unsigned int leds_to_set = (unsigned int)std::min(colors.size(), led_values.size());
unsigned int leds_to_set = (unsigned int)std::min(colors.size(), leds.size());
for(unsigned int i = 0; i < leds_to_set; i++)
{
unsigned int led_idx = led_values[i];
unsigned int led_idx = leds[i].value;
if(led_idx < total_leds)
{
if(brightness >= 100)
@@ -230,41 +230,16 @@ void FnaticStreakController::SetLEDsDirect(std::vector<unsigned int> led_values,
void FnaticStreakController::SendRGBToDevice()
{
if(keyboard_type == FNATIC_STREAK_TYPE_65)
{
unsigned char data[64];
memset(data, 0x00, sizeof(data));
unsigned int total_leds = GetLEDCount();
unsigned int data_size = total_leds * 3;
data[0] = 0x0F;
data[1] = 0x15;
data[7] = 0x0F;
data[8] = 0x03;
for(unsigned int i = 9; i < 25; i++)
{
data[i] = 0xFF;
}
data[25] = color_buf[0];
data[26] = color_buf[1];
data[27] = color_buf[2];
hid_write(dev, data, sizeof(data));
}
else
{
unsigned int total_leds = GetLEDCount();
unsigned int data_size = total_leds * 3;
/*-----------------------------------------------------*\
| For direct/software control, use command 0x0f |
| This bypasses the profile and allows immediate update |
| The 0x03 subcommand indicates per-key color data |
\*-----------------------------------------------------*/
unsigned char prefix[] = { 0x0f, 0x03 };
SendRequest(prefix, sizeof(prefix), color_buf, data_size);
}
/*-----------------------------------------------------*\
| For direct/software control, use command 0x0f |
| This bypasses the profile and allows immediate update |
| The 0x03 subcommand indicates per-key color data |
\*-----------------------------------------------------*/
unsigned char prefix[] = { 0x0f, 0x03 };
SendRequest(prefix, sizeof(prefix), color_buf, data_size);
}
void FnaticStreakController::SetPulse(unsigned char color_mode, unsigned char r, unsigned char g, unsigned char b, unsigned char speed)
@@ -51,8 +51,7 @@
enum FnaticStreakType
{
FNATIC_STREAK_TYPE_FULL,
FNATIC_STREAK_TYPE_MINI,
FNATIC_STREAK_TYPE_65
FNATIC_STREAK_TYPE_MINI
};
class FnaticStreakController
@@ -69,7 +68,7 @@ public:
unsigned int GetLEDCount();
void SetProfile(unsigned char profile);
void SetLEDsDirect(std::vector<unsigned int> led_values, std::vector<RGBColor> colors, unsigned int brightness);
void SetLEDsDirect(std::vector<led> leds, std::vector<RGBColor> colors, unsigned int brightness);
void SendRGBToDevice();
/*-----------------------------------------------------*\
@@ -26,7 +26,6 @@
#define FNATIC_STREAK_PID 0x0101
#define FNATIC_MINISTREAK_PID 0x0102
#define FNATIC_STREAK65_PID 0x0105
DetectedControllers DetectFnaticStreakKeyboard(hid_device_info* info, const std::string& name)
{
@@ -43,10 +42,6 @@ DetectedControllers DetectFnaticStreakKeyboard(hid_device_info* info, const std:
{
kb_type = FNATIC_STREAK_TYPE_MINI;
}
else if(info->product_id == FNATIC_STREAK65_PID)
{
kb_type = FNATIC_STREAK_TYPE_65;
}
else
{
kb_type = FNATIC_STREAK_TYPE_FULL;
@@ -63,4 +58,3 @@ DetectedControllers DetectFnaticStreakKeyboard(hid_device_info* info, const std:
REGISTER_HID_DETECTOR_I("Fnatic Streak", DetectFnaticStreakKeyboard, FNATIC_VID, FNATIC_STREAK_PID, 1);
REGISTER_HID_DETECTOR_I("Fnatic miniStreak", DetectFnaticStreakKeyboard, FNATIC_VID, FNATIC_MINISTREAK_PID, 1);
REGISTER_HID_DETECTOR_I("Fnatic Streak65", DetectFnaticStreakKeyboard, FNATIC_VID, FNATIC_STREAK65_PID, 1);
@@ -525,7 +525,7 @@ void RGBController_FnaticStreak::SetupZones()
{
led new_led;
new_led.name = led_name_ptr[led_idx];
led_values.push_back(led_idx);
new_led.value = led_idx;
leds.push_back(new_led);
}
@@ -541,7 +541,7 @@ void RGBController_FnaticStreak::DeviceUpdateLEDs()
| Apply brightness scaling to colors |
\*-----------------------------------------------------*/
unsigned int brightness = modes[active_mode].brightness;
controller->SetLEDsDirect(led_values, colors, brightness);
controller->SetLEDsDirect(leds, colors, brightness);
controller->SendRGBToDevice();
}
@@ -36,5 +36,4 @@ private:
std::thread* keepalive_thread;
std::atomic<bool> keepalive_thread_run;
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
std::vector<unsigned int> led_values;
};
@@ -29,13 +29,10 @@ bool TestForGalaxGPUController(i2c_smbus_interface* bus, unsigned char address)
\*-------------------------------------------------*/
case 0x32:
res = bus->i2c_smbus_read_byte_data(address, 0x00);
if(res == 0x27 || res == 0x26)
{
if(res == 0x27 || res == 0x26) {
res = bus->i2c_smbus_read_byte_data(address, 0x01);
if(res == 0x10 || res == 0x20)
{
if (res == 0x10 || res == 0x20)
pass = true;
}
}
break;
@@ -44,7 +41,7 @@ bool TestForGalaxGPUController(i2c_smbus_interface* bus, unsigned char address)
\*-------------------------------------------------*/
case 0x23:
res = bus->i2c_smbus_read_byte_data(address, 0x00);
if(res == 0x27 || res == 0x30)
if(res == 0x30)
{
pass = true;
}
@@ -55,10 +52,8 @@ bool TestForGalaxGPUController(i2c_smbus_interface* bus, unsigned char address)
\*-------------------------------------------------*/
case 0x51:
res = bus->i2c_smbus_read_byte_data(address, 0x00);
if(res == 0x80)
{
if (res == 0x80)
pass = true;
}
break;
}
@@ -121,7 +121,6 @@ REGISTER_I2C_PCI_DETECTOR("Gigabyte GeForce RTX 5080 Gaming OC",
REGISTER_I2C_PCI_DETECTOR("Gigabyte AORUS GeForce RTX 5080 MASTER", DetectGigabyteRGBFusion2BlackwellAorusMaster5080LayoutGPUControllers, NVIDIA_VEN, NVIDIA_RTX5080_DEV, GIGABYTE_SUB_VEN, GIGABYTE_AORUS_RTX5080_MASTER_16G_SUB_DEV, 0x75);
REGISTER_I2C_PCI_DETECTOR("Gigabyte AORUS GeForce RTX 5080 XTREME WATERFORCE", DetectGigabyteRGBFusion2BlackwellAorusWaterforceLayoutGPUControllers, NVIDIA_VEN, NVIDIA_RTX5080_DEV, GIGABYTE_SUB_VEN, GIGABYTE_AORUS_RTX5080_XTREME_WATERFORCE_16G_SUB_DEV, 0x75);
REGISTER_I2C_PCI_DETECTOR("Gigabyte GeForce RTX 5080 XTREME WATERFORCE", DetectGigabyteRGBFusion2BlackwellWaterforceLayoutGPUControllers, NVIDIA_VEN, NVIDIA_RTX5080_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX5080_XTREME_WATERFORCE_16G_SUB_DEV, 0x75);
REGISTER_I2C_PCI_DETECTOR("Gigabyte AORUS GeForce RTX 5080 MASTER ICE", DetectGigabyteRGBFusion2BlackwellAorusMaster5080LayoutGPUControllers, NVIDIA_VEN, NVIDIA_RTX5080_DEV, GIGABYTE_SUB_VEN, GIGABYTE_AORUS_RTX5080_MASTER_ICE_16G_SUB_DEV, 0x75);
REGISTER_I2C_PCI_DETECTOR("Gigabyte GeForce RTX 5090 Gaming OC", DetectGigabyteRGBFusion2BlackwellGamingLayoutGPUControllers, NVIDIA_VEN, NVIDIA_RTX5090_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX5090_GAMING_OC_32G_SUB_DEV, 0x75);
REGISTER_I2C_PCI_DETECTOR("Gigabyte GeForce RTX 5090 XTREME WATERFORCE", DetectGigabyteRGBFusion2BlackwellWaterforceLayoutGPUControllers, NVIDIA_VEN, NVIDIA_RTX5090_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX5090_XTREME_WATERFORCE_32G_SUB_DEV1, 0x75);
REGISTER_I2C_PCI_DETECTOR("Gigabyte GeForce RTX 5090 XTREME WATERFORCE", DetectGigabyteRGBFusion2BlackwellWaterforceLayoutGPUControllers, NVIDIA_VEN, NVIDIA_RTX5090_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX5090_XTREME_WATERFORCE_32G_SUB_DEV2, 0x75);
@@ -176,7 +176,6 @@ REGISTER_I2C_PCI_DETECTOR("Gigabyte Radeon RX 7800 XT GAMING OC",
REGISTER_I2C_PCI_DETECTOR("Gigabyte Radeon RX 7900 GRE GAMING OC", DetectGigabyteRGBFusion2GPUControllers, AMD_GPU_VEN, AMD_NAVI31_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RX7900GRE_GAMING_OC_16G_SUB_DEV, 0x62);
REGISTER_I2C_PCI_DETECTOR("Gigabyte Radeon RX 7900 XT GAMING OC", DetectGigabyteRGBFusion2GPUControllers, AMD_GPU_VEN, AMD_NAVI31_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RX7900XT_GAMING_OC_20G_SUB_DEV, 0x62);
REGISTER_I2C_PCI_DETECTOR("Gigabyte Radeon RX 7900 XTX GAMING OC", DetectGigabyteRGBFusion2GPUControllers, AMD_GPU_VEN, AMD_NAVI31_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RX7900XTX_GAMING_OC_24G_SUB_DEV, 0x62);
REGISTER_I2C_PCI_DETECTOR("Gigabyte AORUS Radeon RX 7900 XTX ELITE 24G", DetectGigabyteRGBFusion2GPUControllers, AMD_GPU_VEN, AMD_NAVI31_DEV, GIGABYTE_SUB_VEN, GIGABYTE_AORUS_RX7900XTX_ELITE_24G_SUB_DEV, 0x71);
REGISTER_I2C_PCI_DETECTOR("Gigabyte AORUS RX 6750 XT ELITE 12G", DetectGigabyteRGBFusion2GPUControllers, AMD_GPU_VEN, AMD_NAVI22_DEV, GIGABYTE_SUB_VEN, GIGABYTE_AORUS_RX_6750_XT_ELITE_12G_SUB_DEV, 0x70);
REGISTER_I2C_PCI_DETECTOR("Gigabyte AORUS RX 6900 XT EXTREME WATERFORCE WB", DetectGigabyteRGBFusion2GPUControllers, AMD_GPU_VEN, AMD_NAVI21_DEV2, GIGABYTE_SUB_VEN, GIGABYTE_RX6900XT_XTREME_WATERFORCE_WB_SUB_DEV, 0x70);
REGISTER_I2C_PCI_DETECTOR("Gigabyte AORUS Radeon RX 9070 XT Elite", DetectGigabyteRGBFusion2GPUControllers, AMD_GPU_VEN, AMD_NAVI48_DEV, GIGABYTE_SUB_VEN, GIGABYTE_AORUS_RX9070XT_ELITE_16G_SUB_DEV, 0x73);
@@ -347,7 +347,6 @@ void RGBController_RGBFusion2USB::SetupZones()
\*-----------------------------------------------------*/
leds.clear();
colors.clear();
led_values.clear();
/*-----------------------------------------------------*\
| Count number of zones to resize zones vector |
@@ -442,7 +441,7 @@ void RGBController_RGBFusion2USB::SetupZones()
led new_led;
new_led.name = zone_at_idx->name;
led_values.push_back(zone_at_idx->idx);
new_led.value = zone_at_idx->idx;
if(!fixed_zone)
{
@@ -534,7 +533,7 @@ void RGBController_RGBFusion2USB::DeviceUpdateLEDs()
/*---------------------------------------------------------*\
| Apply the mode and color to the zone |
\*---------------------------------------------------------*/
controller->SetLEDEffect(led_values[zones[zone_idx].start_idx + led_idx], mode_value, modes[active_mode].speed, modes[active_mode].brightness, random, color);
controller->SetLEDEffect(zones[zone_idx].leds[led_idx].value, mode_value, modes[active_mode].speed, modes[active_mode].brightness, random, color);
}
}
/*---------------------------------------------------------*\
@@ -544,7 +543,7 @@ void RGBController_RGBFusion2USB::DeviceUpdateLEDs()
{
if(zones[zone_idx].leds && zones[zone_idx].leds_count)
{
unsigned char hdr = led_values[zones[zone_idx].start_idx];
unsigned char hdr = zones[zone_idx].leds->value;
/*---------------------------------------------------------*\
| Direct mode addresses a different register |
@@ -630,7 +629,7 @@ void RGBController_RGBFusion2USB::DeviceUpdateZoneLEDs(int zone)
/*---------------------------------------------------------*\
| Apply the mode and color to the zone |
\*---------------------------------------------------------*/
controller->SetLEDEffect(led_values[zones[zone].start_idx + led_idx], mode_value, modes[active_mode].speed, modes[active_mode].brightness, random, color);
controller->SetLEDEffect(zones[zone].leds[led_idx].value, mode_value, modes[active_mode].speed, modes[active_mode].brightness, random, color);
controller->ApplyEffect();
}
}
@@ -642,7 +641,7 @@ void RGBController_RGBFusion2USB::DeviceUpdateZoneLEDs(int zone)
{
if(zones[zone].leds && zones[zone].leds_count)
{
unsigned char hdr = led_values[zones[zone].start_idx];
unsigned char hdr = zones[zone].leds->value;
/*---------------------------------------------------------*\
| Direct mode addresses a different register |
@@ -723,7 +722,7 @@ void RGBController_RGBFusion2USB::DeviceUpdateSingleLED(int led)
color = &modes[active_mode].colors[0];
}
controller->SetLEDEffect(led_values[led], mode_value, modes[active_mode].speed, modes[active_mode].brightness, random, color);
controller->SetLEDEffect(leds[led].value, mode_value, modes[active_mode].speed, modes[active_mode].brightness, random, color);
controller->ApplyEffect();
}
@@ -64,9 +64,6 @@ private:
RGBFusion2USBController* controller;
int device_num;
RGBColor null_color = 0;
std::vector<unsigned int> led_values;
/*---------------------------------------------------------*\
| The intial value of device_index should point to the |
| layout for the generic_device |
@@ -1,121 +0,0 @@
/*---------------------------------------------------------*\
| HyperXEve1800Controller.cpp |
| |
| Driver for HyperX Eve 1800 keyboard |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include <cstring>
#include "HyperXEve1800Controller.h"
#include "StringUtils.h"
HyperXEve1800Controller::HyperXEve1800Controller(hid_device* dev_handle, const char* path, std::string dev_name)
{
dev = dev_handle;
location = path;
name = dev_name;
}
HyperXEve1800Controller::~HyperXEve1800Controller()
{
hid_close(dev);
}
std::string HyperXEve1800Controller::GetDeviceLocation()
{
return("HID: " + location);
}
std::string HyperXEve1800Controller::GetNameString()
{
return(name);
}
std::string HyperXEve1800Controller::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 HyperXEve1800Controller::SetBrightness(unsigned int brightness)
{
unsigned char buf[65];
memset(buf, 0x00, sizeof(buf));
buf[0x00] = 0x40;
buf[0x01] = 0x01;
buf[0x02] = 0x00;
buf[0x03] = 0x00;
buf[0x04] = brightness & 0xFF;
hid_write(dev, buf, 65);
}
void HyperXEve1800Controller::SetLEDsDirect(std::vector<RGBColor> colors)
{
SendDirectInitialization();
if(colors.empty())
{
RGBColor temp = 0x00000000;
SendDirectColorPacket(&temp, 1);
}
else
{
SendDirectColorPacket(&colors[0], (unsigned int)colors.size());
}
}
void HyperXEve1800Controller::SendDirectInitialization()
{
unsigned char buf[65];
memset(buf, 0x00, sizeof(buf));
buf[0x00] = 0x44;
buf[0x01] = 0x01;
buf[0x02] = 0x04;
buf[0x03] = 0x00;
hid_write(dev, buf, 65);
}
void HyperXEve1800Controller::SendDirectColorPacket(RGBColor* color_data, unsigned int color_count)
{
unsigned char buf[65];
memset(buf, 0x00, sizeof(buf));
buf[0x00] = 0x44;
buf[0x01] = 0x02;
buf[0x02] = 0x00;
buf[0x03] = 0x00;
/*-----------------------------------------------------*\
| The Eve 1800 exposes 10 lighting zones, but this |
| report format can carry up to 20 RGB triplets. |
\*-----------------------------------------------------*/
if(color_count > 20)
{
color_count = 20;
}
for(unsigned int color_idx = 0; color_idx < color_count; color_idx++)
{
buf[4 + (color_idx * 3)] = RGBGetRValue(color_data[color_idx]);
buf[4 + (color_idx * 3) + 1] = RGBGetGValue(color_data[color_idx]);
buf[4 + (color_idx * 3) + 2] = RGBGetBValue(color_data[color_idx]);
}
hid_write(dev, buf, 65);
}
@@ -1,36 +0,0 @@
/*---------------------------------------------------------*\
| HyperXEve1800Controller.h |
| |
| Driver for HyperX Eve 1800 keyboard |
| |
| 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 HyperXEve1800Controller
{
public:
HyperXEve1800Controller(hid_device* dev_handle, const char* path, std::string dev_name);
~HyperXEve1800Controller();
std::string GetDeviceLocation();
std::string GetNameString();
std::string GetSerialString();
void SetBrightness(unsigned int brightness);
void SetLEDsDirect(std::vector<RGBColor> colors);
private:
hid_device* dev;
std::string location;
std::string name;
void SendDirectInitialization();
void SendDirectColorPacket(RGBColor* color_data, unsigned int color_count);
};
@@ -1,123 +0,0 @@
/*---------------------------------------------------------*\
| RGBController_HyperXEve1800.cpp |
| |
| RGBController for HyperX Eve 1800 keyboard |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "RGBController_HyperXEve1800.h"
using namespace std::chrono_literals;
#define HYPERX_EVE_1800_BRIGHTNESS_MIN 0x00
#define HYPERX_EVE_1800_BRIGHTNESS_MAX 0xFF
#define HYPERX_EVE_1800_ZONE_COUNT 10
/**------------------------------------------------------------------*\
@name HyperX Eve 1800
@category Keyboard
@type USB
@save :x:
@direct :white_check_mark:
@effects :x:
@detectors DetectHyperXEve1800
@comment
\*-------------------------------------------------------------------*/
RGBController_HyperXEve1800::RGBController_HyperXEve1800(HyperXEve1800Controller* controller_ptr)
{
controller = controller_ptr;
name = controller->GetNameString();
vendor = "HyperX";
type = DEVICE_TYPE_KEYBOARD;
description = "HyperX Eve 1800 Keyboard Device";
location = controller->GetDeviceLocation();
serial = controller->GetSerialString();
mode Direct;
Direct.name = "Direct";
Direct.value = 0xFFFF;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Direct.brightness_min = HYPERX_EVE_1800_BRIGHTNESS_MIN;
Direct.brightness_max = HYPERX_EVE_1800_BRIGHTNESS_MAX;
Direct.brightness = HYPERX_EVE_1800_BRIGHTNESS_MAX;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
SetupZones();
keepalive_thread_run = 1;
keepalive_thread = new std::thread(&RGBController_HyperXEve1800::KeepaliveThread, this);
}
RGBController_HyperXEve1800::~RGBController_HyperXEve1800()
{
keepalive_thread_run = 0;
keepalive_thread->join();
delete keepalive_thread;
Shutdown();
delete controller;
}
void RGBController_HyperXEve1800::SetupZones()
{
zone new_zone;
new_zone.name = "Keyboard";
new_zone.type = ZONE_TYPE_LINEAR;
new_zone.leds_min = HYPERX_EVE_1800_ZONE_COUNT;
new_zone.leds_max = HYPERX_EVE_1800_ZONE_COUNT;
new_zone.leds_count = HYPERX_EVE_1800_ZONE_COUNT;
zones.push_back(new_zone);
for(unsigned int led_idx = 0; led_idx < zones[0].leds_count; led_idx++)
{
led new_led;
new_led.name = "Zone ";
new_led.name.append(std::to_string(led_idx + 1));
leds.push_back(new_led);
}
SetupColors();
}
void RGBController_HyperXEve1800::DeviceUpdateLEDs()
{
controller->SetLEDsDirect(colors);
last_update_time = std::chrono::steady_clock::now();
}
void RGBController_HyperXEve1800::DeviceUpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_HyperXEve1800::DeviceUpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_HyperXEve1800::DeviceUpdateMode()
{
controller->SetBrightness(modes[active_mode].brightness);
DeviceUpdateLEDs();
}
void RGBController_HyperXEve1800::KeepaliveThread()
{
while(keepalive_thread_run.load())
{
if(active_mode == 0)
{
if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50))
{
UpdateLEDs();
}
}
std::this_thread::sleep_for(10ms);
}
}
@@ -1,37 +0,0 @@
/*---------------------------------------------------------*\
| RGBController_HyperXEve1800.h |
| |
| RGBController for HyperX Eve 1800 keyboard |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include <chrono>
#include "RGBController.h"
#include "HyperXEve1800Controller.h"
class RGBController_HyperXEve1800 : public RGBController
{
public:
RGBController_HyperXEve1800(HyperXEve1800Controller* controller_ptr);
~RGBController_HyperXEve1800();
void SetupZones();
void DeviceUpdateLEDs();
void DeviceUpdateZoneLEDs(int zone);
void DeviceUpdateSingleLED(int led);
void DeviceUpdateMode();
void KeepaliveThread();
private:
HyperXEve1800Controller* controller;
std::thread* keepalive_thread;
std::atomic<bool> keepalive_thread_run;
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
};
@@ -15,7 +15,6 @@
#include "HyperXAlloyOriginsController.h"
#include "HyperXAlloyOriginsCoreController.h"
#include "HyperXAlloyOrigins60and65Controller.h"
#include "HyperXEve1800Controller.h"
#include "HyperXOrigins2_65Controller.h"
#include "RGBController_HyperXAlloyElite.h"
#include "RGBController_HyperXAlloyElite2.h"
@@ -23,7 +22,6 @@
#include "RGBController_HyperXAlloyOrigins.h"
#include "RGBController_HyperXAlloyOriginsCore.h"
#include "RGBController_HyperXAlloyOrigins60and65.h"
#include "RGBController_HyperXEve1800.h"
#include "RGBController_HyperXOrigins2_65.h"
/*---------------------------------------------------------*\
@@ -48,7 +46,6 @@
#define HYPERX_ALLOY_ORIGINS_65_HP_PID 0x038F
#define HYPERX_ALLOY_ORIGINS_CORE_HP_PID 0x098F
#define HYPERX_ALLOY_ORIGINS_HP_PID 0x0591
#define HYPERX_EVE_1800_HP_PID 0x08C2
#define HYPERX_ORIGINS_2_65_HP_PID 0x0CC2
AlloyOrigins60and65MappingLayoutType GetAlloyOrigins60and65MappingLayoutType(int pid)
@@ -194,24 +191,6 @@ DetectedControllers DetectHyperXOrigins2_65(hid_device_info* info, const std::st
return(detected_controllers);
}
DetectedControllers DetectHyperXEve1800(hid_device_info* info, const std::string& name)
{
DetectedControllers detected_controllers;
hid_device* dev;
dev = hid_open_path(info->path);
if(dev)
{
HyperXEve1800Controller* controller = new HyperXEve1800Controller(dev, info->path, name);
RGBController_HyperXEve1800* rgb_controller = new RGBController_HyperXEve1800(controller);
detected_controllers.push_back(rgb_controller);
}
return detected_controllers;
}
REGISTER_HID_DETECTOR_IP("HyperX Alloy Elite RGB", DetectHyperXAlloyElite, HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ELITE_PID, 2, 0xFF01);
REGISTER_HID_DETECTOR_IP("HyperX Alloy FPS RGB", DetectHyperXAlloyFPS, HYPERX_KEYBOARD_VID, HYPERX_ALLOY_FPS_RGB_PID, 2, 0xFF01);
REGISTER_HID_DETECTOR_I("HyperX Alloy Origins Core", DetectHyperXAlloyOriginsCore, HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ORIGINS_CORE_PID, 2);
@@ -219,7 +198,6 @@ REGISTER_HID_DETECTOR_I("HyperX Alloy Origins Core", DetectHyperXAlloyOrigi
REGISTER_HID_DETECTOR_I("HyperX Alloy Origins Core (HP)", DetectHyperXAlloyOriginsCore, HP_KEYBOARD_VID, HYPERX_ALLOY_ORIGINS_CORE_HP_PID, 2);
REGISTER_HID_DETECTOR_I("HyperX Origins 2 65 (HP)", DetectHyperXOrigins2_65, HP_KEYBOARD_VID, HYPERX_ORIGINS_2_65_HP_PID, 3);
REGISTER_HID_DETECTOR_I("HyperX Eve 1800 (HP)", DetectHyperXEve1800, HP_KEYBOARD_VID, HYPERX_EVE_1800_HP_PID, 2);
#ifdef _WIN32
REGISTER_HID_DETECTOR_I("HyperX Alloy Origins", DetectHyperXAlloyOrigins, HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ORIGINS_PID, 3);
@@ -91,9 +91,11 @@ void RGBController_HyperXMicrophone::SetupZones()
{
led Top;
Top.name = "Top";
Top.value = 0;
led Bot;
Bot.name = "Bottom";
Bot.value = 1;
leds.push_back(Top);
leds.push_back(Bot);
@@ -91,6 +91,7 @@ void RGBController_HyperXMicrophoneV2::SetupZones()
{
led l;
l.name = "LED " + std::to_string(i);
l.value = led_mapping[i];
leds.push_back(l);
}
@@ -128,6 +128,7 @@ void RGBController_LogitechG213::SetupZones()
{
led new_led;
new_led.name = led_names[led_idx];
new_led.value = led_values[led_idx];
leds.push_back(new_led);
}
@@ -136,9 +137,9 @@ void RGBController_LogitechG213::SetupZones()
void RGBController_LogitechG213::DeviceUpdateLEDs()
{
for(std::size_t led_idx = 0; led_idx < colors.size(); led_idx++)
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
{
controller->SetDirect(led_values[led_idx], RGBGetRValue(colors[led_idx]), RGBGetGValue(colors[led_idx]), RGBGetBValue(colors[led_idx]));
controller->SetDirect((unsigned char)leds[led_idx].value, RGBGetRValue(colors[led_idx]), RGBGetGValue(colors[led_idx]), RGBGetBValue(colors[led_idx]));
}
}
@@ -149,7 +150,7 @@ void RGBController_LogitechG213::DeviceUpdateZoneLEDs(int zone)
void RGBController_LogitechG213::DeviceUpdateSingleLED(int led)
{
controller->SetDirect(led_values[led], RGBGetRValue(colors[led]), RGBGetGValue(colors[led]), RGBGetBValue(colors[led]));
controller->SetDirect(leds[led].value, RGBGetRValue(colors[led]), RGBGetGValue(colors[led]), RGBGetBValue(colors[led]));
}
void RGBController_LogitechG213::DeviceUpdateMode()
@@ -68,8 +68,10 @@ void RGBController_LogitechG560::SetupZones()
led G560_left_front_led;
G560_left_front_led.name = "Left Front";
G560_left_front_led.value = 0x00;
leds.push_back(G560_left_front_led);
zone G560_right_front;
G560_right_front.name = "Right Front";
G560_right_front.type = ZONE_TYPE_SINGLE;
@@ -80,6 +82,7 @@ void RGBController_LogitechG560::SetupZones()
led G560_right_front_led;
G560_right_front_led.name = "Right Front";
G560_right_front_led.value = 0x01;
leds.push_back(G560_right_front_led);
@@ -93,6 +96,7 @@ void RGBController_LogitechG560::SetupZones()
led G560_left_read_led;
G560_left_read_led.name = "Left Rear";
G560_left_read_led.value = 0x02;
leds.push_back(G560_left_read_led);
@@ -106,6 +110,7 @@ void RGBController_LogitechG560::SetupZones()
led G560_right_rear_led;
G560_right_rear_led.name = "Right Rear";
G560_right_rear_led.value = 0x03;
leds.push_back(G560_right_rear_led);
SetupColors();
@@ -119,7 +124,7 @@ void RGBController_LogitechG560::DeviceUpdateLEDs()
unsigned char grn = RGBGetGValue(colors[led_idx]);
unsigned char blu = RGBGetBValue(colors[led_idx]);
controller->SendSpeakerMode((unsigned char)led_idx, modes[active_mode].value, red, grn, blu);
controller->SendSpeakerMode((unsigned char)leds[led_idx].value, modes[active_mode].value, red, grn, blu);
}
}
@@ -1,89 +0,0 @@
/*---------------------------------------------------------*\
| MSILaptopController.cpp |
| |
| Driver for MSI laptop SteelSeries KLC/ALC RGB devices |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include <cstring>
#include "MSILaptopController.h"
#include "StringUtils.h"
#define MSI_LAPTOP_REPORT_ID 0x00
#define MSI_LAPTOP_COMMAND 0x0C
#define MSI_LAPTOP_KLC_PACKET_ID 0x66
#define MSI_LAPTOP_ALC_PACKET_ID 0x06
#define MSI_LAPTOP_PACKET_SIZE 525
#define MSI_LAPTOP_PAYLOAD_OFFSET 5
MSILaptopController::MSILaptopController(hid_device* dev_handle, const char* path, std::string dev_name, msi_laptop_device device_type)
{
dev = dev_handle;
location = path;
name = dev_name;
type = device_type;
}
MSILaptopController::~MSILaptopController()
{
hid_close(dev);
}
std::string MSILaptopController::GetDeviceLocation()
{
return("HID: " + location);
}
std::string MSILaptopController::GetDeviceName()
{
return(name);
}
std::string MSILaptopController::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));
}
msi_laptop_device MSILaptopController::GetDeviceType()
{
return(type);
}
void MSILaptopController::SetLEDs(std::vector<led> leds, std::vector<RGBColor> colors)
{
unsigned char buf[MSI_LAPTOP_PACKET_SIZE];
unsigned int led_count = (leds.size() < colors.size()) ? leds.size() : colors.size();
memset(buf, 0x00, sizeof(buf));
buf[0x00] = MSI_LAPTOP_REPORT_ID;
buf[0x01] = MSI_LAPTOP_COMMAND;
buf[0x03] = (type == MSI_LAPTOP_KLC) ? MSI_LAPTOP_KLC_PACKET_ID : MSI_LAPTOP_ALC_PACKET_ID;
for(unsigned int led_idx = 0; led_idx < led_count; led_idx++)
{
unsigned int offset = MSI_LAPTOP_PAYLOAD_OFFSET + (led_idx * 4);
if((offset + 3) >= sizeof(buf))
{
break;
}
buf[offset + 0] = leds[led_idx].value;
buf[offset + 1] = RGBGetRValue(colors[led_idx]);
buf[offset + 2] = RGBGetGValue(colors[led_idx]);
buf[offset + 3] = RGBGetBValue(colors[led_idx]);
}
hid_send_feature_report(dev, buf, sizeof(buf));
}
@@ -1,67 +0,0 @@
/*---------------------------------------------------------*\
| MSILaptopController.h |
| |
| Driver for MSI laptop SteelSeries KLC/ALC RGB devices |
| |
| 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"
typedef enum
{
MSI_LAPTOP_KLC,
MSI_LAPTOP_ALC,
} msi_laptop_device;
typedef struct
{
const char* name;
unsigned char id;
} msi_laptop_led;
struct MSILaptopModel
{
const char* sys_vendor;
const char* product_name;
/* Keyboard layout */
const msi_laptop_led* klc_leds;
unsigned int klc_leds_count;
unsigned int klc_matrix_height;
unsigned int klc_matrix_width;
const unsigned int* klc_matrix_map;
/* Lightbar layout */
const msi_laptop_led* alc_leds;
unsigned int alc_leds_count;
unsigned int alc_lightbar_leds;
};
class MSILaptopController
{
public:
MSILaptopController(hid_device* dev_handle, const char* path, std::string dev_name, msi_laptop_device device_type);
~MSILaptopController();
std::string GetDeviceLocation();
std::string GetDeviceName();
std::string GetSerialString();
msi_laptop_device GetDeviceType();
void SetLEDs(std::vector<led> leds, std::vector<RGBColor> colors);
private:
hid_device* dev;
std::string location;
std::string name;
msi_laptop_device type;
};
@@ -1,227 +0,0 @@
/*---------------------------------------------------------*\
| MSILaptopControllerDetect.cpp |
| |
| Detector for MSI laptop SteelSeries RGB devices |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "DetectionManager.h"
#include "RGBControllerKeyNames.h"
#include "RGBController_MSILaptop.h"
#include "MSILaptopController.h"
#include "dmiinfo.h"
#define MSI_LAPTOP_ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#define STEELSERIES_VID 0x1038
#define STEELSERIES_MSI_RAIDER_A18_KLC_PID 0x1122
#define STEELSERIES_MSI_RAIDER_A18_ALC_PID 0x1161
#define NA 0xFFFFFFFF
#define MSI_LAPTOP_KLC_MATRIX_HEIGHT 6
#define MSI_LAPTOP_KLC_MATRIX_WIDTH 23
#define MSI_LAPTOP_ALC_LIGHTBAR_LEDS 5
static const msi_laptop_led msi_raider_a18_klc_leds[] =
{
{ KEY_EN_A, 0x04 },
{ KEY_EN_B, 0x05 },
{ KEY_EN_C, 0x06 },
{ KEY_EN_D, 0x07 },
{ KEY_EN_E, 0x08 },
{ KEY_EN_F, 0x09 },
{ KEY_EN_G, 0x0A },
{ KEY_EN_H, 0x0B },
{ KEY_EN_I, 0x0C },
{ KEY_EN_J, 0x0D },
{ KEY_EN_K, 0x0E },
{ KEY_EN_L, 0x0F },
{ KEY_EN_M, 0x10 },
{ KEY_EN_N, 0x11 },
{ KEY_EN_O, 0x12 },
{ KEY_EN_P, 0x13 },
{ KEY_EN_Q, 0x14 },
{ KEY_EN_R, 0x15 },
{ KEY_EN_S, 0x16 },
{ KEY_EN_T, 0x17 },
{ KEY_EN_U, 0x18 },
{ KEY_EN_V, 0x19 },
{ KEY_EN_W, 0x1A },
{ KEY_EN_X, 0x1B },
{ KEY_EN_Y, 0x1C },
{ KEY_EN_Z, 0x1D },
{ KEY_EN_1, 0x1E },
{ KEY_EN_2, 0x1F },
{ KEY_EN_3, 0x20 },
{ KEY_EN_4, 0x21 },
{ KEY_EN_5, 0x22 },
{ KEY_EN_6, 0x23 },
{ KEY_EN_7, 0x24 },
{ KEY_EN_8, 0x25 },
{ KEY_EN_9, 0x26 },
{ KEY_EN_0, 0x27 },
{ KEY_EN_ESCAPE, 0x29 },
{ KEY_EN_TAB, 0x2B },
{ KEY_EN_SPACE, 0x2C },
{ KEY_EN_MINUS, 0x2D },
{ KEY_EN_EQUALS, 0x2E },
{ KEY_EN_LEFT_BRACKET, 0x2F },
{ KEY_EN_RIGHT_BRACKET, 0x30 },
{ KEY_EN_SEMICOLON, 0x33 },
{ KEY_EN_QUOTE, 0x34 },
{ KEY_EN_BACK_TICK, 0x35 },
{ KEY_EN_COMMA, 0x36 },
{ KEY_EN_PERIOD, 0x37 },
{ KEY_EN_FORWARD_SLASH, 0x38 },
{ KEY_EN_CAPS_LOCK, 0x39 },
{ KEY_EN_F1, 0x3A },
{ KEY_EN_F2, 0x3B },
{ KEY_EN_F3, 0x3C },
{ KEY_EN_F4, 0x3D },
{ KEY_EN_F5, 0x3E },
{ KEY_EN_F6, 0x3F },
{ KEY_EN_F7, 0x40 },
{ KEY_EN_F8, 0x41 },
{ KEY_EN_F9, 0x42 },
{ KEY_EN_F10, 0x43 },
{ KEY_EN_F11, 0x44 },
{ KEY_EN_F12, 0x45 },
{ KEY_EN_PRINT_SCREEN, 0x46 },
{ KEY_EN_SCROLL_LOCK, 0x47 },
{ KEY_EN_INSERT, 0x49 },
{ "Home/Page Up", 0x4B },
{ KEY_EN_DELETE, 0x4C },
{ KEY_EN_PAGE_DOWN, 0x4E },
{ KEY_EN_RIGHT_ARROW, 0x4F },
{ KEY_EN_LEFT_ARROW, 0x50 },
{ KEY_EN_DOWN_ARROW, 0x51 },
{ KEY_EN_UP_ARROW, 0x52 },
{ KEY_EN_NUMPAD_LOCK, 0x53 },
{ KEY_EN_NUMPAD_DIVIDE, 0x54 },
{ KEY_EN_NUMPAD_TIMES, 0x55 },
{ KEY_EN_NUMPAD_MINUS, 0x56 },
{ KEY_EN_NUMPAD_PLUS, 0x57 },
{ KEY_EN_NUMPAD_ENTER, 0x58 },
{ KEY_EN_NUMPAD_1, 0x59 },
{ KEY_EN_NUMPAD_2, 0x5A },
{ KEY_EN_NUMPAD_3, 0x5B },
{ KEY_EN_NUMPAD_4, 0x5C },
{ KEY_EN_NUMPAD_5, 0x5D },
{ KEY_EN_NUMPAD_6, 0x5E },
{ KEY_EN_NUMPAD_7, 0x5F },
{ KEY_EN_NUMPAD_8, 0x60 },
{ KEY_EN_NUMPAD_9, 0x61 },
{ KEY_EN_NUMPAD_0, 0x62 },
{ KEY_EN_NUMPAD_PERIOD, 0x63 },
{ KEY_EN_POWER, 0x66 },
{ KEY_EN_LEFT_CONTROL, 0xE0 },
{ KEY_EN_LEFT_SHIFT, 0xE1 },
{ KEY_EN_LEFT_ALT, 0xE2 },
{ KEY_EN_LEFT_WINDOWS, 0xE3 },
{ KEY_EN_RIGHT_WINDOWS, 0xE4 },
{ KEY_EN_RIGHT_FUNCTION, 0xF0 },
{ KEY_EN_ANSI_ENTER, 0x28 },
{ KEY_EN_BACKSPACE, 0x2A },
{ KEY_EN_BACK_SLASH, 0x31 },
{ KEY_EN_ISO_BACK_SLASH, 0x64 },
{ KEY_EN_RIGHT_SHIFT, 0xE5 },
{ KEY_EN_RIGHT_ALT, 0xE6 },
};
static unsigned int msi_raider_a18_klc_matrix_map[MSI_LAPTOP_KLC_MATRIX_HEIGHT][MSI_LAPTOP_KLC_MATRIX_WIDTH] =
{
{ 36, NA, 50, 51, 52, 53, NA, 54, 55, 56, 57, NA, 58, 59, 60, 61, 62, 63, NA, NA, NA, NA, 89 },
{ 45, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 39, 40, 97, NA, 64, 65, NA, 72, 73, 74, 75, NA },
{ 37, 16, 22, 4, 17, 19, 24, 20, 8, 14, 15, 41, 42, 98, NA, 66, 67, NA, 84, 85, 86, 76, NA },
{ 49, 0, 18, 3, 5, 6, 7, 9, 10, 11, 43, 44, 96, NA, NA, NA, NA, NA, 81, 82, 83, NA, NA },
{ 91, 25, 23, 2, 21, 1, 13, 12, 46, 47, 48,100, NA, NA, NA, NA, 71, NA, 78, 79, 80, 77, NA },
{ 90, 93, 92, NA, NA, NA, 38, NA, NA, NA,101, 94, 95, NA, 69, 70, 68, NA, 87, NA, 88, NA, NA },
};
static const msi_laptop_led msi_raider_a18_alc_leds[] =
{
{ "Lightbar 1", 0x00 },
{ "Lightbar 2", 0x01 },
{ "Lightbar 3", 0x02 },
{ "Lightbar 4", 0x03 },
{ "Lightbar 5", 0x04 },
{ "Logo", 0x05 },
};
static const MSILaptopModel msi_laptop_models[] =
{
{
"Micro-Star International Co., Ltd.",
"Raider A18 HX A9WJG",
/* Keyboard layout */
msi_raider_a18_klc_leds,
MSI_LAPTOP_ARRAY_SIZE(msi_raider_a18_klc_leds),
MSI_LAPTOP_KLC_MATRIX_HEIGHT,
MSI_LAPTOP_KLC_MATRIX_WIDTH,
(const unsigned int*)msi_raider_a18_klc_matrix_map,
/* Lightbar layout */
msi_raider_a18_alc_leds,
MSI_LAPTOP_ARRAY_SIZE(msi_raider_a18_alc_leds),
MSI_LAPTOP_ALC_LIGHTBAR_LEDS,
},
};
static const MSILaptopModel* GetMSILaptopModelDMI()
{
DMIInfo dmi;
for(unsigned int i = 0; i < MSI_LAPTOP_ARRAY_SIZE(msi_laptop_models); i++)
{
if((dmi.getManufacturer() == msi_laptop_models[i].sys_vendor) &&
(dmi.getProductName() == msi_laptop_models[i].product_name))
{
return &msi_laptop_models[i];
}
}
return nullptr;
}
DetectedControllers DetectMSILaptop(hid_device_info* info, const std::string& name)
{
DetectedControllers detected_controllers;
const MSILaptopModel* model = GetMSILaptopModelDMI();
if(model)
{
msi_laptop_device device_type;
if(info->product_id == STEELSERIES_MSI_RAIDER_A18_KLC_PID)
{
device_type = MSI_LAPTOP_KLC;
}
else if(info->product_id == STEELSERIES_MSI_RAIDER_A18_ALC_PID)
{
device_type = MSI_LAPTOP_ALC;
}
else
{
return(detected_controllers);
}
hid_device* dev = hid_open_path(info->path);
if(dev)
{
MSILaptopController* controller = new MSILaptopController(dev, info->path, name, device_type);
RGBController_MSILaptop* rgb_controller = new RGBController_MSILaptop(controller, model);
detected_controllers.push_back(rgb_controller);
}
}
return(detected_controllers);
}
REGISTER_HID_DETECTOR_I("MSI Laptop Keyboard", DetectMSILaptop, STEELSERIES_VID, STEELSERIES_MSI_RAIDER_A18_KLC_PID, 0);
REGISTER_HID_DETECTOR_I("MSI Laptop Lightbar", DetectMSILaptop, STEELSERIES_VID, STEELSERIES_MSI_RAIDER_A18_ALC_PID, 0);
@@ -1,126 +0,0 @@
/*---------------------------------------------------------*\
| RGBController_MSILaptop.cpp |
| |
| RGBController for MSI laptop SteelSeries RGB devices |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "RGBControllerKeyNames.h"
#include "RGBController_MSILaptop.h"
#define NA 0xFFFFFFFF
/**------------------------------------------------------------------*\
@name MSI Laptop SteelSeries RGB
@category Keyboard
@type USB
@save :x:
@direct :white_check_mark:
@effects :x:
@detectors DetectMSILaptop
@comment
\*-------------------------------------------------------------------*/
RGBController_MSILaptop::RGBController_MSILaptop(MSILaptopController* controller_ptr, const MSILaptopModel* model_ptr)
{
controller = controller_ptr;
model = model_ptr;
name = controller->GetDeviceName();
vendor = "SteelSeries";
description = std::string(model->sys_vendor) + " " + std::string(model->product_name) + " RGB Device";
location = controller->GetDeviceLocation();
serial = controller->GetSerialString();
type = (controller->GetDeviceType() == MSI_LAPTOP_KLC) ? DEVICE_TYPE_KEYBOARD : DEVICE_TYPE_LEDSTRIP;
mode Direct;
Direct.name = "Direct";
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
SetupZones();
}
RGBController_MSILaptop::~RGBController_MSILaptop()
{
Shutdown();
delete controller;
}
void RGBController_MSILaptop::SetupZones()
{
if(controller->GetDeviceType() == MSI_LAPTOP_KLC)
{
zone keyboard_zone;
keyboard_zone.name = ZONE_EN_KEYBOARD;
keyboard_zone.type = ZONE_TYPE_MATRIX;
keyboard_zone.leds_min = model->klc_leds_count;
keyboard_zone.leds_max = model->klc_leds_count;
keyboard_zone.leds_count = model->klc_leds_count;
keyboard_zone.matrix_map.Set(model->klc_matrix_height, model->klc_matrix_width, (unsigned int *)model->klc_matrix_map);
zones.push_back(keyboard_zone);
for(unsigned int led_idx = 0; led_idx < model->klc_leds_count; led_idx++)
{
led new_led;
new_led.name = model->klc_leds[led_idx].name;
new_led.value = model->klc_leds[led_idx].id;
leds.push_back(new_led);
}
}
else
{
zone lightbar_zone;
lightbar_zone.name = "Lightbar";
lightbar_zone.type = ZONE_TYPE_LINEAR;
lightbar_zone.start_idx = 0;
lightbar_zone.leds_min = model->alc_lightbar_leds;
lightbar_zone.leds_max = model->alc_lightbar_leds;
lightbar_zone.leds_count = model->alc_lightbar_leds;
zones.push_back(lightbar_zone);
zone logo_zone;
logo_zone.name = "Logo";
logo_zone.type = ZONE_TYPE_SINGLE;
logo_zone.start_idx = model->alc_lightbar_leds;
logo_zone.leds_min = 1;
logo_zone.leds_max = 1;
logo_zone.leds_count = 1;
zones.push_back(logo_zone);
for(unsigned int led_idx = 0; led_idx < model->alc_leds_count; led_idx++)
{
led new_led;
new_led.name = model->alc_leds[led_idx].name;
new_led.value = model->alc_leds[led_idx].id;
leds.push_back(new_led);
}
}
SetupColors();
}
void RGBController_MSILaptop::DeviceUpdateLEDs()
{
controller->SetLEDs(leds, colors);
}
void RGBController_MSILaptop::DeviceUpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_MSILaptop::DeviceUpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_MSILaptop::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}
@@ -1,32 +0,0 @@
/*---------------------------------------------------------*\
| RGBController_MSILaptop.h |
| |
| RGBController for MSI laptop SteelSeries RGB devices |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include "RGBController.h"
#include "MSILaptopController.h"
class RGBController_MSILaptop : public RGBController
{
public:
RGBController_MSILaptop(MSILaptopController* controller_ptr, const MSILaptopModel* model_ptr);
~RGBController_MSILaptop();
void SetupZones();
void DeviceUpdateLEDs();
void DeviceUpdateZoneLEDs(int zone);
void DeviceUpdateSingleLED(int led);
void DeviceUpdateMode();
private:
MSILaptopController* controller;
const MSILaptopModel* model;
};
@@ -1,297 +0,0 @@
/*---------------------------------------------------------*\
| RGBController_RealtekBridge.cpp |
| |
| Controller for Realtek USB to SSD Bridge ICs |
| |
| Jerry Fan (JerryFan0612) 13 Mar 2026 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "RGBController_RealtekBridge.h"
/**------------------------------------------------------------------*\
@name Realtek Bridge Device
@category Storage
@type USB
@save :x:
@direct :rotating_light:
@effects :white_check_mark:
@detectors RealtekBridgeControllerDetect
@comment
\*-------------------------------------------------------------------*/
RGBController_RealtekBridge::RGBController_RealtekBridge(RealtekBridgeController* controller_ptr)
{
controller = controller_ptr;
name = controller_ptr->get_product_name();
vendor = controller_ptr->get_manu_name();
location = controller_ptr->get_dev_loc();
serial = controller_ptr->get_sn();
version = controller_ptr->get_fw_ver();
description = vendor + "Storage Device";
type = DEVICE_TYPE_STORAGE;
SetupModes();
SetupZones();
}
RGBController_RealtekBridge::~RGBController_RealtekBridge()
{
Shutdown();
delete controller;
}
void RGBController_RealtekBridge::SetupModes()
{
int brightness = controller->get_argb_brightness() >> 8;
mode Direct;
Direct.name = "Direct";
Direct.value = REALTEK_BRIDGE_LED_EFF_NONE;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Direct.color_mode = MODE_COLORS_PER_LED;
Direct.brightness_min = 0;
Direct.brightness_max = 255;
Direct.brightness = brightness;
modes.push_back(Direct);
mode Static;
Static.name = "Static";
Static.value = REALTEK_BRIDGE_LED_EFF_ALWAYS;
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.colors.resize(1);
Static.brightness_min = 0;
Static.brightness_max = 255;
Static.brightness = brightness;
modes.push_back(Static);
mode Blink;
Blink.name = "Blink";
Blink.value = REALTEK_BRIDGE_LED_EFF_BLINK;
Blink.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED;
Blink.speed_min = REALTEK_BRIDGE_SPEED_MIN;
Blink.speed_max = REALTEK_BRIDGE_SPEED_MAX;
Blink.speed = REALTEK_BRIDGE_SPEED_NORMAL;
Blink.colors_min = 1;
Blink.colors_max = 1;
Blink.color_mode = MODE_COLORS_MODE_SPECIFIC;
Blink.colors.resize(1);
Blink.brightness_min = 0;
Blink.brightness_max = 255;
Blink.brightness = brightness;
modes.push_back(Blink);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = REALTEK_BRIDGE_LED_EFF_BREATHE;
Breathing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED;
Breathing.speed_min = REALTEK_BRIDGE_SPEED_MIN;
Breathing.speed_max = REALTEK_BRIDGE_SPEED_MAX;
Breathing.speed = REALTEK_BRIDGE_SPEED_NORMAL;
Breathing.colors_min = 1;
Breathing.colors_max = 1;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.colors.resize(1);
Breathing.brightness_min = 0;
Breathing.brightness_max = 255;
Breathing.brightness = brightness;
modes.push_back(Breathing);
mode Spectrum;
Spectrum.name = "Spectrum";
Spectrum.value = REALTEK_BRIDGE_LED_EFF_SPECTRUM;
Spectrum.flags = MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED;
Spectrum.speed_min = REALTEK_BRIDGE_SPEED_MIN;
Spectrum.speed_max = REALTEK_BRIDGE_SPEED_MAX;
Spectrum.speed = REALTEK_BRIDGE_SPEED_NORMAL;
Spectrum.color_mode = MODE_COLORS_NONE;
Spectrum.brightness_min = 0;
Spectrum.brightness_max = 255;
Spectrum.brightness = brightness;
modes.push_back(Spectrum);
mode Scroll;
Scroll.name = "Scroll";
Scroll.value = REALTEK_BRIDGE_LED_EFF_SCROLL;
Scroll.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED;
Scroll.speed_min = REALTEK_BRIDGE_SPEED_MIN;
Scroll.speed_max = REALTEK_BRIDGE_SPEED_MAX;
Scroll.speed = REALTEK_BRIDGE_SPEED_NORMAL;
Scroll.colors_min = 1;
Scroll.colors_max = 1;
Scroll.color_mode = MODE_COLORS_MODE_SPECIFIC;
Scroll.colors.resize(1);
Scroll.brightness_min = 0;
Scroll.brightness_max = 255;
Scroll.brightness = brightness;
modes.push_back(Scroll);
mode RainbowScroll;
RainbowScroll.name = "Rainbow Scroll";
RainbowScroll.value = REALTEK_BRIDGE_LED_EFF_RAINBOW_SCROLL;
RainbowScroll.flags = MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED;
RainbowScroll.speed_min = REALTEK_BRIDGE_SPEED_MIN;
RainbowScroll.speed_max = REALTEK_BRIDGE_SPEED_MAX;
RainbowScroll.speed = REALTEK_BRIDGE_SPEED_NORMAL;
RainbowScroll.color_mode = MODE_COLORS_NONE;
RainbowScroll.brightness_min = 0;
RainbowScroll.brightness_max = 255;
RainbowScroll.brightness = brightness;
modes.push_back(RainbowScroll);
mode RunningWater;
RunningWater.name = "Running Water";
RunningWater.value = REALTEK_BRIDGE_LED_EFF_RUNNING_WATER;
RunningWater.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED;
RunningWater.speed_min = REALTEK_BRIDGE_SPEED_MIN;
RunningWater.speed_max = REALTEK_BRIDGE_SPEED_MAX;
RunningWater.speed = REALTEK_BRIDGE_SPEED_NORMAL;
RunningWater.colors_min = 1;
RunningWater.colors_max = 1;
RunningWater.color_mode = MODE_COLORS_MODE_SPECIFIC;
RunningWater.colors.resize(1);
RunningWater.brightness_min = 0;
RunningWater.brightness_max = 255;
RunningWater.brightness = brightness;
modes.push_back(RunningWater);
mode Sliding;
Sliding.name = "Sliding";
Sliding.value = REALTEK_BRIDGE_LED_EFF_SLIDING;
Sliding.flags = MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED;
Sliding.speed_min = REALTEK_BRIDGE_SPEED_MIN;
Sliding.speed_max = REALTEK_BRIDGE_SPEED_MAX;
Sliding.speed = REALTEK_BRIDGE_SPEED_NORMAL;
Sliding.color_mode = MODE_COLORS_NONE;
Sliding.brightness_min = 0;
Sliding.brightness_max = 255;
Sliding.brightness = brightness;
modes.push_back(Sliding);
mode NewtonCradle;
NewtonCradle.name = "Newton Cradle";
NewtonCradle.value = REALTEK_BRIDGE_LED_EFF_NEWTON_CRADLE;
NewtonCradle.flags = MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED;
NewtonCradle.speed_min = REALTEK_BRIDGE_SPEED_MIN;
NewtonCradle.speed_max = REALTEK_BRIDGE_SPEED_MAX;
NewtonCradle.speed = REALTEK_BRIDGE_SPEED_NORMAL;
NewtonCradle.color_mode = MODE_COLORS_NONE;
NewtonCradle.brightness_min = 0;
NewtonCradle.brightness_max = 255;
NewtonCradle.brightness = brightness;
modes.push_back(NewtonCradle);
mode Meteor;
Meteor.name = "Meteor";
Meteor.value = REALTEK_BRIDGE_LED_EFF_METEOR;
Meteor.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED;
Meteor.speed_min = REALTEK_BRIDGE_SPEED_MIN;
Meteor.speed_max = REALTEK_BRIDGE_SPEED_MAX;
Meteor.speed = REALTEK_BRIDGE_SPEED_NORMAL;
Meteor.colors_min = 1;
Meteor.colors_max = 1;
Meteor.color_mode = MODE_COLORS_MODE_SPECIFIC;
Meteor.colors.resize(1);
Meteor.brightness_min = 0;
Meteor.brightness_max = 255;
Meteor.brightness = brightness;
modes.push_back(Meteor);
}
void RGBController_RealtekBridge::SetupZones()
{
zone argb_zone;
argb_zone.name = "strip";
argb_zone.type = ZONE_TYPE_LINEAR;
argb_zone.leds_min = controller->get_argb_num();
argb_zone.leds_max = controller->get_argb_num();
argb_zone.leds_count = controller->get_argb_num();
zones.push_back(argb_zone);
for(unsigned int led_idx = 0; led_idx < argb_zone.leds_count; led_idx++)
{
led StripLED;
StripLED.name = "led ";
StripLED.name.append(std::to_string(led_idx + 1));
leds.push_back(StripLED);
}
SetupColors();
}
void RGBController_RealtekBridge::DeviceUpdateLEDs()
{
UpdateZoneLEDs(0);
}
void RGBController_RealtekBridge::DeviceUpdateZoneLEDs(int /*zone*/)
{
unsigned short brightness = 0xFF;
mode& curr_mode = modes[active_mode];
if(curr_mode.color_mode == MODE_COLORS_PER_LED &&
curr_mode.value == REALTEK_BRIDGE_LED_EFF_NONE) //direct mode
{
if(curr_mode.flags & MODE_FLAG_HAS_BRIGHTNESS)
{
brightness = curr_mode.brightness;
}
controller->set_argb_direct(colors, brightness);
}
else
{
UpdateSingleLED(0);
}
}
void RGBController_RealtekBridge::DeviceUpdateSingleLED(int /*led*/)
{
unsigned char speed = REALTEK_BRIDGE_SPEED_NORMAL;
unsigned char dir = 0;
unsigned short brightness = 0xFF;
mode& curr_mode = modes[active_mode];
std::vector<RGBColor> rtk_colors = curr_mode.colors;
if(curr_mode.flags & MODE_FLAG_HAS_SPEED)
{
speed = curr_mode.speed;
}
if(curr_mode.flags & MODE_FLAG_HAS_BRIGHTNESS)
{
brightness = curr_mode.brightness;
}
if(curr_mode.flags & MODE_FLAG_HAS_DIRECTION_LR)
{
if(curr_mode.direction == MODE_DIRECTION_RIGHT)
{
dir = 1;
}
}
if(curr_mode.color_mode == MODE_COLORS_PER_LED)
{
rtk_colors = colors;
}
else if(curr_mode.color_mode == MODE_COLORS_NONE)
{
rtk_colors.clear();
}
controller->set_argb_effect(curr_mode.value, rtk_colors, speed, brightness);
}
void RGBController_RealtekBridge::DeviceUpdateMode()
{
if(modes[active_mode].value != REALTEK_BRIDGE_LED_EFF_NONE)
{
DeviceUpdateLEDs();
}
}
@@ -1,34 +0,0 @@
/*---------------------------------------------------------*\
| RGBController_RealtekBridge.h |
| |
| Controller for Realtek USB to SSD Bridge ICs |
| |
| Jerry Fan (JerryFan0612) 13 Mar 2026 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include "RGBController.h"
#include "RealtekBridgeController.h"
class RGBController_RealtekBridge : public RGBController
{
public:
RGBController_RealtekBridge(RealtekBridgeController* controller_ptr);
~RGBController_RealtekBridge();
void SetupModes();
void SetupZones();
void DeviceUpdateLEDs();
void DeviceUpdateZoneLEDs(int zone);
void DeviceUpdateSingleLED(int led);
void DeviceUpdateMode();
private:
RealtekBridgeController* controller;
};
@@ -1,803 +0,0 @@
/*---------------------------------------------------------*\
| RealtekBridgeController.cpp |
| |
| Controller for Realtek USB to SSD Bridge ICs |
| |
| Jerry Fan (JerryFan0612) 13 Mar 2026 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "RealtekBridgeController.h"
#include "hsv.h"
#include <StringUtils.h>
#include <MathUtils.h>
static const unsigned char hid_set_packet[] =
{
0x56, 0x53, 0x42, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xE3,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const unsigned char hid_get_packet[] =
{
0x56, 0x53, 0x42, 0x43, 0x78, 0x56, 0x34, 0x12, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x10, 0xE2,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const unsigned char hid_end_packet[] =
{
0x58, 0x53, 0x42, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
RealtekBridgeController::RealtekBridgeController(hid_device* dev, hid_device_info* info)
{
hdev = dev;
hidinfo = info;
brctl_data = (unsigned char*)calloc(REALTEK_BRIDGE_CTL_DATA_SIZE, 1);
memset(brctl_data, 0, REALTEK_BRIDGE_CTL_DATA_SIZE);
set_write_unlock();
get_brctl_hdr();
get_brctl_data();
set_appctl(true);
}
RealtekBridgeController::~RealtekBridgeController()
{
if(hdev)
{
set_appctl(false);
hid_close(hdev);
hdev = NULL;
}
memset(brctl_hdr, 0, REALTEK_BRIDGE_CTL_HDR_SIZE);
free(brctl_data);
}
int RealtekBridgeController::usb_hid_ioctl(unsigned char* usb_buf, unsigned char* data, int data_len,
unsigned int offset, unsigned char is_in)
{
int id;
int ret = 0;
int buf_len = usb_hid_get_report(data_len, &id);
if(!is_in && data_len)
{
usb_buf[0x04] = data[0];
}
memcpy(&usb_buf[0x08], &data_len, sizeof(data_len));
memcpy(&usb_buf[0x1B], &data_len, sizeof(data_len));
ret = hid_send_feature_report(hdev, usb_buf, sizeof(hid_get_packet));
memset(usb_buf, 0x00, buf_len);
memcpy(usb_buf, data, data_len);
usb_buf[0x00] = id;
if(is_in)
{
ret = hid_get_feature_report(hdev, usb_buf, buf_len);
memcpy(data, usb_buf + offset, data_len);
}
else
{
ret = hid_send_feature_report(hdev, usb_buf, buf_len);
}
memset(usb_buf, 0x00, buf_len);
memcpy(usb_buf, hid_end_packet, sizeof(hid_end_packet));
ret = hid_get_feature_report(hdev, usb_buf, sizeof(hid_end_packet));
free(usb_buf);
return (ret > 0) ? 0 : ret;
}
int RealtekBridgeController::usb_hid_get_report(int data_len, int* id)
{
int retlen = 0;
if(data_len <= REALTEK_BRIDGE_HID_DATALEN_CH2)
{
*id = REALTEK_BRIDGE_HID_ID_DATA_CH2;
retlen = REALTEK_BRIDGE_HID_DATALEN_CH2;
}
else if(data_len <= REALTEK_BRIDGE_HID_DATALEN_CH3)
{
*id = REALTEK_BRIDGE_HID_ID_DATA_CH3;
retlen = REALTEK_BRIDGE_HID_DATALEN_CH3;
}
else if(data_len <= REALTEK_BRIDGE_HID_DATALEN_CH4)
{
*id = REALTEK_BRIDGE_HID_ID_DATA_CH4;
retlen = REALTEK_BRIDGE_HID_DATALEN_CH4;
}
else if(data_len <= REALTEK_BRIDGE_HID_DATALEN_CH5)
{
*id = REALTEK_BRIDGE_HID_ID_DATA_CH5;
retlen = REALTEK_BRIDGE_HID_DATALEN_CH5;
}
else
{
*id = REALTEK_BRIDGE_HID_ID_DATA_CH1;
retlen = REALTEK_BRIDGE_HID_DATALEN_CH1;
}
return retlen;
}
int RealtekBridgeController::set_write_unlock()
{
int ret = 0;
int buf_len = REALTEK_BRIDGE_HID_DATALEN_CH1;
int data_len = 96;
unsigned int addr = 0xAC004000;
unsigned char* data = (unsigned char*)calloc(data_len, 1);
unsigned char* usb_buf = (unsigned char*)calloc(buf_len, 1);// will release in usb_hid_ioctl function
memset(usb_buf, 0x00, buf_len);
memcpy(usb_buf, hid_get_packet, sizeof(hid_get_packet));
usb_buf[0x13] = 0x92;
memcpy(&usb_buf[0x17], &addr, sizeof(addr));
ret = usb_hid_ioctl(usb_buf, data, data_len, 0, true);
free(data);
return ret;
}
int RealtekBridgeController::get_brctl_hdr()
{
int buf_len = REALTEK_BRIDGE_HID_DATALEN_CH1;
unsigned char* usb_buf = (unsigned char*)calloc(buf_len, 1);// will release in usb_hid_ioctl function
memset(usb_buf, 0x00, buf_len);
memcpy(usb_buf, hid_get_packet, sizeof(hid_get_packet));
usb_buf[0x13] = 0xCC;
usb_buf[0x14] = 0x02;
return usb_hid_ioctl(usb_buf, brctl_hdr, REALTEK_BRIDGE_CTL_HDR_SIZE, 0, true);
}
int RealtekBridgeController::set_brctl_hdr()
{
int buf_len = REALTEK_BRIDGE_HID_DATALEN_CH1;
unsigned char* usb_buf = (unsigned char*)calloc(buf_len, 1);// will release in usb_hid_ioctl function
memset(usb_buf, 0x00, buf_len);
memcpy(usb_buf, hid_set_packet, sizeof(hid_set_packet));
usb_buf[0x13] = 0x4C;
usb_buf[0x14] = 0x02;
return usb_hid_ioctl(usb_buf, brctl_hdr, REALTEK_BRIDGE_CTL_HDR_SIZE, 0, false);
}
int RealtekBridgeController::get_brctl_data()
{
int buf_len = REALTEK_BRIDGE_HID_DATALEN_CH1;
int offset = REALTEK_BRIDGE_CTL_HDR_SIZE;
unsigned char* usb_buf = (unsigned char*)calloc(buf_len, 1);// will release in usb_hid_ioctl function
memset(usb_buf, 0x00, buf_len);
memcpy(usb_buf, hid_get_packet, sizeof(hid_get_packet));
usb_buf[0x13] = 0xCC;
usb_buf[0x14] = 0x02;
memcpy(&usb_buf[0x17], &offset, sizeof(offset));
return usb_hid_ioctl(usb_buf, brctl_data, REALTEK_BRIDGE_CTL_DATA_SIZE, 0, true);
}
int RealtekBridgeController::set_brctl_data()
{
int buf_len = REALTEK_BRIDGE_HID_DATALEN_CH1;
int offset = REALTEK_BRIDGE_CTL_HDR_SIZE;
unsigned char* usb_buf = (unsigned char*)calloc(buf_len, 1);// will release in usb_hid_ioctl function
memset(usb_buf, 0x00, buf_len);
memcpy(usb_buf, hid_set_packet, sizeof(hid_set_packet));
usb_buf[0x13] = 0x4C;
usb_buf[0x14] = 0x02;
memcpy(&usb_buf[0x17], &offset, sizeof(offset));
return usb_hid_ioctl(usb_buf, brctl_data, REALTEK_BRIDGE_CTL_DATA_SIZE, 0, false);
}
unsigned char RealtekBridgeController::get_support_openrgb()
{
int buf_len = REALTEK_BRIDGE_HID_DATALEN_CH1;
unsigned char is_support = 0;
unsigned char* usb_buf = (unsigned char*)calloc(buf_len, 1);// will release in usb_hid_ioctl function
memset(usb_buf, 0x00, buf_len);
memcpy(usb_buf, hid_get_packet, sizeof(hid_get_packet));
usb_buf[0x13] = 0xCC;
usb_buf[0x14] = 0x04;
usb_buf[0x15] = REALTEK_BRIDGE_SYNC_METHOD_OPENRGB;
if(usb_hid_ioctl(usb_buf, &is_support, sizeof(is_support), 0, true))
{
is_support = 0;
}
return is_support;
}
std::string RealtekBridgeController::get_manu_name()
{
return StringUtils::wchar_to_char(hidinfo->manufacturer_string);
}
std::string RealtekBridgeController::get_product_name()
{
return StringUtils::wchar_to_char(hidinfo->product_string);
}
std::string RealtekBridgeController::get_sn()
{
return StringUtils::wchar_to_char(hidinfo->serial_number);
}
std::string RealtekBridgeController::get_dev_loc()
{
std::string location = hidinfo->path;
return("HID: " + location);
}
std::string RealtekBridgeController::get_fw_ver()
{
struct RealtekBridgeControllerFWVersion fw_ver;
std::string ver = "";
int buf_len = REALTEK_BRIDGE_HID_DATALEN_CH1;
unsigned char* usb_buf = (unsigned char*)calloc(buf_len, 1);// will release in usb_hid_ioctl function
memset(usb_buf, 0x00, buf_len);
memcpy(usb_buf, hid_get_packet, sizeof(hid_get_packet));
usb_buf[0x13] = 0xA5;
if(!usb_hid_ioctl(usb_buf, (unsigned char*)&fw_ver, sizeof(fw_ver), 0, true))
{
ver += std::to_string(fw_ver.fw_major_ver) + "." +
std::to_string(fw_ver.fw_minor_ver) + "." +
std::to_string(fw_ver.fw_extra_ver) + "." +
std::to_string(fw_ver.fw_build_date);
}
return ver;
}
int RealtekBridgeController::get_argb_num()
{
int num_rgb = 0;
memcpy(&num_rgb, &brctl_hdr[24], sizeof(num_rgb));
return num_rgb;
}
int RealtekBridgeController::get_argb_brightness()
{
int bright = 0;
memcpy(&bright, &brctl_hdr[28], 2);
return bright;
}
int RealtekBridgeController::set_argb_brightness(unsigned short bright)
{
memcpy(&brctl_hdr[28], &bright, sizeof(bright));
set_brctl_hdr();
return 0;
}
int RealtekBridgeController::set_appctl(unsigned char ctl_sts)
{
int buf_len = REALTEK_BRIDGE_HID_DATALEN_CH1;
unsigned char* usb_buf = (unsigned char*)calloc(buf_len, 1);// will release in usb_hid_ioctl function
memset(usb_buf, 0x00, buf_len);
memcpy(usb_buf, hid_set_packet, sizeof(hid_set_packet));
usb_buf[0x13] = 0x4C;
usb_buf[0x14] = 0x01;
usb_buf[0x15] = ctl_sts;
return usb_hid_ioctl(usb_buf, &ctl_sts, sizeof(ctl_sts), 0, false);
}
int RealtekBridgeController::set_direct(unsigned char* color, int color_num)
{
int buf_len = REALTEK_BRIDGE_HID_DATALEN_CH1;
int data_len = color_num * REALTEK_BRIDGE_COLOR_DEPTH;
unsigned char* usb_buf = (unsigned char*)calloc(buf_len, 1);// will release in usb_hid_ioctl function
memset(usb_buf, 0x00, buf_len);
memcpy(usb_buf, hid_set_packet, sizeof(hid_set_packet));
usb_buf[0x13] = 0x4C;
usb_buf[0x14] = 0x03;
usb_buf[0x15] = REALTEK_BRIDGE_SYNC_METHOD_OPENRGB;
memcpy(&usb_buf[0x17], &color_num, sizeof(color_num));
return usb_hid_ioctl(usb_buf, color, data_len, 0, false);
}
int RealtekBridgeController::eff_set_always_on(RGBColor rgb)
{
int i;
int j;
int row = 1;
int maxrow = REALTEK_BRIDGE_MAX_APPCTL_ROW;
int single_size = maxrow * REALTEK_BRIDGE_COLOR_DEPTH + 32;
memset(brctl_data, 0, REALTEK_BRIDGE_CTL_DATA_SIZE);
for(i = 0; i < get_argb_num(); i++)
{
brctl_data[i * single_size + 0] = 1;
brctl_data[i * single_size + 1] = row;
for(j = 0; j < row; j++)
{
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 32] = RGBGetRValue(rgb);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 33] = RGBGetGValue(rgb);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 34] = RGBGetBValue(rgb);
}
}
return set_brctl_data();
}
int RealtekBridgeController::eff_set_blink(RGBColor rgb, int cycle)
{
int i;
int j;
int row = 2;
int maxrow = REALTEK_BRIDGE_MAX_APPCTL_ROW;
int single_size = maxrow * REALTEK_BRIDGE_COLOR_DEPTH + 32;
memset(brctl_data, 0, REALTEK_BRIDGE_CTL_DATA_SIZE);
for(i = 0; i < get_argb_num(); i++)
{
brctl_data[i * single_size + 0] = 2;
brctl_data[i * single_size + 1] = row;
memcpy(&brctl_data[i * single_size + 2], &cycle, 2);
brctl_data[i * single_size + 8] = 1;
for(j = 0; j < row; j++)
{
if((j & 0x1) == 0)
{
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 32] = RGBGetRValue(rgb);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 33] = RGBGetGValue(rgb);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 34] = RGBGetBValue(rgb);
}
}
}
return set_brctl_data();
}
int RealtekBridgeController::eff_set_breathe(RGBColor rgb, int cycle)
{
int i;
int j;
int row = 2;
int maxrow = REALTEK_BRIDGE_MAX_APPCTL_ROW;
int single_size = maxrow * REALTEK_BRIDGE_COLOR_DEPTH + 32;
memset(brctl_data, 0, REALTEK_BRIDGE_CTL_DATA_SIZE);
for(i = 0; i < get_argb_num(); i++)
{
brctl_data[i * single_size + 0] = 4;
brctl_data[i * single_size + 1] = row;
memcpy(&brctl_data[i * single_size + 2], &cycle, 2);
brctl_data[i * single_size + 8] = 2;
for(j = 0; j < row; j++)
{
if((j & 0x1) == 0)
{
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 32] = RGBGetRValue(rgb);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 33] = RGBGetGValue(rgb);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 34] = RGBGetBValue(rgb);
}
}
}
return set_brctl_data();
}
int RealtekBridgeController::eff_set_spectrum(int cycle)
{
int i;
int j;
int row = 6;
int maxrow = REALTEK_BRIDGE_MAX_APPCTL_ROW;
int single_size = maxrow * REALTEK_BRIDGE_COLOR_DEPTH + 32;
static const RGBColor rainbow_table[6] = {0x0000FF, 0x0050FF, 0x0080FF, 0x00FF00, 0xFF0000, 0xFF0080};
memset(brctl_data, 0, REALTEK_BRIDGE_CTL_DATA_SIZE);
for(i = 0; i < get_argb_num(); i++)
{
brctl_data[i * single_size + 0] = 4;
brctl_data[i * single_size + 1] = row;
memcpy(&brctl_data[i * single_size + 2], &cycle, 2);
brctl_data[i * single_size + 8] = 3;
for(j = 0; j < row; j++)
{
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 32] = RGBGetRValue(rainbow_table[j]);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 33] = RGBGetGValue(rainbow_table[j]);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 34] = RGBGetBValue(rainbow_table[j]);
}
}
return set_brctl_data();
}
int RealtekBridgeController::eff_set_scroll(RGBColor rgb, int cycle)
{
int i;
int j;
int start_idx = -1;
int row = get_argb_num() * 2 - 2;
int maxrow = REALTEK_BRIDGE_MAX_APPCTL_ROW;
int single_size = maxrow * REALTEK_BRIDGE_COLOR_DEPTH + 32;
memset(brctl_data, 0, REALTEK_BRIDGE_CTL_DATA_SIZE);
for(i = 0; i < get_argb_num(); i++)
{
brctl_data[i * single_size + 0] = 2;
brctl_data[i * single_size + 1] = row;
memcpy(&brctl_data[i * single_size + 2], &cycle, 2);
brctl_data[i * single_size + 8] = 4;
if(start_idx == -1)
{
start_idx = i;
}
j = i - start_idx;
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 32] = RGBGetRValue(rgb);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 33] = RGBGetGValue(rgb);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 34] = RGBGetBValue(rgb);
if(i != start_idx)
{
j = row - (i - start_idx);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 32] = RGBGetRValue(rgb);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 33] = RGBGetGValue(rgb);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 34] = RGBGetBValue(rgb);
}
}
return set_brctl_data();
}
int RealtekBridgeController::eff_set_rainbow_scroll(int cycle)
{
int i;
int j;
int start_idx = -1;
int row = get_argb_num() * 2 - 2;
int maxrow = REALTEK_BRIDGE_MAX_APPCTL_ROW;
int single_size = maxrow * REALTEK_BRIDGE_COLOR_DEPTH + 32;
RGBColor slide_table[REALTEK_BRIDGE_MAX_ARGB_NUM] = {0};
hsv_t hsv_color;
hsv_color.saturation = 255;
hsv_color.value = 255;
for(i = 0; i < get_argb_num(); i++)
{
hsv_color.hue = (i % get_argb_num()) * (360 / get_argb_num());
slide_table[i] = hsv2rgb(&hsv_color);
}
memset(brctl_data, 0, REALTEK_BRIDGE_CTL_DATA_SIZE);
for(i = 0; i < get_argb_num(); i++)
{
brctl_data[i * single_size + 0] = 2;
brctl_data[i * single_size + 1] = row;
memcpy(&brctl_data[i * single_size + 2], &cycle, 2);
brctl_data[i * single_size + 8] = 0x85;
if(start_idx == -1)
{
start_idx = i;
}
j = i - start_idx;
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 32] = RGBGetRValue(slide_table[i]);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 33] = RGBGetGValue(slide_table[i]);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 34] = RGBGetBValue(slide_table[i]);
if(i != start_idx)
{
j = row - (i - start_idx);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 32] = RGBGetRValue(slide_table[i]);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 33] = RGBGetGValue(slide_table[i]);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 34] = RGBGetBValue(slide_table[i]);
}
}
return set_brctl_data();
}
int RealtekBridgeController::eff_set_running_water(RGBColor rgb, int cycle)
{
int i;
int j;
int start_idx = -1;
int row = get_argb_num() * 2;
int maxrow = REALTEK_BRIDGE_MAX_APPCTL_ROW;
int single_size = maxrow * REALTEK_BRIDGE_COLOR_DEPTH + 32;
memset(brctl_data, 0, REALTEK_BRIDGE_CTL_DATA_SIZE);
for(i = 0; i < get_argb_num(); i++)
{
brctl_data[i * single_size + 0] = 2;
brctl_data[i * single_size + 1] = row;
memcpy(&brctl_data[i * single_size + 2], &cycle, 2);
brctl_data[i * single_size + 8] = 5;
if(start_idx == -1)
{
start_idx = i;
}
for(j = i - start_idx; j < row / 2; j++)
{
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 32] = RGBGetRValue(rgb);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 33] = RGBGetGValue(rgb);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 34] = RGBGetBValue(rgb);
}
}
return set_brctl_data();
}
int RealtekBridgeController::eff_set_sliding(int cycle)
{
int i;
int j;
int start_idx = -1;
int row = get_argb_num();
int maxrow = REALTEK_BRIDGE_MAX_APPCTL_ROW;
int single_size = maxrow * REALTEK_BRIDGE_COLOR_DEPTH + 32;
RGBColor slide_table[REALTEK_BRIDGE_MAX_ARGB_NUM] = {0};
RGBColor rgb = 0;
hsv_t hsv_color;
hsv_color.saturation = 255;
hsv_color.value = 255;
for(i = 0; i < get_argb_num(); i++)
{
hsv_color.hue = (i % get_argb_num()) * (360 / get_argb_num());
slide_table[i] = hsv2rgb(&hsv_color);
}
memset(brctl_data, 0, REALTEK_BRIDGE_CTL_DATA_SIZE);
for(i = 0; i < get_argb_num(); i++)
{
brctl_data[i * single_size + 0] = 4;
brctl_data[i * single_size + 1] = row;
memcpy(&brctl_data[i * single_size + 2], &cycle, 2);
brctl_data[i * single_size + 8] = 0x83;
if(start_idx == -1)
{
start_idx = i;
}
for(j = 0; j < row; j++)
{
rgb = slide_table[(i - start_idx + j) % row];
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 32] = RGBGetRValue(rgb);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 33] = RGBGetGValue(rgb);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 34] = RGBGetBValue(rgb);
}
}
return set_brctl_data();
}
int RealtekBridgeController::eff_set_newton_cradle(int cycle)
{
int i;
int j;
int start_idx = -1;
int row;
int maxrow = REALTEK_BRIDGE_MAX_APPCTL_ROW;
int single_size = maxrow * REALTEK_BRIDGE_COLOR_DEPTH + 32;
RGBColor rgb = 0;
static const int const_ball_num = 3;
static const RGBColor ball_color[] = {0x0080FF, 0x0000FF, 0x00FF00, 0xFF0000};
static const int mid = get_argb_num() >> 1;
if(get_argb_num() <= const_ball_num)
{
return 0;
}
row = (get_argb_num() - const_ball_num) * 2;
memset(brctl_data, 0, REALTEK_BRIDGE_CTL_DATA_SIZE);
for(i = 0; i < get_argb_num(); i++)
{
brctl_data[i * single_size + 0] = 2;
brctl_data[i * single_size + 1] = row;
memcpy(&brctl_data[i * single_size + 2], &cycle, 2);
brctl_data[i * single_size + 8] = 0x84;
if(start_idx == -1)
{
start_idx = i;
}
for(j = 0; j < row; j++)
{
rgb = 0;
if(i - start_idx > mid - 2 &&
i - start_idx < mid + 2)
{
if(j < mid - 1 || j > row - mid)
{
if(i - start_idx == mid - 1)
{
rgb = ball_color[1];
}
else if(i - start_idx == mid)
{
rgb = ball_color[2];
}
else
{
rgb = ball_color[3];
}
}
else
{
if(i - start_idx == mid - 1)
{
rgb = ball_color[0];
}
else if(i - start_idx == mid)
{
rgb = ball_color[1];
}
else
{
rgb = ball_color[2];
}
}
}
else if(i - start_idx < mid)
{
if(i - start_idx == j || i - start_idx + j == row - 1)
{
rgb = ball_color[0];
}
}
else if(i - start_idx > mid + 1)
{
if(i - start_idx - j == const_ball_num ||
i - start_idx + j == row - 1 + const_ball_num)
{
rgb = ball_color[3];
}
}
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 32] = RGBGetRValue(rgb);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 33] = RGBGetGValue(rgb);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 34] = RGBGetBValue(rgb);
}
}
return set_brctl_data();
}
int RealtekBridgeController::eff_set_meteor(RGBColor rgb, int cycle)
{
int i;
int j;
int row = 2;
int maxrow = REALTEK_BRIDGE_MAX_APPCTL_ROW;
int single_size = maxrow * REALTEK_BRIDGE_COLOR_DEPTH + 32;
int stable_ms = cycle / row;
int latency = stable_ms / get_argb_num();
memset(brctl_data, 0, REALTEK_BRIDGE_CTL_DATA_SIZE);
for(i = 0; i < get_argb_num(); i++)
{
brctl_data[i * single_size + 0] = 4;
brctl_data[i * single_size + 1] = row;
brctl_data[i * single_size + 6] = stable_ms / 100;
brctl_data[i * single_size + 7] = stable_ms / 100;
brctl_data[i * single_size + 8] = 6;
memcpy(&brctl_data[i * single_size + 9], &latency, 2);
j = 0;
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 32] = RGBGetRValue(rgb);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 33] = RGBGetGValue(rgb);
brctl_data[i * single_size + j * REALTEK_BRIDGE_COLOR_DEPTH + 34] = RGBGetBValue(rgb);
}
return set_brctl_data();
}
int RealtekBridgeController::set_argb_direct(std::vector<RGBColor> color_buf, unsigned short brightness)
{
int ret = -1;
size_t color_num = color_buf.size();
size_t buf_len = color_num * REALTEK_BRIDGE_COLOR_DEPTH;
static unsigned short prev_bright = 0xFFFF;
unsigned char* buf;
if(color_num <= 0)
{
goto exit;
}
ret = set_appctl(true);
if(ret)
{
goto exit;
}
if(prev_bright != brightness)
{
prev_bright = brightness;
ret = set_argb_brightness(brightness << 8);
if(ret)
{
goto exit;
}
}
buf = (unsigned char*)malloc(buf_len);
memset(buf, 0, buf_len);
for(int i = 0; i < (int)color_num; i++)
{
buf[i * REALTEK_BRIDGE_COLOR_DEPTH + 0] = RGBGetRValue(color_buf[i]);
buf[i * REALTEK_BRIDGE_COLOR_DEPTH + 1] = RGBGetGValue(color_buf[i]);
buf[i * REALTEK_BRIDGE_COLOR_DEPTH + 2] = RGBGetBValue(color_buf[i]);
}
ret = set_direct(buf, (int)color_num);
free(buf);
if(ret)
{
goto exit;
}
exit:
return ret;
}
int RealtekBridgeController::set_argb_effect(unsigned char mode, std::vector<RGBColor> color_buf, int speed, unsigned short brightness)
{
int ret = -1;
int cycle = MathUtils::IntInterpolate(REALTEK_BRIDGE_CYCLE_MAX, REALTEK_BRIDGE_CYCLE_MIN, 0, REALTEK_BRIDGE_SPEED_MAX, speed);
RGBColor rgb = 0;
static unsigned short prev_bright = 0xFFFF;
if(color_buf.size() >= 1)
{
rgb = color_buf[0];
}
if(prev_bright != brightness)
{
prev_bright = brightness;
ret = set_argb_brightness(brightness << 8);
if(ret)
{
goto exit;
}
}
switch(mode)
{
case REALTEK_BRIDGE_LED_EFF_ALWAYS:
ret = eff_set_always_on(rgb);
break;
case REALTEK_BRIDGE_LED_EFF_BLINK:
ret = eff_set_blink(rgb, cycle);
break;
case REALTEK_BRIDGE_LED_EFF_BREATHE:
ret = eff_set_breathe(rgb, cycle);
break;
case REALTEK_BRIDGE_LED_EFF_SPECTRUM:
ret = eff_set_spectrum(cycle);
break;
case REALTEK_BRIDGE_LED_EFF_SCROLL:
ret = eff_set_scroll(rgb, cycle);
break;
case REALTEK_BRIDGE_LED_EFF_RAINBOW_SCROLL:
ret = eff_set_rainbow_scroll(cycle);
break;
case REALTEK_BRIDGE_LED_EFF_RUNNING_WATER:
ret = eff_set_running_water(rgb, cycle);
break;
case REALTEK_BRIDGE_LED_EFF_SLIDING:
ret = eff_set_sliding(cycle);
break;
case REALTEK_BRIDGE_LED_EFF_NEWTON_CRADLE:
ret = eff_set_newton_cradle(cycle);
break;
case REALTEK_BRIDGE_LED_EFF_METEOR:
ret = eff_set_meteor(rgb, cycle);
break;
default:
break;
}
if(!ret)
{
ret = set_appctl(false);
}
exit:
return ret;
}
@@ -1,126 +0,0 @@
/*---------------------------------------------------------*\
| RealtekBridgeController.h |
| |
| Controller for Realtek USB to SSD Bridge ICs |
| |
| Jerry Fan (JerryFan0612) 13 Mar 2026 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include <stdlib.h>
#include <stdint.h>
#include <cmath>
#include <cstring>
#include <vector>
#include <hidapi.h>
#include "RGBController.h"
#define REALTEK_BRIDGE_SYNC_METHOD_OPENRGB 6
#define REALTEK_BRIDGE_COLOR_DEPTH 3
#define REALTEK_BRIDGE_CTL_HDR_SIZE 64
#define REALTEK_BRIDGE_CTL_DATA_SIZE 3220
#define REALTEK_BRIDGE_MAX_ARGB_NUM 20
#define REALTEK_BRIDGE_MAX_APPCTL_ROW 43
#define REALTEK_BRIDGE_HID_DATALEN_CH1 4096
#define REALTEK_BRIDGE_HID_DATALEN_CH2 64
#define REALTEK_BRIDGE_HID_DATALEN_CH3 512
#define REALTEK_BRIDGE_HID_DATALEN_CH4 1200
#define REALTEK_BRIDGE_HID_DATALEN_CH5 2048
#define REALTEK_BRIDGE_HID_ID_DATA_CH1 0x57
#define REALTEK_BRIDGE_HID_ID_DATA_CH2 0x59
#define REALTEK_BRIDGE_HID_ID_DATA_CH3 0x5A
#define REALTEK_BRIDGE_HID_ID_DATA_CH4 0x5B
#define REALTEK_BRIDGE_HID_ID_DATA_CH5 0x5C
enum REALTEK_BRIDGE_LED_EFF
{
REALTEK_BRIDGE_LED_EFF_NONE,
REALTEK_BRIDGE_LED_EFF_ALWAYS,
REALTEK_BRIDGE_LED_EFF_BLINK,
REALTEK_BRIDGE_LED_EFF_BREATHE,
REALTEK_BRIDGE_LED_EFF_SPECTRUM,
REALTEK_BRIDGE_LED_EFF_SCROLL,
REALTEK_BRIDGE_LED_EFF_RAINBOW_SCROLL,
REALTEK_BRIDGE_LED_EFF_RUNNING_WATER,
REALTEK_BRIDGE_LED_EFF_SLIDING,
REALTEK_BRIDGE_LED_EFF_NEWTON_CRADLE,
REALTEK_BRIDGE_LED_EFF_METEOR,
REALTEK_BRIDGE_NUMBER_OF_LED_EFF_MODE,
};
enum REALTEK_BRIDGE_SPEED
{
REALTEK_BRIDGE_SPEED_MIN = 1,
REALTEK_BRIDGE_SPEED_NORMAL = 50,
REALTEK_BRIDGE_SPEED_MAX = 100,
};
enum REALTEK_BRIDGE_CYCLE_MS
{
REALTEK_BRIDGE_CYCLE_MIN = 200,
REALTEK_BRIDGE_CYCLE_NORMAL = 2000,
REALTEK_BRIDGE_CYCLE_MAX = 10000,
};
struct RealtekBridgeControllerFWVersion
{
unsigned int fw_major_ver;
unsigned int fw_minor_ver;
unsigned int fw_extra_ver;
unsigned int fw_build_ver;
unsigned int fw_build_date;
};
class RealtekBridgeController
{
public:
RealtekBridgeController(hid_device* dev, hid_device_info* info);
~RealtekBridgeController();
unsigned char get_support_openrgb();
std::string get_manu_name();
std::string get_product_name();
std::string get_sn();
std::string get_dev_loc();
std::string get_fw_ver();
int get_argb_num();
int get_argb_brightness();
int set_argb_brightness(unsigned short bright);
int set_argb_direct(std::vector<RGBColor> color_buf, unsigned short brightness);
int set_argb_effect(unsigned char mode, std::vector<RGBColor> color_buf, int speed, unsigned short brightness);
private:
hid_device* hdev;
hid_device_info* hidinfo = NULL;
unsigned char brctl_hdr[REALTEK_BRIDGE_CTL_HDR_SIZE] = {0};
unsigned char* brctl_data = NULL;
int usb_hid_ioctl(unsigned char* usb_buf, unsigned char* data, int data_len,
unsigned int offset, unsigned char is_in);
int usb_hid_get_report(int data_len, int* id);
int set_write_unlock();
int get_brctl_hdr();
int set_brctl_hdr();
int get_brctl_data();
int set_brctl_data();
int set_appctl(unsigned char ctl_sts);
int set_direct(unsigned char* color, int color_num);
int eff_set_always_on(RGBColor rgb);
int eff_set_blink(RGBColor rgb, int cycle);
int eff_set_breathe(RGBColor rgb, int cycle);
int eff_set_spectrum(int cycle);
int eff_set_scroll(RGBColor rgb, int cycle);
int eff_set_rainbow_scroll(int cycle);
int eff_set_running_water(RGBColor rgb, int cycle);
int eff_set_sliding(int cycle);
int eff_set_newton_cradle(int cycle);
int eff_set_meteor(RGBColor rgb, int cycle);
};
@@ -1,63 +0,0 @@
/*---------------------------------------------------------*\
| RealtekBridgeControllerDetect.cpp |
| |
| Controller for Realtek USB to SSD Bridge ICs |
| |
| Jerry Fan (JerryFan0612) 13 Mar 2026 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "DetectionManager.h"
#include "RGBController_RealtekBridge.h"
#define REALTEK_BRIDGE_VID 0x0BDA
#define REALTEK_BRIDGE_PID0 0x9220
#define REALTEK_BRIDGE_PID1 0x9201
#define REALTEK_BRIDGE_PID2 0x9210
#define REALTEK_HID2SCSI_PG 0xFF00
#define REALTEK_HID2SCSI_USAGE 0x0001
/******************************************************************************************\
* *
* DetectRealtekBridgeControllers *
* *
* Tests the USB address to see if an Realtek Bridge controller exists there *
* *
\******************************************************************************************/
DetectedControllers DetectRealtekBridgeControllers(hid_device_info* info, const std::string& /*name*/)
{
DetectedControllers detected_controllers;
RealtekBridgeController* controller = NULL;
RGBController_RealtekBridge* rgb_controller = NULL;
hid_device* dev = hid_open_path(info->path);
if(dev)
{
controller = new RealtekBridgeController(dev, info);
if(controller->get_support_openrgb())
{
rgb_controller = new RGBController_RealtekBridge(controller);
if(rgb_controller->GetDeviceType() != DEVICE_TYPE_UNKNOWN)
{
detected_controllers.push_back(rgb_controller);
}
else
{
delete rgb_controller;
}
}
else
{
delete controller;
}
}
return(detected_controllers);
}
REGISTER_HID_DETECTOR_PU("RTL9220", DetectRealtekBridgeControllers, REALTEK_BRIDGE_VID, REALTEK_BRIDGE_PID0, REALTEK_HID2SCSI_PG, REALTEK_HID2SCSI_USAGE);
REGISTER_HID_DETECTOR_PU("RTL9201", DetectRealtekBridgeControllers, REALTEK_BRIDGE_VID, REALTEK_BRIDGE_PID1, REALTEK_HID2SCSI_PG, REALTEK_HID2SCSI_USAGE);
REGISTER_HID_DETECTOR_PU("RTL9210", DetectRealtekBridgeControllers, REALTEK_BRIDGE_VID, REALTEK_BRIDGE_PID2, REALTEK_HID2SCSI_PG, REALTEK_HID2SCSI_USAGE);
@@ -86,14 +86,9 @@ device_info RoccatVulcanKeyboardController::InitDeviceInfo()
buf[0] = report_id;
hid_get_feature_report(dev_ctrl, buf, packet_length);
/*-------------------------------------------------------------*\
| buf[2] is version e.g. 103 means v1.03 |
\*-------------------------------------------------------------*/
dev_info.version_major = buf[2] / 100;
dev_info.version_minor = buf[2] % 100;
char version[5];
snprintf(version, 5, "%d.%02d", dev_info.version_major, dev_info.version_minor);
snprintf(version, 5, "%d.%02d", buf[2] / 100, buf[2] % 100);
dev_info.version = version;
if(device_pid == ROCCAT_MAGMA_PID || device_pid == ROCCAT_MAGMA_MINI_PID)
@@ -121,11 +116,6 @@ device_info RoccatVulcanKeyboardController::GetDeviceInfo()
return dev_info;
}
bool RoccatVulcanKeyboardController::IsBigEndianDirectMode()
{
return (dev_info.version_major >= 1 && dev_info.version_minor >= 16);
}
void RoccatVulcanKeyboardController::EnableDirect(bool on_off_switch)
{
uint8_t* buf;
@@ -228,16 +218,8 @@ void RoccatVulcanKeyboardController::SendColors(std::vector<led_color> colors)
}
else
{
if(IsBigEndianDirectMode())
{
bufs[0][3] = (packet_length >> 8) & 0xFF;
bufs[0][4] = packet_length & 0xFF;
}
else
{
bufs[0][3] = packet_length & 0xFF;
bufs[0][4] = (packet_length >> 8) & 0xFF;
}
bufs[0][3] = packet_length & 0xFF;
bufs[0][4] = (packet_length >> 8) & 0xFF;
}
unsigned int data_length_packet = 64 - header_length_first;
@@ -61,8 +61,6 @@ enum
struct device_info
{
std::string version;
int version_major;
int version_minor;
int layout_type;
};
@@ -91,7 +89,6 @@ public:
void AwaitResponse(int ms);
void ClearResponses();
uint16_t device_pid;
private:
@@ -100,6 +97,4 @@ private:
device_info dev_info;
std::string location;
std::string name;
bool IsBigEndianDirectMode();
};
@@ -46,7 +46,7 @@ std::string ThermaltakeRiingController::GetSerialString()
std::string ThermaltakeRiingController::GetFirmwareVersion()
{
unsigned char usb_buf[65];
unsigned char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
@@ -56,15 +56,14 @@ std::string ThermaltakeRiingController::GetFirmwareVersion()
/*-----------------------------------------------------*\
| Set up Get Firmware Version packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0x33;
usb_buf[0x02] = 0x50;
usb_buf[0x00] = 0x33;
usb_buf[0x01] = 0x50;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
hid_read_timeout(dev, usb_buf, 65, 100);
hid_write(dev, usb_buf, 64);
hid_read(dev, usb_buf, 64);
std::string ret_str = std::to_string(usb_buf[2]) + "." + std::to_string(usb_buf[3]) + "." + std::to_string(usb_buf[4]);
@@ -118,7 +117,7 @@ void ThermaltakeRiingController::SendInit()
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
hid_read_timeout(dev, usb_buf, 65, 100);
hid_read(dev, usb_buf, 65);
}
void ThermaltakeRiingController::SendRGB
@@ -155,5 +154,5 @@ void ThermaltakeRiingController::SendRGB
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
hid_read_timeout(dev, usb_buf, 65, 100);
hid_read(dev, usb_buf, 65);
}

Some files were not shown because too many files have changed in this diff Show More