Compare commits

...
Author SHA1 Message Date
Adam Honse 90ca955343 ASRock zones created based on LED configuration register rather than pre-defined board layouts 2020-08-30 13:07:00 -05:00
Adam Honse d38dcc038a Remove boolean for ASR LED and replace it with an ASRock type enum with ASR LED, Polychrome V1, and Polychrome V2. 2020-08-30 01:57:13 -05:00
Adam Honse f577e5ef3c Add more sleeps to prevent mode corruption and add a function for reading the LED configuration register 2020-08-30 01:43:14 -05:00
Adam Honse 877469cd2d Fix case typo 2020-08-30 01:06:10 -05:00
Adam Honse 4d506588b5 Add sleeps after i2c operations to make ASRock controller more reliable 2020-08-30 00:59:45 -05:00
Adam Honse e972335872 Move speed setting to mode function, add struct to hold board information, remove firmware version from name string and add it to firmware version field. 2020-08-30 00:48:51 -05:00
Adam Honse 9f584b1f76 Hard coded test with all B450M Steel Legend LEDs (except addressable) 2020-08-30 00:48:51 -05:00
k1-801 45dc619076 Expand large keys to fill empty spaces in the matrix, if possible
Change manually picked from merge request by Adam Honse <[email protected]>
2020-08-30 00:31:18 -05:00
Kryesh 81c8ec6684 Allow for multiple RGBFusion 2 Controllers
See issue 529
2020-08-30 00:11:32 -05:00
k1-801 1c7bfdaeb4 Proper UTF-8 labels
Commit amended by Adam Honse <[email protected]>
2020-08-29 01:40:59 -05:00
crashniels f6812a5c88 Corsair Layout changes
Added the KeyIDs for the K95 and K95 platinum as well as the European specific keys. IDs from ckb-next. https://github.com/ckb-next/ckb-next/blob/ba063cedb751cecb1b8b1abf1af3f6e8dc31e9fe/src/daemon/keymap.c
2020-08-29 00:32:40 -05:00
Adam Honse c76dbc943f Update udev rules for G502 Lightspeed with Powerplay Mousepad 2020-08-29 00:22:16 -05:00
Ryakna cd1ceed5df Added detection for Logitech G502 Lightspeed when connected through the Logitech Powerplay Mousepad 2020-08-29 00:18:06 -05:00
Rafail Giavrimis 1558ffc61f Added Support for Steelseries Apex 5 2020-08-29 00:10:25 -05:00
k1-801 06b75f5ae7 Add debug keyboard
Commit modified by Adam Honse <[email protected]> to remove wingdings portion of change.
2020-08-29 00:07:29 -05:00
Adam Honse 95275ebf39 Make linear zones linear in demo devices 2020-08-28 17:46:48 -05:00
Adam Honse d5f86baa73 Create a debug controller with fake devices for SDK testing. Enable with debug_<type> lines in debug.txt 2020-08-28 16:47:38 -05:00
Adam Honse c386a6c571 Add i2c tool for reading multiple bytes from an SMBus device register 2020-08-27 19:12:37 -05:00
Adam Honse 4e95bc55d8 Add the ability to disable device detection using a text file 2020-08-26 19:44:24 -05:00
Adam Honse ae4c88fef8 Fix missing parameter in i2c call 2020-08-26 15:14:25 -05:00
Adam Honse 989dc7fc5d Select all zones before applying Polychrome colors 2020-08-26 15:04:43 -05:00
dumbasPL 1b863fdc7b Add support for Corsair H150i Pro RGB 2020-08-25 15:06:50 -05:00
Adam Honse 933ea93c25 Update README 2020-08-24 22:54:20 -05:00
Adam Honse 7daa5b6556 Use horizontal layouts for buttons and detection elements, repaint device view when selecting all 2020-08-24 22:36:18 -05:00
k1-801 1598fc8de4 Add apply and select all buttons.
Select all button and some minor rework by Adam Honse <[email protected]>
2020-08-24 22:12:09 -05:00
Adam Honse b03fce33ca Update Key: Context to Key: Menu in device view label lookup 2020-08-24 00:51:34 -05:00
Adam Honse 6d9aea38a6 Fix setting mode specific colors and not changing to direct mode when the mode has no configurable colors 2020-08-24 00:40:44 -05:00
Adam Honse a2ed9571cf Add button to toggle graphical LED view and default to hidden 2020-08-24 00:40:44 -05:00
Adam Honse ba24efe544 Fix display for devices with multiple matrix zones 2020-08-24 00:40:44 -05:00
Adam Honse f750654b3e Check for size changes and refresh data if size has changed 2020-08-24 00:40:44 -05:00
Adam Honse b0b46dd3a5 Use QString for LED labels vector 2020-08-24 00:40:44 -05:00
Adam Honse 5e002107ef Add key labels based on key names 2020-08-24 00:40:44 -05:00
Adam Honse b6824b8a46 Don't update the mode UI when the update callback occurs for now 2020-08-24 00:40:44 -05:00
Adam Honse 342d90b82a Add function to unregister update callback when device page is deleted 2020-08-24 00:40:44 -05:00
k1-801 63f005d4fc Forgot a DeviceView update in setSelectionColor 2020-08-24 00:40:44 -05:00
k1-801 4601b91f1f Fixed multiple selection, temporarily disabled interface updates due to update spam from a controler
Code style changes and integration by Adam Honse <[email protected]>
2020-08-24 00:40:44 -05:00
k1-801 c8ea2ff36f Zones overlapping fixed
Code from RGBController moved to DeviceView by Adam Honse <[email protected]>
2020-08-24 00:40:44 -05:00
k1-801 7781b1425d Ctrl-held selection fix 2020-08-24 00:40:43 -05:00
k1-801 7977a3ef50 Fix some signedness warnings, add size caching 2020-08-24 00:40:43 -05:00
k1-801 3000d625fa WIP: Zone names displayed fine now, but off-center 2020-08-24 00:40:43 -05:00
k1-801 bbc3c1de5b WIP: Instant color setting, buttons removed
Code cleanup by Adam Honse <[email protected]>
2020-08-24 00:40:43 -05:00
k1-801 a2a394492b WIP: Multiple selection test
Rework of LED position data from RGBController into DeviceView, code style cleanup modified by Adam Honse <[email protected]>
2020-08-24 00:40:43 -05:00
Adam Honse c6b10d9316 Center the device view horizontally 2020-08-24 00:40:43 -05:00
Adam Honse 177cd2ec92 Use matrix map when available 2020-08-24 00:40:43 -05:00
Adam Honse f787c5e63f Move device view above other controls, begin working on matrix display 2020-08-24 00:40:43 -05:00
Adam Honse d3993547c3 Device view resizes width to fit window size, UI updates on SDKcontroller update 2020-08-24 00:40:43 -05:00
Adam Honse 17f1390f36 Add widget that displays the current color of all LEDs on a controller 2020-08-24 00:40:43 -05:00
Adam Honse 38f8808bea Rename Key: Context to Key: Menu 2020-08-23 21:40:06 -05:00
Adam Honse c58d458062 Remove non-direct modes 2020-08-23 15:18:08 -05:00
Adam Honse d96fd19c6c Clean up profile setup packets 2020-08-23 15:16:09 -05:00
Adam Honse 9f91170240 Initial implementation of Pulsefire Surge direct mode (requires new firmware?) 2020-08-23 15:16:09 -05:00
Adam Honse 2440ab8fc9 Update Linux CI scripts to use temporary linuxdeploy path as the main release is broken 2020-08-23 00:16:28 -05:00
Denzil S.T. Ferreira 6ec3cfb1de Add support for NZXT Kraken M22 AIO
Reworked to use device information table by Adam Honse <[email protected]>
2020-08-22 14:06:03 -05:00
Adam Honse ebae2a3ba3 Fix typo in MSIGPUController 2020-08-22 13:24:36 -05:00
Felipe Cavalcanti effa243adb Adding support for CPU Cooler Gigabyte Aorus ATC800 2020-08-22 12:57:50 -05:00
Azymm 715099d768 Update MSIGPUControllerDetect.cpp 2020-08-22 12:42:20 -05:00
Adam Honse e6531e5379 Add HyperX Alloy Origins Core PID 2020-08-21 23:23:32 -05:00
Adam Honse 41762d4670 Add additional Corsair Hydro modes 2020-08-21 00:22:09 -05:00
Adam Honse ce836ce7b6 Fix E1.31 device name strings 2020-08-20 15:06:59 -05:00
Adam Honse c517257cb0 Add initialization packet to Corsair Hydro controller 2020-08-18 13:01:10 -05:00
Adam Honse ed368fba12 Add Corsair H115i PRO RGB to udev rules 2020-08-18 12:10:45 -05:00
Adam Honse 0b7b42b8f5 Add Corsair H115i PRO RGB to Corsair Hydro list 2020-08-18 12:06:47 -05:00
Adam Honse 68a16fadc2 Initial support for Corsair Hydro Series devices (only H100i Pro RGB for now) 2020-08-18 00:34:42 -05:00
Adam Honse 4f5cf83e47 Add keepalive option for E1.31 output 2020-08-17 15:53:44 -05:00
Adam Honse ed01850926 Initialize new map 2020-08-14 01:33:50 -05:00
Adam Honse 29e2626471 Generate matrix maps for E1.31 matrix configurations 2020-08-14 01:32:35 -05:00
Adam Honse 4f0cf752f5 Add e131.txt parser for matrix configuration. 2020-08-13 22:19:14 -05:00
Térence Clastres 6c52e3ce11 Fix hang when deleting busses 2020-08-13 00:05:29 -05:00
Térence Clastres 53379c5482 Fixes for memory issues detected by valgrind 2020-08-12 23:48:03 -05:00
Adam Honse ff07a488a2 Update Blackwidow Elite keymap 2020-08-12 23:34:33 -05:00
Adam Honse 73a8a50848 Add Blackwidow Elite keymap 2020-08-12 15:22:31 -05:00
Adam Honse 78a8a2c4a9 Add Blackwidow 2019 keymap 2020-08-12 15:14:21 -05:00
AnierinB 9939d7e4f1 Add support for RTX 2060 Z with Sub-Device ID 0x3752
USB controller: NVIDIA Corporation Device 1ada (rev a1) (prog-if 30 [XHCI])
Subsystem: Micro-Star International Co., Ltd. [MSI] Device 3752

Signed-off-by: AnierinB <[email protected]>
2020-08-11 00:01:20 -05:00
xyz 9cf32593ae add PID of Logitech G502H 2020-08-10 19:14:21 -05:00
santeri3700 7294fa8180 Enable support for Corsair Scimitar PRO RGB 2020-08-09 14:10:47 -05:00
edbgon bd35a83837 Added missing key for US layouts 2020-08-09 14:09:12 -05:00
edbgon 3da5a4f6ba Update to add Apex Pro keyboard 2020-08-08 22:13:39 -05:00
Adam Honse c571ea124f Add GitLab URL to the Software Information page 2020-08-08 02:46:41 -05:00
Adam Honse 9db92e9afa Show Software Information and SMBus Tools tabs after device list has been refreshed 2020-08-07 23:37:23 -05:00
Adam Honse 634ec9f488 Wait on asynchronous device detection before performing CLI operations that require device list 2020-08-07 23:01:20 -05:00
Adam Honse 9c4e73bbed Set default percentage to 100% so that the progress bar goes away if device detection is skipped 2020-08-07 14:02:00 -05:00
Térence Clastres f8af9980fd Fix crash on close while detecting devices 2020-08-07 14:01:59 -05:00
Adam Honse 06b2cd87c6 Clean up progress bar initial state 2020-08-07 14:01:59 -05:00
Adam Honse f716a05947 Add detector names and display them in the progress bar 2020-08-07 14:01:59 -05:00
Adam Honse 75899f973b Load sizes after detection is complete 2020-08-07 14:01:59 -05:00
Adam Honse e84cb98055 Add detection progress bar to the user interface 2020-08-07 14:01:59 -05:00
Adam Honse aaa2ecddc7 Move i2c bus detectors to their respective files and add a detector macro for i2c busses so they can be detected asynchronously. Fix WMI and DMI info. 2020-08-07 14:01:59 -05:00
Adam Honse 7898e9b95d Initial prototype of asynchronous detection. DMI information broken 2020-08-07 14:01:59 -05:00
TheRogueZeta 5270b46e31 Re-order Zones 2020-08-07 12:54:56 -05:00
TheRogueZeta d0ab5a4de4 Fix Lighting Control packet typo. 2020-08-07 12:53:32 -05:00
TheRogueZeta 9be8ab8371 Add Logitech G Pro Wireless 2020-08-07 11:58:29 -05:00
Chris f0be42db38 Added 'X570 AORUS ULTRA' to known layouts 2020-08-07 11:44:03 -05:00
Adam Honse 8667211180 Move console attachment to main and only perform if running in a terminal. (!102) 2020-08-05 21:49:20 -05:00
Chris 8168e1cadb Initial controller for Tecknet mice 2020-08-05 21:35:23 -05:00
kernzerfall c15ceaa26c Add support for Logitech G502 Proteus Spectrum and G512 RGB.
- Set the G512 RGB to use G810 driver
- Add driver and interface for the G502 Proteus Spectrum
2020-08-05 21:06:30 -05:00
kernzerfall ee61b87fe4 Add udev rules 2020-08-05 21:06:12 -05:00
pobrn ddc69778dc Modular detection system with resource manager.
Includes pull request !87 with modifications by Adam Honse ([email protected]).
2020-08-05 00:23:34 -05:00
Adam Honse b3a7b7be81 Add 32-bit AppImage build target 2020-08-04 17:26:44 -05:00
Adam Honse f05df3768b Add number pad to Ducky matrix map 2020-08-04 10:26:38 -05:00
Katzenbiber 1be9f6e460 Add support for Logitech G203 Lightsync 2020-08-02 22:49:14 -05:00
santeri3700 3bbc3da48b Enable support for Holtek USB Gaming Mouse 2020-08-02 22:45:15 -05:00
santeri3700 92f7fe7dc4 Add support for Holtek USB Gaming Mouse 2020-08-02 22:42:56 -05:00
Ahmad Nassri f1d42d27ce docs(readme): include note about VS 2019 runtime 2020-08-02 22:41:24 -05:00
Adam Honse f288f63087 Update default DPI and add some modes to Pulsefire Surge controller 2020-08-02 22:38:42 -05:00
Adam Honse 226045cb8e Update key names on SteelSeries Apex controller 2020-07-31 22:36:21 -05:00
edbgon 4660870c22 Update SteelSeries Apex controller for Apex 7 TKL version 2020-07-31 22:08:57 -05:00
Adam Honse 412c819699 Set matrix map pointers to NULL for HyperX Pulsefire Surge 2020-07-31 12:29:08 -05:00
Adam Honse 635dcce7f0 Use the name Direct for all custom/static modes that transition smoothly without flicker 2020-07-31 10:49:25 -05:00
B Horn 1457831840 Modifying find_usb_serial_port() to return a vector 2020-07-31 08:47:39 -05:00
Adam Honse 00cc6978a2 Initial HyperX Pulsefire Surge controller 2020-07-28 20:37:12 -05:00
Chris d26e4da9f1 Added B550 Aorus Pro & Elite layouts
* Added MBName2Layout map
* Changed layouts to accomodate
2020-07-27 10:46:52 -05:00
Adam Honse 0a821526fa Fix typo 2020-07-27 10:17:28 -05:00
159 changed files with 8431 additions and 1755 deletions
+19 -3
View File
@@ -21,9 +21,25 @@ before_script:
- echo "started by ${GITLAB_USER_NAME}"
#-----------------------------------------------------------------------#
# Linux (AppImage) Build Target #
# Linux (AppImage) 32-bit Build Target #
#-----------------------------------------------------------------------#
build_linux:
build_linux_32:
image: i386/ubuntu:bionic
stage: build
script:
- apt update
- apt install -y build-essential qtcreator qt5-default libusb-1.0-0-dev libhidapi-dev pkgconf wget git
- ./scripts/build-appimage-32.sh
artifacts:
paths:
- OpenRGB-i386.AppImage
expire_in: 1337 years
#-----------------------------------------------------------------------#
# Linux (AppImage) 64-bit Build Target #
#-----------------------------------------------------------------------#
build_linux_64:
image: ubuntu:bionic
stage: build
script:
@@ -35,7 +51,7 @@ build_linux:
paths:
- OpenRGB-x86_64.AppImage
expire_in: 1337 years
#-----------------------------------------------------------------------#
# Windows (32-bit) Build Target #
#-----------------------------------------------------------------------#
+28
View File
@@ -19,6 +19,11 @@ KERNEL=="hidraw*", SUBSYSTEM=="hidraw", TAG+="uaccess"
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="2516", ATTR{idProduct}=="0051", TAG+="uaccess"
#---------------------------------------------------------------#
# Aorus Devices #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="1044", ATTR{idProduct}=="7a42", TAG+="uaccess"
#---------------------------------------------------------------#
# ASUS Aura Core Devices #
#---------------------------------------------------------------#
@@ -43,6 +48,17 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="18f3", TAG+="uacces
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="2516", ATTR{idProduct}=="0109", TAG+="uaccess"
#---------------------------------------------------------------#
# Corsair Hydro Series Devices #
# #
# Corsair H100i Pro RGB #
# Corsair H115i Pro RGB #
# Corsair H150i Pro RGB #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c15", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c13", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c12", TAG+="uaccess"
#---------------------------------------------------------------#
# Corsair Lighting Node Devices #
# #
@@ -128,10 +144,22 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="0951", ATTR{idProduct}=="16be", TAG+="uacces
# Logitech G203 Prodigy #
# Logitech G403 Prodigy #
# Logitech G403 Hero #
# Logitech G502 Proteus Spectrum #
# Logitech G502 Lightspeed with Powerplay Mousepad #
# #
# Keyboards: #
# Logitech G512 RGB #
# Logitech G Pro Wireless Gaming Mouse Lightspeed #
# Logitech G Pro Wireless Gaming Mouse (Wired) #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c084", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c083", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c08f", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c332", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c33c", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c539", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c088", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c53a", TAG+="uaccess"
#---------------------------------------------------------------#
# MSI Mysticlight #
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "AMDWraithPrismController.h"
#include "RGBController.h"
#include "RGBController_AMDWraithPrism.h"
@@ -49,3 +50,5 @@ void DetectAMDWraithPrismControllers(std::vector<RGBController*>& rgb_controller
info = info->next;
}
}
REGISTER_DETECTOR("AMD Wraith Prism", DetectAMDWraithPrismControllers);
@@ -0,0 +1,116 @@
/*-----------------------------------------*\
| ATC800Controller.cpp |
| |
| Driver for Aorus ATC800 CPU Cooler |
| |
| |
| Felipe Cavalcanti 08/13/2020 |
\*-----------------------------------------*/
#include "ATC800Controller.h"
#include <cstring>
ATC800Controller::ATC800Controller(hid_device* dev_handle)
{
dev = dev_handle;
}
ATC800Controller::~ATC800Controller()
{
hid_close(dev);
}
void ATC800Controller::SendCoolerMode
(
unsigned char mode,
unsigned short speed,
unsigned char channel,
unsigned char red,
unsigned char green,
unsigned char blue
)
{
unsigned char usb_buf[9];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Lighting Control packet |
\*-----------------------------------------------------*/
if (channel == AORUS_ATC800_TOP_ZONE)
{
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0xbe;
usb_buf[0x08] = 0xcc;
hid_send_feature_report(dev, usb_buf, 9);
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0xc9;
usb_buf[0x02] = mode;
usb_buf[0x03] = 0x3c;
usb_buf[0x04] = 0x02;
usb_buf[0x05] = 0x00;
usb_buf[0x06] = 0x00;
hid_send_feature_report(dev, usb_buf, 9);
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0xbc;
usb_buf[0x02] = red;
usb_buf[0x03] = green;
usb_buf[0x04] = blue;
hid_send_feature_report(dev, usb_buf, 9);
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0xb6;
}
else if (channel == AORUS_ATC800_FANS_ZONE)
{
hid_send_feature_report(dev, usb_buf, 9);
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0xc9;
usb_buf[0x02] = mode;
usb_buf[0x03] = 0x3c;
usb_buf[0x04] = 0x02;
usb_buf[0x05] = 0x00;
usb_buf[0x06] = 0x01;
hid_send_feature_report(dev, usb_buf, 9);
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0xb0;
usb_buf[0x02] = mode;
usb_buf[0x03] = red;
usb_buf[0x04] = green;
usb_buf[0x05] = blue;
usb_buf[0x06] = red;
usb_buf[0x07] = green;
usb_buf[0x08] = blue;
for(int i = 0xb0; i <= 0xb3; i++)
{
usb_buf[0x01] = i; //zone b0->b3
hid_send_feature_report(dev, usb_buf, 9);
}
}
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0xb6;
hid_send_feature_report(dev, usb_buf, 9);
}
@@ -0,0 +1,59 @@
/*-----------------------------------------*\
| ATC800Controller.h |
| |
| Definitions and types for ATC800 CPU |
| Cooler |
| |
| Felipe Cavalcanti 08/13/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
AORUS_ATC800_MODE_OFF = 0x00,
AORUS_ATC800_MODE_STATIC = 0x01,
AORUS_ATC800_MODE_PULSE = 0x02,
AORUS_ATC800_MODE_FLASHING = 0x04,
AORUS_ATC800_MODE_DOUBLE_FLASH = 0x05,
};
enum
{
AORUS_ATC800_SPEED_SLOWEST = 0x00, /* Slowest speed */
AORUS_ATC800_SPEED_SLOW = 0x01, /* Slow speed */
AORUS_ATC800_SPEED_NORMAL = 0x02, /* Normal speed */
AORUS_ATC800_SPEED_FAST = 0x03, /* Fast speed */
AORUS_ATC800_SPEED_FASTEST = 0x04, /* Fastest speed */
};
enum
{
AORUS_ATC800_FANS_ZONE = 0,
AORUS_ATC800_TOP_ZONE = 1
};
class ATC800Controller
{
public:
ATC800Controller(hid_device* dev_handle);
~ATC800Controller();
void SendCoolerMode
(
unsigned char mode,
unsigned short speed,
unsigned char channel,
unsigned char red,
unsigned char green,
unsigned char blue
);
private:
hid_device* dev;
};
@@ -0,0 +1,87 @@
#include "Detector.h"
#include "RGBController.h"
#include "ATC800Controller.h"
#include "RGBController_AorusATC800.h"
#include <vector>
#include <hidapi/hidapi.h>
/*-----------------------------------------------------*\
| Vendor ID |
\*-----------------------------------------------------*/
#define HOLTEK_VID 0x1044
/*-----------------------------------------------------*\
| Controller product ids |
\*-----------------------------------------------------*/
#define ATC_800_CONTROLLER_PID 0x7A42
typedef struct
{
unsigned short usb_vid;
unsigned short usb_pid;
char usb_interface;
device_type type;
const char * name;
} device;
#define NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
static const device device_list[] =
{
{ HOLTEK_VID, ATC_800_CONTROLLER_PID, 0, DEVICE_TYPE_KEYBOARD, "Aorus ATC800 CPU Cooler" },
};
/******************************************************************************************\
* *
* DetectAorusCPUCoolerControllers *
* *
* Tests the USB address to see if a Aorus RGB CPU Cooler exists there. *
* *
\******************************************************************************************/
void DetectAorusCPUCoolerControllers(std::vector<RGBController*>& rgb_controllers)
{
hid_init();
for(int device_idx = 0; device_idx < NUM_DEVICES; device_idx++)
{
hid_device_info* info = hid_enumerate(device_list[device_idx].usb_vid, device_list[device_idx].usb_pid);
while(info)
{
if((info->vendor_id == device_list[device_idx].usb_vid)
&&(info->product_id == device_list[device_idx].usb_pid)
#ifdef USE_HID_USAGE
&&(info->interface_number == device_list[device_idx].usb_interface)
&&(info->usage_page == 0xFF01)
&&(info->usage == 1))
#else
&&(info->interface_number == device_list[device_idx].usb_interface))
#endif
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
switch(device_list[device_idx].usb_pid)
{
case ATC_800_CONTROLLER_PID:
{
ATC800Controller* controller = new ATC800Controller(dev);
RGBController_AorusATC800* rgb_controller = new RGBController_AorusATC800(controller);
rgb_controller->name = device_list[device_idx].name;
rgb_controllers.push_back(rgb_controller);
}
break;
}
}
}
info = info->next;
}
hid_free_enumeration(info);
}
}
REGISTER_DETECTOR("Aorus CPU Coolers", DetectAorusCPUCoolerControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "AuraCoreController.h"
#include "RGBController.h"
#include "RGBController_AuraCore.h"
@@ -43,3 +44,5 @@ void DetectAuraCoreControllers(std::vector<RGBController*>& rgb_controllers)
}
}
}
REGISTER_DETECTOR("ASUS Aura Core", DetectAuraCoreControllers);
@@ -6,6 +6,7 @@
| Jan Rettig (Klapstuhl) 14.02.2020 |
\*-----------------------------------------*/
#include "Detector.h"
#include "AuraGPUController.h"
#include "RGBController.h"
#include "RGBController_AuraGPU.h"
@@ -82,4 +83,6 @@ void DetectAuraGPUControllers(std::vector<i2c_smbus_interface*> &busses, std::ve
std::this_thread::sleep_for(1ms);
}
}
} /* DetectAuraGPUControllers() */
} /* DetectAuraGPUControllers() */
REGISTER_I2C_DETECTOR("ASUS Aura GPU", DetectAuraGPUControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "AuraSMBusController.h"
#include "RGBController.h"
#include "RGBController_AuraSMBus.h"
@@ -188,3 +189,5 @@ void DetectAuraSMBusControllers(std::vector<i2c_smbus_interface*> &busses, std::
}
} /* DetectAuraSMBusControllers() */
REGISTER_I2C_DETECTOR("ASUS Aura SMBus", DetectAuraSMBusControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "AuraAddressableController.h"
#include "AuraMainboardController.h"
#include "RGBController.h"
@@ -74,4 +75,6 @@ void DetectAuraUSBControllers(std::vector<RGBController*>& rgb_controllers)
}
}
}
}
} /* DetectAuraUSBControllers() */
REGISTER_DETECTOR("ASUS Aura USB", DetectAuraUSBControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "CMMP750Controller.h"
#include "RGBController.h"
#include "RGBController_CMMP750Controller.h"
@@ -63,4 +64,6 @@ void DetectCoolerMasterControllers(std::vector<RGBController*>& rgb_controllers)
info = info->next;
}
hid_free_enumeration(info);
}
} /* DetectCoolerMasterControllers() */
REGISTER_DETECTOR("Cooler Master", DetectCoolerMasterControllers);
@@ -0,0 +1,251 @@
/*---------------------------------------------------------*\
| Processing Code for Corsair Hydro Series |
| |
| Adam Honse ([email protected]), 8/17/2020 |
\*---------------------------------------------------------*/
#include "CorsairHydroController.h"
#include <cstring>
CorsairHydroController::CorsairHydroController(libusb_device_handle* dev_handle)
{
dev = dev_handle;
SendInit();
SendFirmwareRequest();
}
std::string CorsairHydroController::GetFirmwareString()
{
return(firmware_version);
}
void CorsairHydroController::SetBlink
(
std::vector<RGBColor> & colors,
unsigned char speed
)
{
SendColors(colors);
SendSpeed(speed);
SendApplyBlink();
}
void CorsairHydroController::SetFixed
(
std::vector<RGBColor> & colors
)
{
SendColors(colors);
/*-----------------------------------------------------*\
| Fixed mode seems to just be shift mode with the same |
| value for both colors |
\*-----------------------------------------------------*/
SendApplyShift();
}
void CorsairHydroController::SetPulse
(
std::vector<RGBColor> & colors,
unsigned char speed
)
{
SendColors(colors);
SendSpeed(speed);
SendApplyPulse();
}
void CorsairHydroController::SetShift
(
std::vector<RGBColor> & colors,
unsigned char speed
)
{
SendColors(colors);
SendSpeed(speed);
SendApplyShift();
}
/*-------------------------------------------------------------------------------------------------*\
| Private packet sending functions. |
\*-------------------------------------------------------------------------------------------------*/
void CorsairHydroController::SendApplyBlink()
{
unsigned char usb_buf[3];
int actual;
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Apply Blink packet |
\*-----------------------------------------------------*/
usb_buf[0] = 0x58;
usb_buf[1] = 0x01;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_bulk_transfer(dev, 0x01, usb_buf, 2, &actual, 1000);
libusb_bulk_transfer(dev, 0x81, usb_buf, 3, &actual, 1000);
}
void CorsairHydroController::SendApplyPulse()
{
unsigned char usb_buf[3];
int actual;
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Apply Pulse packet |
\*-----------------------------------------------------*/
usb_buf[0] = 0x52;
usb_buf[1] = 0x01;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_bulk_transfer(dev, 0x01, usb_buf, 2, &actual, 1000);
libusb_bulk_transfer(dev, 0x81, usb_buf, 3, &actual, 1000);
}
void CorsairHydroController::SendApplyShift()
{
unsigned char usb_buf[3];
int actual;
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Apply Shift packet |
\*-----------------------------------------------------*/
usb_buf[0] = 0x55;
usb_buf[1] = 0x01;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_bulk_transfer(dev, 0x01, usb_buf, 2, &actual, 1000);
libusb_bulk_transfer(dev, 0x81, usb_buf, 3, &actual, 1000);
}
void CorsairHydroController::SendFirmwareRequest()
{
unsigned char usb_buf[8];
int actual;
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Firmware Request packet |
\*-----------------------------------------------------*/
usb_buf[0] = 0xAA;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_bulk_transfer(dev, 0x01, usb_buf, 1, &actual, 1000);
libusb_bulk_transfer(dev, 0x81, usb_buf, 7, &actual, 1000);
firmware_version = std::to_string(usb_buf[3]) + "." + std::to_string(usb_buf[4]) + "." + std::to_string(usb_buf[5]) + "." + std::to_string(usb_buf[6]);
}
void CorsairHydroController::SendColors
(
std::vector<RGBColor> & colors
)
{
unsigned char usb_buf[23];
int actual;
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Send Colors packet |
\*-----------------------------------------------------*/
usb_buf[0] = 0x56;
usb_buf[1] = colors.size();
/*---------------------------------------------------------*\
| Fill in colors from vector |
\*---------------------------------------------------------*/
for(std::size_t color_idx = 0; color_idx < colors.size(); color_idx++)
{
usb_buf[(color_idx * 3) + 2] = RGBGetRValue(colors[color_idx]);
usb_buf[(color_idx * 3) + 3] = RGBGetGValue(colors[color_idx]);
usb_buf[(color_idx * 3) + 4] = RGBGetBValue(colors[color_idx]);
/*---------------------------------------------------------*\
| If the color vector only has one entry, duplicate it, as |
| the controller appears to require two colors in order to |
| update. |
\*---------------------------------------------------------*/
if((color_idx == 0) && colors.size() == 1)
{
usb_buf[1] = colors.size() + 1;
usb_buf[(color_idx * 3) + 5] = RGBGetRValue(colors[color_idx]);
usb_buf[(color_idx * 3) + 6] = RGBGetGValue(colors[color_idx]);
usb_buf[(color_idx * 3) + 7] = RGBGetBValue(colors[color_idx]);
}
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_bulk_transfer(dev, 0x01, usb_buf, 2 + (usb_buf[1] * 3), &actual, 1000);
libusb_bulk_transfer(dev, 0x81, usb_buf, 3, &actual, 1000);
}
void CorsairHydroController::SendInit()
{
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_control_transfer( dev, 0x40, 0x00, 0xffff, 0x0000, NULL, 0, 0 );
libusb_control_transfer( dev, 0x40, 0x02, 0x0002, 0x0000, NULL, 0, 0 );
}
void CorsairHydroController::SendSpeed
(
unsigned char speed
)
{
unsigned char usb_buf[3];
int actual;
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Send Speed packet |
\*-----------------------------------------------------*/
usb_buf[0] = 0x53;
usb_buf[1] = speed;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_bulk_transfer(dev, 0x01, usb_buf, 2, &actual, 1000);
libusb_bulk_transfer(dev, 0x81, usb_buf, 3, &actual, 1000);
}
@@ -0,0 +1,86 @@
/*---------------------------------------------------------*\
| Definitions for Corsair Hydro Series |
| |
| Adam Honse ([email protected]), 8/17/2020 |
\*---------------------------------------------------------*/
#include "RGBController.h"
#include <vector>
#include <libusb-1.0/libusb.h>
#pragma once
enum
{
CORSAIR_HYDRO_CMD_READ_PUMP_SPEED = 0x31,
CORSAIR_HYDRO_CMD_WRITE_PUMP_MODE = 0x32,
CORSAIR_HYDRO_CMD_READ_PUMP_MODE = 0x33,
CORSAIR_HYDRO_CMD_READ_FAN_SPEED = 0x41,
CORSAIR_HYDRO_CMD_READ_AIO_TEMP = 0xA9,
CORSAIR_HYDRO_CMD_READ_FIRMWARE = 0xAA,
};
enum
{
CORSAIR_HYDRO_PUMP_MODE_QUIET = 0x00,
CORSAIR_HYDRO_PUMP_MODE_BALANCED = 0x01,
CORSAIR_HYDRO_PUMP_MODE_PERFORMANCE = 0x02,
};
class CorsairHydroController
{
public:
CorsairHydroController(libusb_device_handle* dev_handle);
~CorsairHydroController();
unsigned char GetFanPercent(unsigned char fan_channel);
unsigned short GetFanRPM(unsigned char fan_channel);
std::string GetFirmwareString();
void SetBlink
(
std::vector<RGBColor> & colors,
unsigned char speed
);
void SetFixed
(
std::vector<RGBColor> & colors
);
void SetPulse
(
std::vector<RGBColor> & colors,
unsigned char speed
);
void SetShift
(
std::vector<RGBColor> & colors,
unsigned char speed
);
private:
libusb_device_handle* dev;
std::string firmware_version;
void SendApplyBlink();
void SendApplyPulse();
void SendApplyShift();
void SendColors
(
std::vector<RGBColor> & colors
);
void SendFirmwareRequest();
void SendInit();
void SendSpeed
(
unsigned char speed
);
};
@@ -0,0 +1,74 @@
#include "Detector.h"
#include "CorsairHydroController.h"
#include "RGBController.h"
#include "RGBController_CorsairHydro.h"
#include <vector>
#include <libusb-1.0/libusb.h>
/*-----------------------------------------------------*\
| Corsair vendor ID |
\*-----------------------------------------------------*/
#define CORSAIR_VID 0x1B1C
/*-----------------------------------------------------*\
| Keyboard Hydro Series product IDs |
\*-----------------------------------------------------*/
#define CORSAIR_H115I_PRO_RGB_PID 0x0C13
#define CORSAIR_H100I_PRO_RGB_PID 0x0C15
#define CORSAIR_H150I_PRO_RGB_PID 0x0C12
typedef struct
{
unsigned short usb_vid;
unsigned short usb_pid;
unsigned char usb_interface;
const char * name;
} corsair_hydro_device;
#define CORSAIR_NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
static const corsair_hydro_device device_list[] =
{
/*-----------------------------------------------------------------------------------------------------*\
| Coolers |
\*-----------------------------------------------------------------------------------------------------*/
{ CORSAIR_VID, CORSAIR_H100I_PRO_RGB_PID, 0, "Corsair H100i PRO RGB" },
{ CORSAIR_VID, CORSAIR_H115I_PRO_RGB_PID, 0, "Corsair H115i PRO RGB" },
{ CORSAIR_VID, CORSAIR_H150I_PRO_RGB_PID, 0, "Corsair H150i PRO RGB" },
};
/******************************************************************************************\
* *
* DetectCorsairHydroControllers *
* *
* Tests the USB address to see if a Corsair RGB Cooler controller exists there. *
* *
\******************************************************************************************/
void DetectCorsairHydroControllers(std::vector<RGBController*>& rgb_controllers)
{
libusb_context * ctx;
libusb_init(&ctx);
for(std::size_t device_idx = 0; device_idx < CORSAIR_NUM_DEVICES; device_idx++)
{
libusb_device_handle * dev = libusb_open_device_with_vid_pid(ctx, device_list[device_idx].usb_vid, device_list[device_idx].usb_pid);
//Look for Corsair RGB Peripheral
if(dev)
{
libusb_detach_kernel_driver(dev, 0);
libusb_claim_interface(dev, 0);
CorsairHydroController* controller = new CorsairHydroController(dev);//, device_list[device_idx].usb_endpoint);
RGBController_CorsairHydro* rgb_controller = new RGBController_CorsairHydro(controller);
rgb_controller->name = device_list[device_idx].name;
rgb_controllers.push_back(rgb_controller);
}
}
} /* DetectCorsairHydroControllers() */
REGISTER_DETECTOR("Corsair Hydro Series", DetectCorsairHydroControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "CorsairLightingNodeController.h"
#include "RGBController.h"
#include "RGBController_CorsairLightingNode.h"
@@ -77,3 +78,5 @@ void DetectCorsairLightingNodeControllers(std::vector<RGBController*> &rgb_contr
}
}
} /* DetectCorsairLightingNodeControllers() */
REGISTER_DETECTOR("Corsair Lighting Node", DetectCorsairLightingNodeControllers);
@@ -22,6 +22,30 @@ static unsigned int keys[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x
116, 117, 120, 121, 122, 123, 124, 126, 127, 128, 129, 132, 133, 134, 135,
136, 137, 139, 140, 141};
static unsigned int keys_k95_plat[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0C, 0x0D, 0x0E, 0x0F, 0x11, 0x12,
0x14, 0x15, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x24, 0x25, 0x26,
0x27, 0x28, 0x2A, 0x2B, 0x2C, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x42, 0x43, 0x44, 0x45, 0x48, 73, 74, 75, 76, 78,
79, 80, 81, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 96, 97,
98, 99, 100, 101, 102, 103, 104, 105, 108, 109, 110, 111, 112, 113, 115,
116, 117, 120, 121, 122, 123, 124, 126, 127, 128, 129, 132, 133, 134, 135,
136, 137, 139, 140, 141,
0x10, 114, 0x0a, 0x16, 0x22, 0x2e, 0x3a, 0x46,
144, 145, 146, 158, 160, 147, 148, 149, 150, 151, 152, 153,
154, 155, 159, 162, 161, 156, 157};
static unsigned int keys_k95[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0C, 0x0D, 0x0E, 0x0F, 0x11, 0x12,
0x14, 0x15, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x24, 0x25, 0x26,
0x27, 0x28, 0x2A, 0x2B, 0x2C, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x42, 0x43, 0x44, 0x45, 0x48, 73, 74, 75, 76, 78,
79, 80, 81, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 96, 97,
98, 99, 100, 101, 102, 103, 104, 105, 108, 109, 110, 111, 112, 113, 115,
116, 117, 120, 121, 122, 123, 124, 126, 127, 128, 129, 132, 133, 134, 135,
136, 137, 139, 140, 141,
0x10, 114, 0x0a, 0x16, 0x22, 0x2e, 0x3a, 0x46, 0x52, 0x5e, 0x6a, 0x76, 0x3b, 0x47, 0x53,
0x5f, 0x6b, 0x77, 0x83, 0x8f, 0x0b, 0x17, 0x23, 0x2f};
static unsigned int st100[] = { 0x00, 0x01, 0x02, 0x03, 0x05, 0x06, 0x07, 0x08, 0x04 };
CorsairPeripheralController::CorsairPeripheralController(hid_device* dev_handle)
@@ -43,6 +67,16 @@ device_type CorsairPeripheralController::GetDeviceType()
return type;
}
int CorsairPeripheralController::GetPhysicalLayout()
{
return physical_layout;
}
int CorsairPeripheralController::GetLogicalLayout()
{
return logical_layout;
}
std::string CorsairPeripheralController::GetFirmwareString()
{
return firmware_version;
@@ -88,9 +122,9 @@ void CorsairPeripheralController::SetLEDs(std::vector<RGBColor>colors)
void CorsairPeripheralController::SetLEDsKeyboardFull(std::vector<RGBColor> colors)
{
unsigned char red_val[144];
unsigned char grn_val[144];
unsigned char blu_val[144];
unsigned char red_val[168];
unsigned char grn_val[168];
unsigned char blu_val[168];
/*-----------------------------------------------------*\
| Zero out buffers |
@@ -105,9 +139,24 @@ void CorsairPeripheralController::SetLEDsKeyboardFull(std::vector<RGBColor> colo
for(std::size_t color_idx = 0; color_idx < colors.size(); color_idx++)
{
RGBColor color = colors[color_idx];
red_val[keys[color_idx]] = RGBGetRValue(color);
grn_val[keys[color_idx]] = RGBGetGValue(color);
blu_val[keys[color_idx]] = RGBGetBValue(color);
if (logical_layout == CORSAIR_TYPE_K95_PLAT)
{
red_val[keys_k95_plat[color_idx]] = RGBGetRValue(color);
grn_val[keys_k95_plat[color_idx]] = RGBGetGValue(color);
blu_val[keys_k95_plat[color_idx]] = RGBGetBValue(color);
}
else if (logical_layout == CORSAIR_TYPE_K95)
{
red_val[keys_k95[color_idx]] = RGBGetRValue(color);
grn_val[keys_k95[color_idx]] = RGBGetGValue(color);
blu_val[keys_k95[color_idx]] = RGBGetBValue(color);
}
else
{
red_val[keys[color_idx]] = RGBGetRValue(color);
grn_val[keys[color_idx]] = RGBGetGValue(color);
blu_val[keys[color_idx]] = RGBGetBValue(color);
}
}
/*-----------------------------------------------------*\
@@ -115,7 +164,7 @@ void CorsairPeripheralController::SetLEDsKeyboardFull(std::vector<RGBColor> colo
\*-----------------------------------------------------*/
StreamPacket(1, 60, &red_val[0]);
StreamPacket(2, 60, &red_val[60]);
StreamPacket(3, 24, &red_val[120]);
StreamPacket(3, 48, &red_val[120]);
SubmitKeyboardFullColors(1, 3, 1);
/*-----------------------------------------------------*\
@@ -123,7 +172,7 @@ void CorsairPeripheralController::SetLEDsKeyboardFull(std::vector<RGBColor> colo
\*-----------------------------------------------------*/
StreamPacket(1, 60, &grn_val[0]);
StreamPacket(2, 60, &grn_val[60]);
StreamPacket(3, 24, &grn_val[120]);
StreamPacket(3, 48, &grn_val[120]);
SubmitKeyboardFullColors(2, 3, 1);
/*-----------------------------------------------------*\
@@ -131,7 +180,7 @@ void CorsairPeripheralController::SetLEDsKeyboardFull(std::vector<RGBColor> colo
\*-----------------------------------------------------*/
StreamPacket(1, 60, &blu_val[0]);
StreamPacket(2, 60, &blu_val[60]);
StreamPacket(3, 24, &blu_val[120]);
StreamPacket(3, 48, &blu_val[120]);
SubmitKeyboardFullColors(3, 3, 2);
}
@@ -286,6 +335,7 @@ void CorsairPeripheralController::SpecialFunctionControl()
hid_write(dev, (unsigned char *)usb_buf, 65);
}
void CorsairPeripheralController::ReadFirmwareInfo()
{
int actual;
@@ -340,6 +390,23 @@ void CorsairPeripheralController::ReadFirmwareInfo()
switch((unsigned char)usb_buf[0x14 + offset])
{
case 0xC0:
{
unsigned short pid = (unsigned short)(usb_buf[0x0F] << 8) + (unsigned char)(usb_buf[0x0E]);
switch(pid)
{
case 0x2D1B:
logical_layout = CORSAIR_TYPE_K95_PLAT;
break;
case 0x1B11:
logical_layout = CORSAIR_TYPE_K95;
break;
default:
logical_layout = CORSAIR_TYPE_NORMAL;
}
}
type = DEVICE_TYPE_KEYBOARD;
break;
@@ -379,6 +446,21 @@ void CorsairPeripheralController::ReadFirmwareInfo()
{
firmware_version = std::to_string(usb_buf[0x09 + offset]) + "." + std::to_string(usb_buf[0x08 + offset]);
}
/*-----------------------------------------------------*\
| Get the correct Keyboard Layout |
\*-----------------------------------------------------*/
switch((unsigned char)usb_buf[0x17 + offset])
{
case CORSAIR_LAYOUT_ANSI:
physical_layout = CORSAIR_LAYOUT_ANSI;
break;
case CORSAIR_LAYOUT_ISO:
physical_layout = CORSAIR_LAYOUT_ISO;
break;
default:
physical_layout = CORSAIR_LAYOUT_ANSI;
}
}
void CorsairPeripheralController::StreamPacket
@@ -47,12 +47,30 @@ enum
CORSAIR_COLOR_CHANNEL_BLUE = 0x03
};
enum
{
CORSAIR_LAYOUT_ANSI = 0x00,
CORSAIR_LAYOUT_ISO = 0x01,
CORSAIR_LAYOUT_ABNT = 0x02,
CORSAIR_LAYOUT_JIS = 0x03,
CORSAIR_LAYOUT_DUBEOLSIK = 0x04
};
enum
{
CORSAIR_TYPE_NORMAL = 0,
CORSAIR_TYPE_K95_PLAT = 1,
CORSAIR_TYPE_K95 = 2
};
class CorsairPeripheralController
{
public:
CorsairPeripheralController(hid_device* dev_handle);
~CorsairPeripheralController();
int GetLogicalLayout();
int GetPhysicalLayout();
device_type GetDeviceType();
std::string GetFirmwareString();
@@ -67,6 +85,8 @@ private:
std::string firmware_version;
device_type type;
int physical_layout; //ANSI, ISO, etc.
int logical_layout; //Normal, K95 or K95 Platinum
void LightingControl();
void SpecialFunctionControl();
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "CorsairPeripheralController.h"
#include "RGBController.h"
#include "RGBController_CorsairPeripheral.h"
@@ -44,6 +45,7 @@
#define CORSAIR_HARPOON_RGB_PRO_PID 0x1B75
#define CORSAIR_M65_PRO_PID 0x1B2E
#define CORSAIR_M65_RGB_ELITE_PID 0x1B5A
#define CORSAIR_SCIMITAR_PRO_RGB_PID 0x1B3E
/*-----------------------------------------------------*\
| Mousepad product IDs |
@@ -95,6 +97,7 @@ static const corsair_node_device device_list[] =
{ CORSAIR_VID, CORSAIR_HARPOON_RGB_PRO_PID, 1, "Corsair Harpoon RGB PRO" },
{ CORSAIR_VID, CORSAIR_M65_PRO_PID, 1, "Corsair M65 PRO" },
{ CORSAIR_VID, CORSAIR_M65_RGB_ELITE_PID, 1, "Corsair M65 RGB Elite" },
{ CORSAIR_VID, CORSAIR_SCIMITAR_PRO_RGB_PID, 1, "Corsair Scimitar PRO RGB" },
/*-----------------------------------------------------------------------------------------------------*\
| Mousemats |
\*-----------------------------------------------------------------------------------------------------*/
@@ -157,4 +160,6 @@ void DetectCorsairPeripheralControllers(std::vector<RGBController*>& rgb_control
info = info->next;
}
}
}
} /* DetectCorsairPeripheralControllers() */
REGISTER_DETECTOR("Corsair Peripheral", DetectCorsairPeripheralControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "CorsairVengeanceController.h"
#include "RGBController.h"
#include "RGBController_CorsairVengeance.h"
@@ -122,4 +123,6 @@ void DetectCorsairVengeanceControllers(std::vector<i2c_smbus_interface*> &busses
}
}
} /* DetectCorsairVengeanceControllers() */
} /* DetectCorsairVengeanceControllers() */
REGISTER_I2C_DETECTOR("Corsair Vengeance", DetectCorsairVengeanceControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "CorsairVengeanceProController.h"
#include "RGBController.h"
#include "RGBController_CorsairVengeancePro.h"
@@ -130,4 +131,6 @@ void DetectCorsairVengeanceProControllers(std::vector<i2c_smbus_interface*> &bus
}
}
} /* DetectCorsairVengeanceProControllers() */
} /* DetectCorsairVengeanceProControllers() */
REGISTER_I2C_DETECTOR("Corsair Vengeance Pro", DetectCorsairVengeanceProControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "CrucialController.h"
#include "RGBController.h"
#include "RGBController_Crucial.h"
@@ -86,3 +87,5 @@ void DetectCrucialControllers(std::vector<i2c_smbus_interface*> &busses, std::ve
}
} /* DetectCrucialControllers() */
REGISTER_I2C_DETECTOR("Crucial", DetectCrucialControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "DuckyKeyboardController.h"
#include "RGBController.h"
#include "RGBController_DuckyKeyboard.h"
@@ -78,4 +79,6 @@ void DetectDuckyKeyboardControllers(std::vector<RGBController*>& rgb_controllers
info = info->next;
}
}
}
} /* DetectDuckyKeyboardControllers() */
REGISTER_DETECTOR("Ducky Keyboard", DetectDuckyKeyboardControllers);
+4 -1
View File
@@ -33,7 +33,10 @@ EKController::EKController(hid_device* dev_handle, wchar_t *_vendor, wchar_t *_d
EKController::~EKController()
{
hid_close(dev);
if(dev)
{
hid_close(dev);
}
}
char* EKController::GetDeviceName()
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "EKController.h"
#include "RGBController.h"
#include "RGBController_EKController.h"
@@ -30,11 +31,11 @@ static const unsigned int ek_pids[][2] =
void DetectEKControllers(std::vector<RGBController*>& rgb_controllers)
{
hid_device_info* info;
hid_device_info* info = NULL;
//Look for the passed in cm_pids
hid_init();
info = hid_enumerate(0x0, 0x0);
info = hid_enumerate(EK_VID, 0x0);
while(info)
{
@@ -61,4 +62,6 @@ void DetectEKControllers(std::vector<RGBController*>& rgb_controllers)
info = info->next;
}
hid_free_enumeration(info);
}
} /* DetectEKControllers() */
REGISTER_DETECTOR("EK", DetectEKControllers);
@@ -6,6 +6,7 @@
| Niels Westphal (crashniels) 12.07.2020 |
\*-----------------------------------------*/
#include "Detector.h"
#include "GalaxGPUController.h"
#include "RGBController.h"
#include "RGBController_GalaxGPU.h"
@@ -66,3 +67,5 @@ void DetectGalaxGPUControllers(std::vector<i2c_smbus_interface*> &busses, std::v
}
} /* DetectGalaxGPUControllers() */
REGISTER_I2C_DETECTOR("Galax GPU", DetectGalaxGPUControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "GloriousModelOController.h"
#include "RGBController.h"
#include "RGBController_GloriousModelO.h"
@@ -21,9 +22,6 @@ void DetectGloriousModelOControllers(std::vector<RGBController*>& rgb_controller
hid_device* dev = NULL;
hid_init();
dev = NULL;
info = hid_enumerate(Glorious_Model_O_VID, Glorious_Model_O_PID);
//Look for Glorious Model O
@@ -57,4 +55,6 @@ void DetectGloriousModelOControllers(std::vector<RGBController*>& rgb_controller
rgb_controllers.push_back(rgb_controller);
}
}
} /* DetectGloriousModelOControllers() */
REGISTER_DETECTOR("Glorious Model O", DetectGloriousModelOControllers);
@@ -0,0 +1,87 @@
/*-----------------------------------------------*\
| HoltekA070Controller.cpp |
| |
| Driver for Holtek USB Gaming Mouse [04d9:a070] |
| |
| Santeri Pikarinen (santeri3700) 8/01/2020 |
\*-----------------------------------------------*/
#include "HoltekA070Controller.h"
#include <cstring>
HoltekA070Controller::HoltekA070Controller(hid_device* dev_handle)
{
dev = dev_handle;
}
/*-------------------------------------------------------------------------------------------------*\
| Private packet sending functions. |
\*-------------------------------------------------------------------------------------------------*/
void HoltekA070Controller::SendCustomColor
(
unsigned char red,
unsigned char green,
unsigned char blue
)
{
char usb_buf[8];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up RGB Control packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x07; // PACKET SIZE?
usb_buf[0x01] = 0x0a; // SET RGB
usb_buf[0x02] = 0x00; // SAVE (does not work with SET RGB)
usb_buf[0x03] = red; // RED
usb_buf[0x04] = green; // GREEN
usb_buf[0x05] = blue; // BLUE
usb_buf[0x06] = 0x00; // PADDING?
usb_buf[0x07] = 0x00; // PADDING?
// So far no saving function has been discovered for the "SET RGB" command.
// Such functionality might not even exist for the A070 series.
// The chosen RGB color will therefore reset after a power cycle.
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, (unsigned char *)usb_buf, sizeof(usb_buf));
}
void HoltekA070Controller::SendMode
(
unsigned char mode
)
{
char usb_buf[8];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up lighting mode control packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x07; // PACKET SIZE?
usb_buf[0x01] = 0x0b; // SET LIGHTING MODE
usb_buf[0x02] = 0x01; // SAVE
usb_buf[0x03] = mode; // MODE 01-04
usb_buf[0x04] = 0x00; // PADDING?
usb_buf[0x05] = 0x00; // PADDING?
usb_buf[0x06] = 0x00; // PADDING?
usb_buf[0x07] = 0x00; // PADDING?
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, (unsigned char *)usb_buf, sizeof(usb_buf));
}
@@ -0,0 +1,44 @@
/*---------------------------------------------------------------*\
| HoltekA070Controller.h |
| |
| Definitions and types for Holtek USB Gaming Mouse [04d9:a070] |
| |
| Santeri Pikarinen (santeri3700) 8/01/2020 |
\*---------------------------------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
HOLTEK_A070_MODE_STATIC = 0x01,
HOLTEK_A070_MODE_BREATHING_SLOW = 0x02,
HOLTEK_A070_MODE_BREATHING_MEDIUM = 0x03,
HOLTEK_A070_MODE_BREATHING_FAST = 0x04
};
class HoltekA070Controller
{
public:
HoltekA070Controller(hid_device* dev_handle);
~HoltekA070Controller();
void SendCustomColor
(
unsigned char red,
unsigned char green,
unsigned char blue
);
void SendMode
(
unsigned char mode
);
private:
hid_device* dev;
};
@@ -0,0 +1,89 @@
#include "Detector.h"
#include "HoltekA070Controller.h"
#include "RGBController.h"
#include "RGBController_HoltekA070.h"
#include <vector>
#include <hidapi/hidapi.h>
/*-----------------------------------------------------*\
| Holtek Semiconductor Inc. vendor ID |
\*-----------------------------------------------------*/
#define HOLTEK_VID 0x04D9
/*-----------------------------------------------------*\
| Mouse product IDs |
\*-----------------------------------------------------*/
#define HOLTEK_A070_PID 0xA070
typedef struct
{
unsigned short usb_vid;
unsigned short usb_pid;
unsigned char usb_interface;
device_type type;
const char * name;
} holtek_device;
#define HOLTEK_NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
static const holtek_device device_list[] =
{
/*-------------------------------------------------------------------------------------------------------------*\
| Mice |
\*-------------------------------------------------------------------------------------------------------------*/
{ HOLTEK_VID, HOLTEK_A070_PID, 1, DEVICE_TYPE_MOUSE, "Holtek USB Gaming Mouse" },
};
void DetectHoltekControllers(std::vector<RGBController*>& rgb_controllers)
{
hid_init();
for(int device_idx = 0; device_idx < HOLTEK_NUM_DEVICES; device_idx++)
{
switch(device_list[device_idx].type)
{
case DEVICE_TYPE_MOUSE:
{
hid_device_info* info = hid_enumerate(device_list[device_idx].usb_vid, device_list[device_idx].usb_pid);
while(info)
{
if((info->vendor_id == device_list[device_idx].usb_vid)
&&(info->product_id == device_list[device_idx].usb_pid)
#ifdef USE_HID_USAGE
&&(info->interface_number == device_list[device_idx].usb_interface)
&&(info->usage_page == 0xFF00)
&&(info->usage == 2))
#else
&&(info->interface_number == device_list[device_idx].usb_interface))
#endif
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
switch(device_list[device_idx].usb_pid)
{
case HOLTEK_A070_PID:
{
HoltekA070Controller* controller = new HoltekA070Controller(dev);
RGBController_HoltekA070* rgb_controller = new RGBController_HoltekA070(controller);
rgb_controller->name = device_list[device_idx].name;
rgb_controllers.push_back(rgb_controller);
}
break;
}
}
}
info = info->next;
}
hid_free_enumeration(info);
}
break;
}
}
} /* DetectHoltekControllers() */
REGISTER_DETECTOR("Holtek", DetectHoltekControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "HuePlusController.h"
#include "RGBController.h"
#include "RGBController_HuePlus.h"
@@ -17,16 +18,23 @@
void DetectHuePlusControllers(std::vector<RGBController*> &rgb_controllers)
{
size_t i;
HuePlusController* new_hueplus;
RGBController_HuePlus* new_controller;
std::string portname = find_usb_serial_port(NZXT_HUE_PLUS_VID, NZXT_HUE_PLUS_PID);
if( portname != "" )
{
new_hueplus = new HuePlusController();
new_hueplus->Initialize((char *)portname.c_str());
std::vector<std::string *> ports = find_usb_serial_port(NZXT_HUE_PLUS_VID, NZXT_HUE_PLUS_PID);
new_controller = new RGBController_HuePlus(new_hueplus);
rgb_controllers.push_back(new_controller);
for (i = 0; i < ports.size(); i++)
{
if( *ports[i] != "" )
{
new_hueplus = new HuePlusController();
new_hueplus->Initialize((char *)ports[i]->c_str());
new_controller = new RGBController_HuePlus(new_hueplus);
rgb_controllers.push_back(new_controller);
}
}
} /* DetectHuePlusControllers() */
REGISTER_DETECTOR("NZXT Hue+", DetectHuePlusControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "HyperXDRAMController.h"
#include "RGBController.h"
#include "RGBController_HyperXDRAM.h"
@@ -93,3 +94,5 @@ void DetectHyperXDRAMControllers(std::vector<i2c_smbus_interface*> &busses, std:
}
} /* DetectHyperXDRAMControllers() */
REGISTER_I2C_DETECTOR("HyperX DRAM", DetectHyperXDRAMControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "HyperXAlloyOriginsController.h"
#include "HyperXKeyboardController.h"
#include "RGBController.h"
@@ -9,10 +10,11 @@
/*-----------------------------------------------------*\
| HyperX keyboard vendor IDs |
\*-----------------------------------------------------*/
#define HYPERX_KEYBOARD_VID 0x0951
#define HYPERX_ALLOY_ELITE_PID 0x16BE
#define HYPERX_ALLOY_FPS_RGB_PID 0x16DC
#define HYPERX_ALLOY_ORIGINS_PID 0x16E5
#define HYPERX_KEYBOARD_VID 0x0951
#define HYPERX_ALLOY_ELITE_PID 0x16BE
#define HYPERX_ALLOY_FPS_RGB_PID 0x16DC
#define HYPERX_ALLOY_ORIGINS_PID 0x16E5
#define HYPERX_ALLOY_ORIGINS_CORE_PID 0x16E6
typedef struct
{
@@ -29,9 +31,10 @@ static const hyperx_device device_list[] =
/*-----------------------------------------------------------------------------------------------------*\
| Keyboards |
\*-----------------------------------------------------------------------------------------------------*/
{ HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ELITE_PID, 2, "HyperX Alloy Elite RGB" },
{ HYPERX_KEYBOARD_VID, HYPERX_ALLOY_FPS_RGB_PID, 2, "HyperX Alloy FPS RGB" },
{ HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ORIGINS_PID, 3, "HyperX Alloy Origins" },
{ HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ELITE_PID, 2, "HyperX Alloy Elite RGB" },
{ HYPERX_KEYBOARD_VID, HYPERX_ALLOY_FPS_RGB_PID, 2, "HyperX Alloy FPS RGB" },
{ HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ORIGINS_PID, 3, "HyperX Alloy Origins" },
{ HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ORIGINS_CORE_PID, 3, "HyperX Alloy Origins Core" },
};
/******************************************************************************************\
@@ -104,4 +107,6 @@ void DetectHyperXKeyboardControllers(std::vector<RGBController*>& rgb_controller
info = info->next;
}
}
}
} /* DetectHyperXKeyboardControllers() */
REGISTER_DETECTOR("HyperX Keyboard", DetectHyperXKeyboardControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "HyperXPulsefireSurgeController.h"
#include "RGBController.h"
#include "RGBController_HyperXPulsefireSurge.h"
@@ -54,7 +55,12 @@ void DetectHyperXMouseControllers(std::vector<RGBController*>& rgb_controllers)
{
if((info->vendor_id == device_list[device_idx].usb_vid)
&&(info->product_id == device_list[device_idx].usb_pid)
&&(info->interface_number == device_list[device_idx].usb_interface))
#ifdef USE_HID_USAGE
&&(info->interface_number == device_list[device_idx].usb_interface)
&&(info->usage_page == 0xFF01))
#else
&&(info->interface_number == device_list[device_idx].usb_interface))
#endif
{
dev = hid_open_path(info->path);
@@ -73,4 +79,6 @@ void DetectHyperXMouseControllers(std::vector<RGBController*>& rgb_controllers)
info = info->next;
}
}
}
} /* DetectHyperXMouseControllers() */
REGISTER_DETECTOR("HyperX Mouse", DetectHyperXMouseControllers);
@@ -19,4 +19,107 @@ HyperXPulsefireSurgeController::HyperXPulsefireSurgeController(hid_device* dev_h
HyperXPulsefireSurgeController::~HyperXPulsefireSurgeController()
{
}
}
/*-------------------------------------------------------------------------------------------------*\
| Private packet sending functions. |
\*-------------------------------------------------------------------------------------------------*/
void HyperXPulsefireSurgeController::SelectProfile
(
unsigned char profile
)
{
unsigned char buf[264];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(buf, 0x00, sizeof(buf));
/*-----------------------------------------------------*\
| Set up Select Profile packet |
\*-----------------------------------------------------*/
buf[0x00] = 0x07;
buf[0x01] = HYPERX_PULSEFIRE_SURGE_PACKET_ID_SELECT_PROFILE;
buf[0x02] = profile;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, buf, 264);
}
void HyperXPulsefireSurgeController::SetProfileBrightness
(
unsigned char profile,
unsigned char brightness
)
{
unsigned char buf[264];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(buf, 0x00, sizeof(buf));
/*-----------------------------------------------------*\
| Set up Select Profile packet |
\*-----------------------------------------------------*/
buf[0x00] = 0x07;
buf[0x01] = HYPERX_PULSEFIRE_SURGE_PACKET_ID_SET_BRIGHTNESS;
buf[0x02] = profile;
buf[0x03] = 0x01;
buf[0x04] = 0x01;
buf[0x05] = 0x01;
buf[0x06] = 0x64;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, buf, 264);
}
void HyperXPulsefireSurgeController::SendDirect
(
RGBColor* color_data
)
{
unsigned char buf[264];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(buf, 0x00, sizeof(buf));
/*-----------------------------------------------------*\
| Set up Select Profile packet |
\*-----------------------------------------------------*/
buf[0x00] = 0x07;
buf[0x01] = HYPERX_PULSEFIRE_SURGE_PACKET_ID_DIRECT;
buf[0x03] = 0xA0;
for(int red_idx = 0; red_idx < 32; red_idx++)
{
buf[0x08 + red_idx] = RGBGetRValue(color_data[red_idx]);
}
for(int grn_idx = 0; grn_idx < 32; grn_idx++)
{
buf[0x28 + grn_idx] = RGBGetGValue(color_data[grn_idx]);
}
for(int blu_idx = 0; blu_idx < 32; blu_idx++)
{
buf[0x48 + blu_idx] = RGBGetBValue(color_data[blu_idx]);
}
buf[0x6C] = RGBGetRValue(color_data[32]);
buf[0x6D] = RGBGetGValue(color_data[32]);
buf[0x6E] = RGBGetBValue(color_data[32]);
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, buf, 264);
}
@@ -14,12 +14,45 @@
#pragma once
enum
{
HYPERX_PULSEFIRE_SURGE_PACKET_ID_SET_CONFIGURATION = 0x01, /* Set profile configuration packet */
HYPERX_PULSEFIRE_SURGE_PACKET_ID_SET_BRIGHTNESS = 0x03, /* Set profile settings and brightness */
HYPERX_PULSEFIRE_SURGE_PACKET_ID_SELECT_PROFILE = 0x07, /* Select profile */
HYPERX_PULSEFIRE_SURGE_PACKET_ID_DIRECT = 0x14, /* Direct control packet */
};
enum
{
HYPERX_PULSEFIRE_SURGE_MODE_SOLID = 0x00, /* Solid color mode */
HYPERX_PULSEFIRE_SURGE_MODE_CYCLE = 0x01, /* Spectrum cycle mode */
HYPERX_PULSEFIRE_SURGE_MODE_BREATHING = 0x02, /* Breathing mode */
HYPERX_PULSEFIRE_SURGE_MODE_WAVE = 0x03, /* Wave mode */
HYPERX_PULSEFIRE_SURGE_MODE_TRIGGER = 0x04, /* Trigger mode */
};
class HyperXPulsefireSurgeController
{
public:
HyperXPulsefireSurgeController(hid_device* dev_handle);
~HyperXPulsefireSurgeController();
void SelectProfile
(
unsigned char profile
);
void SetProfileBrightness
(
unsigned char profile,
unsigned char brightness
);
void SendDirect
(
RGBColor* color_data
);
private:
hid_device* dev;
};
};
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "LEDStripController.h"
#include "RGBController.h"
#include "RGBController_LEDStrip.h"
@@ -21,7 +22,7 @@
* DetectLEDStripControllers *
* *
* Detect devices supported by the LEDStrip driver *
* * *
* *
\******************************************************************************************/
void DetectLEDStripControllers(std::vector<RGBController*> &rgb_controllers)
@@ -84,5 +85,6 @@ void DetectLEDStripControllers(std::vector<RGBController*> &rgb_controllers)
}
}
} /* DetectLEDStripControllers() */
} /* DetectLEDStripControllers() */
REGISTER_DETECTOR("LED Strip", DetectLEDStripControllers);
@@ -1,29 +1,43 @@
#include "Detector.h"
#include "LogitechG203Controller.h"
#include "LogitechG203LController.h"
#include "LogitechG403Controller.h"
#include "LogitechG502PSController.h"
#include "LogitechG810Controller.h"
#include "LogitechGProWirelessController.h"
#include "RGBController.h"
#include "RGBController_LogitechG203.h"
#include "RGBController_LogitechG203L.h"
#include "RGBController_LogitechG403.h"
#include "RGBController_LogitechG502PS.h"
#include "RGBController_LogitechG810.h"
#include "RGBController_LogitechGProWireless.h"
#include <vector>
#include <hidapi/hidapi.h>
/*-----------------------------------------------------*\
| Logitech vendor ID |
\*-----------------------------------------------------*/
#define LOGITECH_VID 0x046D
#define LOGITECH_VID 0x046D
/*-----------------------------------------------------*\
| Keyboard product IDs |
\*-----------------------------------------------------*/
#define LOGITECH_G810_1_PID 0xC337
#define LOGITECH_G810_2_PID 0xC331
#define LOGITECH_G512_PID 0xC342
#define LOGITECH_G810_1_PID 0xC337
#define LOGITECH_G810_2_PID 0xC331
#define LOGITECH_G512_PID 0xC342
#define LOGITECH_G512_RGB_PID 0xC33C
/*-----------------------------------------------------*\
| Mouse product IDs |
\*-----------------------------------------------------*/
#define LOGITECH_G203_PID 0xC084
#define LOGITECH_G403_PID 0xC083
#define LOGITECH_G403H_PID 0xC08F
#define LOGITECH_G203_PID 0xC084
#define LOGITECH_G203L_PID 0xC092
#define LOGITECH_G403_PID 0xC083
#define LOGITECH_G403H_PID 0xC08F
#define LOGITECH_G502_PS_PID 0xC332
#define LOGITECH_G502H_PID 0xC08B
#define LOGITECH_GPRO_WIRELESS_LIGHTSPEED_PID 0xC539
#define LOGITECH_GPRO_WIRELESS_PID 0xC088
#define LOGITECH_G502_LIGHTSPEED_POWERPLAY_PID 0xC53A
typedef struct
{
@@ -38,21 +52,28 @@ typedef struct
static const logitech_device device_list[] =
{
/*-------------------------------------------------------------------------------------------------------------*\
| Keyboards |
\*-------------------------------------------------------------------------------------------------------------*/
{ LOGITECH_VID, LOGITECH_G810_1_PID, 1, DEVICE_TYPE_KEYBOARD, "Logitech G810 Orion Spectrum" },
{ LOGITECH_VID, LOGITECH_G810_2_PID, 1, DEVICE_TYPE_KEYBOARD, "Logitech G810 Orion Spectrum" },
{ LOGITECH_VID, LOGITECH_G512_PID, 1, DEVICE_TYPE_KEYBOARD, "Logitech G512" },
/*-------------------------------------------------------------------------------------------------------------*\
| Mice |
\*-------------------------------------------------------------------------------------------------------------*/
{ LOGITECH_VID, LOGITECH_G203_PID, 1, DEVICE_TYPE_MOUSE, "Logitech G203 Prodigy" },
{ LOGITECH_VID, LOGITECH_G403_PID, 1, DEVICE_TYPE_MOUSE, "Logitech G403 Prodigy" },
{ LOGITECH_VID, LOGITECH_G403H_PID, 1, DEVICE_TYPE_MOUSE, "Logitech G403 Hero" },
/*-------------------------------------------------------------------------------------------------------------*\
| Mousemats |
\*-------------------------------------------------------------------------------------------------------------*/
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
| Keyboards |
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
{ LOGITECH_VID, LOGITECH_G810_1_PID, 1, DEVICE_TYPE_KEYBOARD, "Logitech G810 Orion Spectrum" },
{ LOGITECH_VID, LOGITECH_G810_2_PID, 1, DEVICE_TYPE_KEYBOARD, "Logitech G810 Orion Spectrum" },
{ LOGITECH_VID, LOGITECH_G512_PID, 1, DEVICE_TYPE_KEYBOARD, "Logitech G512" },
{ LOGITECH_VID, LOGITECH_G512_RGB_PID, 1, DEVICE_TYPE_KEYBOARD, "Logitech G512 RGB" },
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
| Mice |
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
{ LOGITECH_VID, LOGITECH_G203_PID, 1, DEVICE_TYPE_MOUSE, "Logitech G203 Prodigy" },
{ LOGITECH_VID, LOGITECH_G203L_PID, 1, DEVICE_TYPE_MOUSE, "Logitech G203 Lightsync" },
{ LOGITECH_VID, LOGITECH_G403_PID, 1, DEVICE_TYPE_MOUSE, "Logitech G403 Prodigy" },
{ LOGITECH_VID, LOGITECH_G403H_PID, 1, DEVICE_TYPE_MOUSE, "Logitech G403 Hero" },
{ LOGITECH_VID, LOGITECH_G502_PS_PID, 1, DEVICE_TYPE_MOUSE, "Logitech G502 Proteus Spectrum" },
{ LOGITECH_VID, LOGITECH_G502H_PID, 1, DEVICE_TYPE_MOUSE, "Logitech G502 Hero" },
{ LOGITECH_VID, LOGITECH_GPRO_WIRELESS_LIGHTSPEED_PID, 2, DEVICE_TYPE_MOUSE, "Logitech G Pro Wireless Gaming Mouse" },
{ LOGITECH_VID, LOGITECH_GPRO_WIRELESS_PID, 2, DEVICE_TYPE_MOUSE, "Logitech G Pro Wireless Gaming Mouse (Wired)" },
{ LOGITECH_VID, LOGITECH_G502_LIGHTSPEED_POWERPLAY_PID, 2, DEVICE_TYPE_MOUSE, "Logitech G502 Lightspeed With Powerplay Mousepad" },
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
| Mousemats |
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
};
/******************************************************************************************\
@@ -172,6 +193,17 @@ void DetectLogitechControllers(std::vector<RGBController*>& rgb_controllers)
}
break;
case LOGITECH_G203L_PID:
{
LogitechG203LController* controller = new LogitechG203LController(dev);
RGBController_LogitechG203L* rgb_controller = new RGBController_LogitechG203L(controller);
rgb_controller->name = device_list[device_idx].name;
rgb_controllers.push_back(rgb_controller);
}
break;
case LOGITECH_G403_PID:
case LOGITECH_G403H_PID:
{
@@ -182,6 +214,32 @@ void DetectLogitechControllers(std::vector<RGBController*>& rgb_controllers)
rgb_controller->name = device_list[device_idx].name;
rgb_controllers.push_back(rgb_controller);
}
break;
case LOGITECH_G502_PS_PID:
case LOGITECH_G502H_PID:
{
LogitechG502PSController* controller = new LogitechG502PSController(dev);
RGBController_LogitechG502PS* rgb_controller = new RGBController_LogitechG502PS(controller);
rgb_controller->name = device_list[device_idx].name;
rgb_controllers.push_back(rgb_controller);
}
break;
case LOGITECH_GPRO_WIRELESS_LIGHTSPEED_PID:
case LOGITECH_GPRO_WIRELESS_PID:
case LOGITECH_G502_LIGHTSPEED_POWERPLAY_PID:
{
LogitechGProWirelessController* controller = new LogitechGProWirelessController(dev);
RGBController_LogitechGProWireless* rgb_controller = new RGBController_LogitechGProWireless(controller);
rgb_controller->name = device_list[device_idx].name;
rgb_controllers.push_back(rgb_controller);
}
break;
}
}
}
@@ -193,4 +251,6 @@ void DetectLogitechControllers(std::vector<RGBController*>& rgb_controllers)
}
}
}
} /* DetectLogitechControllers() */
REGISTER_DETECTOR("Logitech", DetectLogitechControllers);
@@ -0,0 +1,140 @@
#include "LogitechG203LController.h"
#include <cstring>
LogitechG203LController::LogitechG203LController(hid_device* dev_handle)
{
dev = dev_handle;
}
void LogitechG203LController::SendApply()
{
unsigned char usb_buf[20];
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x11;
usb_buf[0x01] = 0xFF;
usb_buf[0x02] = 0x12;
usb_buf[0x03] = 0x7A;
hid_write(dev, usb_buf, 20);
hid_read(dev, usb_buf, 20);
}
void LogitechG203LController::SetSingleLED(int led, unsigned char red, unsigned char green, unsigned char blue)
{
unsigned char usb_buf[20];
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x11;
usb_buf[0x01] = 0xFF;
usb_buf[0x02] = 0x12;
usb_buf[0x03] = 0x19;
usb_buf[0x04] = (unsigned char)led;
usb_buf[0x05] = red;
usb_buf[0x06] = green;
usb_buf[0x07] = blue;
usb_buf[0x08] = 0xFF;
hid_write(dev, usb_buf, 20);
hid_read(dev, usb_buf, 20);
SendApply();
}
void LogitechG203LController::SetMode(
int mode,
int speed,
unsigned char bright,
unsigned char dir,
unsigned char red,
unsigned char green,
unsigned char blue)
{
unsigned char usb_buf[20];
memset(usb_buf, 0x00, sizeof(usb_buf));
//Header
usb_buf[0x00] = 0x11;
usb_buf[0x01] = 0xFF;
usb_buf[0x02] = 0x0E;
usb_buf[0x03] = 0x1A;
//Common Data
usb_buf[0x04] = 0x00;
usb_buf[0x05] = (unsigned char)mode;
usb_buf[0x06] = red;
usb_buf[0x07] = green;
usb_buf[0x08] = blue;
//mode specific Data and position
if(mode == LOGITECH_G203L_MODE_STATIC) usb_buf[0x09] = 0x02;
if(mode == LOGITECH_G203L_MODE_CYCLE)
{
usb_buf[0x0B] = (unsigned char)((speed>>8) & 0x000000FF);
usb_buf[0x0C] = (unsigned char)(speed & 0x000000FF);
usb_buf[0x0D] = bright;
}
if(mode == LOGITECH_G203L_MODE_BREATHING)
{
usb_buf[0x09] = (unsigned char)((speed>>8) & 0x000000FF);
usb_buf[0x0A] = (unsigned char)(speed & 0x000000FF);
usb_buf[0x0C] = bright;
}
if(mode == LOGITECH_G203L_MODE_WAVE)
{
usb_buf[0x0C] = (unsigned char)(speed & 0x000000FF);
usb_buf[0x0D] = dir ? 0x01 : 0x06; //0x01: Left->Right 0x06: Right->Left
usb_buf[0x0E] = bright;
usb_buf[0x0F] = (unsigned char)((speed>>8) & 0x000000FF);
}
if(mode == LOGITECH_G203L_MODE_COLORMIXING)
{
usb_buf[0x0C] = (unsigned char)(speed & 0x000000FF);
usb_buf[0x0D] = (unsigned char)((speed>>8) & 0x000000FF);
usb_buf[0x0E] = bright;
}
//END BYTE
usb_buf[0x10] = 0x01;
hid_write(dev, usb_buf, 20);
hid_read(dev, usb_buf, 20);
}
void LogitechG203LController::SetDevice(std::vector<RGBColor> colors)
{
unsigned char usb_buf[20];
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x11;
usb_buf[0x01] = 0xFF;
usb_buf[0x02] = 0x12;
usb_buf[0x03] = 0x1A;
usb_buf[0x04] = 0x01;
usb_buf[0x05] = RGBGetRValue(colors[0]);
usb_buf[0x06] = RGBGetGValue(colors[0]);
usb_buf[0x07] = RGBGetBValue(colors[0]);
usb_buf[0x08] = 0x02;
usb_buf[0x09] = RGBGetRValue(colors[1]);
usb_buf[0x0A] = RGBGetGValue(colors[1]);
usb_buf[0x0B] = RGBGetBValue(colors[1]);
usb_buf[0x0C] = 0x03;
usb_buf[0x0D] = RGBGetRValue(colors[2]);
usb_buf[0x0E] = RGBGetGValue(colors[2]);
usb_buf[0x0F] = RGBGetBValue(colors[2]);
usb_buf[0x10] = 0xFF;
hid_write(dev, usb_buf, 20);
hid_read(dev, usb_buf, 20);
SendApply();
}
@@ -0,0 +1,32 @@
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
LOGITECH_G203L_MODE_DIRECT = 0x07,
LOGITECH_G203L_MODE_OFF = 0x00,
LOGITECH_G203L_MODE_STATIC = 0x01,
LOGITECH_G203L_MODE_CYCLE = 0x02,
LOGITECH_G203L_MODE_WAVE = 0x03,
LOGITECH_G203L_MODE_BREATHING = 0x04,
LOGITECH_G203L_MODE_COLORMIXING = 0x06,
};
class LogitechG203LController
{
public:
LogitechG203LController(hid_device* dev_handle);
~LogitechG203LController();
void SetSingleLED(int led, unsigned char red, unsigned char green, unsigned char blue);
void SetMode(int mode, int speed, unsigned char brightness, unsigned char dir, unsigned char red, unsigned char green, unsigned char blue);
void SetDevice(std::vector<RGBColor> colors);
private:
hid_device* dev;
void SendApply();
};
@@ -0,0 +1,77 @@
/*-----------------------------------------*\
| Logitech502PSController.cpp |
| |
| Driver for Logitech G502 Proteus |
| Spectrum mouse lighting controller |
| |
| kernzerfall 07/28/2020 |
\*-----------------------------------------*/
#include "LogitechG502PSController.h"
#include <cstring>
LogitechG502PSController::LogitechG502PSController(hid_device* dev_handle)
{
dev = dev_handle;
}
LogitechG502PSController::~LogitechG502PSController()
{
hid_close(dev);
}
void LogitechG502PSController::SendMouseMode
(
unsigned char mode,
std::uint16_t speed,
unsigned char channel,
unsigned char red,
unsigned char green,
unsigned char blue
)
{
unsigned char usb_buf[20];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Lighting Control packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x11;
usb_buf[0x01] = 0xFF;
usb_buf[0x02] = 0x02;
usb_buf[0x03] = 0x3A;
usb_buf[0x04] = channel;
usb_buf[0x05] = mode;
usb_buf[0x06] = red;
usb_buf[0x07] = green;
usb_buf[0x08] = blue;
speed = 1000 + 4750 * (LOGITECH_G502_PS_SPEED_FASTEST - speed);
if(mode == LOGITECH_G502_PS_MODE_CYCLE)
{
usb_buf[0x0B] = speed >> 8;
usb_buf[0x0C] = speed & 0xFF;
usb_buf[0x0D] = 0x64;
}
else if(mode == LOGITECH_G502_PS_MODE_BREATHING)
{
usb_buf[0x09] = speed >> 8;
usb_buf[0x0A] = speed & 0xFF;
usb_buf[0x0C] = 0x64;
}else if(mode == LOGITECH_G502_PS_MODE_STATIC){
usb_buf[0x09] = 0x02;
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 20);
hid_read(dev, usb_buf, 20);
}
@@ -0,0 +1,53 @@
/*-----------------------------------------*\
| Logitech502PSController.h |
| |
| Definitions and types for Logitech |
| G502 Proteus Spectrum mouse lighting |
| controller |
| |
| kernzerfall 07/28/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
LOGITECH_G502_PS_MODE_OFF = 0x00,
LOGITECH_G502_PS_MODE_STATIC = 0x01,
LOGITECH_G502_PS_MODE_CYCLE = 0x03,
LOGITECH_G502_PS_MODE_BREATHING = 0x02
};
enum
{
LOGITECH_G502_PS_SPEED_SLOWEST = 0x00, /* Slowest speed */
LOGITECH_G502_PS_SPEED_SLOW = 0x01, /* Slow speed */
LOGITECH_G502_PS_SPEED_NORMAL = 0x02, /* Normal speed */
LOGITECH_G502_PS_SPEED_FAST = 0x03, /* Fast speed */
LOGITECH_G502_PS_SPEED_FASTEST = 0x04, /* Fastest speed */
};
class LogitechG502PSController
{
public:
LogitechG502PSController(hid_device* dev_handle);
~LogitechG502PSController();
void SendMouseMode
(
unsigned char mode,
unsigned short speed,
unsigned char channel,
unsigned char red,
unsigned char green,
unsigned char blue
);
private:
hid_device* dev;
};
@@ -0,0 +1,82 @@
/*-----------------------------------------*\
| LogitechGProWirelessController.cpp |
| |
| Driver for Logitech G Pro Wireless Gaming|
| Mouse lighting controller |
| |
| TheRogueZeta 8/5/2020 |
\*-----------------------------------------*/
#include "LogitechGProWirelessController.h"
#include <cstring>
LogitechGProWirelessController::LogitechGProWirelessController(hid_device* dev_handle)
{
dev = dev_handle;
}
LogitechGProWirelessController::~LogitechGProWirelessController()
{
hid_close(dev);
}
void LogitechGProWirelessController::SendMouseMode
(
unsigned char mode,
std::uint16_t speed,
unsigned char zone,
unsigned char red,
unsigned char green,
unsigned char blue
// unsigned char brightness
)
{
unsigned char usb_buf[20];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Lighting Control packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x11;
usb_buf[0x01] = 0x01;
usb_buf[0x02] = 0x07;
usb_buf[0x03] = 0x3C;
usb_buf[0x04] = zone;
usb_buf[0x05] = mode;
usb_buf[0x06] = red;
usb_buf[0x07] = green;
usb_buf[0x08] = blue;
speed = 1000 + 4750 * (LOGITECH_G_PRO_WIRELESS_SPEED_FASTEST - speed);
if(mode == LOGITECH_G_PRO_WIRELESS_MODE_STATIC)
{
usb_buf[0x09] = 0x02;
}
if(mode == LOGITECH_G_PRO_WIRELESS_MODE_CYCLE)
{
usb_buf[0x0B] = speed >> 8;
usb_buf[0x0C] = speed & 0xFF;
//usb_buf[0x0D] = brightness;
usb_buf[0x0D] = 0x64;
}
else if(mode == LOGITECH_G_PRO_WIRELESS_MODE_BREATHING)
{
usb_buf[0x09] = speed >> 8;
usb_buf[0x0A] = speed & 0xFF;
//usb_buf[0x0C] = brightness;
usb_buf[0x0C] = 0x64;
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 20);
hid_read(dev, usb_buf, 20);
}
@@ -0,0 +1,53 @@
/*-----------------------------------------*\
| LogitechGProWirelessController.h |
| |
| Definitions and types for Logitech G Pro |
| Wireless Gaming Mouse lighting controller|
| |
| TheRogueZeta 8/5/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
LOGITECH_G_PRO_WIRELESS_MODE_OFF = 0x00,
LOGITECH_G_PRO_WIRELESS_MODE_STATIC = 0x01,
LOGITECH_G_PRO_WIRELESS_MODE_CYCLE = 0x02,
LOGITECH_G_PRO_WIRELESS_MODE_BREATHING = 0x03,
};
enum
{
LOGITECH_G_PRO_WIRELESS_SPEED_SLOWEST = 0x00, /* Slowest speed */
LOGITECH_G_PRO_WIRELESS_SPEED_SLOW = 0x01, /* Slow speed */
LOGITECH_G_PRO_WIRELESS_SPEED_NORMAL = 0x02, /* Normal speed */
LOGITECH_G_PRO_WIRELESS_SPEED_FAST = 0x03, /* Fast speed */
LOGITECH_G_PRO_WIRELESS_SPEED_FASTEST = 0x04, /* Fastest speed */
};
class LogitechGProWirelessController
{
public:
LogitechGProWirelessController(hid_device* dev_handle);
~LogitechGProWirelessController();
void SendMouseMode
(
unsigned char mode,
unsigned short speed,
unsigned char zone,
unsigned char red,
unsigned char green,
unsigned char blue
// unsigned char brightness
);
private:
hid_device* dev;
};
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "MSI3ZoneController.h"
#include "RGBController.h"
#include "RGBController_MSI3Zone.h"
@@ -33,4 +34,6 @@ void DetectMSI3ZoneControllers(std::vector<RGBController*>& rgb_controllers)
rgb_controllers.push_back(rgb_controller);
}
}
} /* DetectMSI3ZoneControllers() */
REGISTER_DETECTOR("MSI 3-Zone Laptop", DetectMSI3ZoneControllers);
@@ -5,6 +5,7 @@
| |
\*-----------------------------------------*/
#include "Detector.h"
#include "MSIGPUController.h"
#include "RGBController.h"
#include "RGBController_MSIGPU.h"
@@ -21,6 +22,7 @@
/*-----------------------------------------------------*\
| NVidia device IDs |
\*-----------------------------------------------------*/
#define NVIDIA_GTX1070_DEV 0x1B81
#define NVIDIA_RTX2060_DEV 0x1F08
#define NVIDIA_RTX2060S_DEV 0x1F06
#define NVIDIA_RTX2070_DEV 0x1F02
@@ -37,6 +39,7 @@
/*-----------------------------------------------------*\
| MSI sub-device IDs |
\*-----------------------------------------------------*/
#define MSI_GTX1070_GAMING_X_SUB_DEV 0x3306
#define MSI_RTX2060S_GAMING_X_SUB_DEV 0xC752
#define MSI_RTX2070S_GAMING_X_SUB_DEV 0x373e
#define MSI_RTX2070S_GAMING_X_TRIO_SUB_DEV 0xC726
@@ -44,6 +47,7 @@
#define MSI_RTX2080S_GAMING_X_TRIO_SUB_DEV 0xC724
#define MSI_RTX2080TI_GAMING_X_TRIO_SUB_DEV 0x3715
#define MSI_RTX2060_GAMING_Z_6G_SUB_DEV 0x3754
#define MSI_RTX2060_GAMING_Z_6G_SUB_DEV_2 0x3752
#define MSI_RTX2070_ARMOR_SUB_DEV 0x3734
#define MSI_RTX2060S_ARMOR_OC_SUB_DEV 0xC754
#define MSI_RTX2080_SEA_HAWK_EK_X_SUB_DEV 0x3728
@@ -62,6 +66,7 @@ typedef struct
static const msi_gpu_pci_device device_list[] =
{
{ NVIDIA_VEN, NVIDIA_GTX1070_DEV, MSI_SUB_VEN, MSI_GTX1070_GAMING_X_SUB_DEV, "MSI GeForce GTX 1070 Gaming X" },
{ NVIDIA_VEN, NVIDIA_RTX2060S_DEV, MSI_SUB_VEN, MSI_RTX2060S_GAMING_X_SUB_DEV, "MSI GeForce RTX 2060 Super Gaming X" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_DEV, MSI_SUB_VEN, MSI_RTX2070S_GAMING_X_SUB_DEV, "MSI GeForce RTX 2070 Super Gaming X" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_DEV, MSI_SUB_VEN, MSI_RTX2070S_GAMING_X_TRIO_SUB_DEV, "MSI GeForce RTX 2070 Super Gaming X Trio" },
@@ -69,6 +74,7 @@ static const msi_gpu_pci_device device_list[] =
{ NVIDIA_VEN, NVIDIA_RTX2080S_DEV, MSI_SUB_VEN, MSI_RTX2080S_GAMING_X_TRIO_SUB_DEV, "MSI GeForce RTX 2080 Super Gaming X Trio" },
{ NVIDIA_VEN, NVIDIA_RTX2080TI_DEV, MSI_SUB_VEN, MSI_RTX2080TI_GAMING_X_TRIO_SUB_DEV, "MSI GeForce RTX 2080Ti Gaming X Trio" },
{ NVIDIA_VEN, NVIDIA_RTX2060_DEV, MSI_SUB_VEN, MSI_RTX2060_GAMING_Z_6G_SUB_DEV, "MSI GeForce RTX 2060 Gaming Z 6G" },
{ NVIDIA_VEN, NVIDIA_RTX2060_DEV, MSI_SUB_VEN, MSI_RTX2060_GAMING_Z_6G_SUB_DEV_2, "MSI GeForce RTX 2060 Gaming Z 6G" },
{ NVIDIA_VEN, NVIDIA_RTX2060S_DEV, MSI_SUB_VEN, MSI_RTX2060S_ARMOR_OC_SUB_DEV, "MSI GeForce RTX 2060 Super ARMOR OC" },
{ NVIDIA_VEN, NVIDIA_RTX2070_DEV, MSI_SUB_VEN, MSI_RTX2070_ARMOR_SUB_DEV, "MSI GeForce RTX 2070 ARMOR" },
{ NVIDIA_VEN, NVIDIA_RTX2080_DEV, MSI_SUB_VEN, MSI_RTX2080_SEA_HAWK_EK_X_SUB_DEV, "MSI GeForce RTX 2080 Sea Hawk EK X" },
@@ -111,3 +117,5 @@ void DetectMSIGPUControllers(std::vector<i2c_smbus_interface*> &busses, std::vec
}
}
} /* DetectMSIGPUControllers() */
REGISTER_I2C_DETECTOR("MSI GPU", DetectMSIGPUControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "MSIMysticLightController.h"
#include "RGBController_MSIMysticLight.h"
@@ -98,4 +99,8 @@ void DetectMSIMysticLightControllers(std::vector<RGBController*> &rgb_controller
rgb_controllers.push_back(rgb_controller);
}
}
}
} /* DetectMSIMysticLightControllers() */
// The MSI Mystic Light controller is disabled due to bricking risk
// Uncomment this line to enable. Do so at your own risk.
//REGISTER_DETECTOR("MSI Mystic Light", DetectMSIMysticLightControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "MSIRGBController.h"
#include "RGBController.h"
#include "RGBController_MSIRGB.h"
@@ -38,3 +39,5 @@ void DetectMSIRGBControllers(std::vector<RGBController*> &rgb_controllers)
}
}
} /* DetectMSIRGBControllers() */
REGISTER_DETECTOR("MSI-RGB", DetectMSIRGBControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "NZXTHue2Controller.h"
#include "RGBController.h"
#include "RGBController_NZXTHue2.h"
@@ -76,3 +77,5 @@ void DetectNZXTHue2Controllers(std::vector<RGBController*> &rgb_controllers)
}
}
} /* DetectNZXTHue2Controllers() */
REGISTER_DETECTOR("NZXT Hue 2", DetectNZXTHue2Controllers);
@@ -1,18 +1,38 @@
#include "Detector.h"
#include "NZXTKrakenController.h"
#include "RGBController.h"
#include "RGBController_NZXTKraken.h"
#include <vector>
#include <hidapi/hidapi.h>
#define NZXT_KRAKEN_VID 0x1E71
#define NZXT_KRAKEN_PID 0x170E
#define NZXT_KRAKEN_VID 0x1E71
#define NZXT_KRAKEN_X2_PID 0x170E
#define NZXT_KRAKEN_M2_PID 0x1715
typedef struct
{
unsigned short usb_vid;
unsigned short usb_pid;
const char * name;
} nzxt_kraken_device;
#define NZXT_KRAKEN_NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
static const nzxt_kraken_device device_list[] =
{
/*-----------------------------------------------------------------------------------------------------*\
| NZXT Hue 2 devices |
\*-----------------------------------------------------------------------------------------------------*/
{ NZXT_KRAKEN_VID, NZXT_KRAKEN_X2_PID, "NZXT Kraken X2" },
{ NZXT_KRAKEN_VID, NZXT_KRAKEN_M2_PID, "NZXT Kraken M2" },
};
/******************************************************************************************\
* *
* DetectNZXTKrakenControllers *
* *
* Detect devices supported by the NZXTKraken driver *
* * *
* *
\******************************************************************************************/
void DetectNZXTKrakenControllers(std::vector<RGBController*> &rgb_controllers)
@@ -22,17 +42,17 @@ void DetectNZXTKrakenControllers(std::vector<RGBController*> &rgb_controllers)
hid_init();
for(std::size_t device_idx = 0; device_idx < 1; device_idx++)
for(std::size_t device_idx = 0; device_idx < NZXT_KRAKEN_NUM_DEVICES; device_idx++)
{
dev = NULL;
info = hid_enumerate(NZXT_KRAKEN_VID, NZXT_KRAKEN_PID);
info = hid_enumerate(device_list[device_idx].usb_vid, device_list[device_idx].usb_pid);
//Look for NZXT Kraken devices
while(info)
{
if((info->vendor_id == NZXT_KRAKEN_VID)
&&(info->product_id == NZXT_KRAKEN_PID))
if((info->vendor_id == device_list[device_idx].usb_vid)
&&(info->product_id == device_list[device_idx].usb_pid))
{
dev = hid_open_path(info->path);
@@ -42,10 +62,14 @@ void DetectNZXTKrakenControllers(std::vector<RGBController*> &rgb_controllers)
RGBController_NZXTKraken* rgb_controller = new RGBController_NZXTKraken(controller);
rgb_controller->name = device_list[device_idx].name;
rgb_controllers.push_back(rgb_controller);
}
}
info = info->next;
}
}
}
} /* DetectNZXTKrakenControllers() */
REGISTER_DETECTOR("NZXT Kraken", DetectNZXTKrakenControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "PatriotViperController.h"
#include "RGBController.h"
#include "RGBController_PatriotViper.h"
@@ -70,3 +71,5 @@ void DetectPatriotViperControllers(std::vector<i2c_smbus_interface*> &busses, st
}
} /* DetectPatriotViperControllers() */
REGISTER_I2C_DETECTOR("Patriot Viper", DetectPatriotViperControllers);
@@ -10,12 +10,14 @@
#include "PolychromeController.h"
#include <cstring>
using namespace std::chrono_literals;
PolychromeController::PolychromeController(i2c_smbus_interface* bus, polychrome_dev_id dev)
{
this->bus = bus;
this->dev = dev;
unsigned short fw_version = GetFirmwareVersion();
unsigned short fw_version = ReadFirmwareVersion();
unsigned char major_version = fw_version >> 8;
unsigned char minor_version = fw_version & 0xFF;
@@ -25,23 +27,30 @@ PolychromeController::PolychromeController(i2c_smbus_interface* bus, polychrome_
| Versions 1.xx and 2.xx use ASR LED, 3.xx uses |
| Polychrome |
\*-----------------------------------------------------*/
if((major_version < 0x03) && (major_version > 0x00))
switch(major_version)
{
snprintf(device_name, 32, "ASRock ASR LED FW %d.%02d", major_version, minor_version);
led_count = 1;
asr_led = true;
case ASROCK_TYPE_ASRLED:
device_name = "ASRock ASR LED";
asrock_type = ASROCK_TYPE_ASRLED;
memset(zone_led_count, 0, sizeof(zone_led_count));
break;
case ASROCK_TYPE_POLYCHROME_V1:
device_name = "ASRock Polychrome V1";
asrock_type = ASROCK_TYPE_POLYCHROME_V1;
ReadLEDConfiguration();
break;
case ASROCK_TYPE_POLYCHROME_V2:
device_name = "ASRock Polychrome V2";
asrock_type = ASROCK_TYPE_POLYCHROME_V2;
ReadLEDConfiguration();
break;
default:
asrock_type = ASROCK_TYPE_UNKNOWN;
break;
}
else if(major_version == 0x03)
{
snprintf(device_name, 32, "ASRock Polychrome FW %d.%02d", major_version, minor_version);
led_count = 1;
asr_led = false;
}
else
{
led_count = 0;
}
}
PolychromeController::~PolychromeController()
@@ -49,18 +58,34 @@ PolychromeController::~PolychromeController()
}
char* PolychromeController::GetDeviceName()
unsigned int PolychromeController::GetASRockType()
{
return(asrock_type);
}
std::string PolychromeController::GetDeviceName()
{
return(device_name);
}
unsigned short PolychromeController::GetFirmwareVersion()
std::string PolychromeController::GetFirmwareVersion()
{
unsigned short fw_version = ReadFirmwareVersion();
unsigned char major_version = fw_version >> 8;
unsigned char minor_version = fw_version & 0xFF;
return(std::to_string(major_version) + "." + std::to_string(minor_version));
}
unsigned short PolychromeController::ReadFirmwareVersion()
{
// The firmware register holds two bytes, so the first read should return 2
// If not, report invalid firmware revision FFFF
if (bus->i2c_smbus_read_byte_data(dev, POLYCHROME_REG_FIRMWARE_VER) == 0x02)
{
std::this_thread::sleep_for(1ms);
unsigned char major = bus->i2c_smbus_read_byte(dev);
std::this_thread::sleep_for(1ms);
unsigned char minor = bus->i2c_smbus_read_byte(dev);
return((major << 8) | minor);
@@ -71,9 +96,29 @@ unsigned short PolychromeController::GetFirmwareVersion()
}
}
unsigned int PolychromeController::GetLEDCount()
void PolychromeController::ReadLEDConfiguration()
{
return(led_count);
// The LED configuration register holds 6 bytes, so the first read should return 6
// If not, set all zone sizes to zero
if (bus->i2c_smbus_read_byte_data(dev, POLYCHROME_REG_LED_CONFIG) == 0x06)
{
std::this_thread::sleep_for(1ms);
zone_led_count[POLYCHROME_ZONE_RGB_FAN_HDR] = bus->i2c_smbus_read_byte(dev);
std::this_thread::sleep_for(1ms);
zone_led_count[POLYCHROME_ZONE_RGB_LED_HDR] = bus->i2c_smbus_read_byte(dev);
std::this_thread::sleep_for(1ms);
zone_led_count[POLYCHROME_ZONE_AUDIO] = bus->i2c_smbus_read_byte(dev);
std::this_thread::sleep_for(1ms);
zone_led_count[POLYCHROME_ZONE_PCH] = bus->i2c_smbus_read_byte(dev);
std::this_thread::sleep_for(1ms);
zone_led_count[POLYCHROME_ZONE_IO_COVER] = bus->i2c_smbus_read_byte(dev);
std::this_thread::sleep_for(1ms);
zone_led_count[POLYCHROME_ZONE_ADDRESSABLE] = bus->i2c_smbus_read_byte(dev);
}
else
{
memset(zone_led_count, 0, sizeof(zone_led_count));
}
}
unsigned int PolychromeController::GetMode()
@@ -81,89 +126,109 @@ unsigned int PolychromeController::GetMode()
return(active_mode);
}
bool PolychromeController::IsAsrLed()
void PolychromeController::SetColorsAndSpeed(unsigned char led, unsigned char red, unsigned char green, unsigned char blue)
{
return(asr_led);
}
void PolychromeController::SetColorsAndSpeed(unsigned char red, unsigned char green, unsigned char blue, unsigned char speed)
{
unsigned char color_speed_pkt[4] = { red, green, blue, speed };
if (asr_led)
unsigned char color_speed_pkt[4] = { red, green, blue, active_speed };
unsigned char select_led_pkt[1] = { led };
switch(asrock_type)
{
switch(active_mode)
{
case ASROCK_TYPE_ASRLED:
switch(active_mode)
{
/*-----------------------------------------------------*\
| These modes take 4 bytes in R/G/B/S order |
\*-----------------------------------------------------*/
case ASRLED_MODE_BREATHING:
case ASRLED_MODE_FLASHING:
case ASRLED_MODE_SPECTRUM_CYCLE:
bus->i2c_smbus_write_block_data(dev, active_mode, 4, color_speed_pkt);
break;
/*-----------------------------------------------------*\
| These modes take 3 bytes in R/G/B order |
\*-----------------------------------------------------*/
default:
case ASRLED_MODE_STATIC:
case ASRLED_MODE_MUSIC:
bus->i2c_smbus_write_block_data(dev, active_mode, 3, color_speed_pkt);
break;
/*-----------------------------------------------------*\
| These modes take 1 byte - speed |
\*-----------------------------------------------------*/
case ASRLED_MODE_RANDOM:
case ASRLED_MODE_WAVE:
bus->i2c_smbus_write_block_data(dev, active_mode, 1, &active_speed);
break;
/*-----------------------------------------------------*\
| These modes take no bytes |
\*-----------------------------------------------------*/
case ASRLED_MODE_OFF:
break;
}
std::this_thread::sleep_for(1ms);
break;
case ASROCK_TYPE_POLYCHROME_V1:
case ASROCK_TYPE_POLYCHROME_V2:
/*-----------------------------------------------------*\
| These modes take 4 bytes in R/G/B/S order |
| Select LED |
\*-----------------------------------------------------*/
case ASRLED_MODE_BREATHING:
case ASRLED_MODE_FLASHING:
case ASRLED_MODE_SPECTRUM_CYCLE:
bus->i2c_smbus_write_block_data(dev, active_mode, 4, color_speed_pkt);
break;
bus->i2c_smbus_write_block_data(dev, POLYCHROME_REG_LED_SELECT, 1, select_led_pkt);
std::this_thread::sleep_for(1ms);
/*-----------------------------------------------------*\
| These modes take 3 bytes in R/G/B order |
| Polychrome firmware always writes color to fixed reg |
\*-----------------------------------------------------*/
default:
case ASRLED_MODE_STATIC:
case ASRLED_MODE_MUSIC:
bus->i2c_smbus_write_block_data(dev, active_mode, 3, color_speed_pkt);
break;
/*-----------------------------------------------------*\
| These modes take 1 byte - speed |
\*-----------------------------------------------------*/
case ASRLED_MODE_RANDOM:
case ASRLED_MODE_WAVE:
bus->i2c_smbus_write_block_data(dev, active_mode, 1, &speed);
break;
/*-----------------------------------------------------*\
| These modes take no bytes |
\*-----------------------------------------------------*/
case ASRLED_MODE_OFF:
break;
}
}
else
{
/*-----------------------------------------------------*\
| Polychrome firmware always writes color to fixed reg |
\*-----------------------------------------------------*/
bus->i2c_smbus_write_block_data(dev, POLYCHROME_REG_COLOR, 3, color_speed_pkt);
switch(active_mode)
{
/*-----------------------------------------------------*\
| These modes don't take a speed |
\*-----------------------------------------------------*/
POLYCHROME_MODE_OFF:
POLYCHROME_MODE_STATIC:
break;
/*-----------------------------------------------------*\
| All other modes, write speed to active mode register |
\*-----------------------------------------------------*/
default:
bus->i2c_smbus_write_block_data(dev, active_mode, 1, &speed);
break;
}
bus->i2c_smbus_write_block_data(dev, POLYCHROME_REG_COLOR, 3, color_speed_pkt);
std::this_thread::sleep_for(1ms);
break;
}
}
void PolychromeController::SetMode(unsigned char mode)
void PolychromeController::SetMode(unsigned char mode, unsigned char speed)
{
active_mode = mode;
unsigned char led_count_pkt[1] = { 0x00 };
active_mode = mode;
active_speed = speed;
if (asr_led)
switch(asrock_type)
{
bus->i2c_smbus_write_block_data(dev, ASRLED_REG_MODE, 1, &active_mode);
}
else
{
bus->i2c_smbus_write_block_data(dev, POLYCHROME_REG_MODE, 1, &active_mode);
case ASROCK_TYPE_ASRLED:
bus->i2c_smbus_write_block_data(dev, ASRLED_REG_MODE, 1, &active_mode);
std::this_thread::sleep_for(1ms);
break;
case ASROCK_TYPE_POLYCHROME_V1:
case ASROCK_TYPE_POLYCHROME_V2:
bus->i2c_smbus_write_block_data(dev, POLYCHROME_REG_MODE, 1, &active_mode);
std::this_thread::sleep_for(1ms);
/*-----------------------------------------------------*\
| Select a single LED |
\*-----------------------------------------------------*/
bus->i2c_smbus_write_block_data(dev, POLYCHROME_REG_LED_COUNT, 0, led_count_pkt);
std::this_thread::sleep_for(1ms);
switch(active_mode)
{
/*-----------------------------------------------------*\
| These modes don't take a speed |
\*-----------------------------------------------------*/
case POLYCHROME_MODE_OFF:
case POLYCHROME_MODE_STATIC:
break;
/*-----------------------------------------------------*\
| All other modes, write speed to active mode register |
\*-----------------------------------------------------*/
default:
bus->i2c_smbus_write_block_data(dev, active_mode, 1, &speed);
std::this_thread::sleep_for(1ms);
break;
}
break;
}
}
}
@@ -9,11 +9,20 @@
\*-----------------------------------------*/
#include "i2c_smbus.h"
#include <string>
#pragma once
typedef unsigned char polychrome_dev_id;
enum
{
ASROCK_TYPE_UNKNOWN = 0x00, /* Unknown Type or Not ASRock Device */
ASROCK_TYPE_ASRLED = 0x01, /* ASRock Firmware 1.x - ASR LED */
ASROCK_TYPE_POLYCHROME_V1 = 0x02, /* ASRock Firmware 2.x - Polychrome V1 */
ASROCK_TYPE_POLYCHROME_V2 = 0x03, /* ASRock Firmware 3.x - Polychrome V2 */
};
enum
{
ASRLED_REG_FIRMWARE_VER = 0x00, /* Firmware version Major.Minor */
@@ -45,6 +54,9 @@ enum
{
POLYCHROME_REG_FIRMWARE_VER = 0x00, /* Firmware version Major.Minor */
POLYCHROME_REG_MODE = 0x30, /* Mode selection register */
POLYCHROME_REG_LED_SELECT = 0x31, /* LED selection register */
POLYCHROME_REG_LED_COUNT = 0x32, /* Additional LED count register */
POLYCHROME_REG_LED_CONFIG = 0x33, /* LED configuration register */
POLYCHROME_REG_COLOR = 0x34, /* Color register: Red, Green, Blue */
};
@@ -75,26 +87,40 @@ enum
POLYCHROME_SPEED_MAX = 0x00, /* Fastest speed */
};
enum
{
POLYCHROME_ZONE_RGB_FAN_HDR = 0x00, /* RGB Fan Header */
POLYCHROME_ZONE_RGB_LED_HDR = 0x01, /* RGB LED Header */
POLYCHROME_ZONE_AUDIO = 0x02, /* Audio Zone LEDs */
POLYCHROME_ZONE_PCH = 0x03, /* PCH Zone LEDs */
POLYCHROME_ZONE_IO_COVER = 0x04, /* IO Cover Zone LEDs */
POLYCHROME_ZONE_ADDRESSABLE = 0x05, /* Addressable LED header */
POLYCHROME_ZONE_COUNT = 0x06, /* Total number of zones */
};
class PolychromeController
{
public:
PolychromeController(i2c_smbus_interface* bus, polychrome_dev_id dev);
~PolychromeController();
char* GetDeviceName();
unsigned int GetLEDCount();
std::string GetDeviceName();
std::string GetFirmwareVersion();
unsigned int GetMode();
bool IsAsrLed();
void SetColorsAndSpeed(unsigned char red, unsigned char green, unsigned char blue, unsigned char speed);
void SetMode(unsigned char mode);
unsigned short GetFirmwareVersion();
unsigned int GetASRockType();
void SetColorsAndSpeed(unsigned char led, unsigned char red, unsigned char green, unsigned char blue);
void SetMode(unsigned char mode, unsigned char speed);
unsigned int zone_led_count[6];
private:
bool asr_led;
char device_name[32];
unsigned int led_count;
unsigned int asrock_type;
std::string device_name;
unsigned char active_mode;
unsigned char active_speed;
i2c_smbus_interface* bus;
polychrome_dev_id dev;
unsigned short ReadFirmwareVersion();
void ReadLEDConfiguration();
};
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "PolychromeController.h"
#include "RGBController.h"
#include "RGBController_Polychrome.h"
@@ -54,7 +55,7 @@ void DetectPolychromeControllers(std::vector<i2c_smbus_interface*>& busses, std:
{
new_polychrome = new PolychromeController(busses[bus], 0x6A);
if(new_polychrome->GetLEDCount() != 0)
if(new_polychrome->GetASRockType() != ASROCK_TYPE_UNKNOWN)
{
new_controller = new RGBController_Polychrome(new_polychrome);
rgb_controllers.push_back(new_controller);
@@ -62,8 +63,10 @@ void DetectPolychromeControllers(std::vector<i2c_smbus_interface*>& busses, std:
else
{
delete new_polychrome;
}
}
}
}
} /* DetectPolychromeControllers() */
REGISTER_I2C_DETECTOR("ASRock Polychrome", DetectPolychromeControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "PoseidonZRGBController.h"
#include "RGBController.h"
#include "RGBController_PoseidonZRGB.h"
@@ -50,5 +51,6 @@ void DetectPoseidonZRGBControllers(std::vector<RGBController*>& rgb_controllers)
info = info->next;
}
} /* DetectPoseidonZRGBControllers() */
}
REGISTER_DETECTOR("Thermaltake Poseidon Z RGB", DetectPoseidonZRGBControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "RGBFusion2DRAMController.h"
#include "RGBController.h"
#include "RGBController_RGBFusion2DRAM.h"
@@ -65,3 +66,6 @@ void DetectRGBFusion2DRAMControllers(std::vector<i2c_smbus_interface*>& busses,
}
} /* DetectRGBFusion2DRAMControllers() */
// This detector is disabled as proper detection isn't implemented
//REGISTER_I2C_DETECTOR("Gigabyte RGB Fusion 2 DRAM", DetectRGBFusion2DRAMControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "RGBFusion2SMBusController.h"
#include "RGBController.h"
#include "RGBController_RGBFusion2SMBus.h"
@@ -71,3 +72,6 @@ void DetectRGBFusion2SMBusControllers(std::vector<i2c_smbus_interface*>& busses,
}
} /* DetectRGBFusion2SMBusControllers() */
// This detector is disabled as proper detection is not implemented
//REGISTER_DETECTOR("Gigabyte RGB Fusion 2 SMBus", DetectRGBFusion2SMBusControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "RGBFusion2USBController.h"
#include "RGBController_RGBFusion2USB.h"
#include "dependencies/dmiinfo.h"
@@ -59,7 +60,6 @@ void DetectRGBFusion2USBControllers(std::vector<RGBController*> &rgb_controllers
RGBFusion2USBController * controller = new RGBFusion2USBController(dev, info->path, MB_info.getMainboard());
RGBController_RGBFusion2USB * rgb_controller = new RGBController_RGBFusion2USB(controller);
rgb_controllers.push_back(rgb_controller);
break;
}
}
info = info->next;
@@ -67,4 +67,6 @@ void DetectRGBFusion2USBControllers(std::vector<RGBController*> &rgb_controllers
}
hid_free_enumeration(info);
}
} /* DetectRGBFusion2USBControllers() */
REGISTER_DETECTOR("Gigabyte RGB Fusion 2 USB", DetectRGBFusion2USBControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "RGBFusionController.h"
#include "RGBController.h"
#include "RGBController_RGBFusion.h"
@@ -64,4 +65,6 @@ void DetectRGBFusionControllers(std::vector<i2c_smbus_interface*>& busses, std::
}
}
} /* DetectRGBFusionControllers() */
} /* DetectRGBFusionControllers() */
REGISTER_I2C_DETECTOR("Gigabyte RGB Fusion", DetectRGBFusionControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "RGBFusionGPUController.h"
#include "RGBController.h"
#include "RGBController_RGBFusionGPU.h"
@@ -81,3 +82,5 @@ void DetectRGBFusionGPUControllers(std::vector<i2c_smbus_interface*>& busses, st
}
} /* DetectRGBFusionGPUControllers() */
REGISTER_I2C_DETECTOR("Gigabyte RGB Fusion GPU", DetectRGBFusionGPUControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "RedragonK556Controller.h"
#include "RedragonM711Controller.h"
#include "RGBController.h"
@@ -123,4 +124,6 @@ void DetectRedragonControllers(std::vector<RGBController*>& rgb_controllers)
info = info->next;
}
}
}
} /* DetectRedragonControllers() */
REGISTER_DETECTOR("Redragon Peripheral", DetectRedragonControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "SapphireGPUController.h"
#include "RGBController.h"
#include "RGBController_SapphireGPU.h"
@@ -57,3 +58,6 @@ void DetectSapphireGPUControllers(std::vector<i2c_smbus_interface*>& busses, std
}
} /* DetectSapphireGPUControllers() */
// This detector is disabled as it does not properly detect
//REGISTER_I2C_DETECTOR("Sapphire GPU", DetectSapphireGPUControllers);
@@ -21,11 +21,20 @@ static unsigned int keys[] = {0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x
0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52,
0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
0x60, 0x61, 0x62, 0x63, 0x64, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
0xf0 };
0xf0, 0x31 };
SteelSeriesApexController::SteelSeriesApexController(hid_device* dev_handle)
static unsigned int keys_tkl[] = {0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,
0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45,
0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52,
0x64, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xf0, 0x31 };
SteelSeriesApexController::SteelSeriesApexController(hid_device* dev_handle, steelseries_type type)
{
dev = dev_handle;
proto_type = type;
}
SteelSeriesApexController::~SteelSeriesApexController()
@@ -50,7 +59,16 @@ void SteelSeriesApexController::SetMode
void SteelSeriesApexController::SetLEDsDirect(std::vector<RGBColor> colors)
{
unsigned char buf[643];
int num_keys = sizeof(keys)/sizeof(*keys);
int num_keys = 0;
if(proto_type == APEX)
{
num_keys = sizeof(keys) / sizeof(*keys);
}
else
{
num_keys = sizeof(keys_tkl) / sizeof(*keys_tkl);
}
/*-----------------------------------------------------*\
| Zero out buffer |
@@ -61,7 +79,7 @@ void SteelSeriesApexController::SetLEDsDirect(std::vector<RGBColor> colors)
| Set up Direct packet |
\*-----------------------------------------------------*/
buf[0x00] = 0;
buf[0x01] = APEX7_PACKET_ID_DIRECT;
buf[0x01] = APEX_PACKET_ID_DIRECT;
buf[0x02] = num_keys;
/*-----------------------------------------------------*\
@@ -69,7 +87,14 @@ void SteelSeriesApexController::SetLEDsDirect(std::vector<RGBColor> colors)
\*-----------------------------------------------------*/
for(int i = 0; i < num_keys; i++)
{
buf[(i*4)+3] = keys[i];
if(proto_type == APEX)
{
buf[(i*4)+3] = keys[i];
}
else
{
buf[(i*4)+3] = keys_tkl[i];
}
buf[(i*4)+4] = RGBGetRValue(colors[i]);
buf[(i*4)+5] = RGBGetGValue(colors[i]);
buf[(i*4)+6] = RGBGetBValue(colors[i]);
@@ -8,6 +8,7 @@
\*-----------------------------------------*/
#include "RGBController.h"
#include "SteelSeriesGeneric.h"
#include <string>
#include <hidapi/hidapi.h>
@@ -16,15 +17,17 @@
enum
{
APEX7_PACKET_ID_DIRECT = 0x3a, /* Direct mode */
APEX_PACKET_ID_DIRECT = 0x3a, /* Direct mode */
};
class SteelSeriesApexController
{
public:
SteelSeriesApexController(hid_device* dev_handle);
SteelSeriesApexController(hid_device* dev_handle, steelseries_type type);
~SteelSeriesApexController();
steelseries_type proto_type;
void SetMode
(
unsigned char mode,
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "SteelSeriesRivalController.h"
#include "SteelSeriesSiberiaController.h"
#include "SteelSeriesApexController.h"
@@ -35,7 +36,10 @@
/*-----------------------------------------------------*\
| Keyboard product IDs |
\*-----------------------------------------------------*/
#define STEELSERIES_APEX_5_PID 0x161C
#define STEELSERIES_APEX_7_PID 0x1612
#define STEELSERIES_APEX_7_TKL_PID 0x1618
#define STEELSERIES_APEX_PRO_PID 0x1610
typedef struct
{
@@ -73,7 +77,10 @@ static const steelseries_device device_list[] =
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------*\
| Keyboards |
\*-----------------------------------------------------------------------------------------------------------------------------------------------------------------*/
{ STEELSERIES_VID, STEELSERIES_APEX_7_PID, 1, DEVICE_TYPE_KEYBOARD, APEX_7, "SteelSeries Apex 7" },
{ STEELSERIES_VID, STEELSERIES_APEX_5_PID, 1, DEVICE_TYPE_KEYBOARD, APEX, "SteelSeries Apex 5" },
{ STEELSERIES_VID, STEELSERIES_APEX_7_PID, 1, DEVICE_TYPE_KEYBOARD, APEX, "SteelSeries Apex 7" },
{ STEELSERIES_VID, STEELSERIES_APEX_7_TKL_PID, 1, DEVICE_TYPE_KEYBOARD, APEX_TKL, "SteelSeries Apex 7 TKL" },
{ STEELSERIES_VID, STEELSERIES_APEX_PRO_PID, 1, DEVICE_TYPE_KEYBOARD, APEX, "SteelSeries Apex Pro" },
};
/******************************************************************************************\
@@ -119,7 +126,7 @@ void DetectSteelSeriesControllers(std::vector<RGBController*>& rgb_controllers)
{
case DEVICE_TYPE_KEYBOARD:
{
SteelSeriesApexController* controller = new SteelSeriesApexController(dev);
SteelSeriesApexController* controller = new SteelSeriesApexController(dev, device_list[device_idx].proto_type);
RGBController_SteelSeriesApex* rgb_controller = new RGBController_SteelSeriesApex(controller);
rgb_controller->name = device_list[device_idx].name;
@@ -153,4 +160,6 @@ void DetectSteelSeriesControllers(std::vector<RGBController*>& rgb_controllers)
}
}
}
}
} /* DetectSteelSeriesControllers() */
REGISTER_DETECTOR("SteelSeries", DetectSteelSeriesControllers);
@@ -20,6 +20,7 @@ typedef enum
RIVAL_100 = 0x00,
RIVAL_300 = 0x01,
SIBERIA_350 = 0x03,
APEX_7 = 0x04,
APEX = 0x04,
APEX_TKL = 0x05,
} steelseries_type;
@@ -0,0 +1,96 @@
/*-------------------------------------------------------------------*\
| TecknetController.cpp |
| |
| Driver for Technet Devices |
| |
| Chris M (Dr_No) 29th Jul 2020 |
| |
\*-------------------------------------------------------------------*/
#include "TecknetController.h"
TecknetController::TecknetController(hid_device* dev_handle, char *_path)
{
const int szTemp = 256;
wchar_t tmpName[szTemp];
dev = dev_handle;
hid_get_manufacturer_string(dev, tmpName, szTemp);
std::wstring wName = std::wstring(tmpName);
device_name = std::string(wName.begin(), wName.end());
hid_get_product_string(dev, tmpName, szTemp);
wName = std::wstring(tmpName);
device_name.append(" ").append(std::string(wName.begin(), wName.end()));
hid_get_serial_number_string(dev, tmpName, szTemp);
wName = std::wstring(tmpName);
serial = std::string(wName.begin(), wName.end());
location = _path;
current_mode = TECKNET_MODE_STATIC;
current_speed = TECKNET_SPEED_NORMAL;
current_brightness = TECKNET_BRIGHTNESS_HIGH;
}
TecknetController::~TecknetController()
{
hid_close(dev);
}
std::string TecknetController::GetDeviceName()
{
return device_name;
}
std::string TecknetController::GetSerial()
{
return serial;
}
std::string TecknetController::GetLocation()
{
return location;
}
void TecknetController::SetMode(unsigned char mode, unsigned char speed, unsigned char brightness)
{
current_mode = mode;
current_speed = speed;
current_brightness = brightness;
SendUpdate();
}
void TecknetController::SetColor(unsigned char red, unsigned char green, unsigned char blue)
{
//The Tecknet mouse expects inverted colours in sent packets
current_red = 255 - red;
current_green = 255 - green;
current_blue = 255 - blue;
SendUpdate();
}
void TecknetController::SendUpdate()
{
unsigned char buffer[TECKNET_PACKET_LENGTH] = { 0x00 };
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
for(int i = 0; i < TECKNET_COLOUR_MODE_DATA_SIZE; i++)
{
buffer[i] = tecknet_colour_mode_data[current_mode][i];
}
//Set the relevant colour info
buffer[TECKNET_RED_BYTE] = current_red;
buffer[TECKNET_GREEN_BYTE] = current_green;
buffer[TECKNET_BLUE_BYTE] = current_blue;
buffer[TECKNET_BRIGHTNESS_BYTE] = current_brightness;
buffer[TECKNET_SPEED_BYTE] = tecknet_speed_mode_data[current_mode][current_speed];
hid_send_feature_report(dev, buffer, buffer_size);
}
@@ -0,0 +1,94 @@
/*-------------------------------------------------------------------*\
| TecknetController.h |
| |
| Driver for Tecknet Devices |
| |
| Chris M (Dr_No) 29th Jul 2020 |
| |
\*-------------------------------------------------------------------*/
#ifndef TECKNETCONTROLLER_H
#define TECKNETCONTROLLER_H
#include <string>
#include <hidapi/hidapi.h>
#define TECKNET_COLOUR_MODE_DATA_SIZE (sizeof(tecknet_colour_mode_data[0]) / sizeof(tecknet_colour_mode_data[0][0]))
#define TECKNET_DEVICE_NAME_SIZE (sizeof(device_name) / sizeof(device_name[ 0 ]))
#define TECKNET_PACKET_LENGTH 0x10 //16 bytes
enum
{
TECKNET_RED_BYTE = 2,
TECKNET_GREEN_BYTE = 3,
TECKNET_BLUE_BYTE = 4,
TECKNET_BRIGHTNESS_BYTE = 5,
TECKNET_SPEED_BYTE = 6
};
enum
{
TECKNET_MODE_OFF = 0xFF, //LEDs Off
TECKNET_MODE_STATIC = 0x00, //Static Mode
TECKNET_MODE_BREATHING = 0x01, //Breathing Mode
};
enum
{
TECKNET_BRIGHTNESS_OFF = 0x00,
TECKNET_BRIGHTNESS_LOW = 0x01,
TECKNET_BRIGHTNESS_MED = 0x02,
TECKNET_BRIGHTNESS_HIGH = 0x03
};
static unsigned char tecknet_colour_mode_data[][16] =
{
{ 0x02, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00 }, // Static
{ 0x02, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00 }, // Breathing
};
static unsigned char tecknet_speed_mode_data[][9] =
{
{ 0x00, 0x00, 0x00, 0x00 }, // Static
{ 0x00, 0x06, 0x03, 0x01 }, // Breathing
};
enum
{
TECKNET_SPEED_OFF = 0x00, // Breathe Off
TECKNET_SPEED_SLOW = 0x01, // Breathe Slow speed
TECKNET_SPEED_NORMAL = 0x02, // Breathe Normal speed
TECKNET_SPEED_FAST = 0x03, // Breathe Fast speed
};
class TecknetController
{
public:
TecknetController(hid_device *dev_handle, char *_path);
~TecknetController();
std::string GetDeviceName();
std::string GetSerial();
std::string GetLocation();
void SetMode(unsigned char mode, unsigned char speed, unsigned char brightness);
void SetColor(unsigned char red, unsigned char green, unsigned char blue);
private:
std::string device_name;
std::string serial;
std::string location;
hid_device* dev;
unsigned char current_mode;
unsigned char current_speed;
unsigned char current_brightness;
unsigned char current_red;
unsigned char current_green;
unsigned char current_blue;
void SendUpdate();
};
#endif // TECKNETCONTROLLER_H
@@ -0,0 +1,87 @@
/*-------------------------------------------------------------------*\
| TecknetControllerDetect.cpp |
| |
| Driver for Tecknet Devices |
| |
| Chris M (Dr_No) 29th Jul 2020 |
| |
\*-------------------------------------------------------------------*/
#include "Detector.h"
#include "TecknetController.h"
#include "RGBController.h"
#include "RGBController_Tecknet.h"
#include <hidapi/hidapi.h>
#define TECKNET_VID 0x04D9
#define TECKNET_M0008_PID 0xFC05
#define TECKNET_M0008_U 0x01 //Usage 01
#define TECKNET_M0008_UPG 0xFFA0 //Vendor Defined Usage Page
#define TECKNET_NUM_DEVICES (sizeof(tecknet_pids) / sizeof(tecknet_pids[ 0 ]))
enum
{
TECKNET_PID = 0,
TECKNET_INTERFACE = 1,
TECKNET_USAGE = 2,
TECKNET_USAGE_PAGE = 3
};
static const unsigned int tecknet_pids[][4] =
{ // PID, Interface, Usage, Usage_Page
{ TECKNET_M0008_PID, 0, TECKNET_M0008_U, TECKNET_M0008_UPG } //Tecknet M008 Mouse
};
/******************************************************************************************\
* *
* DetectTecknetControllers *
* *
* Tests the USB address to see if any Tecknet Controllers. *
* *
\******************************************************************************************/
void DetectTecknetControllers(std::vector<RGBController*>& rgb_controllers)
{
hid_device_info* info;
//Look for the passed in tecknet_pids
hid_init();
info = hid_enumerate(TECKNET_VID, 0x0);
while(info)
{
hid_device* dev = NULL;
if(info->vendor_id == TECKNET_VID)
{
for(int pid_idx = 0; pid_idx < TECKNET_NUM_DEVICES; pid_idx++)
{
if((info->vendor_id == TECKNET_VID)
#ifdef USE_HID_USAGE
&&(info->usage == tecknet_pids[pid_idx][TECKNET_USAGE])
&&(info->usage_page == tecknet_pids[pid_idx][TECKNET_USAGE_PAGE])
&&(info->product_id == tecknet_pids[pid_idx][TECKNET_PID]))
#else
&&(info->interface_number == tecknet_pids[pid_idx][TECKNET_INTERFACE]) //Interface is only valid on Windows where there is > 1 interface
&&(info->product_id == tecknet_pids[pid_idx][TECKNET_PID]))
#endif
{
dev = hid_open_path(info->path);
break;
}
}
}
if(dev)
{
TecknetController* controller = new TecknetController(dev, info->path);
RGBController_Tecknet* rgb_controller = new RGBController_Tecknet(controller);
rgb_controllers.push_back(rgb_controller);
}
info = info->next;
}
hid_free_enumeration(info);
} /* DetectTecknetControllers) */
REGISTER_DETECTOR("Tecknet", DetectTecknetControllers);
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "ThermaltakeRiingController.h"
#include "RGBController.h"
#include "RGBController_ThermaltakeRiing.h"
@@ -53,4 +54,6 @@ void DetectThermaltakeRiingControllers(std::vector<RGBController*>& rgb_controll
rgb_controllers.push_back(rgb_controller);
}
}
}
} /* DetectThermaltakeRiingControllers() */
REGISTER_DETECTOR("Thermaltake Riing", DetectThermaltakeRiingControllers);
+7
View File
@@ -0,0 +1,7 @@
#pragma once
#include "DeviceDetector.h"
#define REGISTER_DETECTOR(name, func) static DeviceDetector device_detector_obj(name, func)
#define REGISTER_I2C_DETECTOR(name, func) static I2CDeviceDetector device_detector_obj(name, func)
#define REGISTER_I2C_BUS_DETECTOR(func) static I2CBusDetector device_detector_obj(func)
+34
View File
@@ -0,0 +1,34 @@
#pragma once
#include <functional>
#include <string>
#include <vector>
#include "ResourceManager.h"
class DeviceDetector
{
public:
DeviceDetector(std::string name, DeviceDetectorFunction detector)
{
ResourceManager::get()->RegisterDeviceDetector(name, detector);
}
};
class I2CDeviceDetector
{
public:
I2CDeviceDetector(std::string name, I2CDeviceDetectorFunction detector)
{
ResourceManager::get()->RegisterI2CDeviceDetector(name, detector);
}
};
class I2CBusDetector
{
public:
I2CBusDetector(I2CBusDetectorFunction detector)
{
ResourceManager::get()->RegisterI2CBusDetector(detector);
}
};
+12 -2
View File
@@ -31,6 +31,7 @@ NetworkClient::NetworkClient(std::vector<RGBController *>& control) : controller
{
strcpy(port_ip, "127.0.0.1");
port_num = OPENRGB_SDK_PORT;
client_sock = -1;
server_connected = false;
server_controller_count = 0;
@@ -38,6 +39,11 @@ NetworkClient::NetworkClient(std::vector<RGBController *>& control) : controller
ConnectionThread = NULL;
}
NetworkClient::~NetworkClient()
{
delete ConnectionThread;
}
void NetworkClient::ClientInfoChanged()
{
ClientInfoChangeMutex.lock();
@@ -129,8 +135,12 @@ void NetworkClient::StopClient()
server_connected = false;
client_active = false;
shutdown(client_sock, SD_RECEIVE);
closesocket(client_sock);
if (server_connected)
{
shutdown(client_sock, SD_RECEIVE);
closesocket(client_sock);
}
if(ListenThread)
ListenThread->join();
ConnectionThread->join();
+1
View File
@@ -21,6 +21,7 @@ class NetworkClient
{
public:
NetworkClient(std::vector<RGBController *>& control);
~NetworkClient();
void ClientInfoChanged();
-529
View File
@@ -1,529 +0,0 @@
/******************************************************************************************\
* *
* OpenRGB.cpp *
* *
* Functions for communicating with RGBController API devices on Windows and Linux *
* *
\******************************************************************************************/
#include "RGBController.h"
#include "i2c_smbus.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#ifdef WIN32
#include <regex>
#include "i2c_smbus_piix4.h"
#include "i2c_smbus_i801.h"
#include "i2c_smbus_nct6775.h"
#include "i2c_smbus_nvapi.h"
#include "i2c_smbus_amdadl.h"
#include "super_io.h"
#include "wmi.h"
#else /* WIN32 */
#include "i2c_smbus_linux.h"
#include <fcntl.h>
#include <unistd.h>
#include <dirent.h>
#include <string.h>
#endif /* WIN32 */
std::vector<i2c_smbus_interface*> busses;
std::vector<RGBController*> rgb_controllers;
#ifdef WIN32
/******************************************************************************************\
* *
* DetectNuvotonI2CBusses (Windows) *
* *
* Detects available Nuvoton Super IO SMBUS adapters and enumerates *
* i2c_smbus_interface objects for them *
* *
\******************************************************************************************/
void DetectNuvotonI2CBusses()
{
i2c_smbus_interface* bus;
int sioaddr = 0x2E;
superio_enter(sioaddr);
int val = (superio_inb(sioaddr, SIO_REG_DEVID) << 8) | superio_inb(sioaddr, SIO_REG_DEVID + 1);
switch (val & SIO_ID_MASK)
{
case SIO_NCT5577_ID:
case SIO_NCT6102_ID:
case SIO_NCT6793_ID:
case SIO_NCT6796_ID:
case SIO_NCT6798_ID:
bus = new i2c_smbus_nct6775();
// Set logical device register to get SMBus base address
superio_outb(sioaddr, SIO_REG_LOGDEV, SIO_LOGDEV_SMBUS);
// Get SMBus base address from configuration register
int smba = (superio_inb(sioaddr, SIO_REG_SMBA) << 8) | superio_inb(sioaddr, SIO_REG_SMBA + 1);
((i2c_smbus_nct6775*)bus)->nct6775_smba = smba;
// Set device name string
switch (val & SIO_ID_MASK)
{
case SIO_NCT5577_ID:
sprintf(bus->device_name, "Nuvoton NCT5577D SMBus at %X", smba);
break;
case SIO_NCT6102_ID:
sprintf(bus->device_name, "Nuvoton NCT6102D/NCT6106D SMBus at %X", smba);
break;
case SIO_NCT6793_ID:
sprintf(bus->device_name, "Nuvoton NCT6793D SMBus at %X", smba);
break;
case SIO_NCT6796_ID:
sprintf(bus->device_name, "Nuvoton NCT6796D SMBus at %X", smba);
break;
case SIO_NCT6798_ID:
sprintf(bus->device_name, "Nuvoton NCT6798D SMBus at %X", smba);
break;
}
busses.push_back(bus);
}
} /* DetectNuvotonI2CBusses() */
/******************************************************************************************\
* *
* DetectNvAPII2CBusses (Windows) *
* *
* Detects available NVidia NvAPI I2C adapters and enumerates *
* i2c_smbus_interface objects for them. Only enumerates the first bus for each GPU *
* *
\******************************************************************************************/
void DetectNvAPII2CBusses()
{
static NV_PHYSICAL_GPU_HANDLE gpu_handles[64];
static NV_S32 gpu_count = 0;
NV_U32 device_id;
NV_U32 ext_device_id;
NV_STATUS res;
NV_U32 revision_id;
NV_U32 sub_system_id;
NV_STATUS initialize = NvAPI_Initialize();
NvAPI_EnumPhysicalGPUs(gpu_handles, &gpu_count);
for(NV_S32 gpu_idx = 0; gpu_idx < gpu_count; gpu_idx++)
{
i2c_smbus_nvapi * nvapi_bus = new i2c_smbus_nvapi(gpu_handles[gpu_idx]);
sprintf(nvapi_bus->device_name, "NVidia NvAPI I2C on GPU %d", gpu_idx);
res = NvAPI_GPU_GetPCIIdentifiers(gpu_handles[gpu_idx], &device_id, &sub_system_id, &revision_id, &ext_device_id);
if (res == 0)
{
nvapi_bus->pci_device = device_id >> 16;
nvapi_bus->pci_vendor = device_id & 0xffff;
nvapi_bus->pci_subsystem_device = sub_system_id >> 16;
nvapi_bus->pci_subsystem_vendor = sub_system_id & 0xffff;
nvapi_bus->port_id = 1;
}
busses.push_back(nvapi_bus);
}
} /* DetectNvAPII2CBusses() */
/******************************************************************************************\
* *
* DetectAMDADLI2CBusses (Windows) *
* *
* Detects available AMD ADL I2C adapters and enumerates *
* i2c_smbus_interface objects for them. Only enumerates Bus Nr 1 *
* *
\******************************************************************************************/
void DetectADLI2C()
{
int adl_status;
int gpu_count = 0;
ADL_CONTEXT_HANDLE gpu_handle;
i2c_smbus_amdadl * adl_bus = new i2c_smbus_amdadl(gpu_handle);
adl_status = adl_bus->ADL_Initialize();
if(0 != adl_status)
{
printf_s("ADL Status %d \n", adl_status);
}
else
{
sprintf(adl_bus->device_name, "AMD ADL I2C on GPU %d", gpu_count);
busses.push_back(adl_bus);
}
} /* DetectAMDADLI2CBusses() */
/******************************************************************************************\
* *
* DetectI2CBusses (Windows) *
* *
* Detects available AMD and Intel SMBUS adapters and enumerates i2c_smbus_interface *
* objects for them *
* *
\******************************************************************************************/
void DetectI2CBusses()
{
i2c_smbus_interface * bus;
HRESULT hres;
Wmi wmi;
wmi.init();
// Query WMI for Win32_PnPSignedDriver entries with names matching "SMBUS" or "SM BUS"
// These devices may be browsed under Device Manager -> System Devices
std::vector<QueryObj> q_res_PnPSignedDriver;
hres = wmi.query("SELECT * FROM Win32_PnPSignedDriver WHERE Description LIKE '\%SMBUS\%' OR Description LIKE '\%SM BUS\%'", q_res_PnPSignedDriver);
if (hres)
{
return;
}
// For each detected SMBus adapter, try enumerating it as either AMD or Intel
for (QueryObj &i : q_res_PnPSignedDriver)
{
// AMD SMBus controllers do not show any I/O resources allocated in Device Manager
// Analysis of many AMD boards has shown that AMD SMBus controllers have two adapters with fixed I/O spaces at 0x0B00 and 0x0B20
// AMD SMBus adapters use the PIIX4 driver
if (i["Manufacturer"].find("Advanced Micro Devices, Inc") != std::string::npos)
{
bus = new i2c_smbus_piix4();
strcpy(bus->device_name, i["Description"].c_str());
strcat(bus->device_name, " at 0x0B00");
((i2c_smbus_piix4 *)bus)->piix4_smba = 0x0B00;
busses.push_back(bus);
bus = new i2c_smbus_piix4();
((i2c_smbus_piix4 *)bus)->piix4_smba = 0x0B20;
strcpy(bus->device_name, i["Description"].c_str());
strcat(bus->device_name, " at 0x0B20");
busses.push_back(bus);
}
// Intel SMBus controllers do show I/O resources in Device Manager
// Analysis of many Intel boards has shown that Intel SMBus adapter I/O space varies between boards
// We can query Win32_PnPAllocatedResource entries and look up the PCI device ID to find the allocated I/O space
// Intel SMBus adapters use the i801 driver
else if ((i["Manufacturer"].find("Intel") != std::string::npos)
|| (i["Manufacturer"].find("INTEL") != std::string::npos))
{
std::string rgx1 = ".+" + q_res_PnPSignedDriver[0]["DeviceID"].substr(4, 33) + ".+";
AdditionalFilters filters;
filters.emplace("Dependent", rgx1);
filters.emplace("Antecedent", ".*Port.*");
std::vector<QueryObj> q_res_PNPAllocatedResource;
hres = wmi.query("SELECT * FROM Win32_PnPAllocatedResource", q_res_PNPAllocatedResource, &filters);
std::regex rgx2(".*StartingAddress=\"(\\d+)\".*");
std::smatch matches;
// Query the StartingAddress for the matching device ID and use it to enumerate the bus
if (std::regex_search(q_res_PNPAllocatedResource[0]["Antecedent"], matches, rgx2))
{
unsigned int IORangeStart = std::stoi(matches[1].str());
bus = new i2c_smbus_i801();
strcpy(bus->device_name, i["Description"].c_str());
((i2c_smbus_i801 *)bus)->i801_smba = IORangeStart;
busses.push_back(bus);
}
}
}
// Detect Nuvoton Super IO SMBus adapters
DetectNuvotonI2CBusses();
// Detect NVidia NvAPI I2C adapters
DetectNvAPII2CBusses();
// Detect AMD ADL I2C adadpters
DetectADLI2C();
} /* DetectI2CBusses() */
#else /* WIN32 */
/******************************************************************************************\
* *
* DetectI2CBusses (Linux) *
* *
* Detects available SMBUS adapters and enumerates i2c_smbus_interface objects for *
* them *
* *
\******************************************************************************************/
void DetectI2CBusses()
{
i2c_smbus_linux * bus;
char device_string[1024];
DIR * dir;
char driver_path[512];
struct dirent * ent;
int test_fd;
char path[1024];
char buff[100];
unsigned short pci_device, pci_vendor, pci_subsystem_device, pci_subsystem_vendor;
unsigned short port_id;
bool info;
// Start looking for I2C adapters in /sys/bus/i2c/devices/
strcpy(driver_path, "/sys/bus/i2c/devices/");
dir = opendir(driver_path);
if(dir == NULL)
{
return;
}
// Loop through all entries in i2c-adapter list
ent = readdir(dir);
while(ent != NULL)
{
if(ent->d_type == DT_DIR || ent->d_type == DT_LNK)
{
if(strncmp(ent->d_name, "i2c-", 4) == 0)
{
strcpy(device_string, driver_path);
strcat(device_string, ent->d_name);
strcat(device_string, "/name");
test_fd = open(device_string, O_RDONLY);
if(test_fd)
{
memset(device_string, 0x00, sizeof(device_string));
read(test_fd, device_string, sizeof(device_string));
device_string[strlen(device_string) - 1] = 0x00;
close(test_fd);
// For now, only get PCI information from nVidia GPUs
// PCI IDs are not currently obtained from the Nouveau driver
// and GPUs using PCI IDs for detection will not work with it.
if (sscanf(device_string, "NVIDIA i2c adapter %hu at", &port_id) == 1)
{
info = true;
// Get PCI Device
snprintf(path, sizeof(path), "%s%s%s", driver_path, ent->d_name, "/device/device");
test_fd = open(path, O_RDONLY);
if (test_fd < 0)
{
ent = readdir(dir);
continue;
}
memset(buff, 0x00, sizeof(buff));
read(test_fd, buff, sizeof(buff));
buff[strlen(buff) - 1] = 0x00;
pci_device = strtoul(buff, NULL, 16);
close(test_fd);
// Get PCI Vendor
snprintf(path, sizeof(path), "%s%s%s", driver_path, ent->d_name, "/device/vendor");
test_fd = open(path, O_RDONLY);
if (test_fd < 0)
{
ent = readdir(dir);
continue;
}
memset(buff, 0x00, sizeof(buff));
read(test_fd, buff, sizeof(buff));
buff[strlen(buff) - 1] = 0x00;
pci_vendor = strtoul(buff, NULL, 16);
close(test_fd);
// Get PCI Subsystem Device
snprintf(path, sizeof(path), "%s%s%s", driver_path, ent->d_name, "/device/subsystem_device");
test_fd = open(path, O_RDONLY);
if (test_fd < 0)
{
ent = readdir(dir);
continue;
}
memset(buff, 0x00, sizeof(buff));
read(test_fd, buff, sizeof(buff));
buff[strlen(buff) - 1] = 0x00;
pci_subsystem_device = strtoul(buff, NULL, 16);
close(test_fd);
// Get PCI Subsystem Vendor
snprintf(path, sizeof(path), "%s%s%s", driver_path, ent->d_name, "/device/subsystem_vendor");
test_fd = open(path, O_RDONLY);
if (test_fd < 0)
{
ent = readdir(dir);
continue;
}
memset(buff, 0x00, sizeof(buff));
read(test_fd, buff, sizeof(buff));
buff[strlen(buff) - 1] = 0x00;
pci_subsystem_vendor = strtoul(buff, NULL, 16);
close(test_fd);
}
else
{
info = false;
}
strcpy(device_string, "/dev/");
strcat(device_string, ent->d_name);
test_fd = open(device_string, O_RDWR);
if (test_fd < 0)
{
ent = readdir(dir);
continue;
}
bus = new i2c_smbus_linux();
strcpy(bus->device_name, device_string);
bus->handle = test_fd;
if (info) {
bus->pci_device = pci_device;
bus->pci_vendor = pci_vendor;
bus->pci_subsystem_device = pci_subsystem_device;
bus->pci_subsystem_vendor = pci_subsystem_vendor;
bus->port_id = port_id;
}
busses.push_back(bus);
}
}
}
ent = readdir(dir);
}
} /* DetectI2CBusses() */
#endif /* WIN32 */
void DetectAuraSMBusControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers);
void DetectAuraGPUControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers);
void DetectCorsairVengeanceControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers);
void DetectCorsairVengeanceProControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers);
void DetectCrucialControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers);
void DetectHyperXDRAMControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers);
void DetectPatriotViperControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers);
void DetectPolychromeControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
void DetectRGBFusionControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
void DetectRGBFusionGPUControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
void DetectRGBFusion2SMBusControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
void DetectRGBFusion2DRAMControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
void DetectMSIGPUControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
void DetectSapphireGPUControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
void DetectGalaxGPUControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
void DetectMSIMysticLightControllers(std::vector<RGBController*> &rgb_controllers);
void DetectMSIRGBControllers(std::vector<RGBController*> &rgb_controllers);
void DetectAuraUSBControllers(std::vector<RGBController*> &rgb_controllers);
void DetectAuraCoreControllers(std::vector<RGBController*> &rgb_controllers);
void DetectLEDStripControllers(std::vector<RGBController*> &rgb_controllers);
void DetectNZXTHue2Controllers(std::vector<RGBController*> &rgb_controllers);
void DetectHuePlusControllers(std::vector<RGBController*> &rgb_controllers);
void DetectOpenRazerControllers(std::vector<RGBController*> &rgb_controllers);
void DetectE131Controllers(std::vector<RGBController*> &rgb_controllers);
void DetectAMDWraithPrismControllers(std::vector<RGBController*>& rgb_controllers);
void DetectCoolerMasterControllers(std::vector<RGBController*>& rgb_controllers);
void DetectMSI3ZoneControllers(std::vector<RGBController*>& rgb_controllers);
void DetectPoseidonZRGBControllers(std::vector<RGBController*>& rgb_controllers);
void DetectCorsairPeripheralControllers(std::vector<RGBController*>& rgb_controllers);
void DetectCorsairLightingNodeControllers(std::vector<RGBController*> &rgb_controllers);
void DetectFaustusControllers(std::vector<RGBController*> &rgb_controllers);
void DetectHyperXKeyboardControllers(std::vector<RGBController*>& rgb_controllers);
void DetectHyperXMouseControllers(std::vector<RGBController*>& rgb_controllers);
void DetectThermaltakeRiingControllers(std::vector<RGBController*>& rgb_controllers);
void DetectRGBFusion2USBControllers(std::vector<RGBController*> &rgb_controllers);
void DetectRedragonControllers(std::vector<RGBController*>& rgb_controllers);
void DetectLogitechControllers(std::vector<RGBController*>& rgb_controllers);
void DetectNZXTKrakenControllers(std::vector<RGBController*>& rgb_controllers);
void DetectSteelSeriesControllers(std::vector<RGBController*>& rgb_controllers);
void DetectGloriousModelOControllers(std::vector<RGBController*>& rgb_controllers);
void DetectDuckyKeyboardControllers(std::vector<RGBController*>& rgb_controllers);
void DetectEKControllers(std::vector<RGBController*>& rgb_controllers);
/******************************************************************************************\
* *
* DetectRGBConrollers *
* *
* Detect and populate RGB Controllers vector *
* *
\******************************************************************************************/
void DetectRGBControllers(void)
{
DetectI2CBusses();
DetectAuraSMBusControllers(busses, rgb_controllers);
DetectAuraGPUControllers(busses, rgb_controllers);
DetectCorsairVengeanceControllers(busses, rgb_controllers);
DetectCorsairVengeanceProControllers(busses, rgb_controllers);
DetectCrucialControllers(busses, rgb_controllers);
DetectGalaxGPUControllers(busses, rgb_controllers);
DetectHyperXDRAMControllers(busses, rgb_controllers);
DetectPatriotViperControllers(busses, rgb_controllers);
DetectPolychromeControllers(busses, rgb_controllers);
DetectRGBFusionGPUControllers(busses, rgb_controllers);
DetectMSIGPUControllers(busses, rgb_controllers);
DetectSapphireGPUControllers(busses, rgb_controllers);
//TODO: Implement better detection before enabling these controllers
//DetectRGBFusion2SMBusControllers(busses, rgb_controllers);
//DetectRGBFusion2DRAMControllers(busses, rgb_controllers);
DetectRGBFusionControllers(busses, rgb_controllers);
//DetectMSIMysticLightControllers(rgb_controllers);
DetectMSIRGBControllers(rgb_controllers);
DetectAuraUSBControllers(rgb_controllers);
DetectAuraCoreControllers(rgb_controllers);
DetectLEDStripControllers(rgb_controllers);
DetectNZXTHue2Controllers(rgb_controllers);
DetectHuePlusControllers(rgb_controllers);
DetectAMDWraithPrismControllers(rgb_controllers);
DetectCoolerMasterControllers(rgb_controllers);
DetectMSI3ZoneControllers(rgb_controllers);
DetectPoseidonZRGBControllers(rgb_controllers);
DetectHyperXKeyboardControllers(rgb_controllers);
//DetectHyperXMouseControllers(rgb_controllers);
DetectCorsairPeripheralControllers(rgb_controllers);
DetectCorsairLightingNodeControllers(rgb_controllers);
DetectThermaltakeRiingControllers(rgb_controllers);
DetectRGBFusion2USBControllers(rgb_controllers);
DetectRedragonControllers(rgb_controllers);
DetectLogitechControllers(rgb_controllers);
DetectNZXTKrakenControllers(rgb_controllers);
DetectSteelSeriesControllers(rgb_controllers);
DetectGloriousModelOControllers(rgb_controllers);
DetectDuckyKeyboardControllers(rgb_controllers);
DetectEKControllers(rgb_controllers);
DetectE131Controllers(rgb_controllers);
DetectOpenRazerControllers(rgb_controllers);
/*-------------------------------------*\
| Windows-only devices |
\*-------------------------------------*/
#ifdef WIN32
/*-------------------------------------*\
| Linux-only devices |
\*-------------------------------------*/
#else
DetectFaustusControllers(rgb_controllers);
#endif
} /* DetectRGBControllers() */
+45 -3
View File
@@ -47,12 +47,14 @@ INCLUDEPATH += \
net_port/ \
serial_port/ \
super_io/ \
Controllers/AorusCPUCoolerController/ \
Controllers/AMDWraithPrismController/ \
Controllers/AuraUSBController/ \
Controllers/AuraCoreController/ \
Controllers/AuraGPUController/ \
Controllers/AuraSMBusController/ \
Controllers/CoolerMasterController/ \
Controllers/CorsairHydroController/ \
Controllers/CorsairPeripheralController/ \
Controllers/CorsairLightingNodeController/ \
Controllers/CorsairVengeanceController/ \
@@ -61,6 +63,7 @@ INCLUDEPATH += \
Controllers/DuckyKeyboardController/ \
Controllers/GalaxGPUController/ \
Controllers/GloriousModelOController/ \
Controllers/HoltekController/ \
Controllers/HuePlusController/ \
Controllers/HyperXDRAMController/ \
Controllers/HyperXKeyboardController/ \
@@ -84,6 +87,7 @@ INCLUDEPATH += \
Controllers/RGBFusionGPUController/ \
Controllers/SapphireGPUController/ \
Controllers/SteelSeriesController/ \
Controllers/TecknetController/ \
Controllers/ThermaltakeRiingController/ \
RGBController/ \
qt/
@@ -94,6 +98,9 @@ HEADERS += \
NetworkProtocol.h \
NetworkServer.h \
ProfileManager.h \
ResourceManager.h \
Detector.h \
DeviceDetector.h \
qt/OpenRGBClientInfoPage.h \
qt/OpenRGBDeviceInfoPage.h \
qt/OpenRGBDevicePage.h \
@@ -101,6 +108,7 @@ HEADERS += \
i2c_smbus/i2c_smbus.h \
i2c_tools/i2c_tools.h \
net_port/net_port.h \
qt/DeviceView.h \
qt/OpenRGBDialog2.h \
qt/OpenRGBProfileSaveDialog.h \
qt/OpenRGBServerInfoPage.h \
@@ -111,6 +119,7 @@ HEADERS += \
serial_port/serial_port.h \
super_io/super_io.h \
Controllers/AMDWraithPrismController/AMDWraithPrismController.h \
Controllers/AorusCPUCoolerController/ATC800Controller.h \
Controllers/AuraUSBController/AuraUSBController.h \
Controllers/AuraUSBController/AuraAddressableController.h \
Controllers/AuraUSBController/AuraMainboardController.h \
@@ -118,6 +127,7 @@ HEADERS += \
Controllers/AuraGPUController/AuraGPUController.h \
Controllers/AuraSMBusController/AuraSMBusController.h \
Controllers/CoolerMasterController/CMMP750Controller.h \
Controllers/CorsairHydroController/CorsairHydroController.h \
Controllers/CorsairLightingNodeController/CorsairLightingNodeController.h \
Controllers/CorsairPeripheralController/CorsairPeripheralController.h \
Controllers/CorsairVengeanceController/CorsairVengeanceController.h \
@@ -125,17 +135,21 @@ HEADERS += \
Controllers/CrucialController/CrucialController.h \
Controllers/DuckyKeyboardController/DuckyKeyboardController.h \
Controllers/EKController/EKController.h \
Controllers/GalaxGPUController/GalaxGPUController.h \
Controllers/GalaxGPUController/GalaxGPUController.h \
Controllers/GloriousModelOController/GloriousModelOController.h \
Controllers/HoltekController/HoltekA070Controller.h \
Controllers/HuePlusController/HuePlusController.h \
Controllers/HyperXDRAMController/HyperXDRAMController.h \
Controllers/HyperXKeyboardController/HyperXAlloyOriginsController.h \
Controllers/HyperXKeyboardController/HyperXKeyboardController.h \
Controllers/HyperXMouseController/HyperXPulsefireSurgeController..h \
Controllers/HyperXMouseController/HyperXPulsefireSurgeController.h \
Controllers/LEDStripController/LEDStripController.h \
Controllers/LogitechController/LogitechG203Controller.h \
Controllers/LogitechController/LogitechG203LController.h \
Controllers/LogitechController/LogitechG403Controller.h \
Controllers/LogitechController/LogitechG502PSController.h \
Controllers/LogitechController/LogitechG810Controller.h \
Controllers/LogitechController/LogitechGProWirelessController.h \
Controllers/MSI3ZoneController/MSI3ZoneController.h \
Controllers/MSIGPUController/MSIGPUController.h \
Controllers/MSIMysticLightController/MSIMysticLightController.h \
@@ -156,14 +170,17 @@ HEADERS += \
Controllers/SteelSeriesController/SteelSeriesRivalController.h \
Controllers/SteelSeriesController/SteelSeriesSiberiaController.h \
Controllers/SteelSeriesController/SteelSeriesApexController.h \
Controllers/TecknetController/TecknetController.h \
Controllers/ThermaltakeRiingController/ThermaltakeRiingController.h \
RGBController/RGBController.h \
RGBController/RGBController_AMDWraithPrism.h \
RGBController/RGBController_AorusATC800.h \
RGBController/RGBController_AuraUSB.h \
RGBController/RGBController_AuraCore.h \
RGBController/RGBController_AuraGPU.h \
RGBController/RGBController_AuraSMBus.h \
RGBController/RGBController_CMMP750Controller.h \
RGBController/RGBController_CorsairHydro.h \
RGBController/RGBController_CorsairLightingNode.h \
RGBController/RGBController_CorsairPeripheral.h \
RGBController/RGBController_CorsairVengeance.h \
@@ -175,6 +192,7 @@ HEADERS += \
RGBController/RGBController_E131.h \
RGBController/RGBController_GalaxGPU.h \
RGBController/RGBController_GloriousModelO.h \
RGBController/RGBController_HoltekA070.h \
RGBController/RGBController_HuePlus.h \
RGBController/RGBController_HyperXAlloyOrigins.h \
RGBController/RGBController_HyperXDRAM.h \
@@ -182,8 +200,11 @@ HEADERS += \
RGBController/RGBController_HyperXPulsefireSurge.h \
RGBController/RGBController_LEDStrip.h \
RGBController/RGBController_LogitechG203.h \
RGBController/RGBController_LogitechG203L.h \
RGBController/RGBController_LogitechG403.h \
RGBController/RGBController_LogitechG502PS.h \
RGBController/RGBController_LogitechG810.h \
RGBController/RGBController_LogitechGProWireless.h \
RGBController/RGBController_MSI3Zone.h \
RGBController/RGBController_MSIGPU.h \
RGBController/RGBController_MSIGPU.h \
@@ -206,6 +227,7 @@ HEADERS += \
RGBController/RGBController_SteelSeriesRival.h \
RGBController/RGBController_SteelSeriesSiberia.h \
RGBController/RGBController_SteelSeriesApex.h \
RGBController/RGBController_Tecknet.h \
RGBController/RGBController_ThermaltakeRiing.h \
SOURCES += \
@@ -214,10 +236,10 @@ SOURCES += \
dependencies/libe131/src/e131.c \
main.cpp \
cli.cpp \
OpenRGB.cpp \
NetworkClient.cpp \
NetworkServer.cpp \
ProfileManager.cpp \
ResourceManager.cpp \
qt/OpenRGBClientInfoPage.cpp \
qt/OpenRGBDeviceInfoPage.cpp \
qt/OpenRGBDevicePage.cpp \
@@ -225,6 +247,7 @@ SOURCES += \
i2c_smbus/i2c_smbus.cpp \
i2c_tools/i2c_tools.cpp \
net_port/net_port.cpp \
qt/DeviceView.cpp \
qt/OpenRGBDialog2.cpp \
qt/OpenRGBProfileSaveDialog.cpp \
qt/OpenRGBServerInfoPage.cpp \
@@ -236,6 +259,8 @@ SOURCES += \
super_io/super_io.cpp \
Controllers/AMDWraithPrismController/AMDWraithPrismController.cpp \
Controllers/AMDWraithPrismController/AMDWraithPrismControllerDetect.cpp \
Controllers/AorusCPUCoolerController/ATC800Controller.cpp \
Controllers/AorusCPUCoolerController/AorusCPUCoolerControllerDetect.cpp \
Controllers/AuraUSBController/AuraUSBController.cpp \
Controllers/AuraUSBController/AuraAddressableController.cpp \
Controllers/AuraUSBController/AuraMainboardController.cpp \
@@ -248,6 +273,8 @@ SOURCES += \
Controllers/AuraSMBusController/AuraSMBusControllerDetect.cpp \
Controllers/CoolerMasterController/CMMP750Controller.cpp \
Controllers/CoolerMasterController/CoolerMasterControllerDetect.cpp \
Controllers/CorsairHydroController/CorsairHydroController.cpp \
Controllers/CorsairHydroController/CorsairHydroControllerDetect.cpp \
Controllers/CorsairLightingNodeController/CorsairLightingNodeController.cpp \
Controllers/CorsairLightingNodeController/CorsairLightingNodeControllerDetect.cpp \
Controllers/CorsairPeripheralController/CorsairPeripheralController.cpp \
@@ -266,6 +293,8 @@ SOURCES += \
Controllers/GalaxGPUController/GalaxGPUControllerDetect.cpp \
Controllers/GloriousModelOController/GloriousModelOController.cpp \
Controllers/GloriousModelOController/GloriousModelOControllerDetect.cpp \
Controllers/HoltekController/HoltekA070Controller.cpp \
Controllers/HoltekController/HoltekControllerDetect.cpp \
Controllers/HuePlusController/HuePlusController.cpp \
Controllers/HuePlusController/HuePlusControllerDetect.cpp \
Controllers/HyperXDRAMController/HyperXDRAMController.cpp \
@@ -279,8 +308,11 @@ SOURCES += \
Controllers/LEDStripController/LEDStripControllerDetect.cpp \
Controllers/LogitechController/LogitechControllerDetect.cpp \
Controllers/LogitechController/LogitechG203Controller.cpp \
Controllers/LogitechController/LogitechG203LController.cpp \
Controllers/LogitechController/LogitechG403Controller.cpp \
Controllers/LogitechController/LogitechG502PSController.cpp \
Controllers/LogitechController/LogitechG810Controller.cpp \
Controllers/LogitechController/LogitechGProWirelessController.cpp \
Controllers/MSI3ZoneController/MSI3ZoneController.cpp \
Controllers/MSI3ZoneController/MSI3ZoneControllerDetect.cpp \
Controllers/MSIGPUController/MSIGPUController.cpp \
@@ -318,16 +350,21 @@ SOURCES += \
Controllers/SteelSeriesController/SteelSeriesSiberiaController.cpp \
Controllers/SteelSeriesController/SteelSeriesApexController.cpp \
Controllers/SteelSeriesController/SteelSeriesControllerDetect.cpp \
Controllers/TecknetController/TecknetController.cpp \
Controllers/TecknetController/TecknetControllerDetect.cpp \
Controllers/ThermaltakeRiingController/ThermaltakeRiingController.cpp \
Controllers/ThermaltakeRiingController/ThermaltakeRiingControllerDetect.cpp \
RGBController/RGBController.cpp \
RGBController/DebugControllerDetect.cpp \
RGBController/E131ControllerDetect.cpp \
RGBController/RGBController_AMDWraithPrism.cpp \
RGBController/RGBController_AorusATC800.cpp \
RGBController/RGBController_AuraUSB.cpp \
RGBController/RGBController_AuraCore.cpp \
RGBController/RGBController_AuraGPU.cpp \
RGBController/RGBController_AuraSMBus.cpp \
RGBController/RGBController_CMMP750Controller.cpp \
RGBController/RGBController_CorsairHydro.cpp \
RGBController/RGBController_CorsairLightingNode.cpp \
RGBController/RGBController_CorsairPeripheral.cpp \
RGBController/RGBController_CorsairVengeance.cpp \
@@ -338,6 +375,7 @@ SOURCES += \
RGBController/RGBController_EKController.cpp \
RGBController/RGBController_GalaxGPU.cpp \
RGBController/RGBController_GloriousModelO.cpp \
RGBController/RGBController_HoltekA070.cpp \
RGBController/RGBController_HuePlus.cpp \
RGBController/RGBController_HyperXAlloyOrigins.cpp \
RGBController/RGBController_HyperXDRAM.cpp \
@@ -346,8 +384,11 @@ SOURCES += \
RGBController/RGBController_E131.cpp \
RGBController/RGBController_LEDStrip.cpp \
RGBController/RGBController_LogitechG203.cpp \
RGBController/RGBController_LogitechG203L.cpp \
RGBController/RGBController_LogitechG403.cpp \
RGBController/RGBController_LogitechG502PS.cpp \
RGBController/RGBController_LogitechG810.cpp \
RGBController/RGBController_LogitechGProWireless.cpp \
RGBController/RGBController_MSI3Zone.cpp \
RGBController/RGBController_MSIGPU.cpp \
RGBController/RGBController_MSIMysticLight.cpp \
@@ -369,6 +410,7 @@ SOURCES += \
RGBController/RGBController_SteelSeriesRival.cpp \
RGBController/RGBController_SteelSeriesSiberia.cpp \
RGBController/RGBController_SteelSeriesApex.cpp \
RGBController/RGBController_Tecknet.cpp \
RGBController/RGBController_ThermaltakeRiing.cpp \
RESOURCES += \
+1 -1
View File
@@ -103,7 +103,7 @@ bool ProfileManager::LoadProfileWithOptions
/*---------------------------------------------------------*\
| Read and verify file header |
\*---------------------------------------------------------*/
char header_string[16];
char header_string[16]{};
unsigned int header_version;
controller_file.read(header_string, 16);
+3 -1
View File
@@ -12,6 +12,7 @@ One of the biggest complaints about RGB is the software ecosystem surrounding it
* Can operate standalone or in a client/headless server configuration
* View device information
* No official/manufacturer software required
* Graphical view of device LEDs makes creating custom patterns easy
## Supported Devices
@@ -27,11 +28,12 @@ There have been two instances of hardware damage in OpenRGB's development and we
* There were reports of bricked Gigabyte Aorus Z390 motherboards caused by dumping SMBus address 0x68 in an attempt to reverse engineer the RGB. Due to this, the SMBus Tools page on OpenRGB is hidden by default now as it has no real use to non-developers. Additionally, the RGB Fusion 2 SMBus code is disabled by default because, although it works on boards it is meant for, probing this address (0x68) could damage Gigabyte Z390 boards.
* To enable the MSI Mystic Light or Gigabyte RGB Fusion 2 SMBus code, you must uncomment the functions in main.cpp and recompile.
![OpenRGB_0.11](https://gitlab.com/CalcProgrammer1/OpenRGB/-/wikis/uploads/0ef8eb3936fe715217e7e3430c0aae18/OpenRGB_new_icons.PNG)
![OpenRGB_Device_View](https://gitlab.com/CalcProgrammer1/OpenRGB/-/wikis/uploads/e1d8d4603ecdd04f1acbcf6b2314fc66/OpenRGB_0.31_Device_View.PNG)
## Windows
* Pre-built binaries are available under the Releases section on GitLab.
- You will need the **Microsoft Visual 2019 C++ runtime** installed. You can get it [here](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads)
* If you wish to build the application yourself:
1. Download the latest Visual Studio Community Edition and Qt Creator.
2. Open the OpenRGB.pro project in Qt Creator.
+515
View File
@@ -0,0 +1,515 @@
#include "Detector.h"
#include "RGBController.h"
#include "RGBController_Dummy.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <fstream>
#include <iostream>
#include <string>
#ifndef WIN32
#include <unistd.h>
#include <dirent.h>
#else
#include <windows.h>
#endif
#ifndef WIN32
#define LPSTR char *
#define strtok_s strtok_r
#endif
//0xFFFFFFFF indicates an unused entry in matrix
#define NA 0xFFFFFFFF
static unsigned int debug_keyboard_matrix_map[6][23] =
{ { 0, NA, 16, 30, 44, 54, NA, 65, 75, 84, 95, NA, 8, 23 , 38, 6 , 22, 36, 49, NA, NA, NA, NA },
{ 1, 17, 31, 45, 55, 66, 76, 85, 96, 9, 24, NA, 39, 7 , 37, NA , 60, 70, 80, 52, 63, 73, 82 },
{ 2, NA, 18, 32, 46, 56, NA, 67, 77, 86, 97, 10, 25, 40 , 90, 101, 50, 61, 71, 51, 62, 72, 93 },
{ 3, NA, 19, 33, 47, 57, NA, 68, 78, 87, 98, 11, 26, 41 , 28, 14 , NA, NA, NA, 92, 103, 53, NA },
{ 4, 20, 34, 48, 58, 69, NA, 79, NA, 88, 99, 12, 27, 42 , 81, NA , NA, 102, NA, 64, 74, 83, 104 },
{ 5, 21, 35, NA, NA, NA, NA, 59, NA, NA, NA, NA, 89, 100, 13, 91 , 15, 29, 43, 94, NA, 105, NA } };
static const char *led_names[] =
{
"Key: Escape",
"Key: `",
"Key: Tab",
"Key: Caps Lock",
"Key: Left Shift",
"Key: Left Control",
"Key: F12",
"Key: =",
"Key: F9",
"Key: 9",
"Key: O",
"Key: L",
"Key: ,",
"Key: Menu",
"Key: Enter (ISO)",
"Key: Left Arrow",
"Key: F1",
"Key: 1",
"Key: Q",
"Key: A",
"Key: \\ (ISO)",
"Key: Left Windows",
"Key: Print Screen",
"Key: F10",
"Key: 0",
"Key: P",
"Key: ;",
"Key: .",
"Key: Enter",
"Key: Down Arrow",
"Key: F2",
"Key: 2",
"Key: W",
"Key: S",
"Key: Z",
"Key: Left Alt",
"Key: Scroll Lock",
"Key: Backspace",
"Key: F11",
"Key: -",
"Key: [",
"Key: '",
"Key: /",
"Key: Right Arrow",
"Key: F3",
"Key: 3",
"Key: E",
"Key: D",
"Key: X",
"Key: Pause/Break",
"Key: Delete",
"Key: Number Pad 7",
"Key: Num Lock",
"Key: Number Pad 6",
"Key: F4",
"Key: 4",
"Key: R",
"Key: F",
"Key: C",
"Key: Space",
"Key: Insert",
"Key: End",
"Key: Number Pad 8",
"Key: Number Pad /",
"Key: Number Pad 1",
"Key: F5",
"Key: 5",
"Key: T",
"Key: G",
"Key: V",
"Key: Home",
"Key: Page Down",
"Key: Number Pad 9",
"Key: Number Pad *",
"Key: Number Pad 2",
"Key: F6",
"Key: 6",
"Key: Y",
"Key: H",
"Key: B",
"Key: Page Up",
"Key: Right Shift",
"Key: Number Pad -",
"Key: Number Pad 3",
"Key: F7",
"Key: 7",
"Key: U",
"Key: J",
"Key: N",
"Key: Right Alt",
"Key: ]",
"Key: Right Control",
"Key: Number Pad 4",
"Key: Number Pad +",
"Key: Number Pad 0",
"Key: F8",
"Key: 8",
"Key: I",
"Key: K",
"Key: M",
"Key: Right Windows",
"Key: \\ (ANSI)",
"Key: Up Arrow",
"Key: Number Pad 5",
"Key: Number Pad Enter",
"Key: Number Pad .",
"RGB Strip 1",
"RGB Strip 2",
"RGB Strip 3",
"RGB Strip 4",
"RGB Strip 5",
"RGB Strip 6",
"RGB Strip 7",
"RGB Strip 8",
"RGB Strip 9",
"RGB Strip 10",
"RGB Strip 11",
"RGB Strip 12",
"RGB Strip 13",
"RGB Strip 14",
"RGB Strip 15",
"RGB Strip 16",
"RGB Strip 17",
"RGB Strip 18",
"Key: Media Previous",
"Key: Media Play/Pause",
"Key: Media Next",
"Key: Media Mute"
};
/******************************************************************************************\
* *
* DetectDebugControllers *
* *
* Add dummy controllers based on debug.txt *
* *
\******************************************************************************************/
void DetectDebugControllers(std::vector<RGBController*> &rgb_controllers)
{
std::ifstream infile;
//Open settings file
infile.open("debug.txt");
if (infile.good())
{
for (std::string line; std::getline(infile, line); )
{
if (line == "")
{
continue;
}
if ((line[0] != ';') && (line[0] != '#') && (line[0] != '/'))
{
char * argument;
char * value;
value = (char *)line.c_str();
argument = strtok_s(value, "=", &value);
//Strip off new line characters if present
argument = strtok(argument, "\r\n");
value = strtok(value, "\r\n");
if(argument)
{
if (strcmp(argument, "debug_motherboard") == 0)
{
/*---------------------------------------------------------*\
| Create a dummy motherboard |
\*---------------------------------------------------------*/
RGBController_Dummy* dummy_motherboard = new RGBController_Dummy();
dummy_motherboard->name = "Debug Motherboard";
dummy_motherboard->type = DEVICE_TYPE_MOTHERBOARD;
dummy_motherboard->description = "Debug Motherboard Device";
dummy_motherboard->location = "Debug Motherboard Location";
dummy_motherboard->version = "Debug Motherboard Version";
dummy_motherboard->serial = "Debug Motherboard Serial";
/*---------------------------------------------------------*\
| Create a direct mode for the dummy motherboard |
\*---------------------------------------------------------*/
mode dummy_motherboard_direct_mode;
dummy_motherboard_direct_mode.name = "Direct";
dummy_motherboard_direct_mode.value = 0;
dummy_motherboard_direct_mode.flags = MODE_FLAG_HAS_PER_LED_COLOR;
dummy_motherboard_direct_mode.color_mode = MODE_COLORS_PER_LED;
dummy_motherboard->modes.push_back(dummy_motherboard_direct_mode);
/*---------------------------------------------------------*\
| Create a single zone/LED for the dummy motherboard |
\*---------------------------------------------------------*/
zone dummy_motherboard_single_zone;
dummy_motherboard_single_zone.name = "Single Zone";
dummy_motherboard_single_zone.type = ZONE_TYPE_SINGLE;
dummy_motherboard_single_zone.leds_min = 1;
dummy_motherboard_single_zone.leds_max = 1;
dummy_motherboard_single_zone.leds_count = 1;
dummy_motherboard_single_zone.matrix_map = NULL;
dummy_motherboard->zones.push_back(dummy_motherboard_single_zone);
led dummy_motherboard_single_led;
dummy_motherboard_single_led.name = "Single LED";
dummy_motherboard->leds.push_back(dummy_motherboard_single_led);
/*---------------------------------------------------------*\
| Create a linear zone for the dummy motherboard |
\*---------------------------------------------------------*/
zone dummy_motherboard_linear_zone;
dummy_motherboard_linear_zone.name = "Linear Zone";
dummy_motherboard_linear_zone.type = ZONE_TYPE_LINEAR;
dummy_motherboard_linear_zone.leds_min = 10;
dummy_motherboard_linear_zone.leds_max = 10;
dummy_motherboard_linear_zone.leds_count = 10;
dummy_motherboard_linear_zone.matrix_map = NULL;
dummy_motherboard->zones.push_back(dummy_motherboard_linear_zone);
for(std::size_t led_idx = 0; led_idx < 10; led_idx++)
{
led dummy_motherboard_linear_led;
dummy_motherboard_linear_led.name = "Linear LED " + std::to_string(led_idx);
dummy_motherboard->leds.push_back(dummy_motherboard_linear_led);
}
dummy_motherboard->SetupColors();
/*---------------------------------------------------------*\
| Push the dummy motherboard onto the controller list |
\*---------------------------------------------------------*/
rgb_controllers.push_back(dummy_motherboard);
}
else if(strcmp(argument, "debug_dram") == 0)
{
/*---------------------------------------------------------*\
| Create a dummy DRAM |
\*---------------------------------------------------------*/
RGBController_Dummy* dummy_dram = new RGBController_Dummy();
dummy_dram->name = "Debug DRAM";
dummy_dram->type = DEVICE_TYPE_DRAM;
dummy_dram->description = "Debug DRAM Device";
dummy_dram->location = "Debug DRAM Location";
dummy_dram->version = "Debug DRAM Version";
dummy_dram->serial = "Debug DRAM Serial";
/*---------------------------------------------------------*\
| Create a direct mode for the dummy DRAM |
\*---------------------------------------------------------*/
mode dummy_dram_direct_mode;
dummy_dram_direct_mode.name = "Direct";
dummy_dram_direct_mode.value = 0;
dummy_dram_direct_mode.flags = MODE_FLAG_HAS_PER_LED_COLOR;
dummy_dram_direct_mode.color_mode = MODE_COLORS_PER_LED;
dummy_dram->modes.push_back(dummy_dram_direct_mode);
/*---------------------------------------------------------*\
| Create a single zone/LED for the dummy DRAM |
\*---------------------------------------------------------*/
zone dummy_dram_single_zone;
dummy_dram_single_zone.name = "Single Zone";
dummy_dram_single_zone.type = ZONE_TYPE_SINGLE;
dummy_dram_single_zone.leds_min = 1;
dummy_dram_single_zone.leds_max = 1;
dummy_dram_single_zone.leds_count = 1;
dummy_dram_single_zone.matrix_map = NULL;
dummy_dram->zones.push_back(dummy_dram_single_zone);
led dummy_dram_single_led;
dummy_dram_single_led.name = "Single LED";
dummy_dram->leds.push_back(dummy_dram_single_led);
/*---------------------------------------------------------*\
| Create a linear zone for the dummy DRAM |
\*---------------------------------------------------------*/
zone dummy_dram_linear_zone;
dummy_dram_linear_zone.name = "Linear Zone";
dummy_dram_linear_zone.type = ZONE_TYPE_LINEAR;
dummy_dram_linear_zone.leds_min = 5;
dummy_dram_linear_zone.leds_max = 5;
dummy_dram_linear_zone.leds_count = 5;
dummy_dram_linear_zone.matrix_map = NULL;
dummy_dram->zones.push_back(dummy_dram_linear_zone);
for(std::size_t led_idx = 0; led_idx < 5; led_idx++)
{
led dummy_dram_linear_led;
dummy_dram_linear_led.name = "Linear LED " + std::to_string(led_idx);
dummy_dram->leds.push_back(dummy_dram_linear_led);
}
dummy_dram->SetupColors();
/*---------------------------------------------------------*\
| Push the dummy DRAM onto the controller list |
\*---------------------------------------------------------*/
rgb_controllers.push_back(dummy_dram);
}
else if(strcmp(argument, "debug_gpu") == 0)
{
/*---------------------------------------------------------*\
| Create a dummy GPU |
\*---------------------------------------------------------*/
RGBController_Dummy* dummy_gpu = new RGBController_Dummy();
dummy_gpu->name = "Debug GPU";
dummy_gpu->type = DEVICE_TYPE_GPU;
dummy_gpu->description = "Debug GPU Device";
dummy_gpu->location = "Debug GPU Location";
dummy_gpu->version = "Debug GPU Version";
dummy_gpu->serial = "Debug GPU Serial";
/*---------------------------------------------------------*\
| Create a direct mode for the dummy GPU |
\*---------------------------------------------------------*/
mode dummy_gpu_direct_mode;
dummy_gpu_direct_mode.name = "Direct";
dummy_gpu_direct_mode.value = 0;
dummy_gpu_direct_mode.flags = MODE_FLAG_HAS_PER_LED_COLOR;
dummy_gpu_direct_mode.color_mode = MODE_COLORS_PER_LED;
dummy_gpu->modes.push_back(dummy_gpu_direct_mode);
/*---------------------------------------------------------*\
| Create a single zone/LED for the dummy GPU |
\*---------------------------------------------------------*/
zone dummy_gpu_single_zone;
dummy_gpu_single_zone.name = "Single Zone";
dummy_gpu_single_zone.type = ZONE_TYPE_SINGLE;
dummy_gpu_single_zone.leds_min = 1;
dummy_gpu_single_zone.leds_max = 1;
dummy_gpu_single_zone.leds_count = 1;
dummy_gpu_single_zone.matrix_map = NULL;
dummy_gpu->zones.push_back(dummy_gpu_single_zone);
led dummy_gpu_single_led;
dummy_gpu_single_led.name = "Single LED";
dummy_gpu->leds.push_back(dummy_gpu_single_led);
/*---------------------------------------------------------*\
| Create a linear zone for the dummy GPU |
\*---------------------------------------------------------*/
zone dummy_gpu_linear_zone;
dummy_gpu_linear_zone.name = "Linear Zone";
dummy_gpu_linear_zone.type = ZONE_TYPE_LINEAR;
dummy_gpu_linear_zone.leds_min = 15;
dummy_gpu_linear_zone.leds_max = 15;
dummy_gpu_linear_zone.leds_count = 15;
dummy_gpu_linear_zone.matrix_map = NULL;
dummy_gpu->zones.push_back(dummy_gpu_linear_zone);
for(std::size_t led_idx = 0; led_idx < 15; led_idx++)
{
led dummy_gpu_linear_led;
dummy_gpu_linear_led.name = "Linear LED " + std::to_string(led_idx);
dummy_gpu->leds.push_back(dummy_gpu_linear_led);
}
dummy_gpu->SetupColors();
/*---------------------------------------------------------*\
| Push the dummy GPU onto the controller list |
\*---------------------------------------------------------*/
rgb_controllers.push_back(dummy_gpu);
}
else if(strcmp(argument, "debug_keyboard") == 0)
{
/*---------------------------------------------------------*\
| Create a dummy Keyboard |
\*---------------------------------------------------------*/
RGBController_Dummy* dummy_keyboard = new RGBController_Dummy();
dummy_keyboard->name = "Debug Keyboard";
dummy_keyboard->type = DEVICE_TYPE_KEYBOARD;
dummy_keyboard->description = "Debug Keyboard Device";
dummy_keyboard->location = "Debug Keyboard Location";
dummy_keyboard->version = "Debug Keyboard Version";
dummy_keyboard->serial = "Debug Keyboard Serial";
/*---------------------------------------------------------*\
| Create a direct mode for the dummy GPU |
\*---------------------------------------------------------*/
mode dummy_gpu_direct_mode;
dummy_gpu_direct_mode.name = "Direct";
dummy_gpu_direct_mode.value = 0;
dummy_gpu_direct_mode.flags = MODE_FLAG_HAS_PER_LED_COLOR;
dummy_gpu_direct_mode.color_mode = MODE_COLORS_PER_LED;
dummy_keyboard->modes.push_back(dummy_gpu_direct_mode);
/*---------------------------------------------------------*\
| Create a matrix zone for the debug Keyboard |
\*---------------------------------------------------------*/
zone dummy_keyboard_matrix_zone;
dummy_keyboard_matrix_zone.name = "Keyboard Matrix Zone";
dummy_keyboard_matrix_zone.type = ZONE_TYPE_MATRIX;
dummy_keyboard_matrix_zone.leds_min = 106;
dummy_keyboard_matrix_zone.leds_max = 106;
dummy_keyboard_matrix_zone.leds_count = 106;
dummy_keyboard_matrix_zone.matrix_map = new matrix_map_type;
dummy_keyboard_matrix_zone.matrix_map->height = 6;
dummy_keyboard_matrix_zone.matrix_map->width = 23;
dummy_keyboard_matrix_zone.matrix_map->map = (unsigned int*)&debug_keyboard_matrix_map;
dummy_keyboard->zones.push_back(dummy_keyboard_matrix_zone);
/*---------------------------------------------------------*\
| Create a linear zone for the dummy GPU |
\*---------------------------------------------------------*/
zone dummy_keyboard_linear_zone;
dummy_keyboard_linear_zone.name = "Linear Zone";
dummy_keyboard_linear_zone.type = ZONE_TYPE_LINEAR;
dummy_keyboard_linear_zone.leds_min = 18;
dummy_keyboard_linear_zone.leds_max = 18;
dummy_keyboard_linear_zone.leds_count = 18;
dummy_keyboard_linear_zone.matrix_map = NULL;
dummy_keyboard->zones.push_back(dummy_keyboard_linear_zone);
for(std::size_t led_idx = 0; led_idx < 124; led_idx++)
{
led dummy_keyboard_led;
dummy_keyboard_led.name = led_names[led_idx];
dummy_keyboard->leds.push_back(dummy_keyboard_led);
}
dummy_keyboard->SetupColors();
/*---------------------------------------------------------*\
| Push the dummy Keyboard onto the controller list |
\*---------------------------------------------------------*/
ResourceManager::get()->RegisterRGBController(dummy_keyboard);
}
}
}
}
}
} /* DetectDebugControllers() */
REGISTER_DETECTOR("Debug Controllers", DetectDebugControllers);
+64
View File
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "RGBController.h"
#include "RGBController_E131.h"
#include <vector>
@@ -55,6 +56,15 @@ void DetectE131Controllers(std::vector<RGBController*> &rgb_controllers)
bool new_device = false;
//Clear E131 device data
dev.name = "";
dev.type = ZONE_TYPE_SINGLE;
dev.num_leds = 0;
dev.rgb_order = E131_RGB_ORDER_RBG;
dev.matrix_order = E131_MATRIX_ORDER_HORIZONTAL_TOP_LEFT;
dev.matrix_width = 0;
dev.matrix_height = 0;
//Open settings file
infile.open(filename);
@@ -66,6 +76,7 @@ void DetectE131Controllers(std::vector<RGBController*> &rgb_controllers)
{
dev.name = line;
new_device = false;
continue;
}
if (line == "")
@@ -104,6 +115,10 @@ void DetectE131Controllers(std::vector<RGBController*> &rgb_controllers)
{
dev.start_channel = atoi(value);
}
else if(strcmp(argument, "keepalive_time") == 0)
{
dev.keepalive_time = atoi(value);
}
else if(strcmp(argument, "rgb_order") == 0)
{
if(strcmp(value, "RGB") == 0)
@@ -135,6 +150,53 @@ void DetectE131Controllers(std::vector<RGBController*> &rgb_controllers)
dev.rgb_order = atoi(value);
}
}
else if(strcmp(argument, "matrix_order") == 0)
{
if(strcmp(value, "HORIZONTAL_TOP_LEFT") == 0)
{
dev.matrix_order = E131_MATRIX_ORDER_HORIZONTAL_TOP_LEFT;
}
else if(strcmp(value, "HORIZONTAL_TOP_RIGHT") == 0)
{
dev.matrix_order = E131_MATRIX_ORDER_HORIZONTAL_TOP_RIGHT;
}
else if(strcmp(value, "HORIZONTAL_BOTTOM_LEFT") == 0)
{
dev.matrix_order = E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_LEFT;
}
else if(strcmp(value, "HORIZONTAL_BOTTOM_RIGHT") == 0)
{
dev.matrix_order = E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_RIGHT;
}
else if(strcmp(value, "VERTICAL_TOP_LEFT") == 0)
{
dev.matrix_order = E131_MATRIX_ORDER_VERTICAL_TOP_LEFT;
}
else if(strcmp(value, "VERTICAL_TOP_RIGHT") == 0)
{
dev.matrix_order = E131_MATRIX_ORDER_VERTICAL_TOP_RIGHT;
}
else if(strcmp(value, "VERTICAL_BOTTOM_LEFT") == 0)
{
dev.matrix_order = E131_MATRIX_ORDER_VERTICAL_BOTTOM_LEFT;
}
else if(strcmp(value, "VERTICAL_BOTTOM_RIGHT") == 0)
{
dev.matrix_order = E131_MATRIX_ORDER_VERTICAL_BOTTOM_RIGHT;
}
else
{
dev.matrix_order = atoi(value);
}
}
else if(strcmp(argument, "matrix_width") == 0)
{
dev.matrix_width = atoi(value);
}
else if(strcmp(argument, "matrix_height") == 0)
{
dev.matrix_height = atoi(value);
}
else if(strcmp(argument, "type") == 0)
{
if(strcmp(value, "SINGLE") == 0)
@@ -170,3 +232,5 @@ void DetectE131Controllers(std::vector<RGBController*> &rgb_controllers)
}
} /* DetectE131Controllers() */
REGISTER_DETECTOR("E1.31", DetectE131Controllers);
+4 -1
View File
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "RGBController.h"
#include "RGBController_OpenRazer.h"
#include <vector>
@@ -14,7 +15,7 @@
* DetectOpenRazerControllers *
* *
* Detect devices supported by the OpenRazer kernel drivers *
* * *
* *
\******************************************************************************************/
void DetectOpenRazerControllers(std::vector<RGBController*> &rgb_controllers)
@@ -121,3 +122,5 @@ void DetectOpenRazerControllers(std::vector<RGBController*> &rgb_controllers)
}
} /* DetectOpenRazerControllers() */
REGISTER_DETECTOR("OpenRazer", DetectOpenRazerControllers);
+242 -8
View File
@@ -14,7 +14,7 @@ typedef struct
unsigned int row;
unsigned int col;
const char* name;
}razer_key;
} razer_key;
typedef struct
{
@@ -139,7 +139,7 @@ static const razer_key blackwidow_chroma_keymap[] =
{ 0, 5, 2, "Key: Left Windows" },
{ 0, 5, 3, "Key: Left Alt" },
{ 0, 5, 11, "Key: Right Alt" },
{ 0, 5, 13, "Key: Context" },
{ 0, 5, 13, "Key: Menu" },
{ 0, 5, 14, "Key: Right Control" },
{ 0, 5, 15, "Key: Left Arrow" },
{ 0, 5, 16, "Key: Down Arrow" },
@@ -236,7 +236,7 @@ static const razer_key blackwidow_chroma_te_keymap[] =
{ 0, 5, 2, "Key: Left Windows" },
{ 0, 5, 3, "Key: Left Alt" },
{ 0, 5, 11, "Key: Right Alt" },
{ 0, 5, 13, "Key: Context" },
{ 0, 5, 13, "Key: Menu" },
{ 0, 5, 14, "Key: Right Control" },
{ 0, 5, 15, "Key: Left Arrow" },
{ 0, 5, 16, "Key: Down Arrow" },
@@ -541,7 +541,7 @@ static const razer_key huntsman_elite_keymap[] =
{ 0, 5, 7, "Key: Space" },
{ 0, 5, 11, "Key: Right Alt" },
{ 0, 5, 12, "Key: Right Fn" },
{ 0, 5, 13, "Key: Context" },
{ 0, 5, 13, "Key: Menu" },
{ 0, 5, 14, "Key: Right Control" },
{ 0, 5, 15, "Key: Left Arrow" },
{ 0, 5, 16, "Key: Down Arrow" },
@@ -550,6 +550,240 @@ static const razer_key huntsman_elite_keymap[] =
{ 0, 5, 20, "Key: Number Pad ." },
};
#define BLACKWIDOW_ELITE_KEYMAP_SIZE (sizeof(blackwidow_elite_keymap) / sizeof(blackwidow_elite_keymap[0]))
static const razer_key blackwidow_elite_keymap[] =
{
/*---------------------------------------------------------------------*\
| Zone, Row, Column, Key |
\*---------------------------------------------------------------------*/
{ 0, 0, 1, "Key: Escape" },
{ 0, 0, 3, "Key: F1" },
{ 0, 0, 4, "Key: F2" },
{ 0, 0, 5, "Key: F3" },
{ 0, 0, 6, "Key: F4" },
{ 0, 0, 7, "Key: F5" },
{ 0, 0, 8, "Key: F6" },
{ 0, 0, 9, "Key: F7" },
{ 0, 0, 10, "Key: F8" },
{ 0, 0, 11, "Key: F9" },
{ 0, 0, 12, "Key: F10" },
{ 0, 0, 13, "Key: F11" },
{ 0, 0, 14, "Key: F12" },
{ 0, 0, 15, "Key: Print Screen" },
{ 0, 0, 16, "Key: Scroll Lock" },
{ 0, 0, 17, "Key: Pause/Break" },
{ 0, 0, 18, "Key: Media Previous" },
{ 0, 0, 19, "Key: Media Play/Pause" },
{ 0, 0, 20, "Key: Media Next" },
{ 0, 0, 21, "Key: Media Mute" },
{ 0, 1, 1, "Key: `" },
{ 0, 1, 2, "Key: 1" },
{ 0, 1, 3, "Key: 2" },
{ 0, 1, 4, "Key: 3" },
{ 0, 1, 5, "Key: 4" },
{ 0, 1, 6, "Key: 5" },
{ 0, 1, 7, "Key: 6" },
{ 0, 1, 8, "Key: 7" },
{ 0, 1, 9, "Key: 8" },
{ 0, 1, 10, "Key: 9" },
{ 0, 1, 11, "Key: 0" },
{ 0, 1, 12, "Key: -" },
{ 0, 1, 13, "Key: =" },
{ 0, 1, 14, "Key: Backspace" },
{ 0, 1, 15, "Key: Insert" },
{ 0, 1, 16, "Key: Home" },
{ 0, 1, 17, "Key: Page Up" },
{ 0, 1, 18, "Key: Num Lock" },
{ 0, 1, 19, "Key: Number Pad /" },
{ 0, 1, 20, "Key: Number Pad *" },
{ 0, 1, 21, "Key: Number Pad -" },
{ 0, 2, 1, "Key: Tab" },
{ 0, 2, 2, "Key: Q" },
{ 0, 2, 3, "Key: W" },
{ 0, 2, 4, "Key: E" },
{ 0, 2, 5, "Key: R" },
{ 0, 2, 6, "Key: T" },
{ 0, 2, 7, "Key: Y" },
{ 0, 2, 8, "Key: U" },
{ 0, 2, 9, "Key: I" },
{ 0, 2, 10, "Key: O" },
{ 0, 2, 11, "Key: P" },
{ 0, 2, 12, "Key: [" },
{ 0, 2, 13, "Key: ]" },
{ 0, 2, 14, "Key: \\ (ANSI)" },
{ 0, 2, 15, "Key: Delete" },
{ 0, 2, 16, "Key: End" },
{ 0, 2, 17, "Key: Page Down" },
{ 0, 2, 18, "Key: Number Pad 7" },
{ 0, 2, 19, "Key: Number Pad 8" },
{ 0, 2, 20, "Key: Number Pad 9" },
{ 0, 2, 21, "Key: Number Pad +" },
{ 0, 3, 1, "Key: Caps Lock" },
{ 0, 3, 2, "Key: A" },
{ 0, 3, 3, "Key: S" },
{ 0, 3, 4, "Key: D" },
{ 0, 3, 5, "Key: F" },
{ 0, 3, 6, "Key: G" },
{ 0, 3, 7, "Key: H" },
{ 0, 3, 8, "Key: J" },
{ 0, 3, 9, "Key: K" },
{ 0, 3, 10, "Key: L" },
{ 0, 3, 11, "Key: ;" },
{ 0, 3, 12, "Key: '" },
{ 0, 3, 14, "Key: Enter" },
{ 0, 3, 18, "Key: Number Pad 4" },
{ 0, 3, 19, "Key: Number Pad 5" },
{ 0, 3, 20, "Key: Number Pad 6" },
{ 0, 4, 1, "Key: Left Shift" },
{ 0, 4, 3, "Key: Z" },
{ 0, 4, 4, "Key: X" },
{ 0, 4, 5, "Key: C" },
{ 0, 4, 6, "Key: V" },
{ 0, 4, 7, "Key: B" },
{ 0, 4, 8, "Key: N" },
{ 0, 4, 9, "Key: M" },
{ 0, 4, 10, "Key: ," },
{ 0, 4, 11, "Key: ." },
{ 0, 4, 12, "Key: /" },
{ 0, 4, 14, "Key: Right Shift" },
{ 0, 4, 16, "Key: Up Arrow" },
{ 0, 4, 18, "Key: Number Pad 1" },
{ 0, 4, 19, "Key: Number Pad 2" },
{ 0, 4, 20, "Key: Number Pad 3" },
{ 0, 4, 21, "Key: Number Pad Enter" },
{ 0, 5, 1, "Key: Left Control" },
{ 0, 5, 2, "Key: Left Windows" },
{ 0, 5, 3, "Key: Left Alt" },
{ 0, 5, 6, "Key: Space" },
{ 0, 5, 10, "Key: Right Alt" },
{ 0, 5, 11, "Logo" },
{ 0, 5, 12, "Key: Right Fn" },
{ 0, 5, 13, "Key: Menu" },
{ 0, 5, 14, "Key: Right Control" },
{ 0, 5, 15, "Key: Left Arrow" },
{ 0, 5, 16, "Key: Down Arrow" },
{ 0, 5, 17, "Key: Right Arrow" },
{ 0, 5, 19, "Key: Number Pad 0" },
{ 0, 5, 20, "Key: Number Pad ." },
};
#define BLACKWIDOW_2019_KEYMAP_SIZE (sizeof(blackwidow_2019_keymap) / sizeof(blackwidow_2019_keymap[0]))
static const razer_key blackwidow_2019_keymap[] =
{
/*---------------------------------------------------------------------*\
| Zone, Row, Column, Key |
\*---------------------------------------------------------------------*/
{ 0, 0, 1, "Key: Escape" },
{ 0, 0, 3, "Key: F1" },
{ 0, 0, 4, "Key: F2" },
{ 0, 0, 5, "Key: F3" },
{ 0, 0, 6, "Key: F4" },
{ 0, 0, 7, "Key: F5" },
{ 0, 0, 8, "Key: F6" },
{ 0, 0, 9, "Key: F7" },
{ 0, 0, 10, "Key: F8" },
{ 0, 0, 11, "Key: F9" },
{ 0, 0, 12, "Key: F10" },
{ 0, 0, 13, "Key: F11" },
{ 0, 0, 14, "Key: F12" },
{ 0, 0, 15, "Key: Print Screen" },
{ 0, 0, 16, "Key: Scroll Lock" },
{ 0, 0, 17, "Key: Pause/Break" },
{ 0, 1, 1, "Key: `" },
{ 0, 1, 2, "Key: 1" },
{ 0, 1, 3, "Key: 2" },
{ 0, 1, 4, "Key: 3" },
{ 0, 1, 5, "Key: 4" },
{ 0, 1, 6, "Key: 5" },
{ 0, 1, 7, "Key: 6" },
{ 0, 1, 8, "Key: 7" },
{ 0, 1, 9, "Key: 8" },
{ 0, 1, 10, "Key: 9" },
{ 0, 1, 11, "Key: 0" },
{ 0, 1, 12, "Key: -" },
{ 0, 1, 13, "Key: =" },
{ 0, 1, 14, "Key: Backspace" },
{ 0, 1, 15, "Key: Insert" },
{ 0, 1, 16, "Key: Home" },
{ 0, 1, 17, "Key: Page Up" },
{ 0, 1, 18, "Key: Num Lock" },
{ 0, 1, 19, "Key: Number Pad /" },
{ 0, 1, 20, "Key: Number Pad *" },
{ 0, 1, 21, "Key: Number Pad -" },
{ 0, 2, 1, "Key: Tab" },
{ 0, 2, 2, "Key: Q" },
{ 0, 2, 3, "Key: W" },
{ 0, 2, 4, "Key: E" },
{ 0, 2, 5, "Key: R" },
{ 0, 2, 6, "Key: T" },
{ 0, 2, 7, "Key: Y" },
{ 0, 2, 8, "Key: U" },
{ 0, 2, 9, "Key: I" },
{ 0, 2, 10, "Key: O" },
{ 0, 2, 11, "Key: P" },
{ 0, 2, 12, "Key: [" },
{ 0, 2, 13, "Key: ]" },
{ 0, 2, 14, "Key: \\ (ANSI)" },
{ 0, 2, 15, "Key: Delete" },
{ 0, 2, 16, "Key: End" },
{ 0, 2, 17, "Key: Page Down" },
{ 0, 2, 18, "Key: Number Pad 7" },
{ 0, 2, 19, "Key: Number Pad 8" },
{ 0, 2, 20, "Key: Number Pad 9" },
{ 0, 2, 21, "Key: Number Pad +" },
{ 0, 3, 1, "Key: Caps Lock" },
{ 0, 3, 2, "Key: A" },
{ 0, 3, 3, "Key: S" },
{ 0, 3, 4, "Key: D" },
{ 0, 3, 5, "Key: F" },
{ 0, 3, 6, "Key: G" },
{ 0, 3, 7, "Key: H" },
{ 0, 3, 8, "Key: J" },
{ 0, 3, 9, "Key: K" },
{ 0, 3, 10, "Key: L" },
{ 0, 3, 11, "Key: ;" },
{ 0, 3, 12, "Key: '" },
{ 0, 3, 13, "Key: #" },
{ 0, 3, 14, "Key: Enter" },
{ 0, 3, 18, "Key: Number Pad 4" },
{ 0, 3, 19, "Key: Number Pad 5" },
{ 0, 3, 20, "Key: Number Pad 6" },
{ 0, 4, 1, "Key: Left Shift" },
{ 0, 4, 2, "Key: \\ (ISO)" },
{ 0, 4, 3, "Key: Z" },
{ 0, 4, 4, "Key: X" },
{ 0, 4, 5, "Key: C" },
{ 0, 4, 6, "Key: V" },
{ 0, 4, 7, "Key: B" },
{ 0, 4, 8, "Key: N" },
{ 0, 4, 9, "Key: M" },
{ 0, 4, 10, "Key: ," },
{ 0, 4, 11, "Key: ." },
{ 0, 4, 12, "Key: /" },
{ 0, 4, 14, "Key: Right Shift" },
{ 0, 4, 16, "Key: Up Arrow" },
{ 0, 4, 18, "Key: Number Pad 1" },
{ 0, 4, 19, "Key: Number Pad 2" },
{ 0, 4, 20, "Key: Number Pad 3" },
{ 0, 4, 21, "Key: Number Pad Enter" },
{ 0, 5, 1, "Key: Left Control" },
{ 0, 5, 2, "Key: Left Windows" },
{ 0, 5, 3, "Key: Left Alt" },
{ 0, 5, 6, "Key: Space" },
{ 0, 5, 10, "Key: Right Alt" },
{ 0, 5, 11, "Logo" },
{ 0, 5, 12, "Key: Right Fn" },
{ 0, 5, 13, "Key: Menu" },
{ 0, 5, 14, "Key: Right Control" },
{ 0, 5, 15, "Key: Left Arrow" },
{ 0, 5, 16, "Key: Down Arrow" },
{ 0, 5, 17, "Key: Right Arrow" },
{ 0, 5, 19, "Key: Number Pad 0" },
{ 0, 5, 20, "Key: Number Pad ," },
};
/*-------------------------------------------------------------------------*\
| KEYBOARDS |
\*-------------------------------------------------------------------------*/
@@ -584,8 +818,8 @@ static const razer_device blackwidow_2019_device =
NULL,
NULL
},
NULL,
0
blackwidow_2019_keymap,
BLACKWIDOW_2019_KEYMAP_SIZE
};
/*-------------------------------------------------------------*\
@@ -720,8 +954,8 @@ static const razer_device blackwidow_elite_device =
NULL,
NULL
},
NULL,
0
blackwidow_elite_keymap,
BLACKWIDOW_ELITE_KEYMAP_SIZE
};
/*-------------------------------------------------------------*\
+3
View File
@@ -1,3 +1,4 @@
#include "Detector.h"
#include "RGBController.h"
#include "RGBController_OpenRazerWindows.h"
#include <vector>
@@ -250,3 +251,5 @@ void DetectOpenRazerControllers(std::vector<RGBController*> &rgb_controllers)
}
} /* DetectOpenRazerControllers() */
REGISTER_DETECTOR("OpenRazer-Win32", DetectOpenRazerControllers);
+37
View File
@@ -13,6 +13,7 @@ RGBController::~RGBController()
{
DeviceThreadRunning = false;
DeviceCallThread->join();
delete DeviceCallThread;
/*---------------------------------------------------------*\
| Delete the matrix map |
@@ -1327,9 +1328,45 @@ void RGBController::SetMode(int mode)
UpdateMode();
}
void RGBController::RegisterUpdateCallback(RGBControllerCallback new_callback, void * new_callback_arg)
{
UpdateCallbacks.push_back(new_callback);
UpdateCallbackArgs.push_back(new_callback_arg);
}
void RGBController::UnregisterUpdateCallback(void * callback_arg)
{
for(unsigned int callback_idx = 0; callback_idx < UpdateCallbackArgs.size(); callback_idx++ )
{
if(UpdateCallbackArgs[callback_idx] == callback_arg)
{
UpdateCallbackArgs.erase(UpdateCallbackArgs.begin() + callback_idx);
UpdateCallbacks.erase(UpdateCallbacks.begin() + callback_idx);
break;
}
}
}
void RGBController::SignalUpdate()
{
UpdateMutex.lock();
/*-------------------------------------------------*\
| Client info has changed, call the callbacks |
\*-------------------------------------------------*/
for(unsigned int callback_idx = 0; callback_idx < UpdateCallbacks.size(); callback_idx++)
{
UpdateCallbacks[callback_idx](UpdateCallbackArgs[callback_idx]);
}
UpdateMutex.unlock();
}
void RGBController::UpdateLEDs()
{
CallFlag_UpdateLEDs = true;
SignalUpdate();
}
void RGBController::UpdateMode()
+12 -1
View File
@@ -14,6 +14,7 @@
#include <string>
#include <thread>
#include <chrono>
#include <mutex>
typedef unsigned int RGBColor;
@@ -139,6 +140,8 @@ typedef struct
matrix_map_type * matrix_map; /* Matrix map pointer */
} zone;
typedef void (*RGBControllerCallback)(void *);
class RGBController
{
public:
@@ -158,7 +161,7 @@ public:
| RGBController base class constructor |
\*---------------------------------------------------------*/
RGBController();
~RGBController();
virtual ~RGBController();
/*---------------------------------------------------------*\
| Generic functions implemented in RGBController.cpp |
@@ -188,6 +191,10 @@ public:
unsigned char * GetSingleLEDColorDescription(int led);
void SetSingleLEDColorDescription(unsigned char* data_buf);
void RegisterUpdateCallback(RGBControllerCallback new_callback, void * new_callback_arg);
void UnregisterUpdateCallback(void * callback_arg);
void SignalUpdate();
void UpdateLEDs();
//void UpdateZoneLEDs(int zone);
//void UpdateSingleLED(int led);
@@ -219,4 +226,8 @@ private:
//bool CallFlag_UpdateZoneLEDs = false;
//bool CallFlag_UpdateSingleLED = false;
//bool CallFlag_UpdateMode = false;
std::mutex UpdateMutex;
std::vector<RGBControllerCallback> UpdateCallbacks;
std::vector<void *> UpdateCallbackArgs;
};
@@ -18,12 +18,12 @@ RGBController_AMDWraithPrism::RGBController_AMDWraithPrism(AMDWraithPrismControl
description = "AMD Wraith Prism Device";
version = wraith->GetFirmwareVersionString();
mode Static;
Static.name = "Static";
Static.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Direct;
Direct.name = "Direct";
Direct.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_STATIC;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Breathing;
Breathing.name = "Breathing";
+142
View File
@@ -0,0 +1,142 @@
/*-----------------------------------------*\
| RGBController_AorusATC800.cpp |
| |
| Generic RGB Interface Aorus ATC800 CPU |
| Cooler |
| |
| Felipe Cavalcanti 08/13/2020 |
\*-----------------------------------------*/
#include "RGBController_AorusATC800.h"
RGBController_AorusATC800::RGBController_AorusATC800(ATC800Controller* cooler_ptr)
{
cooler = cooler_ptr;
name = "Aorus ATC800 CPU Cooler";
type = DEVICE_TYPE_COOLER;
description = "Aorus ATC800 CPU Cooler";
mode Static;
Static.name = "Static";
Static.value = AORUS_ATC800_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Off;
Off.name = "Off";
Off.value = AORUS_ATC800_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Flashing;
Flashing.name = "Flashing";
Flashing.value = AORUS_ATC800_MODE_FLASHING;
Flashing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
Flashing.color_mode = MODE_COLORS_PER_LED;
Flashing.speed_min = AORUS_ATC800_SPEED_SLOWEST;
Flashing.speed_max = AORUS_ATC800_SPEED_FASTEST;
Flashing.speed = AORUS_ATC800_SPEED_NORMAL;
modes.push_back(Flashing);
mode DoubleFlashing;
DoubleFlashing.name = "Double Flashing";
DoubleFlashing.value = AORUS_ATC800_MODE_DOUBLE_FLASH;
DoubleFlashing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
DoubleFlashing.color_mode = MODE_COLORS_PER_LED;
DoubleFlashing.speed_min = AORUS_ATC800_SPEED_SLOWEST;
DoubleFlashing.speed_max = AORUS_ATC800_SPEED_FASTEST;
DoubleFlashing.speed = AORUS_ATC800_SPEED_NORMAL;
modes.push_back(DoubleFlashing);
mode Pulsing;
Pulsing.name = "Pulsing";
Pulsing.value = AORUS_ATC800_MODE_PULSE;
Pulsing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
Pulsing.color_mode = MODE_COLORS_PER_LED;
Pulsing.speed_min = AORUS_ATC800_SPEED_SLOWEST;
Pulsing.speed_max = AORUS_ATC800_SPEED_FASTEST;
Pulsing.speed = AORUS_ATC800_SPEED_NORMAL;
modes.push_back(Pulsing);
SetupZones();
}
void RGBController_AorusATC800::SetupZones()
{
zone atc800_cpu_fans_zone;
atc800_cpu_fans_zone.name = "Fan";
atc800_cpu_fans_zone.type = ZONE_TYPE_SINGLE;
atc800_cpu_fans_zone.leds_min = 1;
atc800_cpu_fans_zone.leds_max = 1;
atc800_cpu_fans_zone.leds_count = 1;
atc800_cpu_fans_zone.matrix_map = NULL;
zones.push_back(atc800_cpu_fans_zone);
led atc800_fan_led;
atc800_fan_led.name = "Fan";
leds.push_back(atc800_fan_led);
zone atc800_top_zone;
atc800_top_zone.name = "Top";
atc800_top_zone.type = ZONE_TYPE_SINGLE;
atc800_top_zone.leds_min = 1;
atc800_top_zone.leds_max = 1;
atc800_top_zone.leds_count = 1;
atc800_top_zone.matrix_map = NULL;
zones.push_back(atc800_top_zone);
led atc800_top_led;
atc800_top_led.name = "Top";
leds.push_back(atc800_top_led);
SetupColors();
}
void RGBController_AorusATC800::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_AorusATC800::DeviceUpdateLEDs()
{
UpdateZoneLEDs(0);
UpdateZoneLEDs(1);
}
void RGBController_AorusATC800::UpdateZoneLEDs(int zone)
{
unsigned char mode = modes[active_mode].value;
unsigned char red = RGBGetRValue(colors[zone]);
unsigned char grn = RGBGetGValue(colors[zone]);
unsigned char blu = RGBGetBValue(colors[zone]);
if (mode == AORUS_ATC800_MODE_OFF)
{
mode = 1;
red = 0;
grn = 0;
blu = 0;
}
cooler->SendCoolerMode(mode, modes[active_mode].speed, zone, red, grn, blu);
}
void RGBController_AorusATC800::UpdateSingleLED(int led)
{
UpdateZoneLEDs(led);
}
void RGBController_AorusATC800::SetCustomMode()
{
}
void RGBController_AorusATC800::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}
+32
View File
@@ -0,0 +1,32 @@
/*-----------------------------------------*\
| RGBController_AorusATC800.h |
| |
| Generic RGB Interface for Aorus ATC 800 |
| CPU Cooler |
| |
| Felipe Cavalcanti 08/13/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "ATC800Controller.h"
class RGBController_AorusATC800 : public RGBController
{
public:
RGBController_AorusATC800(ATC800Controller* logitech_ptr);
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
ATC800Controller* cooler;
};
@@ -207,6 +207,11 @@ RGBController_AuraSMBus::RGBController_AuraSMBus(AuraSMBusController * aura_ptr)
active_mode = GetDeviceMode();
}
RGBController_AuraSMBus::~RGBController_AuraSMBus()
{
delete aura;
}
void RGBController_AuraSMBus::SetupZones()
{
std::vector<int> aura_led_map;
+1
View File
@@ -16,6 +16,7 @@ class RGBController_AuraSMBus : public RGBController
{
public:
RGBController_AuraSMBus(AuraSMBusController* aura_ptr);
~RGBController_AuraSMBus();
void SetupZones();
@@ -0,0 +1,136 @@
/*-----------------------------------------*\
| RGBController_CorsairHydro.cpp |
| |
| Generic RGB Interface for Corsair |
| Hydro Series |
| |
| Adam Honse (CalcProgrammer1) 8/18/2020 |
\*-----------------------------------------*/
#include "RGBController_CorsairHydro.h"
RGBController_CorsairHydro::RGBController_CorsairHydro(CorsairHydroController* corsair_ptr)
{
corsair = corsair_ptr;
description = "Corsair Hydro Series Device";
version = corsair->GetFirmwareString();
type = DEVICE_TYPE_COOLER;
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);
mode Blinking;
Blinking.name = "Blinking";
Blinking.value = 1;
Blinking.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Blinking.color_mode = MODE_COLORS_MODE_SPECIFIC;
Blinking.speed_min = 0x0F;
Blinking.speed_max = 0x05;
Blinking.speed = 0x0A;
Blinking.colors_min = 2;
Blinking.colors_max = 2;
Blinking.colors.resize(2);
modes.push_back(Blinking);
mode ColorShift;
ColorShift.name = "Color Shift";
ColorShift.value = 2;
ColorShift.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
ColorShift.color_mode = MODE_COLORS_MODE_SPECIFIC;
ColorShift.speed_min = 0x46;
ColorShift.speed_max = 0x0F;
ColorShift.speed = 0x28;
ColorShift.colors_min = 2;
ColorShift.colors_max = 2;
ColorShift.colors.resize(2);
modes.push_back(ColorShift);
mode Pulsing;
Pulsing.name = "Pulsing";
Pulsing.value = 3;
Pulsing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Pulsing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Pulsing.speed_min = 0x50;
Pulsing.speed_max = 0x1E;
Pulsing.speed = 0x37;
Pulsing.colors_min = 2;
Pulsing.colors_max = 2;
Pulsing.colors.resize(2);
modes.push_back(Pulsing);
SetupZones();
}
void RGBController_CorsairHydro::SetupZones()
{
zone new_zone;
new_zone.name = "Pump Zone";
new_zone.type = ZONE_TYPE_SINGLE;
new_zone.leds_min = 1;
new_zone.leds_max = 1;
new_zone.leds_count = 1;
new_zone.matrix_map = NULL;
zones.push_back(new_zone);
led new_led;
new_led.name = "Pump LED";
leds.push_back(new_led);
SetupColors();
}
void RGBController_CorsairHydro::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_CorsairHydro::DeviceUpdateLEDs()
{
DeviceUpdateMode();
}
void RGBController_CorsairHydro::UpdateZoneLEDs(int zone)
{
DeviceUpdateLEDs();
}
void RGBController_CorsairHydro::UpdateSingleLED(int led)
{
DeviceUpdateLEDs();
}
void RGBController_CorsairHydro::SetCustomMode()
{
active_mode = 0;
}
void RGBController_CorsairHydro::DeviceUpdateMode()
{
switch(modes[active_mode].value)
{
case 0:
corsair->SetFixed(colors);
break;
case 1:
corsair->SetBlink(modes[active_mode].colors, modes[active_mode].speed);
break;
case 2:
corsair->SetShift(modes[active_mode].colors, modes[active_mode].speed);
break;
case 3:
corsair->SetPulse(modes[active_mode].colors, modes[active_mode].speed);
break;
}
}
@@ -0,0 +1,32 @@
/*-----------------------------------------*\
| RGBController_CorsairHydro.h |
| |
| Generic RGB Interface for Corsair |
| Hydro Series |
| |
| Adam Honse (CalcProgrammer1) 8/17/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "CorsairHydroController.h"
class RGBController_CorsairHydro : public RGBController
{
public:
RGBController_CorsairHydro(CorsairHydroController* corsair_ptr);
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
CorsairHydroController* corsair;
};
+426 -19
View File
@@ -16,25 +16,86 @@ static unsigned int matrix_map[6][23] =
{ { 0, NA, 10, 18, 28, 36, NA, 46, 55, 64, 74, NA, 84, 93, 102, 6, 15, 24, 33, 26, 35, 44, 53 },
{ 1, 11, 19, 29, 37, 47, 56, 65, 75, 85, 94, NA, 103, 7, 25, NA, 42, 51, 60, 62, 72, 82, 91 },
{ 2, NA, 12, 20, 30, 38, NA, 48, 57, 66, 76, 86, 95, 104, 70, 80, 34, 43, 52, 9, 17, 27, 100 },
{ 3, NA, 13, 21, 31, 39, NA, 49, 58, 67, 77, 87, 96, 105, 98, NA, NA, NA, NA, 45, 54, 63, NA },
{ 4, NA, 22, 32, 40, 50, NA, 59, NA, 68, 78, 88, 97, 106, 61, NA, NA, 81, NA, 73, 83, 92, 109 },
{ 3, NA, 13, 21, 31, 39, NA, 49, 58, 67, 77, 87, 96, 105, 98, 112, NA, NA, NA, 45, 54, 63, NA },
{ 4, 111, 22, 32, 40, 50, NA, 59, NA, 68, 78, 88, 97, 106, 61, NA, NA, 81, NA, 73, 83, 92, 109 },
{ 5, 14, 23, NA, NA, NA, NA, 41, NA, NA, NA, NA, 69, 79, 89, 71, 90, 99, 108, 101, NA, 110, NA } };
static unsigned int matrix_map_k95_platinum[7][24] =
{ { NA, NA, NA, NA, 107, 8, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 16, NA, NA, NA,},
{ 113, 0, NA, 10, 18, 28, 36, NA, 46, 55, 64, 74, NA, 84, 93, 102, 6, 15, 24, 33, 26, 35, 44, 53 },
{ 114, 1, 11, 19, 29, 37, 47, 56, 65, 75, 85, 94, NA, 103, 7, 25, NA, 42, 51, 60, 62, 72, 82, 91 },
{ 115, 2, NA, 12, 20, 30, 38, NA, 48, 57, 66, 76, 86, 95, 104, 70, 80, 34, 43, 52, 9, 17, 27, 100 },
{ 116, 3, NA, 13, 21, 31, 39, NA, 49, 58, 67, 77, 87, 96, 105, 98, 112, NA, NA, NA, 45, 54, 63, NA },
{ 117, 4, 111, 22, 32, 40, 50, NA, 59, NA, 68, 78, 88, 97, 106, 61, NA, NA, 81, NA, 73, 83, 92, 109 },
{ 118, 5, 14, 23, NA, NA, NA, NA, 41, NA, NA, NA, NA, 69, 79, 89, 71, 90, 99, 108, 101, NA, 110, NA } };
static unsigned int matrix_map_k95[7][26] =
{ { NA, NA, NA, 131, 132, 133, 134, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 107, 8, NA, NA, 16, NA, NA,},
{ 113, 114, 115, 0, NA, 10, 18, 28, 36, NA, 46, 55, 64, 74, NA, 84, 93, 102, 6, 15, 24, 33, 26, 35, 44, 53 },
{ 116, 117, 118, 1, 11, 19, 29, 37, 47, 56, 65, 75, 85, 94, NA, 103, 7, 25, NA, 42, 51, 60, 62, 72, 82, 91 },
{ 119, 120, 121, 2, NA, 12, 20, 30, 38, NA, 48, 57, 66, 76, 86, 95, 104, 70, 80, 34, 43, 52, 9, 17, 27, 100 },
{ 122, 123, 124, 3, NA, 13, 21, 31, 39, NA, 49, 58, 67, 77, 87, 96, 105, 98, 112, NA, NA, NA, 45, 54, 63, NA },
{ 125, 126, 127, 4, 111, 22, 32, 40, 50, NA, 59, NA, 68, 78, 88, 97, 106, 61, NA, NA, 81, NA, 73, 83, 92, 109 },
{ 128, 129, 130, 5, 14, 23, NA, NA, NA, NA, 41, NA, NA, NA, NA, 69, 79, 89, 71, 90, 99, 108, 101, NA, 110, NA } };
/*---------------------------------------------------------*\
| Normal Corsair Layout |
\*---------------------------------------------------------*/
static const char* zone_names[] =
{
"Keyboard"
"Keyboard",
};
static const unsigned int zone_sizes[] =
{
111
113
};
static const zone_type zone_types[] =
{
ZONE_TYPE_MATRIX,
};
/*---------------------------------------------------------*\
| K95 Platinum |
\*---------------------------------------------------------*/
static const char* zone_names_k95_platinum[] =
{
"Keyboard",
"Light Bar"
};
static const unsigned int zone_sizes_k95_platinum[] =
{
119,
19
};
static const zone_type zone_types_k95_platinum[] =
{
ZONE_TYPE_MATRIX,
ZONE_TYPE_LINEAR
};
/*---------------------------------------------------------*\
| K95 non-Platinum |
\*---------------------------------------------------------*/
static const char* zone_names_k95[] =
{
"Keyboard",
};
static const unsigned int zone_sizes_k95[] =
{
135
};
static const zone_type zone_types_k95[] =
{
ZONE_TYPE_MATRIX
};
static const char* led_names[] =
{
"Key: Escape", //0
@@ -126,7 +187,7 @@ static const char* led_names[] =
"Key: O", //110
"Key: L", //111
"Key: ,", //112
"Key: Context", //113
"Key: Menu", //113
"Key: Left Arrow", //115
"Key: Number Pad -", //116
"Key: Number Pad 3", //117
@@ -148,6 +209,289 @@ static const char* led_names[] =
"Key: Right Arrow", //139
"Key: Number Pad Enter",//140
"Key: Number Pad .", //141
"Key: / (ISO)",
"Key: \\ (ISO)",
};
static const char* led_names_k95_plat[] =
{
"Key: Escape", //0
"Key: `", //1
"Key: Tab", //2
"Key: Caps Lock", //3
"Key: Left Shift", //4
"Key: Left Control", //5
"Key: F12", //6
"Key: =", //7
"Key: Lock", //8
"Key: Number Pad 7", //9
"Key: F1", //12
"Key: 1", //13
"Key: Q", //14
"Key: A", //15
"Key: Left Windows", //17
"Key: Print Screen", //18
"Key: Media Mute", //20
"Key: Number Pad 8", //21
"Key: F2", //24
"Key: 2", //25
"Key: W", //26
"Key: S", //27
"Key: Z", //28
"Key: Left Alt", //29
"Key: Scroll Lock", //30
"Key: Backspace", //31
"Key: Media Stop", //32
"Key: Number Pad 9", //33
"Key: F3", //36
"Key: 3", //37
"Key: E", //38
"Key: D", //39
"Key: X", //40
"Key: Pause/Break", //42
"Key: Delete", //43
"Key: Media Previous", //44
"Key: F4", //48
"Key: 4", //49
"Key: R", //50
"Key: F", //51
"Key: C", //52
"Key: Space", //53
"Key: Insert", //54
"Key: End", //55
"Key: Media Play/Pause",//56
"Key: Number Pad 4", //57
"Key: F5", //60
"Key: 5", //61
"Key: T", //62
"Key: G", //63
"Key: V", //64
"Key: Home", //66
"Key: Page Down", //67
"Key: Media Next", //68
"Key: Number Pad 5", //69
"Key: F6", //72
"Key: 6", //73
"Key: Y", //74
"Key: H", //75
"Key: B", //76
"Key: Page Up", //78
"Key: Right Shift", //79
"Key: Num Lock", //80
"Key: Number Pad 6", //81
"Key: F7", //84
"Key: 7", //85
"Key: U", //86
"Key: J", //87
"Key: N", //88
"Key: Right Alt", //89
"Key: ]", //90
"Key: Right Control", //91
"Key: Number Pad /", //92
"Key: Number Pad 1", //93
"Key: F8", //96
"Key: 8", //97
"Key: I", //98
"Key: K", //99
"Key: M", //100
"Key: Right Windows", //101
"Key: \\ (ANSI)", //102
"Key: Up Arrow", //103
"Key: Number Pad *", //104
"Key: Number Pad 2", //105
"Key: F9", //108
"Key: 9", //109
"Key: O", //110
"Key: L", //111
"Key: ,", //112
"Key: Menu", //113
"Key: Left Arrow", //115
"Key: Number Pad -", //116
"Key: Number Pad 3", //117
"Key: F10", //120
"Key: 0", //121
"Key: P", //122
"Key: ;", //123
"Key: .", //124
"Key: Enter", //126
"Key: Down Arrow", //127
"Key: Number Pad +", //128
"Key: Number Pad 0", //129
"Key: F11", //132
"Key: -", //133
"Key: [", //134
"Key: '", //135
"Key: /", //136
"Key: Brightness", //137
"Key: Right Arrow", //139
"Key: Number Pad Enter",//140
"Key: Number Pad .", //141
"Key: / (ISO)",
"Key: \\ (ISO)",
"Key: Macro G1",
"Key: Macro G2",
"Key: Macro G3",
"Key: Macro G4",
"Key: Macro G5",
"Key: Macro G6",
"Light Bar 1",
"Light Bar 2",
"Light Bar 3",
"Light Bar 4",
"Light Bar 5",
"Light Bar 6",
"Light Bar 7",
"Light Bar 8",
"Light Bar 9",
"Light Bar 10",
"Light Bar 11",
"Light Bar 12",
"Light Bar 13",
"Light Bar 14",
"Light Bar 15",
"Light Bar 16",
"Light Bar 17",
"Light Bar 18",
"Light Bar 19"
};
static const char* led_names_k95[] =
{
"Key: Escape", //0
"Key: `", //1
"Key: Tab", //2
"Key: Caps Lock", //3
"Key: Left Shift", //4
"Key: Left Control", //5
"Key: F12", //6
"Key: =", //7
"Key: Lock", //8
"Key: Number Pad 7", //9
"Key: F1", //12
"Key: 1", //13
"Key: Q", //14
"Key: A", //15
"Key: Left Windows", //17
"Key: Print Screen", //18
"Key: Media Mute", //20
"Key: Number Pad 8", //21
"Key: F2", //24
"Key: 2", //25
"Key: W", //26
"Key: S", //27
"Key: Z", //28
"Key: Left Alt", //29
"Key: Scroll Lock", //30
"Key: Backspace", //31
"Key: Media Stop", //32
"Key: Number Pad 9", //33
"Key: F3", //36
"Key: 3", //37
"Key: E", //38
"Key: D", //39
"Key: X", //40
"Key: Pause/Break", //42
"Key: Delete", //43
"Key: Media Previous", //44
"Key: F4", //48
"Key: 4", //49
"Key: R", //50
"Key: F", //51
"Key: C", //52
"Key: Space", //53
"Key: Insert", //54
"Key: End", //55
"Key: Media Play/Pause",//56
"Key: Number Pad 4", //57
"Key: F5", //60
"Key: 5", //61
"Key: T", //62
"Key: G", //63
"Key: V", //64
"Key: Home", //66
"Key: Page Down", //67
"Key: Media Next", //68
"Key: Number Pad 5", //69
"Key: F6", //72
"Key: 6", //73
"Key: Y", //74
"Key: H", //75
"Key: B", //76
"Key: Page Up", //78
"Key: Right Shift", //79
"Key: Num Lock", //80
"Key: Number Pad 6", //81
"Key: F7", //84
"Key: 7", //85
"Key: U", //86
"Key: J", //87
"Key: N", //88
"Key: Right Alt", //89
"Key: ]", //90
"Key: Right Control", //91
"Key: Number Pad /", //92
"Key: Number Pad 1", //93
"Key: F8", //96
"Key: 8", //97
"Key: I", //98
"Key: K", //99
"Key: M", //100
"Key: Right Windows", //101
"Key: \\ (ANSI)", //102
"Key: Up Arrow", //103
"Key: Number Pad *", //104
"Key: Number Pad 2", //105
"Key: F9", //108
"Key: 9", //109
"Key: O", //110
"Key: L", //111
"Key: ,", //112
"Key: Menu", //113
"Key: Left Arrow", //115
"Key: Number Pad -", //116
"Key: Number Pad 3", //117
"Key: F10", //120
"Key: 0", //121
"Key: P", //122
"Key: ;", //123
"Key: .", //124
"Key: Enter", //126
"Key: Down Arrow", //127
"Key: Number Pad +", //128
"Key: Number Pad 0", //129
"Key: F11", //132
"Key: -", //133
"Key: [", //134
"Key: '", //135
"Key: /", //136
"Key: Brightness", //137
"Key: Right Arrow", //139
"Key: Number Pad Enter",//140
"Key: Number Pad .", //141
"Key: / (ISO)",
"Key: \\ (ISO)",
"Key: Macro G1",
"Key: Macro G2",
"Key: Macro G3",
"Key: Macro G4",
"Key: Macro G5",
"Key: Macro G6",
"Key: Macro G7",
"Key: Macro G8",
"Key: Macro G9",
"Key: Macro G10",
"Key: Macro G11",
"Key: Macro G12",
"Key: Macro G13",
"Key: Macro G14",
"Key: Macro G15",
"Key: Macro G16",
"Key: Macro G17",
"Key: Macro G18",
"Key: MR",
"Key: M1",
"Key: M2",
"Key: M3",
};
RGBController_CorsairPeripheral::RGBController_CorsairPeripheral(CorsairPeripheralController* corsair_ptr)
@@ -159,6 +503,9 @@ RGBController_CorsairPeripheral::RGBController_CorsairPeripheral(CorsairPeripher
type = corsair->GetDeviceType();
version = corsair->GetFirmwareString();
physical_layout = corsair->GetPhysicalLayout();
logical_layout = corsair->GetLogicalLayout();
mode Direct;
Direct.name = "Direct";
Direct.value = 0;
@@ -185,6 +532,11 @@ void RGBController_CorsairPeripheral::SetupZones()
switch(type)
{
case DEVICE_TYPE_KEYBOARD:
if (logical_layout == CORSAIR_TYPE_K95_PLAT)
{
num_zones = 2;
break;
}
num_zones = 1;
break;
@@ -208,25 +560,69 @@ void RGBController_CorsairPeripheral::SetupZones()
switch(type)
{
case DEVICE_TYPE_KEYBOARD:
new_zone.name = zone_names[zone_idx];
new_zone.type = zone_types[zone_idx];
new_zone.leds_min = zone_sizes[zone_idx];
new_zone.leds_max = zone_sizes[zone_idx];
new_zone.leds_count = zone_sizes[zone_idx];
if(zone_types[zone_idx] == ZONE_TYPE_MATRIX)
if (logical_layout == CORSAIR_TYPE_K95_PLAT)
{
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = 6;
new_zone.matrix_map->width = 23;
new_zone.matrix_map->map = (unsigned int *)&matrix_map;
new_zone.name = zone_names_k95_platinum[zone_idx];
new_zone.type = zone_types_k95_platinum[zone_idx];
new_zone.leds_min = zone_sizes_k95_platinum[zone_idx];
new_zone.leds_max = zone_sizes_k95_platinum[zone_idx];
new_zone.leds_count = zone_sizes_k95_platinum[zone_idx];
if(zone_types[zone_idx] == ZONE_TYPE_MATRIX)
{
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = 7;
new_zone.matrix_map->width = 24;
new_zone.matrix_map->map = (unsigned int *)&matrix_map_k95_platinum;
}
else
{
new_zone.matrix_map = NULL;
}
}
else
else if (logical_layout == CORSAIR_TYPE_K95)
{
new_zone.matrix_map = NULL;
new_zone.name = zone_names_k95[zone_idx];
new_zone.type = zone_types_k95[zone_idx];
new_zone.leds_min = zone_sizes_k95[zone_idx];
new_zone.leds_max = zone_sizes_k95[zone_idx];
new_zone.leds_count = zone_sizes_k95[zone_idx];
if(zone_types[zone_idx] == ZONE_TYPE_MATRIX)
{
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = 7;
new_zone.matrix_map->width = 26;
new_zone.matrix_map->map = (unsigned int *)&matrix_map_k95;
}
else
{
new_zone.matrix_map = NULL;
}
}
else //default layout
{
new_zone.name = zone_names[zone_idx];
new_zone.type = zone_types[zone_idx];
new_zone.leds_min = zone_sizes[zone_idx];
new_zone.leds_max = zone_sizes[zone_idx];
new_zone.leds_count = zone_sizes[zone_idx];
if(zone_types[zone_idx] == ZONE_TYPE_MATRIX)
{
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = 6;
new_zone.matrix_map->width = 23;
new_zone.matrix_map->map = (unsigned int *)&matrix_map;
}
else
{
new_zone.matrix_map = NULL;
}
}
break;
case DEVICE_TYPE_MOUSE:
new_zone.name = "Mousemat Zone";
new_zone.type = ZONE_TYPE_SINGLE;
@@ -279,7 +675,18 @@ void RGBController_CorsairPeripheral::SetupZones()
switch(type)
{
case DEVICE_TYPE_KEYBOARD:
new_led.name = led_names[led_idx];
if(logical_layout == CORSAIR_TYPE_K95_PLAT)
{
new_led.name = led_names_k95_plat[led_idx];
}
else if(logical_layout == CORSAIR_TYPE_K95)
{
new_led.name = led_names_k95[led_idx];
}
else
{
new_led.name = led_names[led_idx];
}
break;
case DEVICE_TYPE_MOUSE:
@@ -17,6 +17,9 @@ public:
RGBController_CorsairPeripheral(CorsairPeripheralController* corsair_ptr);
~RGBController_CorsairPeripheral();
int physical_layout;
int logical_layout;
void SetupZones();
void ResizeZone(int zone, int new_size);
@@ -18,6 +18,16 @@ RGBController_CorsairVengeancePro::RGBController_CorsairVengeancePro(CorsairVeng
description = "Corsair Vengeance Pro RGB Device";
location = corsair->GetDeviceLocation();
mode Direct;
Direct.name = "Direct";
Direct.value = CORSAIR_PRO_MODE_STATIC;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.speed_min = 0;
Direct.speed_max = 0;
Direct.speed = 0;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode ColorShift;
ColorShift.name = "Color Shift";
ColorShift.value = CORSAIR_PRO_MODE_COLOR_SHIFT;
@@ -134,16 +144,6 @@ RGBController_CorsairVengeancePro::RGBController_CorsairVengeancePro(CorsairVeng
Sequential.colors.resize(1);
modes.push_back(Sequential);
mode Static;
Static.name = "Static";
Static.value = CORSAIR_PRO_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Static.speed_min = 0;
Static.speed_max = 0;
Static.speed = 0;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
SetupZones();
active_mode = 9;
@@ -216,7 +216,7 @@ void RGBController_CorsairVengeancePro::UpdateSingleLED(int led)
void RGBController_CorsairVengeancePro::SetCustomMode()
{
active_mode = 9;
active_mode = 0;
}
void RGBController_CorsairVengeancePro::DeviceUpdateMode()
+12 -12
View File
@@ -13,12 +13,12 @@
#define NA 0xFFFFFFFF
static unsigned int matrix_map[6][23] =
{ { 0, NA, 12, 18, 24, 30, NA, 42, 48, 54, 60, NA, 66, 72, 78, 84, 90, 96, 102, NA, NA, NA, NA },
{ 1, 7, 13, 19, 25, 31, 37, 43, 49, 55, 61, NA, 67, 73, 85, NA, 91, 97, 103, NA, NA, NA, NA },
{ 2, NA, 8, 14, 20, 26, NA, 32, 38, 44, 50, 56, 62, 68, 74, 86, 92, 98, 104, NA, NA, NA, NA },
{ 3, NA, 9, 15, 21, 27, NA, 33, 39, 45, 51, 57, 63, 69, 87, NA, NA, NA, NA, NA, NA, NA, NA },
{ 4, NA, 16, 22, 28, 34, NA, 40, NA, 46, 52, 58, 64, 70, 82, NA, NA, 100, NA, NA, NA, NA, NA },
{ 5, 11, 17, NA, NA, NA, NA, 41, NA, NA, NA, NA, 65, 77, 83, 89, 95, 101, 107, NA, NA, NA, NA } };
{ { 0, NA, 12, 18, 24, 30, NA, 42, 48, 54, 60, NA, 66, 72, 78, 84, 90, 96, 102, 108, 114, 120, 126 },
{ 1, 7, 13, 19, 25, 31, 37, 43, 49, 55, 61, NA, 67, 73, 85, NA, 91, 97, 103, 109, 115, 121, 127 },
{ 2, NA, 8, 14, 20, 26, NA, 32, 38, 44, 50, 56, 62, 68, 74, 86, 92, 98, 104, 110, 116, 122, 128 },
{ 3, NA, 9, 15, 21, 27, NA, 33, 39, 45, 51, 57, 63, 69, 87, NA, NA, NA, NA, 111, 117, 123, NA },
{ 4, NA, 16, 22, 28, 34, NA, 40, NA, 46, 52, 58, 64, 70, 82, NA, NA, 100, NA, 112, 118, 124, 131 },
{ 5, 11, 17, NA, NA, NA, NA, 41, NA, NA, NA, NA, 65, 77, 83, 89, 95, 101, 107, 113, NA, 125, NA } };
RGBController_DuckyKeyboard::RGBController_DuckyKeyboard(DuckyKeyboardController* ducky_ptr)
{
@@ -28,12 +28,12 @@ RGBController_DuckyKeyboard::RGBController_DuckyKeyboard(DuckyKeyboardController
type = DEVICE_TYPE_KEYBOARD;
description = "Ducky Keyboard Device";
mode Custom;
Custom.name = "Custom";
Custom.value = 0xFFFF;
Custom.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Custom.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Custom);
mode Direct;
Direct.name = "Direct";
Direct.value = 0xFFFF;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
SetupZones();
}
+132
View File
@@ -11,6 +11,8 @@
#include <e131.h>
#include <math.h>
using namespace std::chrono_literals;
RGBController_E131::RGBController_E131(std::vector<E131Device> device_list)
{
name = "E1.31 Streaming ACN Device";
@@ -28,10 +30,23 @@ RGBController_E131::RGBController_E131(std::vector<E131Device> device_list)
sockfd = e131_socket();
keepalive_delay = 0ms;
SetupZones();
for (std::size_t device_idx = 0; device_idx < devices.size(); device_idx++)
{
/*-----------------------------------------*\
| Update keepalive delay |
\*-----------------------------------------*/
if(devices[device_idx].keepalive_time > 0)
{
if(keepalive_delay.count() == 0 || keepalive_delay.count() > devices[device_idx].keepalive_time)
{
keepalive_delay = std::chrono::milliseconds(devices[device_idx].keepalive_time);
}
}
/*-----------------------------------------*\
| Add Universes |
\*-----------------------------------------*/
@@ -63,7 +78,110 @@ RGBController_E131::RGBController_E131(std::vector<E131Device> device_list)
dest_addrs.push_back(dest_addr);
}
}
/*-----------------------------------------*\
| Generate matrix maps |
\*-----------------------------------------*/
if(devices[device_idx].type == ZONE_TYPE_MATRIX)
{
unsigned int led_idx = 0;
matrix_map_type * new_map = new matrix_map_type;
new_map->width = devices[device_idx].matrix_width;
new_map->height = devices[device_idx].matrix_height;
new_map->map = new unsigned int[devices[device_idx].matrix_width * devices[device_idx].matrix_height];
switch(devices[device_idx].matrix_order)
{
case E131_MATRIX_ORDER_HORIZONTAL_TOP_LEFT:
for(unsigned int y = 0; y < new_map->height; y++)
{
for(unsigned int x = 0; x < new_map->width; x++)
{
new_map->map[(y * new_map->width) + x] = led_idx;
led_idx++;
}
}
break;
case E131_MATRIX_ORDER_HORIZONTAL_TOP_RIGHT:
for(unsigned int y = 0; y < new_map->height; y++)
{
for(unsigned int x = new_map->width - 1; x >= 0; x--)
{
new_map->map[(y * new_map->width) + x] = led_idx;
led_idx++;
}
}
break;
case E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_LEFT:
for(unsigned int y = new_map->height; y >= 0; y--)
{
for(unsigned int x = 0; x < new_map->width; x++)
{
new_map->map[(y * new_map->width) + x] = led_idx;
led_idx++;
}
}
break;
case E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_RIGHT:
for(unsigned int y = new_map->height; y >= 0; y--)
{
for(unsigned int x = new_map->width - 1; x >= 0; x--)
{
new_map->map[(y * new_map->width) + x] = led_idx;
led_idx++;
}
}
break;
case E131_MATRIX_ORDER_VERTICAL_TOP_LEFT:
for(unsigned int x = 0; x < new_map->width; x++)
{
for(unsigned int y = 0; y < new_map->height; y++)
{
new_map->map[(y * new_map->width) + x] = led_idx;
led_idx++;
}
}
break;
case E131_MATRIX_ORDER_VERTICAL_TOP_RIGHT:
for(unsigned int x = new_map->width - 1; x >= 0; x--)
{
for(unsigned int y = 0; y < new_map->height; y++)
{
new_map->map[(y * new_map->width) + x] = led_idx;
led_idx++;
}
}
break;
case E131_MATRIX_ORDER_VERTICAL_BOTTOM_LEFT:
for(unsigned int x = 0; x < new_map->width; x++)
{
for(unsigned int y = new_map->height - 1; y >= 0; y++)
{
new_map->map[(y * new_map->width) + x] = led_idx;
led_idx++;
}
}
break;
case E131_MATRIX_ORDER_VERTICAL_BOTTOM_RIGHT:
for(unsigned int x = new_map->width - 1; x >= 0; x--)
{
for(unsigned int y = new_map->height - 1; y >= 0; y--)
{
new_map->map[(y * new_map->width) + x] = led_idx;
led_idx++;
}
}
break;
}
zones[device_idx].matrix_map = new_map;
}
}
if(keepalive_delay.count() > 0)
{
KeepaliveThread = new std::thread(&RGBController_E131::KeepaliveThreadFunction, this);
}
}
void RGBController_E131::SetupZones()
@@ -114,6 +232,8 @@ void RGBController_E131::DeviceUpdateLEDs()
{
int color_idx = 0;
last_update_time = std::chrono::steady_clock::now();
for(std::size_t device_idx = 0; device_idx < devices.size(); device_idx++)
{
unsigned int total_universes = ceil( ( ( devices[device_idx].num_leds * 3 ) + devices[device_idx].start_channel ) / 512.0f );
@@ -190,3 +310,15 @@ void RGBController_E131::DeviceUpdateMode()
{
}
void RGBController_E131::KeepaliveThreadFunction()
{
while(1)
{
if((std::chrono::steady_clock::now() - last_update_time) > ( keepalive_delay * 0.95f ) )
{
UpdateLEDs();
}
std::this_thread::sleep_for(keepalive_delay / 2);
}
}
+39 -14
View File
@@ -10,27 +10,47 @@
#pragma once
#include "RGBController.h"
#include <e131.h>
#include <chrono>
#include <thread>
typedef unsigned int e131_rgb_order;
enum
{
E131_RGB_ORDER_RGB,
E131_RGB_ORDER_RBG,
E131_RGB_ORDER_GRB,
E131_RGB_ORDER_GBR,
E131_RGB_ORDER_BRG,
E131_RGB_ORDER_BGR
};
{
E131_RGB_ORDER_RGB,
E131_RGB_ORDER_RBG,
E131_RGB_ORDER_GRB,
E131_RGB_ORDER_GBR,
E131_RGB_ORDER_BRG,
E131_RGB_ORDER_BGR
};
enum
{
E131_MATRIX_ORDER_HORIZONTAL_TOP_LEFT,
E131_MATRIX_ORDER_HORIZONTAL_TOP_RIGHT,
E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_LEFT,
E131_MATRIX_ORDER_HORIZONTAL_BOTTOM_RIGHT,
E131_MATRIX_ORDER_VERTICAL_TOP_LEFT,
E131_MATRIX_ORDER_VERTICAL_TOP_RIGHT,
E131_MATRIX_ORDER_VERTICAL_BOTTOM_LEFT,
E131_MATRIX_ORDER_VERTICAL_BOTTOM_RIGHT
};
typedef unsigned int e131_matrix_order;
struct E131Device
{
std::string name;
unsigned int num_leds;
unsigned int start_universe;
unsigned int start_channel;
e131_rgb_order rgb_order;
zone_type type;
std::string name;
unsigned int num_leds;
unsigned int start_universe;
unsigned int start_channel;
unsigned int keepalive_time;
e131_rgb_order rgb_order;
zone_type type;
unsigned int matrix_width;
unsigned int matrix_height;
e131_matrix_order matrix_order;
};
class RGBController_E131 : public RGBController
@@ -49,10 +69,15 @@ public:
void SetCustomMode();
void DeviceUpdateMode();
void KeepaliveThreadFunction();
private:
std::vector<E131Device> devices;
std::vector<e131_packet_t> packets;
std::vector<e131_addr_t> dest_addrs;
std::vector<unsigned int> universes;
int sockfd;
std::thread * KeepaliveThread;
std::chrono::milliseconds keepalive_delay;
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
};
+4 -2
View File
@@ -1,5 +1,5 @@
#include "RGBController_Faustus.h"
#include "Detector.h"
#include <dirent.h>
#include <string.h>
@@ -170,4 +170,6 @@ void DetectFaustusControllers(std::vector<RGBController*> &rgb_controllers)
closedir(dir);
if(found != 6) return;
rgb_controllers.push_back(new RGBController_Faustus(base_path));
}
} /* DetectFaustusControllers() */
REGISTER_DETECTOR("Faustus", DetectFaustusControllers);
@@ -0,0 +1,90 @@
/*--------------------------------------------------------------*\
| RGBController_HoltekA070.cpp |
| |
| Generic RGB Interface for Holtek USB Gaming Mouse [04d9:a070] |
| |
| Santeri Pikarinen (santeri3700) 8/01/2020 |
\*--------------------------------------------------------------*/
#include "RGBController_HoltekA070.h"
RGBController_HoltekA070::RGBController_HoltekA070(HoltekA070Controller* holtek_ptr)
{
holtek = holtek_ptr;
name = "Holtek USB Gaming Mouse Device";
type = DEVICE_TYPE_MOUSE;
description = "Holtek USB Gaming Mouse Device";
mode Static;
Static.name = "Static";
Static.speed = HOLTEK_A070_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Breathing;
Breathing.name = "Breathing";
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Breathing.color_mode = MODE_COLORS_PER_LED;
Breathing.speed_min = HOLTEK_A070_MODE_BREATHING_SLOW;
Breathing.speed_max = HOLTEK_A070_MODE_BREATHING_FAST;
Breathing.speed = HOLTEK_A070_MODE_BREATHING_MEDIUM;
modes.push_back(Breathing);
SetupZones();
}
void RGBController_HoltekA070::SetupZones()
{
zone mouse_zone;
mouse_zone.name = "Mouse Zone";
mouse_zone.type = ZONE_TYPE_SINGLE;
mouse_zone.leds_min = 1;
mouse_zone.leds_max = 1;
mouse_zone.leds_count = 1;
mouse_zone.matrix_map = NULL;
zones.push_back(mouse_zone);
led mouse_led;
mouse_led.name = "All LEDs";
leds.push_back(mouse_led);
SetupColors();
}
void RGBController_HoltekA070::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_HoltekA070::DeviceUpdateLEDs()
{
unsigned char red = RGBGetRValue(colors[0]);
unsigned char green = RGBGetGValue(colors[0]);
unsigned char blue = RGBGetBValue(colors[0]);
holtek->SendCustomColor(red, green, blue);
}
void RGBController_HoltekA070::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_HoltekA070::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_HoltekA070::SetCustomMode()
{
}
void RGBController_HoltekA070::DeviceUpdateMode()
{
holtek->SendMode(modes[active_mode].speed);
}
+30
View File
@@ -0,0 +1,30 @@
/*--------------------------------------------------------------*\
| RGBController_HoltekA070.h |
| |
| Generic RGB Interface for Holtek USB Gaming Mouse [04d9:a070] |
| |
| Santeri Pikarinen (santeri3700) 8/01/2020 |
\*--------------------------------------------------------------*/
#pragma once
#include "RGBController.h"
#include "HoltekA070Controller.h"
class RGBController_HoltekA070 : public RGBController
{
public:
RGBController_HoltekA070(HoltekA070Controller* holtek_ptr);
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
HoltekA070Controller* holtek;
};

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