Compare commits

...
Author SHA1 Message Date
Adam Honse 6128731df6 OpenRGB version 0.7 2021-12-30 00:45:07 -06:00
Adam Honse 6ca090d5f4 Use Bullseye OpenRGB builder image to build AppImages and Debian Bullseye .deb packages 2021-12-30 06:02:41 +00:00
Qwex 57e7e6a823 Revert "Fix frames skip when using external effects engine" to fix ram race condition 2021-12-30 06:00:59 +00:00
Brandon Shoopman bdecbd77fc Add support for Asus Rog Strix 3080 White LHR 2021-12-30 06:00:30 +00:00
Adam Honse 938f67016c Update plugin API to version 2, add unregister functions for all ResourceManager callbacks 2021-12-29 22:50:00 -06:00
Cooper Knaak 6d5ca0b539 Track used paths in DetectRazerARGBController to support multiple Razer ARGB controllers at once. 2021-12-30 01:08:23 +00:00
TheRogueZeta b877787e12 Update resize messages
Wording adjusted by Adam Honse <[email protected]>
2021-12-29 17:02:01 -06:00
Frederik Madsen 5186161fdd Support for wired and wireless BlackWidow V3 Mini 2021-12-29 18:35:54 +00:00
Adam Honse 341607ec3e Free allocated buffer in Linux pure i2c block transfer function 2021-12-29 03:48:19 -06:00
Adam Honse 46d8ca718e Fix pure i2c block read in Linux 2021-12-29 03:45:12 -06:00
Artem Polishchuk 101550bb6c Update RPM .spec file due MR#933 2021-12-29 03:19:49 -06:00
Artem Polishchuk ccbe83919a Fix udev rules install path
Need for Flatpak build and probably useful for other distros like Fedora.
2021-12-29 03:18:12 -06:00
Chris 6e7a59a8d9 Initial commit for Corsair M65 to resolve #1687
+ Adding entry for the Corsair M65 PID (non pro)
+ Registered detector
+ Added UDEV rule to 60-openrgb.rules
2021-12-29 16:56:41 +11:00
morg 84c21919e1 Add support for a RTX2080Ti 11G Gaming variant 2021-12-29 05:09:23 +00:00
Mola19 c6c4e76e04 Fixing bugs in ASUS Aura Mouse Controller
Commit amended for code style by Adam Honse <[email protected]>
2021-12-27 21:58:41 -06:00
Chris be1b982d71 Initial commit for Razer Huntsman V2 TKL
* Adding entry for the Huntsman V2 TKL PID
* Registered detectors
* Added metadata to RazerDevices.h
* Added capabilities to RazerController.cpp
* Added UDEV rule to 60-openrgb.rules
2021-12-27 15:53:05 -06:00
Frederik Madsen c362719771 Added support for the Razer Huntsman V2 Analog 2021-12-27 21:07:32 +00:00
Neneya 35a827d25c Implement new protocol version that adds tracking of keyboard-internal LED IDs rather than assuming they are in the same order as in OpenRGB, as well as sending the LED ID that needs to be updated on every direct update. 2021-12-27 05:12:39 +00:00
Adam Honse f093a66057 Remove Ubuntu 20.10 test stage as 20.10 (groovy) has been removed from Ubuntu's official repos 2021-12-24 04:01:05 -06:00
Artem Polishchuk 6bdc9bae4a OpenRGB.spec: Update icon installation due MR#935 2021-12-23 22:32:19 -06:00
Artem Polishchuk f2ecba739c fix: Icon installation path on Linux
https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html#install_icons
2021-12-23 22:31:06 -06:00
Artem c8f82bb768 Add AppStream metainfo 2021-12-23 03:50:25 +00:00
Will Gannon 16aae4d873 Added support for Asus ROG Strix 3070Ti O8G Gaming 2021-12-22 05:21:26 +00:00
Erik Karsten cb0c93d1a3 Refactor NVIDIA_RTX2070S_DEV to NVIDIA_RTX2070S_OC_DEV
Downbinned 1EC7 variant is now the new NVIDIA_RTX2070S_DEV
2021-12-21 21:10:54 +00:00
Erik Karsten 9ca29ea6ec FIX: Use correctly named A8G macro instead of 08G 2021-12-21 21:10:54 +00:00
Erik Karsten 39b15de83e Add alternative release of Strix 2070 Super A8G 2021-12-21 21:10:54 +00:00
Adam Honse 3b2e1396c0 Update warning in README 2021-12-21 01:23:02 -06:00
morg f08736eab8 Resize tab label height depending on the font in use. Fix #1922
Commit amended to fix icon getting cut off in certain cases by Adam Honse <[email protected]>
2021-12-21 00:27:30 -06:00
TheRogueZeta eac2066ad5 Add Gigabyte 3080 Ti Vision OC device ID 2021-12-21 00:11:24 +00:00
morg af1e8ee4c6 E131: Fix RGB order enum value 2021-12-21 00:08:26 +00:00
Chris bf22e175c1 Removing run time error from AURA USB detection
+ Adding LOG message
+ Deleting object
2021-12-21 09:05:51 +11:00
morg 1dd9148399 Corsair peripheral: fix comparison, add debug messages. 2021-12-20 02:05:24 +00:00
Chris M f3494822d0 Adding Roccat Vulcan 120 Aimo to 60-openrgb.rules 2021-12-20 02:04:26 +00:00
eispalast 2162ff2d27 Added support for the Dygma Raise
Commit amended for code style by Adam Honse <[email protected]>
2021-12-19 16:31:45 -06:00
Mola19 4b9fa421da Add support for Roccat Vulcan 12X Aimo keyboards
Commit amended for code style by Adam Honse <[email protected]>
2021-12-19 15:34:29 -06:00
TheRogueZeta 61310c33d5 Add device ID for ROG STRIX GTX1050TI O4G GAMING 2021-12-19 17:48:18 +00:00
Mola19 366fbd9720 Add ASUS Strix Evolve mouse
Commit amended for code style by Adam Honse <[email protected]>
2021-12-14 14:23:38 -06:00
Malte Zietlow 186d8a57d7 Add support for Logitech G915TKL 2021-12-12 00:11:00 +00:00
CoffeeIsLife 9a12042b74 Fixed deathadder elite modes not working 2021-12-09 02:54:12 +00:00
Chris 2bea9992a3 Adding extra column to the Razer Tartarus V2 to resolve #2006
+ Adding key map to remove non existent LEDs
2021-12-08 15:10:03 +11:00
Chris 3d469e78f5 Adding failure logging to DMI info 2021-12-07 00:22:01 +00:00
TheRogueZeta bc3c1b504b Add Palit 3070Ti GamingPro device ID 2021-12-07 00:20:23 +00:00
TheRogueZeta 3ff19efce6 Add TUF-RTX3080-10G-GAMING-PD device ID to the detector 2021-12-05 21:07:34 +00:00
TheRogueZeta 6b1e217afa Fix GPU print messages to use capital letters 2021-12-05 06:08:37 +00:00
TheRogueZeta d78e9442b2 Add Gigabyte RTX3070 Gaming OC 8G v3.0 LHR to the detector list 2021-12-05 06:06:54 +00:00
Qwex de91237de8 Fix Corsair K100 initialization 2021-12-05 01:23:46 +00:00
TheRogueZeta fe59f75b5b Update spacing and text in warning messages
Commit amended to make DRAM/Motherboard warning common between the Windows and Linux messages by Adam Honse <[email protected]>.  Line breaks in the OS-specific paragraphs removed as I found them unnecessary, especially when the line is already wrapped before the break.
2021-12-04 00:07:05 -06:00
Mola19 ec1cb11621 Add layout, version, save, brightness to AsusTufKeyboard
Commits squashed and amended for code style by Adam Honse <[email protected]>
2021-12-03 23:42:44 -06:00
TheRogueZeta 33e15cfeaa Add Corsair Strafe Red PID to the detector 2021-12-04 00:22:18 +00:00
Chris a64d3a8287 Reverting syntax error introduced in d0cb93dec4 2021-12-02 17:45:00 +11:00
TheRogueZeta f1c2a1eb3f Update GPU deivce logging to use common string 2021-12-02 05:53:27 +00:00
Chris 39c0689129 Adding Gigabyte RTX 2060 OC V2 to resolve #1980
+ Adding entry to `pci_ids.h`
+ Registering detector in Fusion1 GPU controller
2021-12-02 13:47:22 +11:00
Chris 2b346bfb7e Adding Coolermaster MP750 Large PID to resolve #1981
+ Adding PID and registering detector
+ Adding entry to UDEV rules
2021-12-01 18:03:17 +00:00
TheRogueZeta a653e8ddcc Add Aorus RTX 2070 XTREME device id to RGBFusion2GPU detector 2021-12-01 18:02:50 +00:00
TheRogueZeta 3541787c11 Add MSI MPG Z390 Gaming Edge AC PID to the detector 2021-12-01 18:02:15 +00:00
Chris 310447c5f0 Adjusting QSS and palette to resolve #1976
+ Adding global QLabel and QTableView to QSS
+ Adding `Link` and `LinkVisited` to palette
+ Ensuring Windows sets a Monospaced font for the log console
2021-11-30 18:34:58 +00:00
Qwex 74b2fb5083 Add MSI GeForce RTX 3080 Suprim X 10G LHR to detection 2021-11-30 14:59:17 +00:00
TheRogueZeta 7587bf059e Add alternate Asus TUF 3080 O10G v2 Gaming device ID and update list 2021-11-29 20:51:49 +00:00
TheRogueZeta 3414688eb7 Add Gigabyte Aorus RTX2060S device ID and sort names 2021-11-29 20:49:55 +00:00
NathyTheNetbook ee085a1284 Add Support for evga 1070 ftw hybrid 2021-11-29 15:25:30 +00:00
TheRogueZeta 74bef5d290 Add MSI MS_7D25 VID to the device detector 2021-11-28 18:13:42 +00:00
Chris M e9390a82d8 Fixing missing keys in matrix map to resolve #1973 2021-11-28 18:09:24 +00:00
TheRogueZeta b241768201 Add Corsair Ironcalw RGB device ID 2021-11-28 07:44:58 +00:00
sanchezzzs 2ccd141dab Add logitech g pro keyboard support 2021-11-27 21:28:42 +00:00
Qwex 9afaccc747 Add direct mode support for msi gpus 2021-11-27 21:02:48 +00:00
Triqqo af9af2fbe3 Added ASUS TUF 3090 (non-OC) detection 2021-11-27 18:31:18 +00:00
Sam B f5e5c58a35 Added ASUS ROG STRIX 3080 O10G WHITE and ASUS TUF RTX 3080 10G V2 GAMING 2021-11-27 18:19:35 +00:00
Shelby Moore 4b1ceff9fc Added GeForce RTX 3080 Ti AORUS XTREME WATERFORCE 12G 2021-11-26 20:24:05 +00:00
Mola19 e55df516d4 fix usb interface for Asus TUF M5 2021-11-26 18:30:05 +00:00
Adam Honse 44d7e27404 More Alloy Origins matrix fixes 2021-11-26 00:41:26 -06:00
Adam Honse 173862666e Add right shift to matrix layout for HyperX Alloy Origins 2021-11-25 23:53:43 -06:00
Chris M e5782aa253 Adding B450 AORUS ELITE V2 to the GigabyteRGBFusion2SMBus controller 2021-11-25 20:36:08 +00:00
morg d68c398128 Dark theme: add missing entry to QSS file (QTextEdit) 2021-11-25 20:34:52 +00:00
Patrick Robin dfb322b054 Added MSI GeForce RTX 3080 10GB Gaming Z Trio detection 2021-11-25 20:33:04 +00:00
Mola19 f97eae1650 fix pid for Asus TUF M5 2021-11-24 21:54:37 +00:00
1000001101000 81b48adcf5 Gigabyte RGB Fusion 2 GPU controller
Commit amended for code style and to rename Static to Direct mode by Adam Honse <[email protected]>
2021-11-24 15:43:18 -06:00
1000001101000 e36b52136c Add functions to i2c_smbus for pure i2c block transactions
Commit amended to rework API and change for code style by Adam Honse <[email protected]>
2021-11-24 15:42:54 -06:00
Chris M aaa60d7d6f Changing cast type to avoid segfault resolving #1960 2021-11-24 06:50:18 +00:00
Adam Honse 1e760e2368 Use timeouts on Corsair Lighting Node HID reads to improve speed on Linux 2021-11-23 21:14:46 -06:00
Chris M 2648923366 Initial commit for Razer Naga - Left Handed mouse to resolve #1928 2021-11-24 02:28:23 +00:00
Viktor Walter f8e5d31275 Adding line for controlling the Mystic Light RGB on the MSI MAG Tomahawk z390... 2021-11-24 02:26:59 +00:00
Alex 65a886ea60 Add Gigabyte RTX3080 Vision OC 10G to detection 2021-11-23 19:53:23 +00:00
Alex 41059464da Add Gigabyte RTX3070 Ti Vision OC 8G to detection 2021-11-23 18:21:09 +01:00
Adam Honse befc88871a Add Do Not Show Again box to LOG_DIALOG, using std::hash to hash the dialog string 2021-11-23 00:31:25 -06:00
Stijn Bannink 468889c36f Updated Effects Engine Plugin url 2021-11-22 18:38:04 +00:00
Chris M d0cb93dec4 Adding Logitech G903 V2 to the Logitech common controller to resolve #1946 2021-11-22 18:31:31 +00:00
Alex 1bbf5c4b26 Add ASUS TUF 3060Ti O8G OC to detection 2021-11-22 18:29:48 +00:00
Adam Honse c788192349 Accidentally removed Apply command from SetAllColorsEffect function in ENE controller 2021-11-22 03:35:37 -06:00
Adam Honse d69848e4e5 Repeat XPG SSD reads on Windows if they fail 2021-11-22 03:31:35 -06:00
Adam Honse 2c57607baf Add missing ENE channel name case for DRAM LEDs 2021-11-22 03:02:31 -06:00
Adam Honse 41f75d958c Add XPG Spectrix S40G ENE interface for Windows 2021-11-22 01:53:13 -06:00
Adam Honse af43171066 Add NVMe path to XPG Spectrix S40G controller 2021-11-22 00:55:35 -06:00
Adam Honse c21bc267fd Fix windows stupidity 2021-11-22 00:26:51 -06:00
Adam Honse 1333130235 Add XPG Spectrix S40G ENE interface for Linux 2021-11-22 00:14:19 -06:00
NicolasNewman 7b63813cdb Add storage device type
Commit amended from original XPG Spectrix S40G merge request by Adam Honse <[email protected]>
2021-11-22 00:12:30 -06:00
Adam Honse 82c02b48aa Implement ENESMBusInterface to abstract away the specific I2C/SMBus interface implementation used by the ENE SMBus controller. This will allow for alternative interfaces such as NVMe controllers (XPG Spectrix S40G) and USB Mass Storage controllers (ROG Arion SSD enclosure). 2021-11-21 23:25:59 -06:00
Alex c92e1db2dc Fix Gigabyte GPU detection test to resolve #1496 2021-11-22 02:57:24 +00:00
morg aee13c45c9 Set dark theme to warning popup if needed 2021-11-22 02:56:13 +00:00
Adam Honse 408ea734f9 Update Razer PC Case Lighting Kit IPU values to match Chroma HDK 2021-11-21 20:55:12 -06:00
Triqqo 7bc32bd282 Added ASUS TUF 3090 OC 2021-11-20 11:10:59 +01:00
125 changed files with 7642 additions and 870 deletions
+106 -178
View File
@@ -32,7 +32,7 @@ before_script:
#-----------------------------------------------------------------------#
"Linux 32 AppImage":
<<: *ccache_init
image: registry.gitlab.com/openrgbdevelopers/openrgb-linux-ci-deb-builder:buster-32
image: registry.gitlab.com/openrgbdevelopers/openrgb-linux-ci-deb-builder:bullseye-32
stage: build
script:
- export $(dpkg-architecture)
@@ -51,7 +51,7 @@ before_script:
#-----------------------------------------------------------------------#
"Linux 64 AppImage":
<<: *ccache_init
image: registry.gitlab.com/openrgbdevelopers/openrgb-linux-ci-deb-builder:buster-64
image: registry.gitlab.com/openrgbdevelopers/openrgb-linux-ci-deb-builder:bullseye-64
stage: build
script:
- export $(dpkg-architecture)
@@ -66,9 +66,9 @@ before_script:
expire_in: 30 days
#-----------------------------------------------------------------------#
# Linux (.deb) 32-bit Build Target #
# Linux (.deb) Debian Buster (Legacy) 32-bit Build Target #
#-----------------------------------------------------------------------#
"Linux 32 deb":
"Linux 32 .deb (Debian Buster)":
<<: *ccache_init
image: registry.gitlab.com/openrgbdevelopers/openrgb-linux-ci-deb-builder:buster-32
stage: build
@@ -87,9 +87,9 @@ before_script:
expire_in: 30 days
#-----------------------------------------------------------------------#
# Linux (.deb) 64-bit Build Target #
# Linux (.deb) Debian Buster (Legacy) 64-bit Build Target #
#-----------------------------------------------------------------------#
"Linux 64 deb":
"Linux 64 .deb (Debian Buster)":
<<: *ccache_init
image: registry.gitlab.com/openrgbdevelopers/openrgb-linux-ci-deb-builder:buster-64
stage: build
@@ -107,6 +107,48 @@ before_script:
- openrgb-dbgsym*.deb
expire_in: 30 days
#-----------------------------------------------------------------------#
# Linux (.deb) Debian Bullseye 32-bit Build Target #
#-----------------------------------------------------------------------#
"Linux 32 .deb (Debian Bullseye)":
<<: *ccache_init
image: registry.gitlab.com/openrgbdevelopers/openrgb-linux-ci-deb-builder:bullseye-32
stage: build
script:
- dpkg-architecture -l
- dpkg-buildpackage --target-arch i386 -us -B
- rm -v ../openrgb-dbgsym*.deb
- mv -v ../openrgb*.deb ./
artifacts:
name: "${CI_PROJECT_NAME}_Linux_32_deb_${CI_COMMIT_SHORT_SHA}"
paths:
- openrgb*.deb
exclude:
- openrgb-dbgsym*.deb
expire_in: 30 days
#-----------------------------------------------------------------------#
# Linux (.deb) Debian Bullseye 64-bit Build Target #
#-----------------------------------------------------------------------#
"Linux 64 .deb (Debian Bullseye)":
<<: *ccache_init
image: registry.gitlab.com/openrgbdevelopers/openrgb-linux-ci-deb-builder:bullseye-64
stage: build
script:
- dpkg-architecture -l
- dpkg-buildpackage -us -B
- rm -v ../openrgb-dbgsym*.deb
- mv -v ../openrgb*.deb ./
artifacts:
name: "${CI_PROJECT_NAME}_Linux_64_deb_${CI_COMMIT_SHORT_SHA}"
paths:
- openrgb*.deb
exclude:
- openrgb-dbgsym*.deb
expire_in: 30 days
#-----------------------------------------------------------------------#
# Linux (.rpm) 64-bit Build Target #
#-----------------------------------------------------------------------#
@@ -133,52 +175,6 @@ before_script:
paths:
- openrgb*.rpm
expire_in: 30 days
#-----------------------------------------------------------------------#
# Linux (.deb) Debian Bullseye 32-bit Build Target #
#-----------------------------------------------------------------------#
"Linux 32 deb Bullseye":
<<: *ccache_init
image: i386/debian:bullseye
stage: build
script:
- apt update
- apt install -y build-essential qtcreator qtbase5-dev libusb-1.0-0-dev libhidapi-dev libmbedtls-dev pkgconf wget git file debhelper
- dpkg-architecture -l
- dpkg-buildpackage --target-arch i386 -us -B
- rm -v ../openrgb-dbgsym*.deb
- mv -v ../openrgb*.deb ./
artifacts:
name: "${CI_PROJECT_NAME}_Linux_32_deb_${CI_COMMIT_SHORT_SHA}"
paths:
- openrgb*.deb
exclude:
- openrgb-dbgsym*.deb
expire_in: 30 days
#-----------------------------------------------------------------------#
# Linux (.deb) Debian Bullseye 64-bit Build Target #
#-----------------------------------------------------------------------#
"Linux 64 deb Bullseye":
<<: *ccache_init
image: debian:bullseye
stage: build
script:
- apt update
- apt install -y build-essential qtcreator qtbase5-dev libusb-1.0-0-dev libhidapi-dev libmbedtls-dev pkgconf wget git file debhelper
- dpkg-architecture -l
- dpkg-buildpackage -us -B
- rm -v ../openrgb-dbgsym*.deb
- mv -v ../openrgb*.deb ./
artifacts:
name: "${CI_PROJECT_NAME}_Linux_64_deb_${CI_COMMIT_SHORT_SHA}"
paths:
- openrgb*.deb
exclude:
- openrgb-dbgsym*.deb
expire_in: 30 days
#-----------------------------------------------------------------------#
# Debian 32 Buster test #
@@ -193,9 +189,26 @@ before_script:
- openrgb -l
- apt remove -y openrgb
dependencies:
- "Linux 32 deb"
- "Linux 32 .deb (Debian Buster)"
needs:
- "Linux 32 deb"
- "Linux 32 .deb (Debian Buster)"
#-----------------------------------------------------------------------#
# Debian 64 Buster test #
#-----------------------------------------------------------------------#
"Debian 64 Buster":
image: amd64/debian:buster
stage: test
script:
- apt update
- DEBIAN_FRONTEND=noninteractive apt install -yq --no-install-recommends ./openrgb*amd64.deb
- openrgb --version
- openrgb -l
- apt remove -y openrgb
dependencies:
- "Linux 64 .deb (Debian Buster)"
needs:
- "Linux 64 .deb (Debian Buster)"
#-----------------------------------------------------------------------#
# Debian 32 Bullseye test #
@@ -210,66 +223,15 @@ before_script:
- openrgb -l
- apt remove -y openrgb
dependencies:
- "Linux 32 deb"
- "Linux 32 .deb (Debian Bullseye)"
needs:
- "Linux 32 deb"
# #-----------------------------------------------------------------------#
# # Ubuntu 32 18.04LTS test #
# #-----------------------------------------------------------------------#
# "Ubuntu 32 18.04LTS":
# image: i386/ubuntu:bionic
# stage: test
# script:
# - apt update
# - DEBIAN_FRONTEND=noninteractive apt install -yq --no-install-recommends ./openrgb*i386.deb
# - openrgb --version
# - openrgb -l
# - apt remove -y openrgb
# dependencies:
# - "Linux 32 deb"
# needs:
# - "Linux 32 deb"
# #-----------------------------------------------------------------------#
# # Mint 32 19.3 test #
# #-----------------------------------------------------------------------#
# "Mint 32 20.1":
# image: linuxmintd/mint19.3-i386
# stage: test
# script:
# - apt update
# - DEBIAN_FRONTEND=noninteractive apt install -yq --no-install-recommends ./openrgb*i386.deb
# - openrgb --version
# - openrgb -l
# - apt remove -y openrgb
# dependencies:
# - "Linux 32 deb"
# needs:
# - "Linux 32 deb"
#-----------------------------------------------------------------------#
# Debian 64 Buster test #
#-----------------------------------------------------------------------#
"Debian 64 Buster":
image: debian:buster
stage: test
script:
- apt update
- DEBIAN_FRONTEND=noninteractive apt install -yq --no-install-recommends ./openrgb*amd64.deb
- openrgb --version
- openrgb -l
- apt remove -y openrgb
dependencies:
- "Linux 64 deb"
needs:
- "Linux 64 deb"
- "Linux 32 .deb (Debian Bullseye)"
#-----------------------------------------------------------------------#
# Debian 64 Bullseye test #
#-----------------------------------------------------------------------#
"Debian 64 Bullseye":
image: debian:bullseye
image: amd64/debian:bullseye
stage: test
script:
- apt update
@@ -278,9 +240,43 @@ before_script:
- openrgb -l
- apt remove -y openrgb
dependencies:
- "Linux 64 deb"
- "Linux 64 .deb (Debian Bullseye)"
needs:
- "Linux 64 deb"
- "Linux 64 .deb (Debian Bullseye)"
#-----------------------------------------------------------------------#
# Ubuntu 64 20.04LTS test #
#-----------------------------------------------------------------------#
"Ubuntu 64 20.04LTS":
image: ubuntu:focal
stage: test
script:
- apt update
- DEBIAN_FRONTEND=noninteractive apt install -yq --no-install-recommends ./openrgb*amd64.deb
- openrgb --version
- openrgb -l
- apt remove -y openrgb
dependencies:
- "Linux 64 .deb (Debian Buster)"
needs:
- "Linux 64 .deb (Debian Buster)"
#-----------------------------------------------------------------------#
# Ubuntu 64 21.10 test #
#-----------------------------------------------------------------------#
"Ubuntu 64 21.10":
image: ubuntu:impish
stage: test
script:
- apt update
- DEBIAN_FRONTEND=noninteractive apt install -yq --no-install-recommends ./openrgb*amd64.deb
- openrgb --version
- openrgb -l
- apt remove -y openrgb
dependencies:
- "Linux 64 .deb (Debian Bullseye)"
needs:
- "Linux 64 .deb (Debian Bullseye)"
#-----------------------------------------------------------------------#
# Fedora 64 v34 test #
@@ -298,74 +294,6 @@ before_script:
needs:
- "Linux 64 rpm"
# #-----------------------------------------------------------------------#
# # Ubuntu 64 18.04LTS test #
# #-----------------------------------------------------------------------#
# "Ubuntu 64 18.04LTS":
# image: ubuntu:bionic
# stage: test
# script:
# - apt update
# - DEBIAN_FRONTEND=noninteractive apt install -yq --no-install-recommends ./openrgb*amd64.deb
# - openrgb --version
# - openrgb -l
# - apt remove -y openrgb
# dependencies:
# - "Linux 64 deb"
# needs:
# - "Linux 64 deb"
#-----------------------------------------------------------------------#
# Ubuntu 64 20.04LTS test #
#-----------------------------------------------------------------------#
"Ubuntu 64 20.04LTS":
image: ubuntu:focal
stage: test
script:
- apt update
- DEBIAN_FRONTEND=noninteractive apt install -yq --no-install-recommends ./openrgb*amd64.deb
- openrgb --version
- openrgb -l
- apt remove -y openrgb
dependencies:
- "Linux 64 deb"
needs:
- "Linux 64 deb"
#-----------------------------------------------------------------------#
# Ubuntu 64 20.10 test #
#-----------------------------------------------------------------------#
"Ubuntu 64 20.10":
image: ubuntu:groovy
stage: test
script:
- apt update
- DEBIAN_FRONTEND=noninteractive apt install -yq --no-install-recommends ./openrgb*amd64.deb
- openrgb --version
- openrgb -l
- apt remove -y openrgb
dependencies:
- "Linux 64 deb"
needs:
- "Linux 64 deb"
#-----------------------------------------------------------------------#
# Mint 64 20.1 test #
#-----------------------------------------------------------------------#
"Mint 64 20.1":
image: linuxmintd/mint20.1-amd64
stage: test
script:
- apt update
- DEBIAN_FRONTEND=noninteractive apt install -yq --no-install-recommends ./openrgb*amd64.deb
- openrgb --version
- openrgb -l
- apt remove -y openrgb
dependencies:
- "Linux 64 deb"
needs:
- "Linux 64 deb"
#-----------------------------------------------------------------------#
# Windows (32-bit) Build Target #
#-----------------------------------------------------------------------#
+31 -17
View File
@@ -117,6 +117,7 @@ ACTION=="add", SUBSYSTEM=="platform", KERNEL=="faustus", RUN+="/bin/chmod a+w /s
SUBSYSTEMS=="usb", ATTR{idVendor}=="2516", ATTR{idProduct}=="0101", TAG+="uaccess", TAG+="MM711"
SUBSYSTEMS=="usb", ATTR{idVendor}=="2516", ATTR{idProduct}=="0141", TAG+="uaccess", TAG+="MM720"
SUBSYSTEMS=="usb", ATTR{idVendor}=="2516", ATTR{idProduct}=="0109", TAG+="uaccess", TAG+="MP750_XL"
SUBSYSTEMS=="usb", ATTR{idVendor}=="2516", ATTR{idProduct}=="0107", TAG+="uaccess", TAG+="MP750_L"
SUBSYSTEMS=="usb", ATTR{idVendor}=="2516", ATTR{idProduct}=="0105", TAG+="uaccess", TAG+="MP750_M"
SUBSYSTEMS=="usb", ATTR{idVendor}=="2516", ATTR{idProduct}=="1011", TAG+="uaccess", TAG+="ARGB"
SUBSYSTEMS=="usb", ATTR{idVendor}=="2516", ATTR{idProduct}=="1000", TAG+="uaccess", TAG+="Small_ARGB"
@@ -235,6 +236,8 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b34", TAG+="uacces
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b74", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b3c", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b75", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b5d", TAG+="uaccess", TAG+="Ironclaw"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b12", TAG+="uaccess", TAG+="M65"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b2e", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b5a", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b3e", TAG+="uaccess"
@@ -351,6 +354,7 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="0cf2", ATTR{idProduct}=="7750", TAG+="uacces
# Logitech G813 #
# Logitech G815 #
# Logitech G915 #
# Logitech G Pro #
# #
# Mice: #
# Logitech G203 Prodigy #
@@ -382,15 +386,16 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="0cf2", ATTR{idProduct}=="7750", TAG+="uacces
# Logitech Rhino X56 Hotas (Throttle and Stick) #
# #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c336", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c342", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c33c", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c333", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c338", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c331", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c337", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c232", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c33f", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c336", TAG+="uaccess", TAG+="G213"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c342", TAG+="uaccess", TAG+="G512"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c33c", TAG+="uaccess", TAG+="G512_RGB"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c333", TAG+="uaccess", TAG+="G610"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c338", TAG+="uaccess", TAG+="G610"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c331", TAG+="uaccess", TAG+="G810"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c337", TAG+="uaccess", TAG+="G810"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c339", TAG+="uaccess", TAG+="G_Pro"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c232", TAG+="uaccess", TAG+="G813"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c33f", TAG+="uaccess", TAG+="G815"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c335", TAG+="uaccess", TAG+="G910"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c541", TAG+="uaccess", TAG+="G915_Receiver"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c33e", TAG+="uaccess", TAG+="G915_Wired"
@@ -409,10 +414,12 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c087", TAG+="uacces
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="4070", TAG+="uaccess", TAG+="G703_Virtual"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c090", TAG+="uaccess", TAG+="G703_Hero"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="4086", TAG+="uaccess", TAG+="G703_Hero_Virtual"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c081", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="4053", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c086", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="4067", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c081", TAG+="uaccess", TAG+="G900_wired"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="4053", TAG+="uaccess", TAG+="G900_wireless"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c086", TAG+="uaccess", TAG+="G903_wired"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c091", TAG+="uaccess", TAG+="G903_V2_wired"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="4067", TAG+="uaccess", TAG+="G903_wireless"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="4087", TAG+="uaccess", TAG+="G903_V2_wireless"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c539", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c085", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c08c", TAG+="uaccess"
@@ -441,6 +448,7 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="24f0", ATTR{idProduct}=="2020", TAG+="uacces
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="3ea4", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="4459", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="1720", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7b10", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7b12", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7b17", TAG+="uaccess"
@@ -536,6 +544,8 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="025a", TAG+="uacces
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="025b", TAG+="uaccess", TAG+="Blackwidow_V3_Pro-Bluetooth"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="025c", TAG+="uaccess", TAG+="Blackwidow_V3_Pro-Wireless"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0a24", TAG+="uaccess", TAG+="Blackwidow_V3_TKL"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0258", TAG+="uaccess", TAG+="Blackwidow_V3_Mini-Wired"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0271", TAG+="uaccess", TAG+="Blackwidow_V3_Mini-Wireless"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0216", TAG+="uaccess", TAG+="Blackwidow_X Chroma"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="021a", TAG+="uaccess", TAG+="Blackwidow_X_Chroma_TE"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="020f", TAG+="uaccess"
@@ -572,7 +582,9 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0226", TAG+="uacces
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0227", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0257", TAG+="uaccess", TAG+="Huntsman_Mini"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0243", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="026B", TAG+="uaccess", TAG+="Huntsman_V2_TKL"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0207", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0266", TAG+="uaccess", TAG+="Huntsman V2 Analog"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="021e", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="025d", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0208", TAG+="uaccess"
@@ -626,8 +638,9 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="003f", TAG+="uacces
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="003e", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0041", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0036", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0050", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0067", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0050", TAG+="uaccess", TAG+="Naga_Hex_V2"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="008d", TAG+="uaccess", TAG+="Naga_Left_Handed"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0067", TAG+="uaccess", TAG+="Naga_Trinity"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0013", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0039", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0048", TAG+="uaccess"
@@ -669,8 +682,9 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0f1b", TAG+="uacces
#---------------------------------------------------------------#
# Roccat Devices #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="1e7d", ATTR{idProduct}=="2e2c", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1e7d", ATTR{idProduct}=="2e27", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1e7d", ATTR{idProduct}=="2e27", TAG+="uaccess", TAG+="Roccat_Kone_Aimo"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1e7d", ATTR{idProduct}=="2e2c", TAG+="uaccess", TAG+="Roccat_Kone_Aimo_16K"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1e7d", ATTR{idProduct}=="3098", TAG+="uaccess", TAG+="Roccat_Vulcan_120_Aimo"
#---------------------------------------------------------------#
# Redragon Peripheral Devices #
@@ -35,6 +35,7 @@ typedef struct
static const gpu_pci_device device_list[] =
{
{ NVIDIA_VEN, NVIDIA_GTX1050_DEV, ASUS_SUB_VEN, ASUS_GTX1050_STRIX_O2G_GAMING, 0x29, "ASUS ROG Strix GTX 1050 O2G Gaming" },
{ NVIDIA_VEN, NVIDIA_GTX1050TI_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_GTX1050TI_O4G_GAMING, 0x29, "ASUS ROG Strix GTX 1050 TI O4G Gaming" },
{ NVIDIA_VEN, NVIDIA_GTX1060_DEV, ASUS_SUB_VEN, ASUS_GTX1060_STRIX_6G_GAMING, 0x29, "ASUS GTX 1060 Strix 6G Gaming" },
{ NVIDIA_VEN, NVIDIA_GTX1060_DEV, ASUS_SUB_VEN, ASUS_GTX1060_STRIX, 0x29, "ASUS GTX 1060 Strix" },
{ NVIDIA_VEN, NVIDIA_GTX1070_DEV, ASUS_SUB_VEN, ASUS_GTX1070_STRIX_GAMING, 0x29, "ASUS GTX 1070 Strix Gaming" },
@@ -55,11 +56,13 @@ static const gpu_pci_device device_list[] =
{ NVIDIA_VEN, NVIDIA_RTX2060S_OC_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX2060S_O8G_GAMING, 0x2A, "ASUS ROG STRIX RTX 2060S O8G Gaming 8G" },
{ NVIDIA_VEN, NVIDIA_RTX2070_OC_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX2070_A8G_GAMING, 0x2A, "ASUS ROG STRIX RTX 2070 A8G Gaming 8G" },
{ NVIDIA_VEN, NVIDIA_RTX2070_OC_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX2070_O8G_GAMING, 0x2A, "ASUS ROG STRIX RTX 2070 O8G Gaming 8G" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX2070S_A8G_GAMING, 0x2A, "ASUS ROG STRIX RTX 2070S A8G Gaming 8G" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX2070S_A8G_GAMING_8706, 0x2A, "ASUS ROG STRIX RTX 2070S A8G Gaming 8G" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX2070S_O8G_GAMING, 0x2A, "ASUS ROG STRIX RTX 2070S O8G Gaming 8G" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX2070S_A8G_GAMING_86FF, 0x2A, "ASUS ROG STRIX RTX 2070S A8G Gaming 8G" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_OC_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX2070S_A8G_GAMING, 0x2A, "ASUS ROG STRIX RTX 2070S A8G Gaming 8G" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_OC_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX2070S_A8G_GAMING_8706, 0x2A, "ASUS ROG STRIX RTX 2070S A8G Gaming 8G" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_OC_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX2070S_O8G_GAMING, 0x2A, "ASUS ROG STRIX RTX 2070S O8G Gaming 8G" },
{ NVIDIA_VEN, NVIDIA_RTX2080_A_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX2080_O8G_GAMING, 0x2A, "ASUS ROG STRIX RTX 2080 O8G Gaming" },
{ NVIDIA_VEN, NVIDIA_RTX2080S_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX2080S_O8G_GAMING, 0x2A, "ASUS ROG STRIX RTX 2080S O8G Gaming" },
{ NVIDIA_VEN, NVIDIA_RTX2080TI_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX2080TI_11G_GAMING, 0x2A, "ASUS ROG STRIX RTX 2080 Ti 11G Gaming" },
{ NVIDIA_VEN, NVIDIA_RTX2080TI_A_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX2080TI_O11G_GAMING, 0x2A, "ASUS ROG STRIX RTX 2080 Ti O11G Gaming" },
{ AMD_GPU_VEN, AMD_VEGA10_DEV, ASUS_SUB_VEN, ASUS_VEGA64_STRIX, 0x29, "ASUS Vega 64 Strix" },
{ AMD_GPU_VEN, AMD_NAVI10_DEV, ASUS_SUB_VEN, ASUS_RX5600XT_STRIX_O6G_GAMING, 0x2A, "ASUS RX 5600XT Strix O6G Gaming" },
@@ -118,6 +121,7 @@ void DetectAsusAuraGPUControllers(std::vector<i2c_smbus_interface*> &busses)
busses[bus]->pci_subsystem_vendor == device_list[dev_idx].pci_subsystem_vendor &&
busses[bus]->pci_subsystem_device == device_list[dev_idx].pci_subsystem_device)
{
LOG_DEBUG(GPU_DETECT_MESSAGE, ASUSGPU_CONTROLLER_NAME, bus, device_list[dev_idx].pci_device, device_list[dev_idx].pci_subsystem_device, device_list[dev_idx].name );
if (TestForAsusAuraGPUController(busses[bus], device_list[dev_idx].controller_address))
{
new_aura_gpu = new AuraGPUController(busses[bus], device_list[dev_idx].controller_address);
@@ -46,14 +46,14 @@ std::string AuraMouseController::GetSerialString()
std::string AuraMouseController::GetVersion(bool wireless, int protocol)
{
unsigned char usb_buf[65];
unsigned char usb_buf[ASUS_AURA_MOUSE_PACKET_SIZE];
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0x12;
hid_write(dev, usb_buf, 65);
hid_write(dev, usb_buf, ASUS_AURA_MOUSE_PACKET_SIZE);
unsigned char usb_buf_out[65];
hid_read(dev, usb_buf_out, 65);
unsigned char usb_buf_out[ASUS_AURA_MOUSE_PACKET_SIZE];
hid_read(dev, usb_buf_out, ASUS_AURA_MOUSE_PACKET_SIZE);
std::string str;
@@ -107,6 +107,14 @@ void AuraMouseController::SendUpdate
unsigned char brightness
)
{
int bytes_read = 1;
unsigned char usb_buf_flush[ASUS_AURA_MOUSE_PACKET_SIZE];
while(bytes_read > 0)
{
bytes_read = hid_read_timeout(dev, usb_buf_flush, ASUS_AURA_MOUSE_PACKET_SIZE, 0);
}
unsigned char usb_buf[ASUS_AURA_MOUSE_PACKET_SIZE];
/*-----------------------------------------------------*\
@@ -127,6 +135,7 @@ void AuraMouseController::SendUpdate
usb_buf[0x07] = red;
usb_buf[0x08] = grn;
usb_buf[0x09] = blu;
if (device_pid == AURA_ROG_GLADIUS_II_ORIGIN_PNK_LTD_PID)
{
usb_buf[0x0A] = 0;
@@ -147,4 +156,7 @@ void AuraMouseController::SendUpdate
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, ASUS_AURA_MOUSE_PACKET_SIZE);
unsigned char usb_buf_out[ASUS_AURA_MOUSE_PACKET_SIZE];
hid_read(dev, usb_buf_out, ASUS_AURA_MOUSE_PACKET_SIZE);
}
@@ -20,13 +20,13 @@
#define AURA_ROG_GLADIUS_II_WIRELESS_2_PID 0x18A0
#define AURA_ROG_CHAKRAM_WIRELESS_PID 0x18E5
#define AURA_ROG_CHAKRAM_WIRED_1_PID 0x18E3
#define AURA_ROG_CHAKRAM_WIRED_2_PID 0x1958
#define AURA_ROG_CHAKRAM_CORE_PID 0x1958
#define AURA_ROG_PUGIO_PID 0x1846
#define AURA_ROG_PUGIO_II_WIRED_PID 0x1906
#define AURA_ROG_PUGIO_II_WIRELESS_PID 0x1908
#define AURA_ROG_STRIX_IMPACT_II_PID 0x18E1
#define AURA_TUF_M3_PID 0x1910
#define AURA_TUF_M5_PID 0x1910
#define AURA_TUF_M5_PID 0x1898
enum
{
@@ -168,14 +168,14 @@ static std::map<int,mouse_type> aura_mouse_devices =
}
},
{
AURA_ROG_CHAKRAM_WIRED_2_PID, // ROG Chakram Wired 2
AURA_ROG_CHAKRAM_CORE_PID, // ROG Chakram Core
{
15,
1,
0,
0,
false,
1,
{ AURA_MOUSE_ZONE_LOGO, AURA_MOUSE_ZONE_SCROLL, AURA_MOUSE_ZONE_UNDERGLOW },
{ AURA_MOUSE_MODE_STATIC, AURA_MOUSE_MODE_BREATHING, AURA_MOUSE_MODE_SPECTRUM, AURA_MOUSE_MODE_WAVE, AURA_MOUSE_MODE_REACTIVE, AURA_MOUSE_MODE_COMET, AURA_MOUSE_MODE_BATTERY }
{ AURA_MOUSE_ZONE_LOGO, AURA_MOUSE_ZONE_SCROLL },
{ AURA_MOUSE_MODE_STATIC, AURA_MOUSE_MODE_BREATHING, AURA_MOUSE_MODE_SPECTRUM, AURA_MOUSE_MODE_REACTIVE }
}
},
{
@@ -0,0 +1,146 @@
/*-----------------------------------------*\
| AsusAuraStrixEvolveController.cpp |
| |
| Driver for ASUS Aura RGB USB |
| lighting controller |
| |
| Mola19 11/30/2021 |
\*-----------------------------------------*/
#include "AsusAuraStrixEvolveController.h"
#include <cstring>
#include <chrono>
#include <thread>
AuraStrixEvolveController::AuraStrixEvolveController(hid_device* dev_handle, const char* path, uint16_t pid)
{
dev = dev_handle;
location = path;
device_pid = pid;
}
AuraStrixEvolveController::~AuraStrixEvolveController()
{
hid_close(dev);
}
std::string AuraStrixEvolveController::GetDeviceLocation()
{
return("HID: " + location);
}
std::string AuraStrixEvolveController::GetSerialString()
{
wchar_t serial_string[HID_MAX_STR];
int ret = hid_get_serial_number_string(dev, serial_string, HID_MAX_STR);
if(ret != 0)
{
return("");
}
std::wstring return_wstring = serial_string;
std::string return_string(return_wstring.begin(), return_wstring.end());
return(return_string);
}
std::string AuraStrixEvolveController::GetVersion()
{
unsigned char usb_buf[9] = { 0x0c, 0xc4, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
hid_send_feature_report(dev, usb_buf, 9);
unsigned char usb_buf_out[9] = { 0x0c };
hid_get_feature_report(dev, usb_buf_out, 9);
return std::string("1." + std::to_string(usb_buf_out[3]));
}
int AuraStrixEvolveController::GetActiveProfile()
{
int profile;
do
{
unsigned char usb_buf[9] = { 0x0c, 0xdf, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
hid_send_feature_report(dev, usb_buf, 9);
unsigned char usb_buf_out[9] = { 0x0c };
hid_get_feature_report(dev, usb_buf_out, 9);
profile = usb_buf_out[4] % 16;
} while (profile > 2);
return profile + 1;
}
void AuraStrixEvolveController::SendUpdate
(
unsigned char key,
unsigned char value
)
{
unsigned char usb_buf[9];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, 9);
/*-----------------------------------------------------*\
| Set up message packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x0c;
usb_buf[0x01] = 0xc4;
usb_buf[0x02] = 0x0f;
usb_buf[0x03] = 0x00;
usb_buf[0x04] = key;
usb_buf[0x05] = value;
hid_send_feature_report(dev, usb_buf, 9);
}
void AuraStrixEvolveController::UpdateProfile
(
unsigned char key,
unsigned char profile,
unsigned char value
)
{
unsigned char usb_buf[9];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, 9);
/*-----------------------------------------------------*\
| Set up message packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x0c;
usb_buf[0x01] = 0xde;
usb_buf[0x02] = key;
usb_buf[0x03] = profile;
usb_buf[0x04] = value;
hid_send_feature_report(dev, usb_buf, 9);
std::this_thread::sleep_for(std::chrono::milliseconds(5));
}
void AuraStrixEvolveController::SendSavePacket()
{
unsigned char usb_buf[9];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, 9);
/*-----------------------------------------------------*\
| Set up message packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x0c;
usb_buf[0x01] = 0xc4;
hid_send_feature_report(dev, usb_buf, 9);
}
@@ -0,0 +1,50 @@
/*-----------------------------------------*\
| AsusAuraStrixEvolveController.h |
| |
| Definitions and types for ASUS Aura |
| USB RGB lighting controller |
| |
| Mola19 11/30/2021 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
#define HID_MAX_STR 255
class AuraStrixEvolveController
{
public:
AuraStrixEvolveController(hid_device* dev_handle, const char* path, uint16_t pid);
virtual ~AuraStrixEvolveController();
std::string GetDeviceLocation();
std::string GetSerialString();
std::string GetVersion();
int GetActiveProfile();
void SendUpdate
(
unsigned char key,
unsigned char value
);
void UpdateProfile
(
unsigned char key,
unsigned char profile,
unsigned char value
);
void SendSavePacket();
uint16_t device_pid;
private:
hid_device* dev;
std::string location;
};
@@ -15,7 +15,7 @@
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <cmath>
AuraTUFKeyboardController::AuraTUFKeyboardController(hid_device* dev_handle, const char* path)
{
@@ -36,7 +36,12 @@ std::string AuraTUFKeyboardController::GetDeviceLocation()
std::string AuraTUFKeyboardController::GetSerialString()
{
wchar_t serial_string[128];
hid_get_serial_number_string(dev, serial_string, 128);
int ret = hid_get_serial_number_string(dev, serial_string, 128);
if(ret != 0)
{
return("");
}
std::wstring return_wstring = serial_string;
std::string return_string(return_wstring.begin(), return_wstring.end());
@@ -44,6 +49,53 @@ std::string AuraTUFKeyboardController::GetSerialString()
return(return_string);
}
std::string AuraTUFKeyboardController::GetVersion()
{
unsigned char usb_buf[65];
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0x12;
usb_buf[0x02] = 0x00;
hid_write(dev, usb_buf, 65);
unsigned char usb_buf_out[65];
hid_read(dev, usb_buf_out, 65);
char version[9];
snprintf(version, 9, "%02X.%02X.%02X", usb_buf_out[5], usb_buf_out[6], usb_buf_out[7]);
return std::string(version);
}
int AuraTUFKeyboardController::GetLayout()
{
unsigned char usb_buf[65];
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0x12;
usb_buf[0x02] = 0x12;
hid_write(dev, usb_buf, 65);
unsigned char usb_buf_out[65];
hid_read(dev, usb_buf_out, 65);
return(usb_buf_out[4] * 100 + usb_buf_out[5]);
}
void AuraTUFKeyboardController::SaveMode()
{
unsigned char usb_save_buf[65];
memset(usb_save_buf, 0x00, sizeof(usb_save_buf));
usb_save_buf[0x00] = 0x00;
usb_save_buf[0x01] = 0x50;
usb_save_buf[0x02] = 0x55;
hid_write(dev, usb_save_buf, 65);
}
void AuraTUFKeyboardController::UpdateSingleLed
(
int led,
@@ -141,7 +193,8 @@ void AuraTUFKeyboardController::UpdateDevice
std::vector<RGBColor> colors,
unsigned char dir,
unsigned char color_mode,
unsigned char speed
unsigned char speed,
unsigned char brightness
)
{
unsigned char usb_buf[65];
@@ -154,21 +207,21 @@ void AuraTUFKeyboardController::UpdateDevice
usb_buf[0x03] = mode;
usb_buf[0x04] = 0x00;
usb_buf[0x05] = speed;
usb_buf[0x06] = 0x64;
usb_buf[0x06] = brightness;
usb_buf[0x07] = color_mode;
usb_buf[0x08] = dir;
usb_buf[0x09] = 0x02;
if(mode == 4 || mode == 5)
{
/*-----------------------------------------------------*\
if(mode == 4 || mode == 5)
{
/*-----------------------------------------------------*\
| If mode is Rainbow or Ripple |
\*-----------------------------------------------------*/
usb_buf[0x0A] = colors.size();
\*-----------------------------------------------------*/
usb_buf[0x0A] = colors.size();
/*-----------------------------------------------------*\
| Loop over every color given |
\*-----------------------------------------------------*/
/*-----------------------------------------------------*\
| Loop over every color given |
\*-----------------------------------------------------*/
for(unsigned int i = 0; i / 4 < colors.size(); i += 4)
{
if(colors[i / 4])
@@ -179,13 +232,13 @@ void AuraTUFKeyboardController::UpdateDevice
usb_buf[14 + i] = RGBGetBValue(colors[i/4]);
}
}
}
}
else
{
/*-----------------------------------------------------*\
| Loop over Color1, Color2 and Background if there |
\*-----------------------------------------------------*/
for(unsigned int i = 0; i / 3 != colors.size(); i += 3)
/*-----------------------------------------------------*\
| Loop over Color1, Color2 and Background if there |
\*-----------------------------------------------------*/
for(unsigned int i = 0; i / 3 != colors.size(); i += 3)
{
if(colors[i / 3])
{
@@ -194,25 +247,28 @@ void AuraTUFKeyboardController::UpdateDevice
usb_buf[12 + i] = RGBGetBValue(colors[i/3]);
}
}
}
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
}
/*-----------------------------------------------------*\
| Set up and send packet save Packet |
\*-----------------------------------------------------*/
unsigned char usb_save_buf[65];
void AuraTUFKeyboardController::AwaitResponse()
{
unsigned char usb_buf_out[65];
hid_read(dev, usb_buf_out, 65);
}
memset(usb_save_buf, 0x00, sizeof(usb_save_buf));
usb_save_buf[0x00] = 0x00;
usb_save_buf[0x01] = 0x50;
usb_save_buf[0x02] = 0x55;
hid_write(dev, usb_save_buf, 65);
void AuraTUFKeyboardController::ClearResponses()
{
int result = 1;
unsigned char usb_buf_flush[65];
while(result > 0)
{
result = hid_read_timeout(dev, usb_buf_flush, 65, 0);
}
}
@@ -8,6 +8,7 @@
\*-----------------------------------------*/
#include "RGBController.h"
#include "AsusAuraTUFKeyboardLayouts.h"
#include <string>
#include <vector>
@@ -46,6 +47,9 @@ public:
std::string GetDeviceLocation();
std::string GetSerialString();
std::string GetVersion();
int GetLayout();
void SaveMode();
void UpdateSingleLed
(
@@ -55,7 +59,7 @@ public:
unsigned char blue
);
void UpdateLeds
void UpdateLeds
(
std::vector<RGBColor> colors
);
@@ -66,8 +70,11 @@ public:
std::vector<RGBColor> colors,
unsigned char dir,
unsigned char color_mode,
unsigned char speed
unsigned char speed,
unsigned char brightness
);
void AwaitResponse();
void ClearResponses();
private:
hid_device* dev;
@@ -0,0 +1,411 @@
/*-----------------------------------------*\
| AsusAuraTUFKeyboardController.h |
| |
| Definitions and types for ASUS Aura |
| USB RGB lighting controller |
| |
| Mola19 10/02/2021 |
\*-----------------------------------------*/
#include <vector>
#include <map>
#include "RGBController.h"
#pragma once
enum
{
ASUS_TUF_K7_LAYOUT_CA = 1,
ASUS_TUF_K7_LAYOUT_AR = 2,
ASUS_TUF_K7_LAYOUT_DE = 3,
ASUS_TUF_K7_LAYOUT_UK = 4,
ASUS_TUF_K7_LAYOUT_FR = 5,
ASUS_TUF_K7_LAYOUT_CN = 6,
ASUS_TUF_K7_LAYOUT_HU = 7,
ASUS_TUF_K7_LAYOUT_IT = 8,
ASUS_TUF_K7_LAYOUT_TH = 9,
ASUS_TUF_K7_LAYOUT_UA = 10,
ASUS_TUF_K7_LAYOUT_NO = 11,
ASUS_TUF_K7_LAYOUT_PT = 12,
ASUS_TUF_K7_LAYOUT_HE = 13,
ASUS_TUF_K7_LAYOUT_RU = 14,
ASUS_TUF_K7_LAYOUT_ES = 15,
ASUS_TUF_K7_LAYOUT_TW = 16,
ASUS_TUF_K7_LAYOUT_US = 17,
ASUS_TUF_K7_LAYOUT_TR = 18,
ASUS_TUF_K7_LAYOUT_CZ = 19,
ASUS_TUF_K7_LAYOUT_BE = 20,
ASUS_TUF_K7_LAYOUT_JP = 21,
ASUS_TUF_K7_LAYOUT_KR = 22,
ASUS_TUF_K7_LAYOUT_IS = 23,
ASUS_TUF_K7_LAYOUT_WB = 24,
ASUS_TUF_K7_LAYOUT_SW_CH = 25
};
#define NA 0xFFFFFFFF
typedef struct
{
unsigned int * matrix_map;
std::vector<std::string> led_names;
} layout_type;
static unsigned int ASUS_TUF_K7_LAYOUT_KEYS_104[6][23] = {
{ 0, NA, 18, 24, 30, 36, NA, 48, 54, 60, 66, 72, 78, 84, 90, NA, 96, 102, 108, NA, NA, NA, NA },
{ 1, 13, 19, 25, 31, 37, 43, 49, 55, 61, 67, 73, 79, 91, NA, NA, 97, 103, 109, 115, 121, 127, 133 },
{ 2, NA, 14, 20, 26, 32, 38, 44, 50, 56, 62, 68, 74, 80, 92, NA, 98, 104, 110, 116, 122, 128, 134 },
{ 3, NA, 15, 21, 27, 33, 39, 45, 51, 57, 63, 69, 75, NA, 93, NA, NA, NA, NA, 117, 123, 129, NA },
{ 4, NA, 16, 22, 28, 34, 40, 46, 52, 58, 64, 70, NA, 94, NA, NA, NA, 106, NA, 118, 124, 130, 136 },
{ 5, 11, 17, NA, NA, NA, 41, NA, NA, NA, 59, 71, 77, NA, 95, NA, 101, 107, 113, 119, NA, 131, NA }
};
static unsigned int ASUS_TUF_K7_LAYOUT_KEYS_105[6][23] = {
{ 0, NA, 18, 24, 30, 36, NA, 48, 54, 60, 66, 72, 78, 84, 90, NA, 96, 102, 108, NA, NA, NA, NA },
{ 1, 13, 19, 25, 31, 37, 43, 49, 55, 61, 67, 73, 79, 91, NA, NA, 97, 103, 109, 115, 121, 127, 133 },
{ 2, NA, 14, 20, 26, 32, 38, 44, 50, 56, 62, 68, 74, 80, NA, NA, 98, 104, 110, 116, 122, 128, 134 },
{ 3, NA, 15, 21, 27, 33, 39, 45, 51, 57, 63, 69, 75, 81, 93, NA, NA, NA, NA, 117, 123, 129, NA },
{ 4, 10, 16, 22, 28, 34, 40, 46, 52, 58, 64, 70, NA, 94, NA, NA, NA, 106, NA, 118, 124, 130, 136 },
{ 5, 11, 17, NA, NA, NA, 41, NA, NA, NA, 59, 71, 77, NA, 95, NA, 101, 107, 113, 119, NA, 131, NA }
};
static std::map<int,layout_type> AsusTUFK7Layouts =
{
{
ASUS_TUF_K7_LAYOUT_UK,
{
(unsigned int *) ASUS_TUF_K7_LAYOUT_KEYS_105,
{
"Key: Escape",
"Key: `",
"Key: Tab",
"Key: Caps Lock",
"Key: Left Shift",
"Key: Left Control",
"Unused",
"Unused",
"Unused",
"Unused",
"Key: \\",
"Key: Left Windows",
"Unused",
"Key: 1",
"Key: Q",
"Key: A",
"Key: Z",
"Key: Left Alt",
"Key: F1",
"Key: 2",
"Key: W",
"Key: S",
"Key: X",
"Unused",
"Key: F2",
"Key: 3",
"Key: E",
"Key: D",
"Key: C",
"Unused",
"Key: F3",
"Key: 4",
"Key: R",
"Key: F",
"Key: V",
"Unused",
"Key: F4",
"Key: 5",
"Key: T",
"Key: G",
"Key: B",
"Key: Space",
"Unused",
"Key: 6",
"Key: Y",
"Key: H",
"Key: N",
"Unused",
"Key: F5",
"Key: 7",
"Key: U",
"Key: J",
"Key: M",
"Unused",
"Key: F6",
"Key: 8",
"Key: I",
"Key: K",
"Key: ,",
"Key: Right Alt",
"Key: F7",
"Key: 9",
"Key: O",
"Key: L",
"Key: .",
"Unused",
"Key: F8",
"Key: 0",
"Key: P",
"Key: ;",
"Key: /",
"Key: Right Fn",
"Key: F9",
"Key: -",
"Key: [",
"Key: '",
"Unused",
"Key: Menu",
"Key: F10",
"Key: =",
"Key: ]",
"Key: #",
"Unused",
"Unused",
"Key: F11",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Key: F12",
"Key: Backspace",
"Unused",
"Key: Enter",
"Key: Right Shift",
"Key: Right Control",
"Key: Print Screen",
"Key: Insert",
"Key: Delete",
"Unused",
"Unused",
"Key: Left Arrow",
"Key: Scroll Lock",
"Key: Home",
"Key: End",
"Unused",
"Key: Up Arrow",
"Key: Down Arrow",
"Key: Pause/Break",
"Key: Page Up",
"Key: Page Down",
"Unused",
"Unused",
"Key: Right Arrow",
"Unused",
"Key: Num Lock",
"Key: Number Pad 7",
"Key: Number Pad 4",
"Key: Number Pad 1",
"Key: Number Pad 0",
"Unused",
"Key: Number Pad /",
"Key: Number Pad 8",
"Key: Number Pad 5",
"Key: Number Pad 2",
"Unused",
"Unused",
"Key: Number Pad *",
"Key: Number Pad 9",
"Key: Number Pad 6",
"Key: Number Pad 3",
"Key: Number Pad ,",
"Unused",
"Key: Number Pad -",
"Key: Number Pad +",
"Unused",
"Key: Number Pad Enter",
"Unused",
}
}
},
{
ASUS_TUF_K7_LAYOUT_US,
{
(unsigned int *) ASUS_TUF_K7_LAYOUT_KEYS_104,
{
"Key: Escape",
"Key: `",
"Key: Tab",
"Key: Caps Lock",
"Key: Left Shift",
"Key: Left Control",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Key: Left Windows",
"Unused",
"Key: 1",
"Key: Q",
"Key: A",
"Key: Z",
"Key: Left Alt",
"Key: F1",
"Key: 2",
"Key: W",
"Key: S",
"Key: X",
"Unused",
"Key: F2",
"Key: 3",
"Key: E",
"Key: D",
"Key: C",
"Unused",
"Key: F3",
"Key: 4",
"Key: R",
"Key: F",
"Key: V",
"Unused",
"Key: F4",
"Key: 5",
"Key: T",
"Key: G",
"Key: B",
"Key: Space",
"Unused",
"Key: 6",
"Key: Y",
"Key: H",
"Key: N",
"Unused",
"Key: F5",
"Key: 7",
"Key: U",
"Key: J",
"Key: M",
"Unused",
"Key: F6",
"Key: 8",
"Key: I",
"Key: K",
"Key: ,",
"Key: Right Alt",
"Key: F7",
"Key: 9",
"Key: O",
"Key: L",
"Key: .",
"Unused",
"Key: F8",
"Key: 0",
"Key: P",
"Key: ;",
"Key: /",
"Key: Right Fn",
"Key: F9",
"Key: -",
"Key: [",
"Key: '",
"Unused",
"Key: Menu",
"Key: F10",
"Key: =",
"Key: ]",
"Unused",
"Unused",
"Unused",
"Key: F11",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Key: F12",
"Key: Backspace",
"Key: \\",
"Key: Enter",
"Key: Right Shift",
"Key: Right Control",
"Key: Print Screen",
"Key: Insert",
"Key: Delete",
"Unused",
"Unused",
"Key: Left Arrow",
"Key: Scroll Lock",
"Key: Home",
"Key: End",
"Unused",
"Key: Up Arrow",
"Key: Down Arrow",
"Key: Pause/Break",
"Key: Page Up",
"Key: Page Down",
"Unused",
"Unused",
"Key: Right Arrow",
"Unused",
"Key: Num Lock",
"Key: Number Pad 7",
"Key: Number Pad 4",
"Key: Number Pad 1",
"Key: Number Pad 0",
"Unused",
"Key: Number Pad /",
"Key: Number Pad 8",
"Key: Number Pad 5",
"Key: Number Pad 2",
"Unused",
"Unused",
"Key: Number Pad *",
"Key: Number Pad 9",
"Key: Number Pad 6",
"Key: Number Pad 3",
"Key: Number Pad ,",
"Unused",
"Key: Number Pad -",
"Key: Number Pad +",
"Unused",
"Key: Number Pad Enter",
"Unused",
}
}
},
};
@@ -100,9 +100,8 @@ void AuraUSBController::GetConfigTable()
}
else
{
hid_close(dev);
throw std::runtime_error("Could not read config table");
LOG_INFO("[%s] Could not read config table, can not add device", device_name);
delete this;
}
}
@@ -8,6 +8,7 @@
\*-----------------------------------------*/
#include "RGBController.h"
#include "LogManager.h"
#include <string>
#include <vector>
@@ -5,12 +5,14 @@
#include "AsusAuraTUFKeyboardController.h"
#include "AsusAuraMainboardController.h"
#include "AsusAuraMouseController.h"
#include "AsusAuraStrixEvolveController.h"
#include "RGBController.h"
#include "RGBController_AsusAuraUSB.h"
#include "RGBController_AsusAuraHeadsetStand.h"
#include "RGBController_AsusAuraKeyboard.h"
#include "RGBController_AsusAuraTUFKeyboard.h"
#include "RGBController_AsusAuraMouse.h"
#include "RGBController_AsusAuraStrixEvolve.h"
#include <stdexcept>
#include <hidapi/hidapi.h>
#include "dependencies/dmiinfo.h"
@@ -44,6 +46,7 @@
| MICE - defined in AsusAuraMouseDevices.h |
\*-----------------------------------------------------------------*/
#define AURA_ROG_STRIX_EVOLVE_PID 0x185B
/*-----------------------------------------------------------------*\
| OTHER |
@@ -151,6 +154,18 @@ void DetectAsusAuraUSBMice(hid_device_info* info, const std::string& name)
}
}
void DetectAsusAuraUSBStrixEvolve(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
AuraStrixEvolveController* controller = new AuraStrixEvolveController(dev, info->path, info->product_id);
RGBController_AuraStrixEvolve* rgb_controller = new RGBController_AuraStrixEvolve(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
void DetectAsusAuraUSBHeadsetStand(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
@@ -210,13 +225,15 @@ REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius II Wireless", DetectAsusAuraUS
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius II Wireless", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_II_WIRELESS_2_PID, 2, 0xFF01);
REGISTER_HID_DETECTOR_IP("ASUS ROG Chakram (Wireless)", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_CHAKRAM_WIRELESS_PID, 0, 0xFF01);
REGISTER_HID_DETECTOR_IP("Asus ROG Chakram (Wired)", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_CHAKRAM_WIRED_1_PID, 0, 0xFF01);
REGISTER_HID_DETECTOR_IP("Asus ROG Chakram (Wired)", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_CHAKRAM_WIRED_2_PID, 0, 0xFF01);
REGISTER_HID_DETECTOR_IP("Asus ROG Chakram Core", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_CHAKRAM_CORE_PID, 0, 0xFF01);
REGISTER_HID_DETECTOR_IP("ASUS ROG Pugio", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_PUGIO_PID, 2, 0xFF01);
REGISTER_HID_DETECTOR_IP("ASUS ROG Pugio II (Wired)", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_PUGIO_II_WIRED_PID, 0, 0xFF01);
REGISTER_HID_DETECTOR_IP("ASUS ROG Pugio II (Wireless)", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_PUGIO_II_WIRELESS_PID, 0, 0xFF01);
REGISTER_HID_DETECTOR_IP("ASUS ROG Strix Impact II", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_STRIX_IMPACT_II_PID, 1, 0xFF01);
REGISTER_HID_DETECTOR_IP("ASUS TUF Gaming M3", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_TUF_M3_PID, 1, 0xFF01);
REGISTER_HID_DETECTOR_IP("ASUS TUF Gaming M5", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_TUF_M5_PID, 1, 0xFF01);
REGISTER_HID_DETECTOR_IP("ASUS TUF Gaming M5", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_TUF_M5_PID, 2, 0xFF01);
REGISTER_HID_DETECTOR_IP("ASUS ROG Strix Evolve", DetectAsusAuraUSBStrixEvolve, AURA_USB_VID, AURA_ROG_STRIX_EVOLVE_PID, 1, 0x0008);
/*-----------------------------------------------------------------*\
| OTHER |
@@ -71,7 +71,7 @@ RGBController_AuraMouse::RGBController_AuraMouse(AuraMouseController* aura_ptr)
mode ColorCycle;
ColorCycle.name = "Spectrum Cycle";
ColorCycle.value = mode_value;
ColorCycle.flags = MODE_FLAG_HAS_BRIGHTNESS;
ColorCycle.flags = MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE ;
ColorCycle.brightness_min = AURA_MOUSE_BRIGHTNESS_MIN;
ColorCycle.brightness_max = AURA_MOUSE_BRIGHTNESS_MAX;
ColorCycle.brightness = AURA_MOUSE_BRIGHTNESS_DEFAULT;
@@ -191,9 +191,9 @@ void RGBController_AuraMouse::ResizeZone(int /*zone*/, int /*new_size*/)
void RGBController_AuraMouse::DeviceUpdateLEDs()
{
for(std::vector<led>::iterator led_it = leds.begin(); led_it != leds.end(); led_it++)
for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++)
{
UpdateSingleLED(led_it->value);
UpdateSingleLED(zone_index);
}
}
@@ -0,0 +1,154 @@
/*-----------------------------------------*\
| RGBController_AsusAuraStrixEvolve.cpp |
| |
| Generic RGB Interface for Asus Aura |
| USB controller driver |
| |
| Mola19 11/30/2021 |
\*-----------------------------------------*/
#include "RGBController_AsusAuraStrixEvolve.h"
RGBController_AuraStrixEvolve::RGBController_AuraStrixEvolve(AuraStrixEvolveController* controller_ptr)
{
controller = controller_ptr;
name = "ASUS ROG Strix Evolve";
vendor = "ASUS";
type = DEVICE_TYPE_MOUSE;
description = "ASUS Aura Mouse Device";
version = controller->GetVersion();
location = controller->GetDeviceLocation();
serial = controller->GetSerialString();
mode Direct;
Direct.name = "Direct";
Direct.value = 1;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE | MODE_FLAG_HAS_BRIGHTNESS;
Direct.brightness_min = AURA_STRIX_EVOLVE_BRIGHTNESS_MIN;
Direct.brightness_max = AURA_STRIX_EVOLVE_BRIGHTNESS_MAX;
Direct.brightness = AURA_STRIX_EVOLVE_BRIGHTNESS_DEFAULT;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = 2;
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE | MODE_FLAG_HAS_BRIGHTNESS;
Breathing.brightness_min = AURA_STRIX_EVOLVE_BRIGHTNESS_MIN;
Breathing.brightness_max = AURA_STRIX_EVOLVE_BRIGHTNESS_MAX;
Breathing.brightness = AURA_STRIX_EVOLVE_BRIGHTNESS_DEFAULT;
Breathing.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Breathing);
mode ColorCycle;
ColorCycle.name = "Spectrum Cycle";
ColorCycle.value = 3;
ColorCycle.flags = MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
ColorCycle.brightness_min = AURA_STRIX_EVOLVE_BRIGHTNESS_MIN;
ColorCycle.brightness_max = AURA_STRIX_EVOLVE_BRIGHTNESS_MAX;
ColorCycle.brightness = AURA_STRIX_EVOLVE_BRIGHTNESS_DEFAULT;
ColorCycle.color_mode = MODE_COLORS_NONE;
modes.push_back(ColorCycle);
mode Reactive;
Reactive.name = "Reactive";
Reactive.value = 4;
Reactive.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE | MODE_FLAG_HAS_BRIGHTNESS;
Reactive.brightness_min = AURA_STRIX_EVOLVE_BRIGHTNESS_MIN;
Reactive.brightness_max = AURA_STRIX_EVOLVE_BRIGHTNESS_MAX;
Reactive.brightness = AURA_STRIX_EVOLVE_BRIGHTNESS_DEFAULT;
Reactive.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Reactive);
SetupZones();
}
RGBController_AuraStrixEvolve::~RGBController_AuraStrixEvolve()
{
delete controller;
}
void RGBController_AuraStrixEvolve::SetupZones()
{
zone mouse_zone;
mouse_zone.name = "Underglow";
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 = "Underglow";
mouse_led.value = 1;
leds.push_back(mouse_led);
SetupColors();
}
void RGBController_AuraStrixEvolve::ResizeZone(int /*zone*/, int /*new_size*/)
{
}
void RGBController_AuraStrixEvolve::DeviceUpdateLEDs()
{
unsigned char red = RGBGetRValue(colors[0]);
unsigned char grn = RGBGetGValue(colors[0]);
unsigned char blu = RGBGetBValue(colors[0]);
controller->SendUpdate(0x1C, red);
controller->SendUpdate(0x1D, grn);
controller->SendUpdate(0x1E, blu);
}
void RGBController_AuraStrixEvolve::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_AuraStrixEvolve::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_AuraStrixEvolve::SetCustomMode()
{
active_mode = 0;
}
void RGBController_AuraStrixEvolve::DeviceUpdateMode()
{
unsigned char red = RGBGetRValue(colors[0]);
unsigned char grn = RGBGetGValue(colors[0]);
unsigned char blu = RGBGetBValue(colors[0]);
controller->SendUpdate(0x19, modes[active_mode].value);
controller->SendUpdate(0x1A, modes[active_mode].brightness);
controller->SendUpdate(0x1C, red);
controller->SendUpdate(0x1D, grn);
controller->SendUpdate(0x1E, blu);
}
void RGBController_AuraStrixEvolve::DeviceSaveMode()
{
unsigned char red = RGBGetRValue(colors[0]);
unsigned char grn = RGBGetGValue(colors[0]);
unsigned char blu = RGBGetBValue(colors[0]);
unsigned int profile = controller->GetActiveProfile();
controller->UpdateProfile(0x19, profile, modes[active_mode].value);
controller->UpdateProfile(0x1A, profile, modes[active_mode].brightness);
controller->UpdateProfile(0x1C, profile, red);
controller->UpdateProfile(0x1D, profile, grn);
controller->UpdateProfile(0x1E, profile, blu);
controller->SendSavePacket();
}
@@ -0,0 +1,41 @@
/*-----------------------------------------*\
| RGBController_AsusAuraStrixEvolve.h |
| |
| Generic RGB Interface for Asus Aura |
| USB controller driver |
| |
| Mola19 11/30/2021 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "AsusAuraStrixEvolveController.h"
enum
{
AURA_STRIX_EVOLVE_BRIGHTNESS_MIN = 0,
AURA_STRIX_EVOLVE_BRIGHTNESS_MAX = 255,
AURA_STRIX_EVOLVE_BRIGHTNESS_DEFAULT = 255
};
class RGBController_AuraStrixEvolve : public RGBController
{
public:
RGBController_AuraStrixEvolve(AuraStrixEvolveController* controller_ptr);
~RGBController_AuraStrixEvolve();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
void DeviceSaveMode();
private:
AuraStrixEvolveController* controller;
};
@@ -9,195 +9,7 @@
#include "RGBController_AsusAuraTUFKeyboard.h"
#include <vector>
#define NA 0xFFFFFFFF
static unsigned int matrix_map[6][23] =
{ { 0, NA, 18, 24, 30, 36, NA, 48, 54, 60, 66, 72, 78, 84, 90, NA, 96, 102, 108, NA, NA, NA, NA },
{ 1, 13, 19, 25, 31, 37, 43, 49, 55, 61, 67, 73, 79, 91, NA, NA, 97, 103, 109, 115, 121, 127, 133 },
{ 2, NA, 14, 20, 26, 32, 38, 44, 50, 56, 62, 68, 74, 80, NA, NA, 98, 104, 110, 116, 122, 128, 134 },
{ 3, NA, 15, 21, 27, 33, 39, 45, 51, 57, 63, 69, 75, 81, 93, NA, NA, NA, NA, 117, 123, 129, NA },
{ 4, 10, 16, 22, 28, 34, 40, 46, 52, 58, 64, 70, NA, 94, NA, NA, NA, 106, NA, 118, 124, 130, 136 },
{ 5, 11, 17, NA, NA, NA, 41, NA, NA, NA, 59, 71, 77, NA, 95, NA, 101, 107, 113, 119, NA, 131, NA } };
static const char* zone_names[] =
{
"Keyboard"
};
static zone_type zone_types[] =
{
ZONE_TYPE_MATRIX,
};
static const unsigned int zone_sizes[] =
{
138
};
static const char *led_names[] =
{
"Key: Escape",
"Key: ^",
"Key: Tab",
"Key: Caps Lock",
"Key: Left Shift",
"Key: Left Control",
"Unused",
"Unused",
"Unused",
"Unused",
"Key: <",
"Key: Left Windows",
"Unused",
"Key: 1",
"Key: Q",
"Key: A",
"Key: Y",
"Key: Left Alt",
"Key: F1",
"Key: 2",
"Key: W",
"Key: S",
"Key: X",
"Unused",
"Key: F2",
"Key: 3",
"Key: E",
"Key: D",
"Key: C",
"Unused",
"Key: F3",
"Key: 4",
"Key: R",
"Key: F",
"Key: V",
"Unused",
"Key: F4",
"Key: 5",
"Key: T",
"Key: G",
"Key: B",
"Key: Space",
"Unused",
"Key: 6",
"Key: Z",
"Key: H",
"Key: N",
"Unused",
"Key: F5",
"Key: 7",
"Key: U",
"Key: J",
"Key: M",
"Unused",
"Key: F6",
"Key: 8",
"Key: I",
"Key: K",
"Key: ,",
"Key: Right Alt",
"Key: F7",
"Key: 9",
"Key: O",
"Key: L",
"Key: .",
"Unused",
"Key: F8",
"Key: 0",
"Key: P",
"Key: Ö",
"Key: -",
"Key: Right Fn",
"Key: F9",
"Key: ß",
"Key: Ü",
"Key: Ä",
"Unused",
"Key: Menu",
"Key: F10",
"Key: ´",
"Key: +",
"Key: #",
"Unused",
"Unused",
"Key: F11",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Key: F12",
"Key: Backspace",
"Unused",
"Key: Enter",
"Key: Right Shift",
"Key: Right Control",
"Key: Print Screen",
"Key: Insert",
"Key: Delete",
"Unused",
"Unused",
"Key: Left Arrow",
"Key: Scroll Lock",
"Key: Home",
"Key: End",
"Unused",
"Key: Up Arrow",
"Key: Down Arrow",
"Key: Pause/Break",
"Key: Page Up",
"Key: Page Down",
"Unused",
"Unused",
"Key: Right Arrow",
"Unused",
"Key: Num Lock",
"Key: Number Pad 7",
"Key: Number Pad 4",
"Key: Number Pad 1",
"Key: Number Pad 0",
"Unused",
"Key: Number Pad /",
"Key: Number Pad 8",
"Key: Number Pad 5",
"Key: Number Pad 2",
"Unused",
"Unused",
"Key: Number Pad *",
"Key: Number Pad 9",
"Key: Number Pad 6",
"Key: Number Pad 3",
"Key: Number Pad ,",
"Unused",
"Key: Number Pad -",
"Key: Number Pad +",
"Unused",
"Key: Number Pad Enter",
"Unused",
};
#include <cmath>
RGBController_AuraTUFKeyboard::RGBController_AuraTUFKeyboard(AuraTUFKeyboardController* aura_ptr)
{
@@ -207,139 +19,170 @@ RGBController_AuraTUFKeyboard::RGBController_AuraTUFKeyboard(AuraTUFKeyboardCont
vendor = "ASUS";
type = DEVICE_TYPE_KEYBOARD;
description = "ASUS Aura Keyboard Device";
version = aura->GetVersion();
location = aura->GetDeviceLocation();
serial = aura->GetSerialString();
mode Direct;
Direct.name = "Direct";
Direct.value = AURA_KEYBOARD_MODE_DIRECT;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
Direct.name = "Direct";
Direct.value = AURA_KEYBOARD_MODE_DIRECT;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Static;
Static.name = "Static";
Static.value = AURA_KEYBOARD_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
Static.colors_min = 1;
Static.colors_max = 1;
Static.name = "Static";
Static.value = AURA_KEYBOARD_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_MANUAL_SAVE | MODE_FLAG_HAS_BRIGHTNESS;
Static.brightness_min = AURA_KEYBOARD_BRIGHTNESS_MIN;
Static.brightness_max = AURA_KEYBOARD_BRIGHTNESS_MAX;
Static.brightness = AURA_KEYBOARD_BRIGHTNESS_DEFAULT;
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
Static.colors_min = 1;
Static.colors_max = 1;
Static.colors.resize(1);
modes.push_back(Static);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = AURA_KEYBOARD_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.speed_min = 0;
Breathing.speed_max = 15;
Breathing.speed = 8;
Breathing.colors_min = 1;
Breathing.colors_max = 2;
Breathing.name = "Breathing";
Breathing.value = AURA_KEYBOARD_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_MANUAL_SAVE | MODE_FLAG_HAS_BRIGHTNESS;
Breathing.speed_min = AURA_KEYBOARD_SPEED_MIN;
Breathing.speed_max = AURA_KEYBOARD_SPEED_MAX;
Breathing.speed = AURA_KEYBOARD_SPEED_DEFAULT;
Breathing.brightness_min = AURA_KEYBOARD_BRIGHTNESS_MIN;
Breathing.brightness_max = AURA_KEYBOARD_BRIGHTNESS_MAX;
Breathing.brightness = AURA_KEYBOARD_BRIGHTNESS_DEFAULT;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.colors_min = 1;
Breathing.colors_max = 2;
Breathing.colors.resize(1);
modes.push_back(Breathing);
mode Color_Cycle;
Color_Cycle.name = "Color Cycle";
Color_Cycle.value = AURA_KEYBOARD_MODE_COLOR_CYCLE;
Color_Cycle.flags = MODE_FLAG_HAS_SPEED;
Color_Cycle.color_mode = MODE_COLORS_NONE;
Color_Cycle.speed_min = 0;
Color_Cycle.speed_max = 15;
Color_Cycle.speed = 8;
Color_Cycle.name = "Spectrum Cycle";
Color_Cycle.value = AURA_KEYBOARD_MODE_COLOR_CYCLE;
Color_Cycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_MANUAL_SAVE | MODE_FLAG_HAS_BRIGHTNESS;
Color_Cycle.speed_min = AURA_KEYBOARD_SPEED_MIN;
Color_Cycle.speed_max = AURA_KEYBOARD_SPEED_MAX;
Color_Cycle.speed = AURA_KEYBOARD_SPEED_DEFAULT;
Color_Cycle.brightness_min = AURA_KEYBOARD_BRIGHTNESS_MIN;
Color_Cycle.brightness_max = AURA_KEYBOARD_BRIGHTNESS_MAX;
Color_Cycle.brightness = AURA_KEYBOARD_BRIGHTNESS_DEFAULT;
Color_Cycle.color_mode = MODE_COLORS_NONE;
modes.push_back(Color_Cycle);
mode Wave;
Wave.name = "Wave";
Wave.value = AURA_KEYBOARD_MODE_WAVE;
Wave.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_DIRECTION_UD | MODE_FLAG_HAS_DIRECTION_HV;
Wave.color_mode = MODE_COLORS_MODE_SPECIFIC;
Wave.speed_min = 0;
Wave.speed_max = 15;
Wave.speed = 8;
Wave.direction = MODE_DIRECTION_LEFT;
Wave.colors_min = 1;
Wave.colors_max = 7;
Wave.name = "Rainbow Wave";
Wave.value = AURA_KEYBOARD_MODE_WAVE;
Wave.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_DIRECTION_UD | MODE_FLAG_HAS_DIRECTION_HV | MODE_FLAG_MANUAL_SAVE | MODE_FLAG_HAS_BRIGHTNESS;
Wave.speed_min = AURA_KEYBOARD_SPEED_MIN;
Wave.speed_max = AURA_KEYBOARD_SPEED_MAX;
Wave.speed = AURA_KEYBOARD_SPEED_DEFAULT;
Wave.brightness_min = AURA_KEYBOARD_BRIGHTNESS_MIN;
Wave.brightness_max = AURA_KEYBOARD_BRIGHTNESS_MAX;
Wave.brightness = AURA_KEYBOARD_BRIGHTNESS_DEFAULT;
Wave.direction = MODE_DIRECTION_LEFT;
Wave.color_mode = MODE_COLORS_MODE_SPECIFIC;
Wave.colors_min = 1;
Wave.colors_max = 7;
Wave.colors.resize(7);
modes.push_back(Wave);
mode Ripple;
Ripple.name = "Ripple";
Ripple.value = AURA_KEYBOARD_MODE_RIPPLE;
Ripple.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED;
Ripple.color_mode = MODE_COLORS_MODE_SPECIFIC;
Ripple.speed_min = 0;
Ripple.speed_max = 15;
Ripple.speed = 8;
Ripple.colors_min = 1;
Ripple.colors_max = 8;
Ripple.name = "Ripple";
Ripple.value = AURA_KEYBOARD_MODE_RIPPLE;
Ripple.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_MANUAL_SAVE | MODE_FLAG_HAS_BRIGHTNESS;
Ripple.speed_min = AURA_KEYBOARD_SPEED_MIN;
Ripple.speed_max = AURA_KEYBOARD_SPEED_MAX;
Ripple.speed = AURA_KEYBOARD_SPEED_DEFAULT;
Ripple.brightness_min = AURA_KEYBOARD_BRIGHTNESS_MIN;
Ripple.brightness_max = AURA_KEYBOARD_BRIGHTNESS_MAX;
Ripple.brightness = AURA_KEYBOARD_BRIGHTNESS_DEFAULT;
Ripple.color_mode = MODE_COLORS_MODE_SPECIFIC;
Ripple.colors_min = 1;
Ripple.colors_max = 8;
Ripple.colors.resize(7);
modes.push_back(Ripple);
mode Reactive;
Reactive.name = "Reactive";
Reactive.value = AURA_KEYBOARD_MODE_REACTIVE;
Reactive.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED;
Reactive.color_mode = MODE_COLORS_MODE_SPECIFIC;
Reactive.speed_min = 0;
Reactive.speed_max = 15;
Reactive.speed = 8;
Reactive.colors_min = 1;
Reactive.colors_max = 2;
Reactive.name = "Reactive";
Reactive.value = AURA_KEYBOARD_MODE_REACTIVE;
Reactive.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_MANUAL_SAVE | MODE_FLAG_HAS_BRIGHTNESS;
Reactive.speed_min = AURA_KEYBOARD_SPEED_MIN;
Reactive.speed_max = AURA_KEYBOARD_SPEED_MAX;
Reactive.speed = AURA_KEYBOARD_SPEED_DEFAULT;
Reactive.brightness_min = AURA_KEYBOARD_BRIGHTNESS_MIN;
Reactive.brightness_max = AURA_KEYBOARD_BRIGHTNESS_MAX;
Reactive.brightness = AURA_KEYBOARD_BRIGHTNESS_DEFAULT;
Reactive.color_mode = MODE_COLORS_MODE_SPECIFIC;
Reactive.colors_min = 1;
Reactive.colors_max = 2;
Reactive.colors.resize(1);
modes.push_back(Reactive);
mode Starry_Night;
Starry_Night.name = "Starry Night";
Starry_Night.value = AURA_KEYBOARD_MODE_STARRY_NIGHT;
Starry_Night.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED;
Starry_Night.color_mode = MODE_COLORS_MODE_SPECIFIC;
Starry_Night.speed_min = 0;
Starry_Night.speed_max = 15;
Starry_Night.speed = 8;
Starry_Night.colors_min = 1;
Starry_Night.colors_max = 3;
Starry_Night.name = "Starry Night";
Starry_Night.value = AURA_KEYBOARD_MODE_STARRY_NIGHT;
Starry_Night.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_MANUAL_SAVE | MODE_FLAG_HAS_BRIGHTNESS;
Starry_Night.speed_min = AURA_KEYBOARD_SPEED_MIN;
Starry_Night.speed_max = AURA_KEYBOARD_SPEED_MAX;
Starry_Night.speed = AURA_KEYBOARD_SPEED_DEFAULT;
Starry_Night.brightness_min = AURA_KEYBOARD_BRIGHTNESS_MIN;
Starry_Night.brightness_max = AURA_KEYBOARD_BRIGHTNESS_MAX;
Starry_Night.brightness = AURA_KEYBOARD_BRIGHTNESS_DEFAULT;
Starry_Night.color_mode = MODE_COLORS_MODE_SPECIFIC;
Starry_Night.colors_min = 1;
Starry_Night.colors_max = 3;
Starry_Night.colors.resize(1);
modes.push_back(Starry_Night);
mode Quicksand;
Quicksand.name = "Quicksand";
Quicksand.value = AURA_KEYBOARD_MODE_QUICKSAND;
Quicksand.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_UD;
Quicksand.color_mode = MODE_COLORS_MODE_SPECIFIC;
Quicksand.direction = MODE_DIRECTION_DOWN;
Quicksand.speed_min = 0;
Quicksand.speed_max = 15;
Quicksand.speed = 8;
Quicksand.colors_min = 6;
Quicksand.colors_max = 6;
Quicksand.name = "Quicksand";
Quicksand.value = AURA_KEYBOARD_MODE_QUICKSAND;
Quicksand.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_UD | MODE_FLAG_MANUAL_SAVE | MODE_FLAG_HAS_BRIGHTNESS;
Quicksand.direction = MODE_DIRECTION_DOWN;
Quicksand.speed_min = AURA_KEYBOARD_SPEED_MIN;
Quicksand.speed_max = AURA_KEYBOARD_SPEED_MAX;
Quicksand.speed = AURA_KEYBOARD_SPEED_DEFAULT;
Quicksand.brightness_min = AURA_KEYBOARD_BRIGHTNESS_MIN;
Quicksand.brightness_max = AURA_KEYBOARD_BRIGHTNESS_MAX;
Quicksand.brightness = AURA_KEYBOARD_BRIGHTNESS_DEFAULT;
Quicksand.color_mode = MODE_COLORS_MODE_SPECIFIC;
Quicksand.colors_min = 6;
Quicksand.colors_max = 6;
Quicksand.colors.resize(6);
modes.push_back(Quicksand);
mode Current;
Current.name = "Current";
Current.value = AURA_KEYBOARD_MODE_CURRENT;
Current.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED;
Current.color_mode = MODE_COLORS_MODE_SPECIFIC;
Current.speed_min = 0;
Current.speed_max = 15;
Current.speed = 8;
Current.colors_min = 1;
Current.colors_max = 3;
Current.name = "Current";
Current.value = AURA_KEYBOARD_MODE_CURRENT;
Current.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_MANUAL_SAVE | MODE_FLAG_HAS_BRIGHTNESS;
Current.speed_min = AURA_KEYBOARD_SPEED_MIN;
Current.speed_max = AURA_KEYBOARD_SPEED_MAX;
Current.speed = AURA_KEYBOARD_SPEED_DEFAULT;
Current.brightness_min = AURA_KEYBOARD_BRIGHTNESS_MIN;
Current.brightness_max = AURA_KEYBOARD_BRIGHTNESS_MAX;
Current.brightness = AURA_KEYBOARD_BRIGHTNESS_DEFAULT;
Current.color_mode = MODE_COLORS_MODE_SPECIFIC;
Current.colors_min = 1;
Current.colors_max = 3;
Current.colors.resize(1);
modes.push_back(Current);
mode Rain_Drop;
Rain_Drop.name = "Rain Drop";
Rain_Drop.value = AURA_KEYBOARD_MODE_RAIN_DROP;
Rain_Drop.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED;
Rain_Drop.color_mode = MODE_COLORS_MODE_SPECIFIC;
Rain_Drop.speed_min = 0;
Rain_Drop.speed_max = 15;
Rain_Drop.speed = 8;
Rain_Drop.colors_min = 1;
Rain_Drop.colors_max = 3;
Rain_Drop.name = "Rain Drop";
Rain_Drop.value = AURA_KEYBOARD_MODE_RAIN_DROP;
Rain_Drop.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_MANUAL_SAVE | MODE_FLAG_HAS_BRIGHTNESS;
Rain_Drop.speed_min = AURA_KEYBOARD_SPEED_MIN;
Rain_Drop.speed_max = AURA_KEYBOARD_SPEED_MAX;
Rain_Drop.speed = AURA_KEYBOARD_SPEED_DEFAULT;
Rain_Drop.brightness_min = AURA_KEYBOARD_BRIGHTNESS_MIN;
Rain_Drop.brightness_max = AURA_KEYBOARD_BRIGHTNESS_MAX;
Rain_Drop.brightness = AURA_KEYBOARD_BRIGHTNESS_DEFAULT;
Rain_Drop.color_mode = MODE_COLORS_MODE_SPECIFIC;
Rain_Drop.colors_min = 1;
Rain_Drop.colors_max = 3;
Rain_Drop.colors.resize(1);
modes.push_back(Rain_Drop);
@@ -353,29 +196,40 @@ RGBController_AuraTUFKeyboard::~RGBController_AuraTUFKeyboard()
void RGBController_AuraTUFKeyboard::SetupZones()
{
int layout = aura->GetLayout();
if(AsusTUFK7Layouts.find(layout % 100) == AsusTUFK7Layouts.end())
{
layout = std::floor(layout/100) == 2 ? ASUS_TUF_K7_LAYOUT_UK : ASUS_TUF_K7_LAYOUT_US;
}
else
{
layout = layout % 100;
}
unsigned int total_led_count = 0;
for(unsigned int zone_idx = 0; zone_idx < 1; zone_idx++)
{
zone new_zone;
new_zone.name = zone_names[zone_idx];
new_zone.type = zone_types[zone_idx];
new_zone.leds_min = zone_sizes[zone_idx];
new_zone.leds_max = zone_sizes[zone_idx];
new_zone.leds_count = zone_sizes[zone_idx];
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;
zones.push_back(new_zone);
int zone_size = 138;
zone keyboard;
keyboard.name = "Keyboard";
keyboard.type = ZONE_TYPE_MATRIX;
keyboard.leds_min = zone_size;
keyboard.leds_max = zone_size;
keyboard.leds_count = zone_size;
keyboard.matrix_map = new matrix_map_type;
keyboard.matrix_map->height = 6;
keyboard.matrix_map->width = 23;
keyboard.matrix_map->map = AsusTUFK7Layouts[layout].matrix_map;
zones.push_back(keyboard);
total_led_count += zone_size;
total_led_count += zone_sizes[zone_idx];
}
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
{
led new_led;
new_led.name = led_names[led_idx];
new_led.name = AsusTUFK7Layouts[layout].led_names[led_idx];
leds.push_back(new_led);
}
@@ -465,6 +319,14 @@ void RGBController_AuraTUFKeyboard::DeviceUpdateMode()
mode_colors = modes[active_mode].color_mode == MODE_COLORS_PER_LED ? std::vector<RGBColor>(colors) : std::vector<RGBColor>(modes[active_mode].colors);
aura->UpdateDevice(modes[active_mode].value, mode_colors, direction, color_mode, (15 - modes[active_mode].speed));
aura->UpdateDevice(modes[active_mode].value, mode_colors, direction, color_mode, (15 - modes[active_mode].speed), modes[active_mode].brightness * 25);
}
}
void RGBController_AuraTUFKeyboard::DeviceSaveMode()
{
aura->ClearResponses();
DeviceUpdateMode();
aura->AwaitResponse();
aura->SaveMode();
}
@@ -11,6 +11,16 @@
#include "RGBController.h"
#include "AsusAuraTUFKeyboardController.h"
enum
{
AURA_KEYBOARD_SPEED_MIN = 0,
AURA_KEYBOARD_SPEED_MAX = 15,
AURA_KEYBOARD_SPEED_DEFAULT = 8,
AURA_KEYBOARD_BRIGHTNESS_MIN = 0,
AURA_KEYBOARD_BRIGHTNESS_MAX = 4,
AURA_KEYBOARD_BRIGHTNESS_DEFAULT = 4
};
class RGBController_AuraTUFKeyboard : public RGBController
{
public:
@@ -27,6 +37,7 @@ public:
void SetCustomMode();
void DeviceUpdateMode();
void DeviceSaveMode();
private:
AuraTUFKeyboardController* aura;
@@ -21,6 +21,7 @@
#define COOLERMASTER_MM711_PID 0x0101
#define COOLERMASTER_MM720_PID 0x0141
#define COOLERMASTER_MP750_XL_PID 0x0109
#define COOLERMASTER_MP750_L_PID 0x0107
#define COOLERMASTER_MP750_MEDIUM_PID 0x0105
#define COOLERMASTER_ARGB_PID 0x1011
#define COOLERMASTER_SMALL_ARGB_PID 0x1000
@@ -138,6 +139,7 @@ void DetectCoolerMasterSmallARGB(hid_device_info* info, const std::string&)
REGISTER_HID_DETECTOR_IPU("Cooler Master MM711", DetectCoolerMasterMouse, COOLERMASTER_VID, COOLERMASTER_MM711_PID, 1, 0xFF00, 1);
REGISTER_HID_DETECTOR_IPU("Cooler Master MM720", DetectCoolerMasterMouse, COOLERMASTER_VID, COOLERMASTER_MM720_PID, 1, 0xFF00, 1);
REGISTER_HID_DETECTOR_PU ("Cooler Master MP750 XL", DetectCoolerMasterMousemats, COOLERMASTER_VID, COOLERMASTER_MP750_XL_PID, 0xFF00, 1);
REGISTER_HID_DETECTOR_PU ("Cooler Master MP750 Large", DetectCoolerMasterMousemats, COOLERMASTER_VID, COOLERMASTER_MP750_L_PID, 0xFF00, 1);
REGISTER_HID_DETECTOR_PU ("Cooler Master MP750 Medium", DetectCoolerMasterMousemats, COOLERMASTER_VID, COOLERMASTER_MP750_MEDIUM_PID, 0xFF00, 1);
REGISTER_HID_DETECTOR_IPU("Cooler Master MasterKeys Pro L", DetectCoolerMasterKeyboards, COOLERMASTER_VID, COOLERMASTER_MASTERKEYS_PRO_L_PID, 1, 0xFF00, 1);
REGISTER_HID_DETECTOR_IPU("Cooler Master MasterKeys Pro L White", DetectCoolerMasterKeyboards, COOLERMASTER_VID, COOLERMASTER_MASTERKEYS_PRO_L_WHITE_PID, 1, 0xFF00, 1);
@@ -265,7 +265,7 @@ void CorsairLightingNodeController::SendDirect
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
hid_read(dev, usb_buf, 17);
hid_read_timeout(dev, usb_buf, 17, 1);
}
void CorsairLightingNodeController::SendCommit()
@@ -293,7 +293,7 @@ void CorsairLightingNodeController::SendCommit()
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
hid_read(dev, usb_buf, 17);
hid_read_timeout(dev, usb_buf, 17, 1);
}
void CorsairLightingNodeController::SendBegin
@@ -456,7 +456,7 @@ void CorsairLightingNodeController::SendPortState
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
hid_read(dev, usb_buf, 17);
hid_read_timeout(dev, usb_buf, 17, 1);
}
void CorsairLightingNodeController::SendBrightness
@@ -14,7 +14,7 @@ static unsigned int keys_k100[] = {0x25, 0x31, 0x27, 0x35, 0x66, 0x65, 0x41, 0x2
0x3C, 0x20, 0x14, 0x09, 0x0D, 0x6B, 0x2C, 0x69, 0x50, 0x55, 0x3D, 0x21, 0x08, 0x0A, 0x0C, 0x76,
0x2D, 0x4E, 0x51, 0x56, 0x3E, 0x22, 0x0E, 0x0B, 0x32, 0x61, 0x4C, 0x52, 0x57, 0x3F, 0x23, 0x0F,
0x2F, 0x33, 0x24, 0x4D, 0x53, 0x5E, 0x40, 0x29, 0x2B, 0x30, 0x34, /*Brightness,*/
0x4B, 0x54, 0x5F, 114 , 99, 0x7C, //114 and 99 is not conformed it just a guess
0x4B, 0x54, 0x5F, 0x60, 0x2E, 0x7C,
0x7F, 0x80, 0x81, 0x82, 0x83, 0x84,//Macro
0xA6, 0xA5, 0xA4, 0xA3, 0xA2, 0xA1, 0xA0, 0x9F, 0x9E, 0x9D, 0x9C, 0x86, 0x87, 0x88, 0x89, 0x8A,
0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A,
@@ -80,22 +80,59 @@ void CorsairK100Controller::LightingControl()
{
unsigned char usb_buf[65];
memset(usb_buf, 0x00, sizeof(usb_buf));
//This is requered
usb_buf[0x01] = 0x08;
usb_buf[0x02] = 0x01;
usb_buf[0x03] = 0x03;
usb_buf[0x05] = 0x02;
hid_write(dev, (unsigned char *)usb_buf, 65);
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x01] = 0x08;
usb_buf[0x02] = 0x01;
usb_buf[0x03] = 0x4A;
usb_buf[0x05] = 0x01;
hid_write(dev, (unsigned char *)usb_buf, 65);
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x01] = 0x08;
usb_buf[0x02] = 0x01;
usb_buf[0x03] = 0x45;
usb_buf[0x05] = 0x00;
hid_write(dev, (unsigned char *)usb_buf, 65);
memset(usb_buf, 0x00, sizeof(usb_buf));
//This is requered
usb_buf[0x01] = 0x08;
usb_buf[0x02] = 0x0D;
usb_buf[0x03] = 0x01;
usb_buf[0x04] = 0x22;
hid_write(dev, (unsigned char *)usb_buf, 65);
/*memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x01] = 0x08;
usb_buf[0x02] = 0x05;
usb_buf[0x03] = 0x01;
hid_write(dev, (unsigned char *)usb_buf, 5);
hid_write(dev, (unsigned char *)usb_buf, 65);
memset(usb_buf, 0x00, sizeof(usb_buf));
int res = hid_read_timeout(dev, usb_buf, 50, 1000);
if (res == 0 || usb_buf[1] != 0x05)
if (res == 0 || usb_buf[1] != 0x01)
{
LOG_INFO("[Corsair-K100] This device did not allow to take control over it.");
LOG_INFO("[Corsair-K100] This device did not allow to take control over it. recieved response: %02X", usb_buf[1]);
keyboard_type = CORSAIR_TYPE_UNKNOWN;
}
}*/
}
void CorsairK100Controller::SetLEDs(std::vector<RGBColor>colors)
@@ -116,7 +153,6 @@ void CorsairK100Controller::SetLEDsKeyboardFull(std::vector<RGBColor> colors)
unsigned char usb_buf[600];
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0x08;
usb_buf[0x02] = 0x06;
usb_buf[0x03] = 0x01;
@@ -8,6 +8,7 @@
\*-----------------------------------------*/
#include "CorsairPeripheralController.h"
#include "LogManager.h"
#include <cstring>
@@ -60,6 +61,8 @@ static unsigned int st100[] = { 0x00, 0x01, 0x02, 0x03, 0x05, 0x06, 0x07, 0x08,
static unsigned int key_mapping_k95_plat_ansi[] = { 0x31, 0x3f, 0x41, 0x42, 0x51, 0x53, 0x55, 0x6f, 0x7e, 0x7f, 0x80, 0x81 };
static unsigned int key_mapping_k95_plat_iso[] = { 0x3f, 0x41, 0x42, 0x48, 0x50, 0x53, 0x55, 0x6f, 0x7e, 0x7f, 0x80, 0x81 };
#define CORSAIR_PERIPHERAL_CONTROLLER_NAME "Corsair peripheral"
CorsairPeripheralController::CorsairPeripheralController(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
@@ -213,7 +216,7 @@ void CorsairPeripheralController::SetLEDsKeyboardFull(std::vector<RGBColor> colo
blu_val[keys_k95[color_idx]] = RGBGetBValue(color);
data_sz = 48; //untested
}
else if (logical_layout = CORSAIR_TYPE_K70_MK2)
else if (logical_layout == CORSAIR_TYPE_K70_MK2)
{
red_val[keys_k70_mk2[color_idx]] = RGBGetRValue(color);
grn_val[keys_k70_mk2[color_idx]] = RGBGetGValue(color);
@@ -532,7 +535,9 @@ void CorsairPeripheralController::ReadFirmwareInfo()
| 0xC0 Device is a keyboard |
| 0xC1 Device is a mouse |
| 0xC2 Device is a mousepad or headset stand |
\*-----------------------------------------------------*/
\*-----------------------------------------------------*/
LOG_DEBUG("[%s] Device type %02X", CORSAIR_PERIPHERAL_CONTROLLER_NAME, (unsigned char)usb_buf[0x14 + offset]);
switch((unsigned char)usb_buf[0x14 + offset])
{
case 0xC0:
@@ -1,11 +1,14 @@
#include "Detector.h"
#include "CorsairPeripheralController.h"
#include "CorsairK100Controller.h"
#include "LogManager.h"
#include "RGBController.h"
#include "RGBController_CorsairPeripheral.h"
#include "RGBController_CorsairK100.h"
#include <hidapi/hidapi.h>
#define CORSAIR_PERIPHERAL_CONTROLLER_NAME "Corsair peripheral"
/*-----------------------------------------------------*\
| Corsair vendor ID |
\*-----------------------------------------------------*/
@@ -35,6 +38,7 @@
#define CORSAIR_K95_PLATINUM_PID 0x1B2D
#define CORSAIR_STRAFE_PID 0x1B20
#define CORSAIR_STRAFE_RED_PID 0x1B44
#define CORSAIR_STRAFE_MK2_PID 0x1B48
/*-----------------------------------------------------*\
@@ -45,6 +49,8 @@
#define CORSAIR_GLAIVE_RGB_PRO_PID 0x1B74
#define CORSAIR_HARPOON_RGB_PID 0x1B3C
#define CORSAIR_HARPOON_RGB_PRO_PID 0x1B75
#define CORSAIR_IRONCLAW_RGB_PID 0x1B5D
#define CORSAIR_M65_PID 0x1B12
#define CORSAIR_M65_PRO_PID 0x1B2E
#define CORSAIR_M65_RGB_ELITE_PID 0x1B5A
#define CORSAIR_SCIMITAR_PRO_RGB_PID 0x1B3E
@@ -102,6 +108,8 @@ void DetectCorsairPeripheralControllers(hid_device_info* info, const std::string
if(dev)
{
LOG_DEBUG("[%s] Device opened. VID/PID %02X:%02X", CORSAIR_PERIPHERAL_CONTROLLER_NAME, info->vendor_id , info->product_id);
CorsairPeripheralController* controller = new CorsairPeripheralController(dev, info->path);
controller->SetName(name);
@@ -112,6 +120,7 @@ void DetectCorsairPeripheralControllers(hid_device_info* info, const std::string
}
else
{
LOG_DEBUG("[%s] Device type is unknown", CORSAIR_PERIPHERAL_CONTROLLER_NAME);
delete controller;
}
}
@@ -134,6 +143,7 @@ REGISTER_HID_DETECTOR_IP("Corsair K70 RGB MK.2 Low Profile", DetectCorsairPeriph
REGISTER_HID_DETECTOR_IP("Corsair K95 RGB", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_K95_RGB_PID, 1, 0xFFC2);
REGISTER_HID_DETECTOR_IP("Corsair K95 RGB PLATINUM", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_K95_PLATINUM_PID, 1, 0xFFC2);
REGISTER_HID_DETECTOR_IP("Corsair Strafe", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_STRAFE_PID, 1, 0xFFC2);
REGISTER_HID_DETECTOR_IP("Corsair Strafe Red", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_STRAFE_RED_PID, 1, 0xFFC2);
REGISTER_HID_DETECTOR_IP("Corsair Strafe MK.2", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_STRAFE_MK2_PID, 1, 0xFFC2);
/*-----------------------------------------------------------------------------------------------------*\
| Mice |
@@ -142,6 +152,8 @@ REGISTER_HID_DETECTOR_IP("Corsair Glaive RGB", DetectCorsairPeriph
REGISTER_HID_DETECTOR_IP("Corsair Glaive RGB PRO", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_GLAIVE_RGB_PRO_PID, 1, 0xFFC2);
REGISTER_HID_DETECTOR_IP("Corsair Harpoon RGB", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_HARPOON_RGB_PID, 1, 0xFFC2);
REGISTER_HID_DETECTOR_IP("Corsair Harpoon RGB PRO", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_HARPOON_RGB_PRO_PID, 1, 0xFFC2);
REGISTER_HID_DETECTOR_IP("Corsair Ironclaw RGB", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_IRONCLAW_RGB_PID, 1, 0xFFC2);
REGISTER_HID_DETECTOR_IP("Corsair M65", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_M65_PID, 1, 0xFFC2);
REGISTER_HID_DETECTOR_IP("Corsair M65 PRO", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_M65_PRO_PID, 1, 0xFFC2);
REGISTER_HID_DETECTOR_IP("Corsair M65 RGB Elite" , DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_M65_RGB_ELITE_PID, 1, 0xFFC2);
REGISTER_HID_DETECTOR_IP("Corsair Scimitar PRO RGB", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_SCIMITAR_PRO_RGB_PID, 1, 0xFFC2);
@@ -167,4 +179,4 @@ REGISTER_HID_DETECTOR_I("Corsair ST100 RGB", DetectCorsairPeriphe
/*-----------------------------------------------------------------------------------------------------*\
| Corsair K100 Keyboard |
\*-----------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IP("Corsair K100", DetectCorsairK100Controllers, CORSAIR_VID, CORSAIR_K100_PID, 1, 0xFF42);
REGISTER_HID_DETECTOR_IP("Corsair K100", DetectCorsairK100Controllers, CORSAIR_VID, CORSAIR_K100_PID, 1, 0xFF42);
@@ -7,6 +7,8 @@
#include "RGBController_CorsairK100.h"
#include "LogManager.h"
using namespace std::chrono_literals;
#define NA 0xFFFFFFFF
static unsigned int matrix_map_k100[7][24] =
@@ -238,10 +240,25 @@ RGBController_CorsairK100::RGBController_CorsairK100(CorsairK100Controller* cors
modes.push_back(Direct);
SetupZones();
/*-----------------------------------------------------*\
| The Corsair K100 requires a packet within |
| 1 minutes of sending the lighting change in order |
| to not revert back into rainbow mode. Start a thread |
| to continuously send a keepalive packet every 50 sec |
\*-----------------------------------------------------*/
keepalive_thread_run = true;
keepalive_thread = new std::thread(&RGBController_CorsairK100::KeepaliveThread, this);
}
RGBController_CorsairK100::~RGBController_CorsairK100()
{
/*-----------------------------------------------------*\
| Close keepalive thread |
\*-----------------------------------------------------*/
keepalive_thread_run = false;
keepalive_thread->join();
delete keepalive_thread;
/*---------------------------------------------------------*\
| Delete the matrix map |
\*---------------------------------------------------------*/
@@ -314,6 +331,8 @@ void RGBController_CorsairK100::ResizeZone(int /*zone*/, int /*new_size*/)
void RGBController_CorsairK100::DeviceUpdateLEDs()
{
last_update_time = std::chrono::steady_clock::now();
corsair->SetLEDs(colors);
}
@@ -336,3 +355,18 @@ void RGBController_CorsairK100::DeviceUpdateMode()
{
}
void RGBController_CorsairK100::KeepaliveThread()
{
while(keepalive_thread_run.load())
{
if(active_mode == 0)
{
if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50000))
{
DeviceUpdateLEDs();
}
}
std::this_thread::sleep_for(3000ms);
}
}
@@ -25,10 +25,16 @@ public:
void DeviceUpdateMode();
void SetCustomMode();
void KeepaliveThread();
private:
CorsairK100Controller* corsair;
CorsairKeyboardType logical_layout;
CorsairK100Controller* corsair;
CorsairKeyboardType logical_layout;
std::thread* keepalive_thread;
std::atomic<bool> keepalive_thread_run;
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
};
#endif // RGBCONTROLLER_CORSAIRK100_H
@@ -1013,6 +1013,10 @@ void RGBController_CorsairPeripheral::SetupZones()
{
new_led.name = corsair_harpoon_pro_leds[led_idx];
}
if(name == "Corsair Ironclaw RGB")
{
new_led.name = corsair_m65_elite_leds[led_idx];
}
else if(name == "Corsair Sabre RGB")
{
new_led.name = corsair_sabre_rgb_leds[led_idx];
@@ -206,12 +206,18 @@ RGBController_CorsairWireless::RGBController_CorsairWireless(CorsairWirelessCont
| to not revert back into rainbow mode. Start a thread |
| to continuously send a keepalive packet every 5s |
\*-----------------------------------------------------*/
keepalive_thread_run = 1;
keepalive_thread_run = true;
keepalive_thread = new std::thread(&RGBController_CorsairWireless::KeepaliveThread, this);
}
RGBController_CorsairWireless::~RGBController_CorsairWireless()
{
/*-----------------------------------------------------*\
| Close keepalive thread |
\*-----------------------------------------------------*/
keepalive_thread_run = false;
keepalive_thread->join();
delete keepalive_thread;
/*---------------------------------------------------------*\
| Delete the matrix map |
\*---------------------------------------------------------*/
@@ -0,0 +1,97 @@
/*-----------------------------------------*\
| DygmaRaiseController.cpp |
| |
| Driver for Dygma Raise keyboard |
| |
| Timo Schlegel (@eispalast) 12/12/2021 |
\*-----------------------------------------*/
#include "DygmaRaiseController.h"
using namespace std::chrono_literals;
static int val_char_len(int number)
{
if(number < 10)
{
return 1;
}
else if
(number < 100)
{
return 2;
}
else
{
return 3;
}
}
DygmaRaiseController::DygmaRaiseController()
{
}
DygmaRaiseController::~DygmaRaiseController()
{
serialport->serial_close();
delete serialport;
}
void DygmaRaiseController::Initialize(char* port)
{
port_name = port;
serialport = new serial_port(port_name.c_str(), DYGMA_RAISE_BAUD);
}
std::string DygmaRaiseController::GetDeviceLocation()
{
return("COM: " + port_name);
}
void DygmaRaiseController::SendDirect(std::vector<RGBColor>colors, size_t led_num)
{
char serial_buf[MAX_LEN];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(serial_buf,0x00,sizeof(serial_buf));
/*-----------------------------------------------------*\
| Set up led theme packet |
\*-----------------------------------------------------*/
sprintf(serial_buf,"led.theme");
int actual_length=9;
/*-----------------------------------------------------*\
| Fill packet with color values |
\*-----------------------------------------------------*/
for(std::size_t led_idx = 0; led_idx < led_num; led_idx++)
{
int r = RGBGetRValue(colors[led_idx]);
int g = RGBGetGValue(colors[led_idx]);
int b = RGBGetBValue(colors[led_idx]);
sprintf(serial_buf+actual_length," %d",r);
actual_length += val_char_len(r) + 1;
sprintf(serial_buf+actual_length," %d",g);
actual_length += val_char_len(g) + 1;
sprintf(serial_buf+actual_length," %d",b);
actual_length += val_char_len(b) + 1;
}
/*-----------------------------------------------------*\
| Add the final newline |
\*-----------------------------------------------------*/
sprintf(serial_buf+actual_length,"\n");
actual_length++;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
serialport->serial_write(serial_buf, actual_length);
}
@@ -0,0 +1,36 @@
/*-----------------------------------------*\
| DygmaRaiseController.h |
| |
| Driver for Dygma Raise keyboard |
| |
| Timo Schlegel (@eispalast) 12/12/2021 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include <string>
#include <vector>
#include "serial_port.h"
#pragma once
#define DYGMA_RAISE_VID 0x1209
#define DYGMA_RAISE_PID 0x2201
#define DYGMA_RAISE_BAUD 115200
#define MAX_LEN (4*3*132+9) //max. 4 Bytes per led channel * 3 channels * 132 leds + codeword led.theme
class DygmaRaiseController
{
public:
DygmaRaiseController();
~DygmaRaiseController();
void Initialize(char* port);
std::string GetDeviceLocation();
void SendDirect(std::vector<RGBColor>colors, size_t led_num);
private:
std::string location;
std::string port_name;
serial_port * serialport = nullptr;
};
@@ -0,0 +1,39 @@
#include "Detector.h"
#include "DygmaRaiseController.h"
#include "RGBController.h"
#include "RGBController_DygmaRaise.h"
#include "find_usb_serial_port.h"
#include <vector>
#include <stdio.h>
#define DYGMA_RAISE_VID 0x1209
#define DYGMA_RAISE_PID 0x2201
/******************************************************************************************\
* *
* DetectDygmaRaiseControllers *
* *
* Tests the USB address to see if a DygmaRaise keyboard exists there. *
* Then opens a serial port to communicate with the KB *
* *
\******************************************************************************************/
void DetectDygmaRaiseControllers(std::vector<RGBController*> &rgb_controllers)
{
std::vector<std::string *> ports = find_usb_serial_port(DYGMA_RAISE_VID, DYGMA_RAISE_PID);
for(std::size_t i = 0; i < ports.size(); i++)
{
if(*ports[i] != "")
{
DygmaRaiseController* controller = new DygmaRaiseController();
controller->Initialize((char *)ports[i]->c_str());
RGBController_DygmaRaise* rgb_controller = new RGBController_DygmaRaise(controller);
rgb_controllers.push_back(rgb_controller);
}
}
}
REGISTER_DETECTOR("Dygma Raise", DetectDygmaRaiseControllers);
@@ -0,0 +1,249 @@
/*-----------------------------------------*\
| RGBController_DygmaRaise.cpp |
| |
| RGB Interface DygmaRaise keyboard |
| |
| Timo Schlegel (@eispalast) 12/12/2021 |
\*-----------------------------------------*/
#include "RGBController_DygmaRaise.h"
#define NA 0xFFFFFFFF
#define LED_REAL_COUNT ((6*14)+(12*14))
#define LED_COUNT (LED_REAL_COUNT - 121)
static unsigned int kb_matrix_map_ISO[6][14] =
{ { 0, 1, 2, 3, 4, 5, 6, 39, 38, 37, 36, 35, 34, 33 },
{ 7, 8, 9, 10, 11, 12, 47, 46, 45, 44, 43, 42, 41, 40 },
{ 13, 14, 15, 16, 17, 18, 54, 53, 52, 51, 50, 49, 48, NA },
{ 19, 20, 21, 22, 23, 24, 25, 60, 59, 58, 57, 56, 55, NA },
{ 26, 27, 28, NA, 29, 30, NA, 66, 65, NA, 64, 63, 62, 61 },
{ NA, NA, NA, NA, 31, 32, NA, 68, 67, NA, NA, NA, NA, NA } };
static unsigned int underglow_matrix[11][14] =
{ { 2, 3 , 4, 5 , 6 , 7, NA, 38, 37, 36, 35, 34, 33, 32},
{ 1, NA, NA, NA, NA, 8, NA, 39, NA, NA, NA, NA, NA, 31 },
{ 0, NA, NA, NA, NA, 9, NA, 40, NA, NA, NA, NA, NA, 30 },
{ 29, NA, NA, NA, NA, 10,NA, 41, NA, NA, NA, NA, NA, 61 },
{ 28, NA, NA, NA, NA, 11,NA, 42, NA, NA, NA, NA, NA, 60 },
{ 27, NA, NA, NA, NA, 12,NA, 43, NA, NA, NA, NA, NA, 59 },
{ 26, NA, NA, NA, NA, 13,NA, 44, NA, NA, NA, NA, NA, 58 },
{ 25, NA, NA, NA, NA, 14,NA, 45, NA, NA, NA, NA, NA, 57 },
{ 24, NA, NA, NA, NA, 15,NA, 46, NA, NA, NA, NA, NA, 56 },
{ 23, NA, NA, NA, NA, 16,NA, 47, NA, NA, NA, NA, NA, 55 },
{ 22, 21, 20, 19, 18, 17,NA, 48,49,50,51,52,53, 54, }};
static const char* zone_names[] =
{
"Keyboard",
"Underglow",
"Neuron",
};
static zone_type zone_types[] =
{
ZONE_TYPE_MATRIX,
ZONE_TYPE_MATRIX,
ZONE_TYPE_SINGLE,
};
static const unsigned int zone_sizes[] =
{
69,
62,
1,
};
static const char* led_names[] =
{
"Key: Escape",
"Key: 1",
"Key: 2",
"Key: 3",
"Key: 4",
"Key: 5",
"Key: 6",
"Key: Tab",
"Key: Q",
"Key: W",
"Key: E",
"Key: R",
"Key: T",
"Key: Caps Lock",
"Key: A",
"Key: S",
"Key: D",
"Key: F",
"Key: G",
"Key: Left Shift",
"Key: \\ (ISO)",
"Key: Z",
"Key: X",
"Key: C",
"Key: V",
"Key: B",
"Key: Left Control",
"Key: Left Windows",
"Key: Left Alt",
"Key: T1",
"Key: T2",
"Key: T3",
"Key: T4",
"Key: Backspace",
"Key: =",
"Key: -",
"Key: 0",
"Key: 9",
"Key: 8",
"Key: 7",
"Key: Enter",
"Key: ]",
"Key: [",
"Key: P",
"Key: O",
"Key: I",
"Key: U",
"Key: Y",
"Key: #",
"Key: '",
"Key: ;",
"Key: L",
"Key: K",
"Key: J",
"Key: H",
"Key: Right Shift",
"Key: /",
"Key: .",
"Key: ,",
"Key: M",
"Key: N",
"Key: Right Control",
"Key: Right Windows",
"Key: Right Fn",
"Key: Right Alt",
"Key: T6",
"Key: T5",
"Key: T8",
"Key: T7",
};
RGBController_DygmaRaise::RGBController_DygmaRaise(DygmaRaiseController* controller_ptr)
{
controller = controller_ptr;
name = "Raise";
vendor = "Dygma";
type = DEVICE_TYPE_KEYBOARD;
description = "Dygma Raise Split Mech KB";
location = controller->GetDeviceLocation();
mode Direct;
Direct.name = "Direct";
Direct.value = 0;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
SetupZones();
}
RGBController_DygmaRaise::~RGBController_DygmaRaise()
{
delete controller;
}
void RGBController_DygmaRaise::SetupZones()
{
/*---------------------------------------------------------*\
| Set up zones |
\*---------------------------------------------------------*/
for(size_t i=0; i<3; i++)
{
zone new_zone;
new_zone.name = zone_names[i];
new_zone.type = zone_types[i];
new_zone.leds_min = zone_sizes[i];
new_zone.leds_max = zone_sizes[i];
new_zone.leds_count = zone_sizes[i];
if(i==0)
{
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = 6;
new_zone.matrix_map->width = 14;
new_zone.matrix_map->map = (unsigned int *)&kb_matrix_map_ISO;
}
else if(i==1)
{
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = 11;
new_zone.matrix_map->width = 14;
new_zone.matrix_map->map = (unsigned int *)&underglow_matrix;
}
zones.push_back(new_zone);
}
/*---------------------------------------------------------*\
| Set up keyboard LEDs |
\*---------------------------------------------------------*/
for(unsigned int led_idx = 0; led_idx < zone_sizes[0]; led_idx++)
{
led new_led;
new_led.name = led_names[led_idx];
leds.push_back(new_led);
}
/*---------------------------------------------------------*\
| Set up underglow LEDs |
\*---------------------------------------------------------*/
for(unsigned int led_idx = 0; led_idx < zone_sizes[1]; led_idx++)
{
led new_led;
new_led.name = "Underglow";
leds.push_back(new_led);
}
/*---------------------------------------------------------*\
| Set up Neuron LED |
\*---------------------------------------------------------*/
led new_led;
new_led.name = "Neuron";
leds.push_back(new_led);
SetupColors();
}
void RGBController_DygmaRaise::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_DygmaRaise::DeviceUpdateLEDs()
{
controller->SendDirect(colors,leds.size());
}
void RGBController_DygmaRaise::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_DygmaRaise::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_DygmaRaise::SetCustomMode()
{
active_mode = 0;
}
void RGBController_DygmaRaise::DeviceUpdateMode()
{
}
@@ -0,0 +1,31 @@
/*-----------------------------------------*\
| RGBController_DygmaRaise.h |
| |
| RGB Interface for DygmaRaise keyboard |
| |
| Timo Schlegel (@eispalast) 12/12/2021 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "DygmaRaiseController.h"
class RGBController_DygmaRaise : public RGBController
{
public:
RGBController_DygmaRaise(DygmaRaiseController* controller_ptr);
~RGBController_DygmaRaise();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
DygmaRaiseController* controller;
};
@@ -154,7 +154,7 @@ void DetectE131Controllers(std::vector<RGBController*> &rgb_controllers)
}
else if(rgb_order_val == "BRG")
{
dev.rgb_order = E131_RGB_ORDER_BGR;
dev.rgb_order = E131_RGB_ORDER_BRG;
}
else if(rgb_order_val == "BGR")
{
@@ -29,10 +29,10 @@ static const char* ene_channels[] = /* ENE channel strings
"Unknown",
};
ENESMBusController::ENESMBusController(i2c_smbus_interface* bus, ene_dev_id dev)
ENESMBusController::ENESMBusController(ENESMBusInterface* interface, ene_dev_id dev)
{
this->bus = bus;
this->dev = dev;
this->interface = interface;
this->dev = dev;
UpdateDeviceName();
@@ -143,7 +143,7 @@ ENESMBusController::ENESMBusController(i2c_smbus_interface* bus, ene_dev_id dev)
ENESMBusController::~ENESMBusController()
{
delete interface;
}
std::string ENESMBusController::GetDeviceName()
@@ -153,12 +153,14 @@ std::string ENESMBusController::GetDeviceName()
std::string ENESMBusController::GetDeviceLocation()
{
std::string return_string(bus->device_name);
std::string return_string = interface->GetLocation();
char addr[5];
snprintf(addr, 5, "0x%02X", dev);
return_string.append(", address ");
return_string.append(addr);
return("I2C: " + return_string);
return(return_string);
}
unsigned char ENESMBusController::GetChannel(unsigned int led)
@@ -191,6 +193,7 @@ const char * ENESMBusController::GetChannelName(unsigned int led)
break;
case (unsigned char)ENE_LED_CHANNEL_DRAM:
case (unsigned char)ENE_LED_CHANNEL_DRAM_2:
return(ene_channels[5]);
break;
@@ -256,40 +259,67 @@ void ENESMBusController::SaveMode()
ENERegisterWrite(ENE_REG_APPLY, ENE_SAVE_VAL);
}
void ENESMBusController::SetAllColorsDirect(unsigned char red, unsigned char green, unsigned char blue)
void ENESMBusController::SetAllColorsDirect(RGBColor* colors)
{
unsigned char* colors = new unsigned char[led_count * 3];
unsigned char* color_buf = new unsigned char[led_count * 3];
unsigned int bytes_sent = 0;
for (unsigned int i = 0; i < (led_count * 3); i += 3)
for(unsigned int i = 0; i < (led_count * 3); i += 3)
{
colors[i + 0] = red;
colors[i + 1] = blue;
colors[i + 2] = green;
color_buf[i + 0] = RGBGetRValue(colors[i / 3]);
color_buf[i + 1] = RGBGetBValue(colors[i / 3]);
color_buf[i + 2] = RGBGetGValue(colors[i / 3]);
}
ENERegisterWriteBlock(direct_reg, colors, led_count * 3);
while(bytes_sent < (led_count * 3))
{
unsigned int bytes_to_send = (led_count * 3) - bytes_sent;
delete[] colors;
if(bytes_to_send > interface->GetMaxBlock())
{
bytes_to_send = interface->GetMaxBlock();
}
ENERegisterWriteBlock(direct_reg + bytes_sent, &color_buf[bytes_sent], bytes_to_send);
bytes_sent += bytes_to_send;
}
delete color_buf;
}
void ENESMBusController::SetAllColorsEffect(unsigned char red, unsigned char green, unsigned char blue)
void ENESMBusController::SetAllColorsEffect(RGBColor* colors)
{
unsigned char* colors = new unsigned char[led_count * 3];
unsigned char* color_buf = new unsigned char[led_count * 3];
unsigned int bytes_sent = 0;
for (unsigned int i = 0; i < (led_count * 3); i += 3)
for(unsigned int i = 0; i < (led_count * 3); i += 3)
{
colors[i + 0] = red;
colors[i + 1] = blue;
colors[i + 2] = green;
color_buf[i + 0] = RGBGetRValue(colors[i / 3]);
color_buf[i + 1] = RGBGetBValue(colors[i / 3]);
color_buf[i + 2] = RGBGetGValue(colors[i / 3]);
}
while(bytes_sent < (led_count * 3))
{
unsigned int bytes_to_send = (led_count * 3) - bytes_sent;
if(bytes_to_send > interface->GetMaxBlock())
{
bytes_to_send = interface->GetMaxBlock();
}
ENERegisterWriteBlock(effect_reg + bytes_sent, &color_buf[bytes_sent], bytes_to_send);
bytes_sent += bytes_to_send;
}
ENERegisterWriteBlock(effect_reg, colors, led_count * 3);
ENERegisterWrite(ENE_REG_APPLY, ENE_APPLY_VAL);
delete[] colors;
delete color_buf;
}
void ENESMBusController::SetDirect(unsigned char direct)
{
ENERegisterWrite(ENE_REG_DIRECT, direct);
@@ -330,30 +360,15 @@ void ENESMBusController::UpdateDeviceName()
unsigned char ENESMBusController::ENERegisterRead(ene_register reg)
{
//Write ENE register
bus->i2c_smbus_write_word_data(dev, 0x00, ((reg << 8) & 0xFF00) | ((reg >> 8) & 0x00FF));
//Read ENE value
return(bus->i2c_smbus_read_byte_data(dev, 0x81));
return(interface->ENERegisterRead(dev, reg));
}
void ENESMBusController::ENERegisterWrite(ene_register reg, unsigned char val)
{
//Write ENE register
bus->i2c_smbus_write_word_data(dev, 0x00, ((reg << 8) & 0xFF00) | ((reg >> 8) & 0x00FF));
//Write ENE value
bus->i2c_smbus_write_byte_data(dev, 0x01, val);
interface->ENERegisterWrite(dev, reg, val);
}
void ENESMBusController::ENERegisterWriteBlock(ene_register reg, unsigned char * data, unsigned char sz)
{
//Write ENE register
bus->i2c_smbus_write_word_data(dev, 0x00, ((reg << 8) & 0xFF00) | ((reg >> 8) & 0x00FF));
//Write ENE block data
bus->i2c_smbus_write_block_data(dev, 0x03, sz, data);
interface->ENERegisterWriteBlock(dev, reg, data, sz);
}
@@ -11,13 +11,11 @@
\*-----------------------------------------*/
#include <string>
#include "i2c_smbus.h"
#include "ENESMBusInterface.h"
#include "RGBController.h"
#pragma once
typedef unsigned char ene_dev_id;
typedef unsigned short ene_register;
#define ENE_APPLY_VAL 0x01 /* Value for Apply Changes Register */
#define ENE_SAVE_VAL 0xAA /* Value for Save Changes */
@@ -99,7 +97,7 @@ enum
class ENESMBusController
{
public:
ENESMBusController(i2c_smbus_interface* bus, ene_dev_id dev);
ENESMBusController(ENESMBusInterface* interface, ene_dev_id dev);
~ENESMBusController();
std::string GetDeviceName();
@@ -114,8 +112,8 @@ public:
unsigned char GetLEDGreenEffect(unsigned int led);
unsigned char GetLEDBlueEffect(unsigned int led);
void SaveMode();
void SetAllColorsDirect(unsigned char red, unsigned char green, unsigned char blue);
void SetAllColorsEffect(unsigned char red, unsigned char green, unsigned char blue);
void SetAllColorsDirect(RGBColor* colors);
void SetAllColorsEffect(RGBColor* colors);
void SetDirect(unsigned char direct);
void SetLEDColorDirect(unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
void SetLEDColorEffect(unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
@@ -134,7 +132,7 @@ private:
ene_register direct_reg;
ene_register effect_reg;
unsigned char channel_cfg;
i2c_smbus_interface * bus;
ENESMBusInterface* interface;
ene_dev_id dev;
};
@@ -1,5 +1,7 @@
#include "Detector.h"
#include "ENESMBusController.h"
#include "ENESMBusInterface_i2c_smbus.h"
#include "ENESMBusInterface_SpectrixS40G.h"
#include "LogManager.h"
#include "RGBController.h"
#include "RGBController_ENESMBus.h"
@@ -15,6 +17,13 @@
using namespace std::chrono_literals;
/*----------------------------------------------------------------------*\
| Windows defines "interface" for some reason. Work around this |
\*----------------------------------------------------------------------*/
#ifdef interface
#undef interface
#endif
/*----------------------------------------------------------------------*\
| This list contains the available SMBus addresses for mapping ENE RAM |
\*----------------------------------------------------------------------*/
@@ -78,16 +87,25 @@ typedef struct
static const gpu_pci_device device_list[] =
{
{ NVIDIA_VEN, NVIDIA_RTX3060_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX_3060_O12G_GAMING, 0x67, "ASUS ROG STRIX 3060 O12G GAMING" },
{ NVIDIA_VEN, NVIDIA_RTX3060TI_DEV, ASUS_SUB_VEN, ASUS_TUF_RTX_3060_TI_O8G_OC, 0x67, "ASUS TUF RTX 3060Ti O8G OC" },
{ NVIDIA_VEN, NVIDIA_RTX3070_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX_3070_OC, 0x67, "ASUS ROG STRIX 3070 OC" },
{ NVIDIA_VEN, NVIDIA_RTX3070_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX_3070_O8G_WHITE, 0x67, "ASUS ROG STRIX 3070 O8G White" },
{ NVIDIA_VEN, NVIDIA_RTX3070_LHR_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX_3070_08G_V2_GAMING, 0x67, "ASUS ROG STRIX 3070 O8G V2 GAMING" },
{ NVIDIA_VEN, NVIDIA_RTX3070_DEV, ASUS_SUB_VEN, ASUS_TUF_RTX_3070_O8G_GAMING, 0x67, "ASUS TUF 3070 O8G GAMING" },
{ NVIDIA_VEN, NVIDIA_RTX3070_LHR_DEV, ASUS_SUB_VEN, ASUS_TUF_RTX_3070_O8G_V2_GAMING, 0x67, "ASUS TUF 3070 O8G V2 GAMING" },
{ NVIDIA_VEN, NVIDIA_RTX3080_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX_3080_010G_GAMING, 0x67, "ASUS ROG STRIX 3080 010G GAMING" },
{ NVIDIA_VEN, NVIDIA_RTX3080_DEV, ASUS_SUB_VEN, ASUS_TUF_RTX_3080_O10G_OC, 0x67, "ASUS TUF 3080 O10G OC" },
{ NVIDIA_VEN, NVIDIA_RTX3070_DEV, ASUS_SUB_VEN, ASUS_TUF_RTX_3070_O8G_GAMING, 0x67, "ASUS TUF RTX 3070 O8G GAMING" },
{ NVIDIA_VEN, NVIDIA_RTX3070_LHR_DEV, ASUS_SUB_VEN, ASUS_TUF_RTX_3070_O8G_V2_GAMING, 0x67, "ASUS TUF RTX 3070 O8G V2 GAMING" },
{ NVIDIA_VEN, NVIDIA_RTX3070TI_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX_3070TI_O8G_GAMING, 0x67, "ASUS ROG STRIX 3070Ti O8G GAMING" },
{ NVIDIA_VEN, NVIDIA_RTX3080_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX_3080_O10G_GAMING, 0x67, "ASUS ROG STRIX 3080 O10G GAMING" },
{ NVIDIA_VEN, NVIDIA_RTX3080_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX_3080_O10G_WHITE, 0x67, "ASUS ROG STRIX 3080 O10G WHITE" },
{ NVIDIA_VEN, NVIDIA_RTX3080_LHR_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX_3080_O10G_V2_WHITE, 0x67, "ASUS ROG STRIX 3080 O10G V2 WHITE" },
{ NVIDIA_VEN, NVIDIA_RTX3080_DEV, ASUS_SUB_VEN, ASUS_TUF_RTX_3080_10G_GAMING_PD, 0x67, "ASUS TUF RTX 3080 10G GAMING" },
{ NVIDIA_VEN, NVIDIA_RTX3080_DEV, ASUS_SUB_VEN, ASUS_TUF_RTX_3080_O10G_OC, 0x67, "ASUS TUF RTX 3080 O10G OC" },
{ NVIDIA_VEN, NVIDIA_RTX3080_LHR_DEV, ASUS_SUB_VEN, ASUS_TUF_RTX_3080_O10G_V2_GAMING_8822, 0x67, "ASUS TUF RTX 3080 O10G V2 GAMING" },
{ NVIDIA_VEN, NVIDIA_RTX3080_LHR_DEV, ASUS_SUB_VEN, ASUS_TUF_RTX_3080_O10G_V2_GAMING, 0x67, "ASUS TUF RTX 3080 O10G V2 GAMING" },
{ NVIDIA_VEN, NVIDIA_RTX3080TI_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX_3080TI_O12G_GAMING, 0x67, "ASUS ROG STRIX 3080Ti O12G GAMING" },
{ NVIDIA_VEN, NVIDIA_RTX3090_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX_3090_O24G_GAMING, 0x67, "ASUS ROG STRIX 3090 O24G GAMING" },
{ NVIDIA_VEN, NVIDIA_RTX3090_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX_3090_O24G_GAMING_WHITE, 0x67, "ASUS ROG STRIX 3090 O24G GAMING White OC" },
{ NVIDIA_VEN, NVIDIA_RTX3090_DEV, ASUS_SUB_VEN, ASUS_TUF_RTX_3090_O24G, 0x67, "ASUS TUF RTX 3090 O24G" },
{ NVIDIA_VEN, NVIDIA_RTX3090_DEV, ASUS_SUB_VEN, ASUS_TUF_RTX_3090_O24G_OC, 0x67, "ASUS TUF RTX 3090 O24G OC" },
};
@@ -257,8 +275,10 @@ void DetectENESMBusDRAMControllers(std::vector<i2c_smbus_interface*> &busses)
{
if (TestForENESMBusController(busses[bus], ene_ram_addresses[address_list_idx]))
{
ENESMBusController* controller = new ENESMBusController(busses[bus], ene_ram_addresses[address_list_idx]);
RGBController_ENESMBus* rgb_controller = new RGBController_ENESMBus(controller);
ENESMBusInterface_i2c_smbus* interface = new ENESMBusInterface_i2c_smbus(busses[bus]);
ENESMBusController* controller = new ENESMBusController(interface, ene_ram_addresses[address_list_idx]);
RGBController_ENESMBus* rgb_controller = new RGBController_ENESMBus(controller);
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
@@ -295,9 +315,13 @@ void DetectENESMBusMotherboardControllers(std::vector<i2c_smbus_interface*> &bus
if (TestForENESMBusController(busses[bus], aura_mobo_addresses[address_list_idx]))
{
DMIInfo dmi;
ENESMBusController* controller = new ENESMBusController(busses[bus], aura_mobo_addresses[address_list_idx]);
RGBController_ENESMBus* rgb_controller = new RGBController_ENESMBus(controller);
ENESMBusInterface_i2c_smbus* interface = new ENESMBusInterface_i2c_smbus(busses[bus]);
ENESMBusController* controller = new ENESMBusController(interface, aura_mobo_addresses[address_list_idx]);
RGBController_ENESMBus* rgb_controller = new RGBController_ENESMBus(controller);
rgb_controller->name = "ASUS " + dmi.getMainboard();
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
@@ -337,8 +361,9 @@ void DetectENESMBusGPUControllers(std::vector<i2c_smbus_interface*> &busses)
if(TestForENESMBusController(busses[bus], device_list[dev_idx].controller_address))
{
ENESMBusController* controller = new ENESMBusController(busses[bus], device_list[dev_idx].controller_address);
RGBController_ENESMBus* rgb_controller = new RGBController_ENESMBus(controller);
ENESMBusInterface_i2c_smbus* interface = new ENESMBusInterface_i2c_smbus(busses[bus]);
ENESMBusController* controller = new ENESMBusController(interface, device_list[dev_idx].controller_address);
RGBController_ENESMBus* rgb_controller = new RGBController_ENESMBus(controller);
rgb_controller->name = device_list[dev_idx].name;
rgb_controller->type = DEVICE_TYPE_GPU;
@@ -356,4 +381,4 @@ void DetectENESMBusGPUControllers(std::vector<i2c_smbus_interface*> &busses)
REGISTER_I2C_DETECTOR("ENE SMBus DRAM", DetectENESMBusDRAMControllers);
REGISTER_I2C_DETECTOR("ASUS Aura SMBus Motherboard", DetectENESMBusMotherboardControllers);
REGISTER_I2C_DETECTOR("ASUS Aura GPU (ENE)", DetectENESMBusGPUControllers);
REGISTER_I2C_DETECTOR("ASUS Aura GPU (ENE)", DetectENESMBusGPUControllers);
@@ -0,0 +1,24 @@
/*-----------------------------------------*\
| ENESMBusInterface.h |
| |
| Definitions and types for ENE interface |
| |
| Adam Honse (CalcProgrammer1) 11/21/2021 |
\*-----------------------------------------*/
#include <string>
#pragma once
typedef unsigned short ene_register;
typedef unsigned char ene_dev_id;
class ENESMBusInterface
{
public:
virtual std::string GetLocation() = 0;
virtual int GetMaxBlock() = 0;
virtual unsigned char ENERegisterRead(ene_dev_id dev, ene_register reg) = 0;
virtual void ENERegisterWrite(ene_dev_id dev, ene_register reg, unsigned char val) = 0;
virtual void ENERegisterWriteBlock(ene_dev_id dev, ene_register reg, unsigned char * data, unsigned char sz) = 0;
};
@@ -0,0 +1,201 @@
/*-----------------------------------------*\
| ENESMBusInterface_SpectrixS40G.cpp |
| |
| Code for ENE XPG Spectrix S40G NVMe |
| interface |
| |
| Adam Honse (CalcProgrammer1) 11/21/2021 |
\*-----------------------------------------*/
#include "ENESMBusInterface_SpectrixS40G.h"
#include <sys/ioctl.h>
#include <cstring>
/*---------------------------------------------------------------------*\
| Functions for submitting NVME admin passthrough command taken from |
| libnvme: https://github.com/linux-nvme/libnvme |
\*---------------------------------------------------------------------*/
#define NVME_IOCTL_ADMIN_CMD _IOWR('N', 0x41, struct nvme_passthru_cmd)
struct nvme_passthru_cmd
{
uint8_t opcode;
uint8_t flags;
uint16_t rsvd1;
uint32_t nsid;
uint32_t cdw2;
uint32_t cdw3;
uint64_t metadata;
uint64_t addr;
uint32_t metadata_len;
uint32_t data_len;
uint32_t cdw10;
uint32_t cdw11;
uint32_t cdw12;
uint32_t cdw13;
uint32_t cdw14;
uint32_t cdw15;
uint32_t timeout_ms;
uint32_t result;
};
static int nvme_submit_passthru(int fd, unsigned long ioctl_cmd,
struct nvme_passthru_cmd *cmd, uint32_t *result)
{
int err = ioctl(fd, ioctl_cmd, cmd);
if (err >= 0 && result)
*result = cmd->result;
return err;
}
static int nvme_passthru(int fd, unsigned long ioctl_cmd, uint8_t opcode,
uint8_t flags, uint16_t rsvd, uint32_t nsid, uint32_t cdw2,
uint32_t cdw3, uint32_t cdw10, uint32_t cdw11, uint32_t cdw12,
uint32_t cdw13, uint32_t cdw14, uint32_t cdw15, uint32_t data_len,
void *data, uint32_t metadata_len, void *metadata,
uint32_t timeout_ms, uint32_t *result)
{
struct nvme_passthru_cmd cmd = {
.opcode = opcode,
.flags = flags,
.rsvd1 = rsvd,
.nsid = nsid,
.cdw2 = cdw2,
.cdw3 = cdw3,
.metadata = (uint64_t)(uintptr_t)metadata,
.addr = (uint64_t)(uintptr_t)data,
.metadata_len = metadata_len,
.data_len = data_len,
.cdw10 = cdw10,
.cdw11 = cdw11,
.cdw12 = cdw12,
.cdw13 = cdw13,
.cdw14 = cdw14,
.cdw15 = cdw15,
.timeout_ms = timeout_ms,
};
return nvme_submit_passthru(fd, ioctl_cmd, &cmd, result);
}
int nvme_admin_passthru(int fd, uint8_t opcode, uint8_t flags, uint16_t rsvd,
uint32_t nsid, uint32_t cdw2, uint32_t cdw3, uint32_t cdw10,
uint32_t cdw11, uint32_t cdw12, uint32_t cdw13, uint32_t cdw14,
uint32_t cdw15, uint32_t data_len, void *data,
uint32_t metadata_len, void *metadata, uint32_t timeout_ms,
uint32_t *result)
{
return nvme_passthru(fd, NVME_IOCTL_ADMIN_CMD, opcode, flags, rsvd,
nsid, cdw2, cdw3, cdw10, cdw11, cdw12, cdw13,
cdw14, cdw15, data_len, data, metadata_len,
metadata, timeout_ms, result);
}
/*---------------------------------------------------------------------*\
| ENESMBusInterface_SpectrixS40G implementation |
\*---------------------------------------------------------------------*/
ENESMBusInterface_SpectrixS40G::ENESMBusInterface_SpectrixS40G(int fd, char* path)
{
this->nvme_fd = fd;
this->path = path;
}
std::string ENESMBusInterface_SpectrixS40G::GetLocation()
{
return("NVMe: " + path);
}
int ENESMBusInterface_SpectrixS40G::GetMaxBlock()
{
return(24);
}
unsigned char ENESMBusInterface_SpectrixS40G::ENERegisterRead(ene_dev_id dev, ene_register reg)
{
struct nvme_passthru_cmd cfg;
memset(&cfg, 0, sizeof(nvme_passthru_cmd));
unsigned short corrected_reg = ((reg << 8) & 0xFF00) | ((reg >> 8) & 0x00FF);
cfg.opcode = 0xFA;
cfg.cdw12 = (corrected_reg << 16) | (dev << 1);
cfg.cdw13 = 0x81100001;
cfg.data_len = 1;
unsigned char data[1];
unsigned char metadata[1];
unsigned int result;
/*-----------------------------------------------------------------------------*\
| Send the command to the device |
\*-----------------------------------------------------------------------------*/
nvme_admin_passthru(nvme_fd, cfg.opcode, cfg.flags, cfg.rsvd1,
cfg.nsid, cfg.cdw2, cfg.cdw3, cfg.cdw10,
cfg.cdw11, cfg.cdw12, cfg.cdw13, cfg.cdw14,
cfg.cdw15, cfg.data_len, data, cfg.metadata_len,
metadata, cfg.timeout_ms, &result);
return(data[0]);
}
void ENESMBusInterface_SpectrixS40G::ENERegisterWrite(ene_dev_id dev, ene_register reg, unsigned char val)
{
struct nvme_passthru_cmd cfg;
memset(&cfg, 0, sizeof(nvme_passthru_cmd));
unsigned short corrected_reg = ((reg << 8) & 0xFF00) | ((reg >> 8) & 0x00FF);
cfg.opcode = 0xFB;
cfg.cdw12 = (corrected_reg << 16) | (dev << 1);
cfg.cdw13 = 0x01100001;
cfg.data_len = 1;
unsigned char data[1];
data[0] = val;
unsigned char metadata[1];
unsigned int result;
/*-----------------------------------------------------------------------------*\
| Send the command to the device |
\*-----------------------------------------------------------------------------*/
nvme_admin_passthru(nvme_fd, cfg.opcode, cfg.flags, cfg.rsvd1,
cfg.nsid, cfg.cdw2, cfg.cdw3, cfg.cdw10,
cfg.cdw11, cfg.cdw12, cfg.cdw13, cfg.cdw14,
cfg.cdw15, cfg.data_len, data, cfg.metadata_len,
metadata, cfg.timeout_ms, &result);
}
void ENESMBusInterface_SpectrixS40G::ENERegisterWriteBlock(ene_dev_id dev, ene_register reg, unsigned char * data, unsigned char sz)
{
struct nvme_passthru_cmd cfg;
memset(&cfg, 0, sizeof(nvme_passthru_cmd));
unsigned short corrected_reg = ((reg << 8) & 0xFF00) | ((reg >> 8) & 0x00FF);
cfg.opcode = 0xFB;
cfg.cdw12 = (corrected_reg << 16) | (dev << 1);
cfg.cdw13 = 0x03100000 | sz;
cfg.data_len = sz;
unsigned char metadata[1];
unsigned int result;
/*-----------------------------------------------------------------------------*\
| Send the command to the device |
\*-----------------------------------------------------------------------------*/
nvme_admin_passthru(nvme_fd, cfg.opcode, cfg.flags, cfg.rsvd1,
cfg.nsid, cfg.cdw2, cfg.cdw3, cfg.cdw10,
cfg.cdw11, cfg.cdw12, cfg.cdw13, cfg.cdw14,
cfg.cdw15, cfg.data_len, data, cfg.metadata_len,
metadata, cfg.timeout_ms, &result);
}
@@ -0,0 +1,28 @@
/*-----------------------------------------*\
| ENESMBusInterface_SpectrixS40G.h |
| |
| Definitions and types for ENE XPG |
| Spectrix S40G NVMe interface |
| |
| Adam Honse (CalcProgrammer1) 11/21/2021 |
\*-----------------------------------------*/
#include "ENESMBusInterface.h"
#pragma once
class ENESMBusInterface_SpectrixS40G : public ENESMBusInterface
{
public:
ENESMBusInterface_SpectrixS40G(int fd, char* path);
std::string GetLocation();
int GetMaxBlock();
unsigned char ENERegisterRead(ene_dev_id dev, ene_register reg);
void ENERegisterWrite(ene_dev_id dev, ene_register reg, unsigned char val);
void ENERegisterWriteBlock(ene_dev_id dev, ene_register reg, unsigned char * data, unsigned char sz);
private:
int nvme_fd;
std::string path;
};
@@ -0,0 +1,251 @@
/*-----------------------------------------*\
| ENESMBusInterface_SpectrixS40G_Windows |
| |
| Code for ENE XPG Spectrix S40G NVMe |
| interface |
| Windows implementation |
| |
| Adam Honse (CalcProgrammer1) 11/21/2021 |
\*-----------------------------------------*/
#include "ENESMBusInterface_SpectrixS40G_Windows.h"
#include <fileapi.h>
#include <winioctl.h>
#include <nvme.h>
ENESMBusInterface_SpectrixS40G::ENESMBusInterface_SpectrixS40G(HANDLE fd, wchar_t* path)
{
this->nvme_fd = fd;
this->path = path;
}
std::string ENESMBusInterface_SpectrixS40G::GetLocation()
{
std::string str(path.begin(), path.end());
return("NVMe: " + str);
}
int ENESMBusInterface_SpectrixS40G::GetMaxBlock()
{
return(24);
}
unsigned char ENESMBusInterface_SpectrixS40G::ENERegisterRead(ene_dev_id dev, ene_register reg)
{
if(nvme_fd != INVALID_HANDLE_VALUE)
{
/*-----------------------------------------------------------------------------*\
| Create buffer to hold STORAGE_PROTOCOL_COMMAND |
| Size must be enough for the STORAGE_PROTOCOL_COMMAND struct plus the command |
| data. Subtract sizeof(DWORD) as the Command field in the structure overlaps |
| the actual command data. |
\*-----------------------------------------------------------------------------*/
unsigned char buffer[sizeof(STORAGE_PROTOCOL_COMMAND) + (sizeof(DWORD) * 34) - sizeof(DWORD)] = {0};
/*-----------------------------------------------------------------------------*\
| Create STORAGE_PROTOCOL_COMMAND pointer and point it to the buffer |
\*-----------------------------------------------------------------------------*/
PSTORAGE_PROTOCOL_COMMAND command = (PSTORAGE_PROTOCOL_COMMAND)buffer;
/*-----------------------------------------------------------------------------*\
| Fill in STORAGE_PROTOCOL_COMMAND structure |
\*-----------------------------------------------------------------------------*/
command->Version = STORAGE_PROTOCOL_STRUCTURE_VERSION;
command->Length = sizeof(STORAGE_PROTOCOL_COMMAND);
command->ProtocolType = ProtocolTypeNvme;
command->Flags = STORAGE_PROTOCOL_COMMAND_FLAG_ADAPTER_REQUEST;
command->ReturnStatus = 0x00000000;
command->ErrorCode = 0x00000000;
command->CommandLength = STORAGE_PROTOCOL_COMMAND_LENGTH_NVME;
command->ErrorInfoLength = 0x00000040;
command->DataToDeviceTransferLength = 0x00000000;
command->DataFromDeviceTransferLength = 0x00000001;
command->TimeOutValue = 0x00000001;
command->ErrorInfoOffset = 0x00000090;
command->DataToDeviceBufferOffset = 0x00000000;
command->DataFromDeviceBufferOffset = 0x000000D0;
command->CommandSpecific = STORAGE_PROTOCOL_SPECIFIC_NVME_ADMIN_COMMAND;
command->Reserved0 = 0x00000000;
command->FixedProtocolReturnData = 0x00000000;
command->Reserved1[0] = 0x00000000;
command->Reserved1[1] = 0x00000000;
command->Reserved1[2] = 0x00000000;
/*-----------------------------------------------------------------------------*\
| Create ENE Register Write command, filling in the appropriate register and |
| value |
\*-----------------------------------------------------------------------------*/
PNVME_COMMAND CommandValue = (PNVME_COMMAND)command->Command;
unsigned short corrected_reg = ((reg << 8) & 0xFF00) | ((reg >> 8) & 0x00FF);
CommandValue->CDW0.OPC = 0xFA;
CommandValue->u.GENERAL.CDW12 = (corrected_reg << 16) | (dev << 1);
CommandValue->u.GENERAL.CDW13 = 0x81100001;
DWORD ExtraValue[18] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 };
/*-----------------------------------------------------------------------------*\
| Send the STORAGE_PROTOCOL_COMMAND to the device |
\*-----------------------------------------------------------------------------*/
DWORD bytesreturned = 0;
while(bytesreturned != sizeof(buffer))
{
bool result = DeviceIoControl(nvme_fd, IOCTL_STORAGE_PROTOCOL_COMMAND, buffer, sizeof(buffer), buffer, sizeof(buffer), &bytesreturned, (LPOVERLAPPED)0x0);
}
/*-----------------------------------------------------------------------------*\
| Copy the ENE Register Write extra data into the STORAGE_PROTOCOL_COMMAND |
| buffer |
\*-----------------------------------------------------------------------------*/
memcpy(ExtraValue, &command->Command + sizeof(NVME_COMMAND), sizeof(ExtraValue));
return(ExtraValue[16]);
}
}
void ENESMBusInterface_SpectrixS40G::ENERegisterWrite(ene_dev_id dev, ene_register reg, unsigned char val)
{
if(nvme_fd != INVALID_HANDLE_VALUE)
{
/*-----------------------------------------------------------------------------*\
| Create buffer to hold STORAGE_PROTOCOL_COMMAND |
| Size must be enough for the STORAGE_PROTOCOL_COMMAND struct plus the command |
| data. Subtract sizeof(DWORD) as the Command field in the structure overlaps |
| the actual command data. |
\*-----------------------------------------------------------------------------*/
unsigned char buffer[sizeof(STORAGE_PROTOCOL_COMMAND) + (sizeof(DWORD) * 34) - sizeof(DWORD)];
/*-----------------------------------------------------------------------------*\
| Create STORAGE_PROTOCOL_COMMAND pointer and point it to the buffer |
\*-----------------------------------------------------------------------------*/
PSTORAGE_PROTOCOL_COMMAND command = (PSTORAGE_PROTOCOL_COMMAND)buffer;
/*-----------------------------------------------------------------------------*\
| Fill in STORAGE_PROTOCOL_COMMAND structure |
\*-----------------------------------------------------------------------------*/
command->Version = STORAGE_PROTOCOL_STRUCTURE_VERSION;
command->Length = sizeof(STORAGE_PROTOCOL_COMMAND);
command->ProtocolType = ProtocolTypeNvme;
command->Flags = STORAGE_PROTOCOL_COMMAND_FLAG_ADAPTER_REQUEST;
command->ReturnStatus = 0x00000000;
command->ErrorCode = 0x00000000;
command->CommandLength = STORAGE_PROTOCOL_COMMAND_LENGTH_NVME;
command->ErrorInfoLength = 0x00000040;
command->DataToDeviceTransferLength = 0x00000001;
command->DataFromDeviceTransferLength = 0x00000000;
command->TimeOutValue = 0x00000001;
command->ErrorInfoOffset = 0x00000090;
command->DataToDeviceBufferOffset = 0x000000D0;
command->DataFromDeviceBufferOffset = 0x00000000;
command->CommandSpecific = STORAGE_PROTOCOL_SPECIFIC_NVME_ADMIN_COMMAND;
command->Reserved0 = 0x00000000;
command->FixedProtocolReturnData = 0x00000000;
command->Reserved1[0] = 0x00000000;
command->Reserved1[1] = 0x00000000;
command->Reserved1[2] = 0x00000000;
/*-----------------------------------------------------------------------------*\
| Create ENE Register Write command, filling in the appropriate register and |
| value |
\*-----------------------------------------------------------------------------*/
PNVME_COMMAND CommandValue = (PNVME_COMMAND)command->Command;
unsigned short corrected_reg = ((reg << 8) & 0xFF00) | ((reg >> 8) & 0x00FF);
CommandValue->CDW0.OPC = 0xFB;
CommandValue->u.GENERAL.CDW12 = (corrected_reg << 16) | (dev << 1);
CommandValue->u.GENERAL.CDW13 = 0x01100001;
DWORD ExtraValue[18] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 };
ExtraValue[16] = val;
/*-----------------------------------------------------------------------------*\
| Copy the ENE Register Write extra data into the STORAGE_PROTOCOL_COMMAND |
| buffer |
\*-----------------------------------------------------------------------------*/
memcpy(&command->Command + sizeof(NVME_COMMAND), ExtraValue, sizeof(ExtraValue));
/*-----------------------------------------------------------------------------*\
| Send the STORAGE_PROTOCOL_COMMAND to the device |
\*-----------------------------------------------------------------------------*/
DeviceIoControl(nvme_fd, IOCTL_STORAGE_PROTOCOL_COMMAND, buffer, sizeof(buffer), buffer, sizeof(buffer), 0x0, (LPOVERLAPPED)0x0);
}
}
void ENESMBusInterface_SpectrixS40G::ENERegisterWriteBlock(ene_dev_id dev, ene_register reg, unsigned char * data, unsigned char sz)
{
if(nvme_fd != INVALID_HANDLE_VALUE)
{
/*-----------------------------------------------------------------------------*\
| Create buffer to hold STORAGE_PROTOCOL_COMMAND |
| Size must be enough for the STORAGE_PROTOCOL_COMMAND struct plus the command |
| data. Subtract sizeof(DWORD) as the Command field in the structure overlaps |
| the actual command data. |
\*-----------------------------------------------------------------------------*/
unsigned char buffer[sizeof(STORAGE_PROTOCOL_COMMAND) + (sizeof(DWORD) * 39) - sizeof(DWORD)];
/*-----------------------------------------------------------------------------*\
| Create STORAGE_PROTOCOL_COMMAND pointer and point it to the buffer |
\*-----------------------------------------------------------------------------*/
PSTORAGE_PROTOCOL_COMMAND command = (PSTORAGE_PROTOCOL_COMMAND)buffer;
/*-----------------------------------------------------------------------------*\
| Fill in STORAGE_PROTOCOL_COMMAND structure |
\*-----------------------------------------------------------------------------*/
command->Version = STORAGE_PROTOCOL_STRUCTURE_VERSION;
command->Length = sizeof(STORAGE_PROTOCOL_COMMAND);
command->ProtocolType = ProtocolTypeNvme;
command->Flags = STORAGE_PROTOCOL_COMMAND_FLAG_ADAPTER_REQUEST;
command->ReturnStatus = 0x00000000;
command->ErrorCode = 0x00000000;
command->CommandLength = STORAGE_PROTOCOL_COMMAND_LENGTH_NVME;
command->ErrorInfoLength = 0x00000040;
command->DataToDeviceTransferLength = sz;
command->DataFromDeviceTransferLength = 0x00000000;
command->TimeOutValue = 0x00000001;
command->ErrorInfoOffset = 0x00000090;
command->DataToDeviceBufferOffset = 0x000000D0;
command->DataFromDeviceBufferOffset = 0x00000000;
command->CommandSpecific = STORAGE_PROTOCOL_SPECIFIC_NVME_ADMIN_COMMAND;
command->Reserved0 = 0x00000000;
command->FixedProtocolReturnData = 0x00000000;
command->Reserved1[0] = 0x00000000;
command->Reserved1[1] = 0x00000000;
command->Reserved1[2] = 0x00000000;
/*-----------------------------------------------------------------------------*\
| Create ENE Register Write Block command, filling in the appropriate register |
| and value |
\*-----------------------------------------------------------------------------*/
PNVME_COMMAND CommandValue = (PNVME_COMMAND)command->Command;
unsigned short corrected_reg = ((reg << 8) & 0xFF00) | ((reg >> 8) & 0x00FF);
CommandValue->CDW0.OPC = 0xFB;
CommandValue->u.GENERAL.CDW12 = (corrected_reg << 16) | (dev << 1);
CommandValue->u.GENERAL.CDW13 = 0x03100000 | sz;
DWORD ExtraValue[23] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000 };
memcpy(&ExtraValue[16], data, sz);
/*-----------------------------------------------------------------------------*\
| Copy the ENE Register Write Block extra data into the |
| STORAGE_PROTOCOL_COMMAND buffer |
\*-----------------------------------------------------------------------------*/
memcpy(&command->Command + sizeof(NVME_COMMAND), ExtraValue, sizeof(ExtraValue));
/*-----------------------------------------------------------------------------*\
| Send the STORAGE_PROTOCOL_COMMAND to the device |
\*-----------------------------------------------------------------------------*/
DeviceIoControl(nvme_fd, IOCTL_STORAGE_PROTOCOL_COMMAND, buffer, sizeof(buffer), buffer, sizeof(buffer), 0x0, (LPOVERLAPPED)0x0);
}
}
@@ -0,0 +1,30 @@
/*-----------------------------------------*\
| ENESMBusInterface_SpectrixS40G_Windows.h |
| |
| Definitions and types for ENE XPG |
| Spectrix S40G NVMe interface |
| Windows implementation |
| |
| Adam Honse (CalcProgrammer1) 11/21/2021 |
\*-----------------------------------------*/
#include "ENESMBusInterface.h"
#include <windows.h>
#pragma once
class ENESMBusInterface_SpectrixS40G : public ENESMBusInterface
{
public:
ENESMBusInterface_SpectrixS40G(HANDLE fd, wchar_t* path);
std::string GetLocation();
int GetMaxBlock();
unsigned char ENERegisterRead(ene_dev_id dev, ene_register reg);
void ENERegisterWrite(ene_dev_id dev, ene_register reg, unsigned char val);
void ENERegisterWriteBlock(ene_dev_id dev, ene_register reg, unsigned char * data, unsigned char sz);
private:
HANDLE nvme_fd;
std::wstring path;
};
@@ -0,0 +1,52 @@
/*-----------------------------------------*\
| ENESMBusInterface_i2c_smbus.cpp |
| |
| Code for ENE I2C/SMBus interface |
| |
| Adam Honse (CalcProgrammer1) 11/21/2021 |
\*-----------------------------------------*/
#include "ENESMBusInterface_i2c_smbus.h"
ENESMBusInterface_i2c_smbus::ENESMBusInterface_i2c_smbus(i2c_smbus_interface* bus)
{
this->bus = bus;
}
std::string ENESMBusInterface_i2c_smbus::GetLocation()
{
std::string return_string(bus->device_name);
return("I2C: " + return_string);
}
int ENESMBusInterface_i2c_smbus::GetMaxBlock()
{
return(3);
}
unsigned char ENESMBusInterface_i2c_smbus::ENERegisterRead(ene_dev_id dev, ene_register reg)
{
//Write ENE register
bus->i2c_smbus_write_word_data(dev, 0x00, ((reg << 8) & 0xFF00) | ((reg >> 8) & 0x00FF));
//Read ENE value
return(bus->i2c_smbus_read_byte_data(dev, 0x81));
}
void ENESMBusInterface_i2c_smbus::ENERegisterWrite(ene_dev_id dev, ene_register reg, unsigned char val)
{
//Write ENE register
bus->i2c_smbus_write_word_data(dev, 0x00, ((reg << 8) & 0xFF00) | ((reg >> 8) & 0x00FF));
//Write ENE value
bus->i2c_smbus_write_byte_data(dev, 0x01, val);
}
void ENESMBusInterface_i2c_smbus::ENERegisterWriteBlock(ene_dev_id dev, ene_register reg, unsigned char * data, unsigned char sz)
{
//Write ENE register
bus->i2c_smbus_write_word_data(dev, 0x00, ((reg << 8) & 0xFF00) | ((reg >> 8) & 0x00FF));
//Write ENE block data
bus->i2c_smbus_write_block_data(dev, 0x03, sz, data);
}
@@ -0,0 +1,28 @@
/*-----------------------------------------*\
| ENESMBusInterface_i2c_smbus.h |
| |
| Definitions and types for ENE I2C/SMBus |
| interface |
| |
| Adam Honse (CalcProgrammer1) 11/21/2021 |
\*-----------------------------------------*/
#include "ENESMBusInterface.h"
#include "i2c_smbus.h"
#pragma once
class ENESMBusInterface_i2c_smbus : public ENESMBusInterface
{
public:
ENESMBusInterface_i2c_smbus(i2c_smbus_interface* bus);
std::string GetLocation();
int GetMaxBlock();
unsigned char ENERegisterRead(ene_dev_id dev, ene_register reg);
void ENERegisterWrite(ene_dev_id dev, ene_register reg, unsigned char val);
void ENERegisterWriteBlock(ene_dev_id dev, ene_register reg, unsigned char * data, unsigned char sz);
private:
i2c_smbus_interface * bus;
};
@@ -233,21 +233,15 @@ int RGBController_ENESMBus::GetDeviceMode()
void RGBController_ENESMBus::DeviceUpdateLEDs()
{
for(std::size_t led = 0; led < colors.size(); led++)
if(GetMode() == 0)
{
unsigned char red = RGBGetRValue(colors[led]);
unsigned char grn = RGBGetGValue(colors[led]);
unsigned char blu = RGBGetBValue(colors[led]);
if(GetMode() == 0)
{
controller->SetLEDColorDirect(led, red, grn, blu);
}
else
{
controller->SetLEDColorEffect(led, red, grn, blu);
}
controller->SetAllColorsDirect(&colors[0]);
}
else
{
controller->SetAllColorsEffect(&colors[0]);
}
}
void RGBController_ENESMBus::UpdateZoneLEDs(int zone)
@@ -0,0 +1,82 @@
#include "Detector.h"
#include "ENESMBusController.h"
#include "ENESMBusInterface_SpectrixS40G.h"
#include "LogManager.h"
#include "RGBController.h"
#include "RGBController_ENESMBus.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <dirent.h>
/******************************************************************************************\
* *
* DetectSpectrixS40GControllers *
* *
* Detects ENE SMBus controllers on XPG Spectrix S40G NVMe devices *
* *
\******************************************************************************************/
void DetectSpectrixS40GControllers(std::vector<RGBController*>& rgb_controllers)
{
/*---------------------------------------------------------------------*\
| Search for /dev/nvmeX nodes with model matching "XPG SPECTRIX S40G" |
\*---------------------------------------------------------------------*/
unsigned int nvme_idx = 0;
while(1)
{
/*-------------------------------------------------*\
| Create the nvme class model path |
\*-------------------------------------------------*/
char nvme_dev_buf[1024];
snprintf(nvme_dev_buf, 1024, "/sys/class/nvme/nvme%d/model", nvme_idx);
/*-------------------------------------------------*\
| Open the input event path to get the name |
\*-------------------------------------------------*/
int nvme_model_fd = open(nvme_dev_buf, O_RDONLY|O_NONBLOCK);
if(nvme_model_fd < 0)
{
break;
}
memset(nvme_dev_buf, 0, 1024);
read(nvme_model_fd, nvme_dev_buf, 1024);
close(nvme_model_fd);
LOG_DEBUG("[XPG Spectrix S40G] Probing %d, model: %s", nvme_idx, nvme_dev_buf);
/*-------------------------------------------------*\
| Check if this NVMe device is a SPECTRIX S40G |
\*-------------------------------------------------*/
if(strncmp(nvme_dev_buf, "XPG SPECTRIX S40G", 17) == 0)
{
snprintf(nvme_dev_buf, 1024, "/dev/nvme%d", nvme_idx);
int nvme_fd = open(nvme_dev_buf, O_RDWR);
if(nvme_fd > 0)
{
ENESMBusInterface_SpectrixS40G* interface = new ENESMBusInterface_SpectrixS40G(nvme_fd, nvme_dev_buf);
ENESMBusController* controller = new ENESMBusController(interface, 0x67);
RGBController_ENESMBus* rgb_controller = new RGBController_ENESMBus(controller);
rgb_controller->name = "XPG Spectrix S40G";
rgb_controller->type = DEVICE_TYPE_STORAGE;
rgb_controller->vendor = "XPG";
rgb_controllers.push_back(rgb_controller);
}
}
nvme_idx++;
}
} /* DetectSpectrixS40GControllers() */
REGISTER_DETECTOR( "XPG Spectrix S40G", DetectSpectrixS40GControllers);
@@ -0,0 +1,122 @@
#include "Detector.h"
#include "ENESMBusController.h"
#include "ENESMBusInterface_SpectrixS40G_Windows.h"
#include "LogManager.h"
#include "RGBController.h"
#include "RGBController_ENESMBus.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#define DEVBUFSIZE (128 * 1024)
#include <windows.h>
#include <fileapi.h>
/*----------------------------------------------------------------------*\
| Windows defines "interface" for some reason. Work around this |
\*----------------------------------------------------------------------*/
#ifdef interface
#undef interface
#endif
/******************************************************************************************\
* *
* Search *
* *
* Search for an NVMe device matching "XPG SPECTRIX S40G" *
* *
\******************************************************************************************/
int Search(wchar_t *dev_name)
{
wchar_t buff[DEVBUFSIZE] = L"";
int wchar_count;
wchar_count = QueryDosDeviceW(NULL, buff, DEVBUFSIZE);
if(wchar_count == 0)
{
return 0;
}
for(int i = 0; i < wchar_count; i++)
{
if(wcsstr(buff + i, L"SCSI#Disk&Ven_NVMe&Prod_XPG_SPECTRIX_S40#"))
{
wcsncpy(dev_name, buff + i, MAX_PATH);
(dev_name)[MAX_PATH - 1] = '\0';
return 1;
}
i += wcslen(buff + i);
}
return 0;
}
/******************************************************************************************\
* *
* OpenDevice *
* *
* Open a handle to the given device path *
* *
\******************************************************************************************/
HANDLE OpenDevice(wchar_t buff[MAX_PATH])
{
wchar_t path[MAX_PATH];
wcscpy(path, L"\\\\?\\");
wcsncat(path, buff, MAX_PATH - 4);
for(size_t i = 0; i < MAX_PATH && path[i] != '\0'; i++)
{
path[i] = tolower(path[i]);
}
wprintf(L"%s\n", path);
HANDLE hDevice = CreateFileW(path, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, (LPSECURITY_ATTRIBUTES)0x0, OPEN_EXISTING, 0x0, (HANDLE)0x0);
return(hDevice);
}
/******************************************************************************************\
* *
* DetectSpectrixS40GControllers *
* *
* Detects ENE SMBus controllers on XPG Spectrix S40G NVMe devices *
* *
* Tests for the existance of a file descriptor matching *
* SCSI#Disk&Ven_NVMe&Prod_XPG_SPECTRIX_S40# on Windows machines *
* *
\******************************************************************************************/
void DetectSpectrixS40GControllers(std::vector<RGBController*>& rgb_controllers)
{
/*-------------------------------------------------------------------------------------------------*\
| https://docs.microsoft.com/en-us/windows-hardware/drivers/install/identifiers-for-scsi-devices |
\*-------------------------------------------------------------------------------------------------*/
wchar_t dev_name[MAX_PATH];
if(Search(dev_name))
{
HANDLE nvme_fd = OpenDevice(dev_name);
if(nvme_fd != INVALID_HANDLE_VALUE)
{
ENESMBusInterface_SpectrixS40G* interface = new ENESMBusInterface_SpectrixS40G(nvme_fd, dev_name);
ENESMBusController* controller = new ENESMBusController(interface, 0x67);
RGBController_ENESMBus* rgb_controller = new RGBController_ENESMBus(controller);
rgb_controller->name = "XPG Spectrix S40G";
rgb_controller->type = DEVICE_TYPE_STORAGE;
rgb_controller->vendor = "XPG";
rgb_controllers.push_back(rgb_controller);
}
}
} /* DetectSpectrixS40GControllers() */
REGISTER_DETECTOR( "XPG Spectrix S40G", DetectSpectrixS40GControllers);
@@ -16,6 +16,4 @@ union u16_to_u8
uint8_t LSB;
uint8_t MSB;
};
};
#define EVGA_DETECT_MESSAGE "[%s] Found a device match at Bus %02d for Device %04x and SubDevice %04x: %s"
};
@@ -40,6 +40,7 @@ static const gpu_pci_device device_list[] =
{
{ NVIDIA_VEN, NVIDIA_GTX1070_DEV, EVGA_SUB_VEN, EVGA_GTX1070_FTW_DT_GAMING_SUB_DEV, EVGA_RGB_V1, "EVGA GeForce GTX 1070 FTW DT Gaming" },
{ NVIDIA_VEN, NVIDIA_GTX1070_DEV, EVGA_SUB_VEN, EVGA_GTX1070_FTW_SUB_DEV, EVGA_RGB_V1, "EVGA GeForce GTX 1070 FTW" },
{ NVIDIA_VEN, NVIDIA_GTX1070_DEV, EVGA_SUB_VEN, EVGA_GTX1070_FTW_HYBRID_SUB_DEV, EVGA_RGB_V1, "EVGA GeForce GTX 1070 FTW HYBRID" },
{ NVIDIA_VEN, NVIDIA_GTX1070TI_DEV, EVGA_SUB_VEN, EVGA_GTX1070TI_FTW2_SUB_DEV, EVGA_RGB_V1, "EVGA GeForce GTX 1070 Ti FTW2" },
{ NVIDIA_VEN, NVIDIA_GTX1080_DEV, EVGA_SUB_VEN, EVGA_GTX1080_FTW_SUB_DEV, EVGA_RGB_V1, "EVGA GeForce GTX 1080 FTW" },
{ NVIDIA_VEN, NVIDIA_GTX1080_DEV, EVGA_SUB_VEN, EVGA_GTX1080_FTW2_SUB_DEV, EVGA_RGB_GP102, "EVGA GeForce GTX 1080 FTW2" },
@@ -48,9 +49,9 @@ static const gpu_pci_device device_list[] =
{ NVIDIA_VEN, NVIDIA_GTX1080TI_DEV, EVGA_SUB_VEN, EVGA_GTX1080TI_KINGPIN_SUB_DEV, EVGA_RGB_GP102, "EVGA GTX 1080 Ti K|NGP|N" },
{ NVIDIA_VEN, NVIDIA_RTX2070_OC_DEV, EVGA_SUB_VEN, EVGA_RTX2070_XC_GAMING_SUB_DEV, EVGA_RGB_V2, "EVGA GeForce RTX 2070 XC Gaming" },
{ NVIDIA_VEN, NVIDIA_RTX2070_OC_DEV, EVGA_SUB_VEN, EVGA_RTX2070_XC_OC_SUB_DEV, EVGA_RGB_V2, "EVGA GeForce RTX 2070 XC OC" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_DEV, EVGA_SUB_VEN, EVGA_RTX2070S_BLACK_SUB_DEV, EVGA_RGB_V2, "EVGA GeForce RTX 2070 SUPER Black" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_DEV, EVGA_SUB_VEN, EVGA_RTX2070S_XC_ULTRA_SUB_DEV, EVGA_RGB_V2, "EVGA GeForce RTX 2070 SUPER XC Ultra" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_DEV, EVGA_SUB_VEN, EVGA_RTX2070S_XC_ULTRA_PLUS_SUB_DEV, EVGA_RGB_V2, "EVGA GeForce RTX 2070 SUPER XC Ultra+" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_OC_DEV, EVGA_SUB_VEN, EVGA_RTX2070S_BLACK_SUB_DEV, EVGA_RGB_V2, "EVGA GeForce RTX 2070 SUPER Black" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_OC_DEV, EVGA_SUB_VEN, EVGA_RTX2070S_XC_ULTRA_SUB_DEV, EVGA_RGB_V2, "EVGA GeForce RTX 2070 SUPER XC Ultra" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_OC_DEV, EVGA_SUB_VEN, EVGA_RTX2070S_XC_ULTRA_PLUS_SUB_DEV, EVGA_RGB_V2, "EVGA GeForce RTX 2070 SUPER XC Ultra+" },
{ NVIDIA_VEN, NVIDIA_RTX2080_DEV, EVGA_SUB_VEN, EVGA_RTX2080_BLACK_SUB_DEV, EVGA_RGB_V2, "EVGA GeForce RTX 2080 Black" },
{ NVIDIA_VEN, NVIDIA_RTX2080_A_DEV, EVGA_SUB_VEN, EVGA_RTX2080_XC_BLACK_SUB_DEV, EVGA_RGB_V2, "EVGA GeForce RTX 2080 XC Black" },
{ NVIDIA_VEN, NVIDIA_RTX2080_A_DEV, EVGA_SUB_VEN, EVGA_RTX2080_XC_GAMING_SUB_DEV, EVGA_RGB_V2, "EVGA GeForce RTX 2080 XC Gaming" },
@@ -138,7 +139,7 @@ void DetectEVGAGPUControllers(std::vector<i2c_smbus_interface*>& busses)
{
case EVGA_RGB_V1:
{
LOG_DEBUG(EVGA_DETECT_MESSAGE, EVGAGPUV1_CONTROLLER_NAME, bus, device_list[dev_idx].pci_device, device_list[dev_idx].pci_subsystem_device, device_list[dev_idx].name );
LOG_DEBUG(GPU_DETECT_MESSAGE, EVGAGPUV1_CONTROLLER_NAME, bus, device_list[dev_idx].pci_device, device_list[dev_idx].pci_subsystem_device, device_list[dev_idx].name );
EVGAGPUv1Controller* new_controller;
RGBController_EVGAGPUv1* new_rgbcontroller;
@@ -151,7 +152,7 @@ void DetectEVGAGPUControllers(std::vector<i2c_smbus_interface*>& busses)
case EVGA_RGB_V2:
{
LOG_DEBUG(EVGA_DETECT_MESSAGE, EVGAGPUV2_CONTROLLER_NAME, bus, device_list[dev_idx].pci_device, device_list[dev_idx].pci_subsystem_device, device_list[dev_idx].name );
LOG_DEBUG(GPU_DETECT_MESSAGE, EVGAGPUV2_CONTROLLER_NAME, bus, device_list[dev_idx].pci_device, device_list[dev_idx].pci_subsystem_device, device_list[dev_idx].name );
EVGAGPUv2Controller* new_controller;
RGBController_EVGAGPUv2* new_rgbcontroller;
@@ -164,7 +165,7 @@ void DetectEVGAGPUControllers(std::vector<i2c_smbus_interface*>& busses)
case EVGA_RGB_V3:
{
LOG_DEBUG(EVGA_DETECT_MESSAGE, EVGAGPUV3_CONTROLLER_NAME, bus, device_list[dev_idx].pci_device, device_list[dev_idx].pci_subsystem_device, device_list[dev_idx].name );
LOG_DEBUG(GPU_DETECT_MESSAGE, EVGAGPUV3_CONTROLLER_NAME, bus, device_list[dev_idx].pci_device, device_list[dev_idx].pci_subsystem_device, device_list[dev_idx].name );
EVGAGPUv3Controller* new_controller;
RGBController_EVGAGPUv3* new_rgbcontroller;
@@ -186,7 +187,7 @@ void DetectEVGAGPUControllers(std::vector<i2c_smbus_interface*>& busses)
break;
case EVGA_RGB_GP102:
{
LOG_DEBUG(EVGA_DETECT_MESSAGE, EVGA_GP102_CONTROLLER_NAME, bus, device_list[dev_idx].pci_device, device_list[dev_idx].pci_subsystem_device, device_list[dev_idx].name );
LOG_DEBUG(GPU_DETECT_MESSAGE, EVGA_GP102_CONTROLLER_NAME, bus, device_list[dev_idx].pci_device, device_list[dev_idx].pci_subsystem_device, device_list[dev_idx].name );
RGBController_EVGAGP102* new_rgbcontroller;
std::vector<EVGAGP102Controller*> controllers;
@@ -9,6 +9,7 @@
#include "Detector.h"
#include "GainwardGPUv1Controller.h"
#include "GainwardGPUv2Controller.h"
#include "LogManager.h"
#include "RGBController.h"
#include "RGBController_GainwardGPUv1.h"
#include "RGBController_GainwardGPUv2.h"
@@ -41,7 +42,7 @@ typedef struct
static const gpu_pci_device device_list[] =
{
{ NVIDIA_VEN, NVIDIA_GTX1080_DEV, GAINWARD_SUB_VEN, GAINWARD_GTX_1080_PHOENIX, RGB_V1, "Gainward GTX 1080 Phoenix" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_DEV, GAINWARD_SUB_VEN, NVIDIA_RTX2070S_DEV, RGB_V2, "Gainward RTX 2070 Super Phantom" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_OC_DEV, GAINWARD_SUB_VEN, NVIDIA_RTX2070S_OC_DEV, RGB_V2, "Gainward RTX 2070 Super Phantom" },
{ NVIDIA_VEN, NVIDIA_RTX3070_DEV, GAINWARD_SUB_VEN, NVIDIA_RTX3070_DEV, RGB_V2, "Gainward RTX 3070 Phoenix" },
};
@@ -109,6 +110,7 @@ void DetectGainwardGPUControllers(std::vector<i2c_smbus_interface*> &busses)
{
case RGB_V1:
{
LOG_DEBUG(GPU_DETECT_MESSAGE, "Gainward v1", bus, device_list[dev_idx].pci_device, device_list[dev_idx].pci_subsystem_device, device_list[dev_idx].name );
GainwardGPUv1Controller* new_GainwardGPU;
RGBController_GainwardGPUv1* new_controller;
@@ -121,6 +123,7 @@ void DetectGainwardGPUControllers(std::vector<i2c_smbus_interface*> &busses)
case RGB_V2:
{
LOG_DEBUG(GPU_DETECT_MESSAGE, "Gainward v2", bus, device_list[dev_idx].pci_device, device_list[dev_idx].pci_subsystem_device, device_list[dev_idx].name );
GainwardGPUv2Controller* new_GainwardGPU;
RGBController_GainwardGPUv2* new_controller;
@@ -8,6 +8,7 @@
#include "Detector.h"
#include "GalaxGPUController.h"
#include "LogManager.h"
#include "RGBController.h"
#include "RGBController_GalaxGPU.h"
#include "i2c_smbus.h"
@@ -32,7 +33,7 @@ typedef struct
static const gpu_pci_device device_list[] =
{
{ NVIDIA_VEN, NVIDIA_RTX2070_DEV, NVIDIA_SUB_VEN, KFA2_RTX_2070_EX_SUB_DEV, "KFA2 RTX 2070 EX" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_DEV, NVIDIA_SUB_VEN, GALAX_RTX_2070S_EX_GAMER_BLACK_SUB_DEV, "GALAX RTX 2070 Super EX Gamer Black" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_OC_DEV, NVIDIA_SUB_VEN, GALAX_RTX_2070S_EX_GAMER_BLACK_SUB_DEV, "GALAX RTX 2070 Super EX Gamer Black" },
{ NVIDIA_VEN, NVIDIA_RTX2080_DEV, NVIDIA_SUB_VEN, KFA2_RTX_2080_EX_OC_SUB_DEV, "KFA2 RTX 2080 EX OC" },
};
/******************************************************************************************\
@@ -82,6 +83,7 @@ void DetectGalaxGPUControllers(std::vector<i2c_smbus_interface*> &busses)
busses[bus]->pci_subsystem_vendor == device_list[dev_idx].pci_subsystem_vendor &&
busses[bus]->pci_subsystem_device == device_list[dev_idx].pci_subsystem_device)
{
LOG_DEBUG(GPU_DETECT_MESSAGE, "Galax GPU", bus, device_list[dev_idx].pci_device, device_list[dev_idx].pci_subsystem_device, device_list[dev_idx].name );
if (TestForGalaxGPUController(busses[bus], 0x23))
{
new_GalaxGPU = new GalaxGPUController(busses[bus], 0x23);
@@ -0,0 +1,147 @@
/*-----------------------------------------*\
| GigabyteRGBFusion2GPUController.cpp |
| |
| Driver for Gigabyte Aorus RGB Fusion2 GPU|
| lighting controller |
| |
| based on original by |
| Adam Honse (CalcProgrammer1) |
\*-----------------------------------------*/
#include <chrono>
#include <thread>
#include "GigabyteRGBFusion2GPUController.h"
#include "LogManager.h"
using namespace std::chrono_literals;
RGBFusion2GPUController::RGBFusion2GPUController(i2c_smbus_interface* bus, rgb_fusion_dev_id dev)
{
this->bus = bus;
this->dev = dev;
}
RGBFusion2GPUController::~RGBFusion2GPUController()
{
}
std::string RGBFusion2GPUController::GetDeviceLocation()
{
std::string return_string(bus->device_name);
char addr[5];
snprintf(addr, 5, "0x%02X", dev);
return_string.append(", address ");
return_string.append(addr);
return("I2C: " + return_string);
}
void RGBFusion2GPUController::SaveConfig()
{
uint8_t data_pkt[8] = { 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
bus->i2c_write_block(dev, sizeof(data_pkt), data_pkt);
}
void RGBFusion2GPUController::SetMode(uint8_t zone, uint8_t mode, fusion2_config zone_config, uint8_t mystery_flag)
{
uint8_t zone_pkt[8] = { RGB_FUSION2_GPU_REG_MODE, mode, zone_config.speed, zone_config.brightness, mystery_flag, (zone + 1), 0x00, 0x00 };
bus->i2c_write_block(dev, sizeof(zone_pkt), zone_pkt);
uint8_t zone_pkt2[8] = { RGB_FUSION2_GPU_REG_COLOR, RGBGetRValue(zone_config.colors[0]), RGBGetGValue(zone_config.colors[0]), RGBGetBValue(zone_config.colors[0]), (zone + 1), 0x00, 0x00, 0x00 };
bus->i2c_write_block(dev, sizeof(zone_pkt2), zone_pkt2);
}
void RGBFusion2GPUController::SetZone(uint8_t zone, uint8_t mode, fusion2_config zone_config)
{
std::string mode_name;
uint8_t mystery_flag = 0x00;
switch(mode)
{
case RGB_FUSION2_GPU_MODE_STATIC:
{
SetMode(zone, mode, zone_config, mystery_flag);
}
break;
case RGB_FUSION2_GPU_MODE_BREATHING:
{
SetMode(zone, mode, zone_config, mystery_flag);
}
break;
case RGB_FUSION2_GPU_MODE_COLOR_CYCLE:
{
uint8_t zone_pkt[8] = { RGB_FUSION2_GPU_REG_MODE, mode, zone_config.speed, zone_config.brightness, mystery_flag, (zone + 1), 0x00, 0x00 };
bus->i2c_write_block(dev, sizeof(zone_pkt), zone_pkt);
}
break;
case RGB_FUSION2_GPU_MODE_GRADIENT:
{
mystery_flag = 0x08;
SetMode(zone, mode, zone_config, mystery_flag);
}
break;
case RGB_FUSION2_GPU_MODE_FLASHING:
{
SetMode(zone, mode, zone_config, mystery_flag);
}
break;
case RGB_FUSION2_GPU_MODE_DUAL_FLASHING:
{
SetMode(zone, mode, zone_config, mystery_flag);
}
break;
case RGB_FUSION2_GPU_MODE_WAVE:
{
SetMode(zone, mode, zone_config, mystery_flag);
}
break;
case RGB_FUSION2_GPU_MODE_COLOR_SHIFT:
{
mystery_flag = zone_config.numberOfColors;
uint8_t zone_pkt[8] = { RGB_FUSION2_GPU_REG_MODE, mode, zone_config.speed, zone_config.brightness, mystery_flag, (zone + 1), 0x00, 0x00 };
bus->i2c_write_block(dev, sizeof(zone_pkt), zone_pkt);
uint8_t bank = (0xB0 + (zone * 4));
uint8_t zone_pktA[8] = { bank, mode, RGBGetRValue(zone_config.colors[0]), RGBGetGValue(zone_config.colors[0]), RGBGetBValue(zone_config.colors[0]), RGBGetRValue(zone_config.colors[1]), RGBGetGValue(zone_config.colors[1]), RGBGetBValue(zone_config.colors[1]) };
bus->i2c_write_block(dev, sizeof(zone_pktA), zone_pktA);
uint8_t zone_pktB[8] = { (bank + 1), mode, RGBGetRValue(zone_config.colors[2]), RGBGetGValue(zone_config.colors[2]), RGBGetBValue(zone_config.colors[2]), RGBGetRValue(zone_config.colors[3]), RGBGetGValue(zone_config.colors[3]), RGBGetBValue(zone_config.colors[3]) };
bus->i2c_write_block(dev, sizeof(zone_pktB), zone_pktB);
uint8_t zone_pktC[8] = { (bank + 2), mode, RGBGetRValue(zone_config.colors[4]), RGBGetGValue(zone_config.colors[4]), RGBGetBValue(zone_config.colors[4]), RGBGetRValue(zone_config.colors[5]), RGBGetGValue(zone_config.colors[5]), RGBGetBValue(zone_config.colors[5]) };
bus->i2c_write_block(dev, sizeof(zone_pktC), zone_pktC);
uint8_t zone_pktD[8] = { (bank + 3), mode, RGBGetRValue(zone_config.colors[6]), RGBGetGValue(zone_config.colors[6]), RGBGetBValue(zone_config.colors[6]), RGBGetRValue(zone_config.colors[7]), RGBGetGValue(zone_config.colors[7]), RGBGetBValue(zone_config.colors[7]) };
bus->i2c_write_block(dev, sizeof(zone_pktD), zone_pktD);
}
break;
case RGB_FUSION2_GPU_MODE_TRICOLOR:
{
mystery_flag = 0x08;
uint8_t zone_pkt[8] = { RGB_FUSION2_GPU_REG_MODE, mode, zone_config.speed, zone_config.brightness, mystery_flag, (zone + 1), 0x00, 0x00 };
bus->i2c_write_block(dev, sizeof(zone_pkt), zone_pkt);
uint8_t bank = (0xB0 + (zone * 4));
uint8_t zone_pktA[8] = { bank, mode, RGBGetRValue(zone_config.colors[0]), RGBGetGValue(zone_config.colors[0]), RGBGetBValue(zone_config.colors[0]), RGBGetRValue(zone_config.colors[1]), RGBGetGValue(zone_config.colors[1]), RGBGetBValue(zone_config.colors[1]) };
bus->i2c_write_block(dev, sizeof(zone_pktA), zone_pktA);
uint8_t zone_pktB[8] = { (bank + 1), mode, RGBGetRValue(zone_config.colors[2]), RGBGetGValue(zone_config.colors[2]), RGBGetBValue(zone_config.colors[2]), RGBGetRValue(zone_config.colors[3]), RGBGetGValue(zone_config.colors[3]), RGBGetBValue(zone_config.colors[3]) };
bus->i2c_write_block(dev, sizeof(zone_pktB), zone_pktB);
uint8_t zone_pktC[8] = { (bank + 2), mode, RGBGetRValue(zone_config.colors[4]), RGBGetGValue(zone_config.colors[4]), RGBGetBValue(zone_config.colors[4]), RGBGetRValue(zone_config.colors[5]), RGBGetGValue(zone_config.colors[5]), RGBGetBValue(zone_config.colors[5]) };
bus->i2c_write_block(dev, sizeof(zone_pktC), zone_pktC);
uint8_t zone_pktD[8] = { (bank + 3), mode, RGBGetRValue(zone_config.colors[6]), RGBGetGValue(zone_config.colors[6]), RGBGetBValue(zone_config.colors[6]), RGBGetRValue(zone_config.colors[7]), RGBGetGValue(zone_config.colors[7]), RGBGetBValue(zone_config.colors[7]) };
bus->i2c_write_block(dev, sizeof(zone_pktD), zone_pktD);
}
break;
default:
{
LOG_TRACE("[%s] Mode %02d not found", "fusion2 gpu", mode);
}
break;
}
}
@@ -0,0 +1,83 @@
/*------------------------------------------*\
| GigabyteRGBFusion2GPUController.h |
| |
| Definitions and types for Gigabyte Aorus |
| RGB Fusion2 GPU lighting controller |
| |
| based on original by |
| Adam Honse (CalcProgrammer1) 2/20/2020 |
\*------------------------------------------*/
#include <string>
#include "i2c_smbus.h"
#include "RGBController.h"
#pragma once
typedef unsigned char rgb_fusion_dev_id;
struct fusion2_config
{
uint8_t brightness;
RGBColor colors[8];
uint8_t numberOfColors;
uint8_t speed;
uint8_t direction;
};
enum
{
RGB_FUSION2_GPU_REG_COLOR = 0x40,
RGB_FUSION2_GPU_REG_MODE = 0x88
};
enum
{
RGB_FUSION2_GPU_MODE_STATIC = 0x01,
RGB_FUSION2_GPU_MODE_BREATHING = 0x02,
RGB_FUSION2_GPU_MODE_COLOR_CYCLE = 0x03,
RGB_FUSION2_GPU_MODE_FLASHING = 0x04,
RGB_FUSION2_GPU_MODE_GRADIENT = 0x05,
RGB_FUSION2_GPU_MODE_COLOR_SHIFT = 0x06,
RGB_FUSION2_GPU_MODE_WAVE = 0x07,
RGB_FUSION2_GPU_MODE_DUAL_FLASHING = 0x08,
RGB_FUSION2_GPU_MODE_TRICOLOR = 0x0B
};
enum
{
RGB_FUSION2_GPU_SPEED_SLOWEST = 0x00,
RGB_FUSION2_GPU_SPEED_NORMAL = 0x02,
RGB_FUSION2_GPU_SPEED_FASTEST = 0x05
};
enum
{
RGB_FUSION2_GPU_BRIGHTNESS_MIN = 0x00,
RGB_FUSION2_GPU_BRIGHTNESS_MAX = 0x63
};
class RGBFusion2GPUController
{
public:
RGBFusion2GPUController(i2c_smbus_interface* bus, rgb_fusion_dev_id dev);
~RGBFusion2GPUController();
uint8_t zone_led_count[4];
uint8_t zone_modes[4];
std::string GetDeviceLocation();
void GetDeviceModes();
uint8_t GetZoneMode(uint8_t zone);
fusion2_config GetZoneConfig(uint8_t zone, uint8_t mode);
void SaveConfig();
void SetZone(uint8_t zone, uint8_t mode, fusion2_config zone_config);
void SetMode(uint8_t zone, uint8_t mode, fusion2_config zone_config, uint8_t mystery_flag);
private:
i2c_smbus_interface* bus;
rgb_fusion_dev_id dev;
};
@@ -0,0 +1,117 @@
#include "Detector.h"
#include "GigabyteRGBFusion2GPUController.h"
#include "LogManager.h"
#include "RGBController.h"
#include "RGBController_GigabyteRGBFusion2GPU.h"
#include "i2c_smbus.h"
#include "pci_ids.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
typedef struct
{
int pci_vendor;
int pci_device;
int pci_subsystem_vendor;
int pci_subsystem_device;
unsigned char controller_address;
const char * name;
} gpu_pci_device;
#define GIGABYTEGPU_CONTROLLER_NAME2 "Gigabyte RGB Fusion2 GPU"
#define GPU_NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
static const gpu_pci_device device_list[] =
{
{ NVIDIA_VEN, NVIDIA_RTX2060S_OC_DEV, GIGABYTE_SUB_VEN, GIGABYTE_AORUS_RTX2060S_V1_SUB_DEV, 0x50, "Gigabyte AORUS RTX2060 SUPER 8G V1" },
{ NVIDIA_VEN, NVIDIA_RTX2070_OC_DEV, GIGABYTE_SUB_VEN, GIGABYTE_AORUS_RTX2070_XTREME_SUB_DEV, 0x50, "Gigabyte AORUS RTX2070 XTREME 8G" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_OC_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX2070S_GAMING_OC_SUB_DEV2, 0x50, "Gigabyte AORUS RTX2070 SUPER 8G" },
{ NVIDIA_VEN, NVIDIA_RTX3060_LHR_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX3060_ELITE_12GB_SUB_DEV, 0x70, "Gigabyte AORUS RTX3060 ELITE 12G" },
{ NVIDIA_VEN, NVIDIA_RTX3060TI_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX3060TI_GAMING_OC_PRO_SUB_DEV, 0x62, "Gigabyte AORUS RTX3060 Ti GAMING OC PRO 8G" },
{ NVIDIA_VEN, NVIDIA_RTX3070_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX3070_MASTER_OC_SUB_DEV, 0x66, "Gigabyte RTX3070 MASTER 8G" },
{ NVIDIA_VEN, NVIDIA_RTX3080_LHR_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX3080_XTREME_WATERFORCE_SUB_DEV, 0x64, "Gigabyte AORUS RTX3080 XTREME WATERFORCE WB 10G" },
{ NVIDIA_VEN, NVIDIA_RTX3080TI_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX3080TI_VISION_OC_SUB_DEV, 0x63, "Gigabyte RTX3080 Ti Vision OC 12G" },
{ NVIDIA_VEN, NVIDIA_RTX3080TI_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX3080TI_XTREME_WATERFORCE_SUB_DEV, 0x65, "Gigabyte AORUS RTX3080 Ti XTREME WATERFORCE 12G" },
{ NVIDIA_VEN, NVIDIA_RTX3090_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX3090_XTREME_WATERFORCE_SUB_DEV, 0x64, "Gigabyte AORUS RTX3090 XTREME WATERFORCE WB 24G" },
};
/******************************************************************************************\
* *
* TestForGigabyteRGBFusion2GPUController *
* *
* Tests the given address to see if an RGB Fusion2 controller exists there. First *
* does a quick write to test for a response *
* *
\******************************************************************************************/
bool TestForGigabyteRGBFusion2GPUController(i2c_smbus_interface* bus, unsigned char address)
{
bool pass = false;
int res, pktsz;
const int read_sz = 4;
const int write_sz = 8;
uint8_t data_pkt[write_sz] = { 0xAB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
uint8_t data_readpkt[read_sz] = {};
res = bus->i2c_write_block(address, write_sz, data_pkt);
pass = true;
pktsz = read_sz;
res = bus->i2c_read_block(address, &pktsz, data_readpkt);
//What we have seen returned so far...
//GeForce RTX 3070 AORUS MASTER 8G 0xAB 0x11 0x52 0x03
//GeForce RTX 3060 Ti GAMING OC PRO 8G 0xAB 0x10 0x01 0x02
//GeForce RTX 3070 AORUS ELITE 12G 0xAB 0x11 0x52 0x03
//GeForce RTX 3080 Ti AORUS XTREME WATERFORCE 12G 0xAB 0x11 0x01 0x00
//GeForce RTX 3080 AORUS XTREME WATERFORCE WB 10G 0xAB 0x10 0x01 0x00
if(res < 0)
{
LOG_DEBUG("[%s] at 0x%02X address expected 0x04 but received: 0x%02X", GIGABYTEGPU_CONTROLLER_NAME2, address, res);
pass = false;
}
return(pass);
} /* TestForRGBFusion2GPUController() */
/*******************************************************************************************\
* *
* DetectRGBFusion2GPUControllers *
* *
* Detect GigabyteRGB Fusion2 controllers on the enumerated I2C busses at address 0x70.*
* *
* bus - pointer to i2c_smbus_interface where RGB Fusion2 device is connected *
* dev - I2C address of RGB Fusion2 device *
* *
\*******************************************************************************************/
void DetectGigabyteRGBFusion2GPUControllers(std::vector<i2c_smbus_interface*>& busses)
{
for(unsigned int bus = 0; bus < busses.size(); bus++)
{
for(unsigned int dev_idx = 0; dev_idx < GPU_NUM_DEVICES; dev_idx++)
{
if(busses[bus]->pci_vendor == device_list[dev_idx].pci_vendor &&
busses[bus]->pci_device == device_list[dev_idx].pci_device &&
busses[bus]->pci_subsystem_vendor == device_list[dev_idx].pci_subsystem_vendor &&
busses[bus]->pci_subsystem_device == device_list[dev_idx].pci_subsystem_device)
{
LOG_DEBUG(GPU_DETECT_MESSAGE, GIGABYTEGPU_CONTROLLER_NAME2, bus, device_list[dev_idx].pci_device, device_list[dev_idx].pci_subsystem_device, device_list[dev_idx].name );
// Check for RGB Fusion2 controller
if(TestForGigabyteRGBFusion2GPUController(busses[bus], device_list[dev_idx].controller_address))
{
RGBFusion2GPUController* controller = new RGBFusion2GPUController(busses[bus], device_list[dev_idx].controller_address);
RGBController_RGBFusion2GPU* rgb_controller = new RGBController_RGBFusion2GPU(controller);
rgb_controller->name = device_list[dev_idx].name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
}
}
} /* DetectGigabyteRGBFusion2GPUControllers() */
REGISTER_I2C_DETECTOR("Gigabyte RGB Fusion2 GPU", DetectGigabyteRGBFusion2GPUControllers);
@@ -0,0 +1,259 @@
/*-----------------------------------------*\
| RGBController_GigabyteRGBFusion2GPU.cpp |
| |
| Generic RGB Interface for OpenRGB |
| Gigabyte RGB Fusion2 GPU Driver |
| |
| based on original by |
| Adam Honse (CalcProgrammer1) |
\*-----------------------------------------*/
#include "RGBController_GigabyteRGBFusion2GPU.h"
static const char* gigabyte_fusion2_gpu_zone[] =
{
"gpu zone 1",
"gpu zone 2",
"gpu zone 3",
"gpu zone 4"
};
RGBController_RGBFusion2GPU::RGBController_RGBFusion2GPU(RGBFusion2GPUController* controller_ptr)
{
controller = controller_ptr;
name = "Gigabyte GPU";
vendor = "Gigabyte";
description = "Gigabyte RGB Fusion 2 GPU";
location = controller->GetDeviceLocation();
type = DEVICE_TYPE_GPU;
mode Direct;
Direct.name = "Direct";
Direct.value = RGB_FUSION2_GPU_MODE_STATIC;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
Direct.color_mode = MODE_COLORS_PER_LED;
Direct.brightness_min = RGB_FUSION2_GPU_BRIGHTNESS_MIN;
Direct.brightness_max = RGB_FUSION2_GPU_BRIGHTNESS_MAX;
Direct.brightness = RGB_FUSION2_GPU_BRIGHTNESS_MAX;
modes.push_back(Direct);
mode Breathing;
Breathing.name = "Pulse";
Breathing.value = RGB_FUSION2_GPU_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE;
Breathing.speed_min = RGB_FUSION2_GPU_SPEED_SLOWEST;
Breathing.speed_max = RGB_FUSION2_GPU_SPEED_FASTEST;
Breathing.speed = RGB_FUSION2_GPU_SPEED_NORMAL;
Breathing.color_mode = MODE_COLORS_PER_LED;
Breathing.brightness_min = RGB_FUSION2_GPU_BRIGHTNESS_MIN;
Breathing.brightness_max = RGB_FUSION2_GPU_BRIGHTNESS_MAX;
Breathing.brightness = RGB_FUSION2_GPU_BRIGHTNESS_MAX;
modes.push_back(Breathing);
mode Flashing;
Flashing.name = "Flash";
Flashing.value = RGB_FUSION2_GPU_MODE_FLASHING;
Flashing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
Flashing.speed_min = RGB_FUSION2_GPU_SPEED_SLOWEST;
Flashing.speed_max = RGB_FUSION2_GPU_SPEED_FASTEST;
Flashing.speed = RGB_FUSION2_GPU_SPEED_NORMAL;
Flashing.color_mode = MODE_COLORS_PER_LED;
Flashing.brightness_min = RGB_FUSION2_GPU_BRIGHTNESS_MIN;
Flashing.brightness_max = RGB_FUSION2_GPU_BRIGHTNESS_MAX;
Flashing.brightness = RGB_FUSION2_GPU_BRIGHTNESS_MAX;
modes.push_back(Flashing);
mode DualFlashing;
DualFlashing.name = "Double Flash";
DualFlashing.value = RGB_FUSION2_GPU_MODE_DUAL_FLASHING;
DualFlashing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
DualFlashing.speed_min = RGB_FUSION2_GPU_SPEED_SLOWEST;
DualFlashing.speed_max = RGB_FUSION2_GPU_SPEED_FASTEST;
DualFlashing.speed = RGB_FUSION2_GPU_SPEED_NORMAL;
DualFlashing.color_mode = MODE_COLORS_PER_LED;
DualFlashing.brightness_min = RGB_FUSION2_GPU_BRIGHTNESS_MIN;
DualFlashing.brightness_max = RGB_FUSION2_GPU_BRIGHTNESS_MAX;
DualFlashing.brightness = RGB_FUSION2_GPU_BRIGHTNESS_MAX;
modes.push_back(DualFlashing);
mode SpectrumCycle;
SpectrumCycle.name = "Color Cycle";
SpectrumCycle.value = RGB_FUSION2_GPU_MODE_COLOR_CYCLE;
SpectrumCycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;;
SpectrumCycle.speed_min = RGB_FUSION2_GPU_SPEED_SLOWEST;
SpectrumCycle.speed_max = RGB_FUSION2_GPU_SPEED_FASTEST;
SpectrumCycle.speed = RGB_FUSION2_GPU_SPEED_NORMAL;
SpectrumCycle.color_mode = MODE_COLORS_NONE;
SpectrumCycle.brightness_min = RGB_FUSION2_GPU_BRIGHTNESS_MIN;
SpectrumCycle.brightness_max = RGB_FUSION2_GPU_BRIGHTNESS_MAX;
SpectrumCycle.brightness = RGB_FUSION2_GPU_BRIGHTNESS_MAX;
modes.push_back(SpectrumCycle);
mode Gradient;
Gradient.name = "Gradient";
Gradient.value = RGB_FUSION2_GPU_MODE_GRADIENT;
Gradient.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
Gradient.speed_min = RGB_FUSION2_GPU_SPEED_SLOWEST;
Gradient.speed_max = RGB_FUSION2_GPU_SPEED_FASTEST;
Gradient.speed = RGB_FUSION2_GPU_SPEED_NORMAL;
Gradient.color_mode = MODE_COLORS_PER_LED;
Gradient.brightness_min = RGB_FUSION2_GPU_BRIGHTNESS_MIN;
Gradient.brightness_max = RGB_FUSION2_GPU_BRIGHTNESS_MAX;
Gradient.brightness = RGB_FUSION2_GPU_BRIGHTNESS_MAX;
modes.push_back(Gradient);
mode Wave;
Wave.name = "Wave";
Wave.value = RGB_FUSION2_GPU_MODE_WAVE;
Wave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
Wave.speed_min = RGB_FUSION2_GPU_SPEED_SLOWEST;
Wave.speed_max = RGB_FUSION2_GPU_SPEED_FASTEST;
Wave.speed = RGB_FUSION2_GPU_SPEED_NORMAL;
Wave.color_mode = MODE_COLORS_NONE;
Wave.brightness_min = RGB_FUSION2_GPU_BRIGHTNESS_MIN;
Wave.brightness_max = RGB_FUSION2_GPU_BRIGHTNESS_MAX;
Wave.brightness = RGB_FUSION2_GPU_BRIGHTNESS_MAX;
modes.push_back(Wave);
mode Shift;
Shift.name = "Color Shift";
Shift.value = RGB_FUSION2_GPU_MODE_COLOR_SHIFT;
Shift.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
Shift.speed_min = RGB_FUSION2_GPU_SPEED_SLOWEST;
Shift.speed_max = RGB_FUSION2_GPU_SPEED_FASTEST;
Shift.speed = RGB_FUSION2_GPU_SPEED_NORMAL;
Shift.color_mode = MODE_COLORS_MODE_SPECIFIC;
Shift.colors_min = 1;
Shift.colors_max = 8;
Shift.colors.resize(8);
Shift.brightness_min = RGB_FUSION2_GPU_BRIGHTNESS_MIN;
Shift.brightness_max = RGB_FUSION2_GPU_BRIGHTNESS_MAX;
Shift.brightness = RGB_FUSION2_GPU_BRIGHTNESS_MAX;
modes.push_back(Shift);
mode Tricolor;
Tricolor.name = "Tricolor";
Tricolor.value = RGB_FUSION2_GPU_MODE_TRICOLOR;
Tricolor.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
Tricolor.speed_min = RGB_FUSION2_GPU_SPEED_SLOWEST;
Tricolor.speed_max = RGB_FUSION2_GPU_SPEED_FASTEST;
Tricolor.speed = RGB_FUSION2_GPU_SPEED_NORMAL;
Tricolor.color_mode = MODE_COLORS_MODE_SPECIFIC;
Tricolor.colors.resize(3);
Tricolor.brightness_min = RGB_FUSION2_GPU_BRIGHTNESS_MIN;
Tricolor.brightness_max = RGB_FUSION2_GPU_BRIGHTNESS_MAX;
Tricolor.brightness = RGB_FUSION2_GPU_BRIGHTNESS_MAX;
modes.push_back(Tricolor);
SetupZones();
}
RGBController_RGBFusion2GPU::~RGBController_RGBFusion2GPU()
{
delete controller;
}
uint8_t RGBController_RGBFusion2GPU::getModeIndex(uint8_t mode_value)
{
for (uint8_t mode_index = 0; mode_index < modes.size(); mode_index++)
{
if (modes[mode_index].value == mode_value)
{
return mode_index;
}
}
return 0;
}
void RGBController_RGBFusion2GPU::SetupZones()
{
/*---------------------------------------------------------*\
| This device only allows setting the entire zone for all |
| LED's in the zone and does not allow per LED control. |
\*---------------------------------------------------------*/
//controller->GetDeviceModes();
for(uint8_t zone_idx = 0; zone_idx < 4; zone_idx++)
{
if(controller->zone_led_count[zone_idx] > 0)
{
zone* new_zone = new zone();
led* new_led = new led();
new_zone->name = gigabyte_fusion2_gpu_zone[zone_idx];
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;
new_led->name = gigabyte_fusion2_gpu_zone[zone_idx];
/*---------------------------------------------------------*\
| Push the zone and LED on to device vectors |
\*---------------------------------------------------------*/
leds.push_back(*new_led);
zones.push_back(*new_zone);
zoneIndexMap.push_back(zone_idx);
}
}
SetupColors();
}
void RGBController_RGBFusion2GPU::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_RGBFusion2GPU::DeviceUpdateLEDs()
{
fusion2_config zone_config;
zone_config.brightness = modes[active_mode].brightness;
zone_config.speed = modes[active_mode].speed;
zone_config.direction = modes[active_mode].direction;
zone_config.numberOfColors = (uint8_t)modes[active_mode].colors.size();
for (uint8_t zone_idx = 0; zone_idx < zoneIndexMap.size(); zone_idx++)
{
zone_config.colors[0] = colors[zone_idx];
if (modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
{
for (uint8_t i = 0; i < zone_config.numberOfColors; i++)
{
zone_config.colors[i] = modes[active_mode].colors[i];
}
}
controller->SetZone(zoneIndexMap[zone_idx], modes[active_mode].value, zone_config);
}
}
void RGBController_RGBFusion2GPU::UpdateZoneLEDs(int zone)
{
DeviceUpdateLEDs();
}
void RGBController_RGBFusion2GPU::UpdateSingleLED(int led)
{
DeviceUpdateLEDs();
}
void RGBController_RGBFusion2GPU::SetCustomMode()
{
active_mode = 0;
}
void RGBController_RGBFusion2GPU::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}
void RGBController_RGBFusion2GPU::DeviceSaveMode()
{
controller->SaveConfig();
}
@@ -0,0 +1,39 @@
/*-----------------------------------------*\
| RGBController_GigabyteRGBFusion2GPU.h |
| |
| Generic RGB Interface for OpenRGB |
| Gigabyte RGB Fusion2 GPU Driver |
| |
| based on original by |
| Adam Honse (CalcProgrammer1) 2/23/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "GigabyteRGBFusion2GPUController.h"
class RGBController_RGBFusion2GPU : public RGBController
{
public:
RGBController_RGBFusion2GPU(RGBFusion2GPUController* controller_ptr);
~RGBController_RGBFusion2GPU();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
void DeviceSaveMode();
private:
uint8_t getModeIndex(uint8_t mode_value);
RGBFusion2GPUController* controller;
std::vector<uint8_t> zoneIndexMap;
};
@@ -26,6 +26,7 @@ typedef struct
json rgb_fusion_2_smbus_motherboards[] =
{
"B450 AORUS ELITE",
"B450 AORUS ELITE V2",
"B450 AORUS M",
"B450 AORUS PRO WIFI-CF",
"B450 AORUS PRO-CF",
@@ -40,15 +40,16 @@ static const gpu_pci_device device_list[] =
{ NVIDIA_VEN, NVIDIA_GTX1660S_DEV, GIGABYTE_SUB_VEN, GIGABYTE_GTX1660S_GAMING_OC_SUB_DEV, 0x47, "Gigabyte GTX1660 SUPER Gaming OC" },
{ NVIDIA_VEN, NVIDIA_RTX2060_TU106_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX2060_GAMING_OC_SUB_DEV, 0x47, "Gigabyte RTX2060 Gaming OC" },
{ NVIDIA_VEN, NVIDIA_RTX2060_TU106_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX2060_GAMING_OC_PRO_SUB_DEV, 0x47, "Gigabyte RTX2060 Gaming OC PRO" },
{ NVIDIA_VEN, NVIDIA_RTX2060_TU106_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX2060_GAMING_OC_PRO_SUB_DEV2, 0x47, "Gigabyte RTX2060 Gaming OC PRO V2" },
{ NVIDIA_VEN, NVIDIA_RTX2060_TU106_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX2060_GAMING_OC_PRO_WHITE_SUB_DEV, 0x47, "Gigabyte RTX2060 Gaming OC PRO White" },
{ NVIDIA_VEN, NVIDIA_RTX2060S_OC_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX2060S_GAMING_SUB_DEV, 0x47, "Gigabyte RTX2060 SUPER Gaming" },
{ NVIDIA_VEN, NVIDIA_RTX2060S_OC_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX2060S_GAMING_OC_SUB_DEV, 0x47, "Gigabyte RTX2060 SUPER Gaming OC" },
{ NVIDIA_VEN, NVIDIA_RTX2060S_OC_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX2060S_GAMING_OC_WHITE_SUB_DEV, 0x47, "Gigabyte RTX2060 SUPER Gaming OC 3X White 8G" },
{ NVIDIA_VEN, NVIDIA_RTX2070_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX2070_GAMING_OC_SUB_DEV, 0x47, "Gigabyte RTX2070 Gaming OC 8G" },
{ NVIDIA_VEN, NVIDIA_RTX2070_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX2070_WINDFORCE_SUB_DEV, 0x47, "Gigabyte RTX2070 Windforce 8G" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX2070S_GAMING_OC_SUB_DEV, 0x47, "Gigabyte RTX2070S Gaming OC" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX2070S_GAMING_OC_3X_SUB_DEV, 0x55, "Gigabyte RTX2070S Gaming OC 3X" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX2070S_GAMING_OC_3X_WHITE_SUB_DEV, 0x47, "Gigabyte RTX2070S Gaming OC 3X White" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_OC_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX2070S_GAMING_OC_SUB_DEV, 0x47, "Gigabyte RTX2070S Gaming OC" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_OC_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX2070S_GAMING_OC_3X_SUB_DEV, 0x55, "Gigabyte RTX2070S Gaming OC 3X" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_OC_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX2070S_GAMING_OC_3X_WHITE_SUB_DEV, 0x47, "Gigabyte RTX2070S Gaming OC 3X White" },
{ NVIDIA_VEN, NVIDIA_RTX2080_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX2080_GAMING_OC_SUB_DEV, 0x47, "Gigabyte RTX2080 Gaming OC 8G" },
{ NVIDIA_VEN, NVIDIA_RTX2080_A_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX2080_A_GAMING_OC_SUB_DEV, 0x47, "Gigabyte RTX2080 Gaming OC 8G" },
{ NVIDIA_VEN, NVIDIA_RTX2080S_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX2080S_GAMING_OC_SUB_DEV, 0x47, "Gigabyte RTX2080S Gaming OC 8G" },
@@ -60,10 +61,13 @@ static const gpu_pci_device device_list[] =
{ NVIDIA_VEN, NVIDIA_RTX3060TI_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX3060TI_GAMING_OC_PRO_SUB_DEV, 0x62, "Gigabyte RTX3060 Ti Gaming OC PRO 8G" },
{ NVIDIA_VEN, NVIDIA_RTX3060TI_LHR_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX3060TI_GAMING_OC_PRO_SUB_DEV, 0x62, "Gigabyte RTX3060 Ti Gaming OC PRO 8G LHR" },
{ NVIDIA_VEN, NVIDIA_RTX3070_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX3070_GAMING_OC_SUB_DEV, 0x62, "Gigabyte RTX3070 Gaming OC 8G" },
{ NVIDIA_VEN, NVIDIA_RTX3070_LHR_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX3070_GAMING_OC_SUB_DEV, 0x62, "Gigabyte RTX3070 Gaming OC 8G v3.0 LHR" },
{ NVIDIA_VEN, NVIDIA_RTX3070_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX3070_VISION_OC_SUB_DEV, 0x63, "Gigabyte RTX3070 Vision 8G" },
{ NVIDIA_VEN, NVIDIA_RTX3070TI_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX3070TI_GAMING_OC_SUB_DEV, 0x62, "Gigabyte RTX3070 Ti Gaming OC 8G" },
{ NVIDIA_VEN, NVIDIA_RTX3070TI_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX3070TI_EAGLE_SUB_DEV, 0x63, "Gigabyte RTX3070 Ti EAGLE 8G" },
{ NVIDIA_VEN, NVIDIA_RTX3070TI_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX3070TI_VISION_OC_SUB_DEV, 0x63, "Gigabyte RTX3070 Ti Vision OC 8G" },
{ NVIDIA_VEN, NVIDIA_RTX3080_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX3080_GAMING_OC_SUB_DEV, 0x62, "Gigabyte RTX3080 Gaming OC 10G" },
{ NVIDIA_VEN, NVIDIA_RTX3080_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX3080_VISION_OC_SUB_DEV, 0x63, "Gigabyte RTX3080 Vision OC 10G" },
{ NVIDIA_VEN, NVIDIA_RTX3080TI_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX3080TI_EAGLE_SUB_DEV, 0x63, "Gigabyte RTX3080 Ti EAGLE 12G" },
{ NVIDIA_VEN, NVIDIA_RTX3090_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX3090_GAMING_OC_24GB_SUB_DEV, 0x62, "Gigabyte RTX3090 Gaming OC 24G" },
};
@@ -112,9 +116,9 @@ bool TestForGigabyteRGBFusionGPUController(i2c_smbus_interface* bus, unsigned ch
res = bus->i2c_smbus_read_byte(address);
if ((res != 0x14) && (res != 0x10))
if ((res != 0x14)&& (res != 0x12) && (res != 0x10))
{
LOG_DEBUG("[%s] at 0x%02X address expected 0x14|0x10 but recieved: 0x%02X", GIGABYTEGPU_CONTROLLER_NAME, address, res);
LOG_DEBUG("[%s] at 0x%02X address expected 0x14|0x12|0x10 but recieved: 0x%02X", GIGABYTEGPU_CONTROLLER_NAME, address, res);
pass = false;
}
@@ -157,6 +161,7 @@ void DetectGigabyteRGBFusionGPUControllers(std::vector<i2c_smbus_interface*>& bu
busses[bus]->pci_subsystem_vendor == device_list[dev_idx].pci_subsystem_vendor &&
busses[bus]->pci_subsystem_device == device_list[dev_idx].pci_subsystem_device)
{
LOG_DEBUG(GPU_DETECT_MESSAGE, GIGABYTEGPU_CONTROLLER_NAME, bus, device_list[dev_idx].pci_device, device_list[dev_idx].pci_subsystem_device, device_list[dev_idx].name );
// Check for RGB Fusion controller
if (TestForGigabyteRGBFusionGPUController(busses[bus], device_list[dev_idx].controller_address))
{
@@ -15,12 +15,12 @@ using namespace std::chrono_literals;
#define NA 0xFFFFFFFF
static unsigned int matrix_map[6][23] =
{ { 0, NA, 12, 18, 23, 28, NA, 34, 39, 44, 50, NA, 55, 61, 65, 70, 77, 81, 86, NA, NA, NA, NA },
{ 1, 7, 13, 19, 24, 29, 35, 40, 45, 51, 56, NA, 62, 66, 71, NA, 78, 82, 87, 90, 95, 99, 104 },
{ 2, NA, 8, 14, 20, 25, NA, 30, 36, 41, 46, 52, 57, 63, 67, 72, 79, 83, 88, 91, 96, 100, 105 },
{ 3, NA, 9, 15, 21, 26, NA, 31, 37, 42, 47, 53, 58, 64, 68, 73, NA, NA, NA, 92, 97, 101, NA },
{ 4, 6, 10, 16, 22, 27, NA, 32, NA, 38, 43, 48, 54, 59, 74, NA, NA, 84, NA, 93, 98, 102, 106 },
{ 5, 11, 17, NA, NA, NA, NA, 33, NA, NA, NA, NA, 49, 60, 69, 76, 80, 85, 89, 94, NA, 103, NA } };
{ { 0, NA, 12, 18, 23, 28, NA, 34, 39, 44, 50, NA, 55, 61, 65, 71, 77, 81, 86, NA, NA, NA, NA },
{ 1, 7, 13, 19, 24, 29, 35, 40, 45, 51, 56, NA, 62, 66, 71, 72, 78, 82, 87, 90, 95, 99, 104 },
{ 2, NA, 8, 14, 20, 25, NA, 30, 36, 41, 46, 52, 57, 63, 67, 73, 79, 83, 88, 91, 96, 100, 105 },
{ 3, NA, 9, 15, 21, 26, NA, 31, 37, 42, 47, 53, 58, 64, 68, 74, NA, NA, NA, 92, 97, 101, NA },
{ 4, 6, 10, 16, 22, 27, NA, 32, NA, 38, 43, 48, 54, 59, 69, 75, NA, 84, NA, 93, 98, 102, 106 },
{ 5, 11, 17, NA, NA, NA, NA, 33, NA, NA, NA, NA, 49, 60, 70, 76, 80, 85, 89, 94, NA, 103, NA } };
static const char* zone_names[] =
{
@@ -6,6 +6,7 @@
#include "LogitechG560Controller.h"
#include "LogitechG933Controller.h"
#include "LogitechG810Controller.h"
#include "LogitechGProKeyboardController.h"
#include "LogitechG910Controller.h"
#include "LogitechG815Controller.h"
#include "LogitechG915Controller.h"
@@ -18,6 +19,7 @@
#include "RGBController_LogitechG560.h"
#include "RGBController_LogitechG933.h"
#include "RGBController_LogitechG810.h"
#include "RGBController_LogitechGProKeyboard.h"
#include "RGBController_LogitechG910.h"
#include "RGBController_LogitechG815.h"
#include "RGBController_LogitechG915.h"
@@ -53,8 +55,11 @@ using namespace std::chrono_literals;
#define LOGITECH_G815_PID 0xC33F
#define LOGITECH_G915_WIRED_PID 0xC33E
#define LOGITECH_G915_RECEIVER_PID 0xC541
#define LOGITECH_G915TKL_WIRED_PID 0xC343
#define LOGITECH_G915TKL_RECEIVER_PID 0xC545
#define LOGITECH_G910_ORION_SPARK_PID 0xC32B
#define LOGITECH_G910_PID 0xC335
#define LOGITECH_GPRO_KEYBOARD_1_PID 0xC339
/*-----------------------------------------------------*\
| Mouse product IDs |
@@ -72,6 +77,7 @@ using namespace std::chrono_literals;
#define LOGITECH_G703_HERO_LIGHTSPEED_PID 0xC090
#define LOGITECH_G900_LIGHTSPEED_PID 0xC081
#define LOGITECH_G903_LIGHTSPEED_PID 0xC086
#define LOGITECH_G903_LIGHTSPEED_HERO_PID 0xC091
#define LOGITECH_G_PRO_PID 0xC085
#define LOGITECH_G_PRO_HERO_PID 0xC08C
#define LOGITECH_G_PRO_WIRELESS_PID 0xC088
@@ -109,6 +115,7 @@ using namespace std::chrono_literals;
#define LOGITECH_G703_HERO_LIGHTSPEED_VIRTUAL_PID 0x4086
#define LOGITECH_G900_LIGHTSPEED_VIRTUAL_PID 0x4053
#define LOGITECH_G903_LIGHTSPEED_VIRTUAL_PID 0x4067
#define LOGITECH_G903_LIGHTSPEED_VIRTUAL_HERO_PID 0x4087
#define LOGITECH_G_PRO_WIRELESS_VIRTUAL_PID 0x4079
#define LOGITECH_POWERPLAY_MAT_VIRTUAL_PID 0x405F
@@ -323,11 +330,12 @@ void DetectLogitechKeyboardG815(hid_device_info* info, const std::string& name)
void DetectLogitechKeyboardG915(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
bool is_tkl = info->product_id == LOGITECH_G915TKL_RECEIVER_PID;
if(dev)
{
LogitechG915Controller* controller = new LogitechG915Controller(dev, false);
RGBController_LogitechG915* rgb_controller = new RGBController_LogitechG915(controller);
RGBController_LogitechG915* rgb_controller = new RGBController_LogitechG915(controller, is_tkl);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
@@ -336,16 +344,76 @@ void DetectLogitechKeyboardG915(hid_device_info* info, const std::string& name)
void DetectLogitechKeyboardG915Wired(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
bool is_tkl = info->product_id == LOGITECH_G915TKL_WIRED_PID;
if(dev)
{
LogitechG915Controller* controller = new LogitechG915Controller(dev, true);
RGBController_LogitechG915* rgb_controller = new RGBController_LogitechG915(controller);
RGBController_LogitechG915* rgb_controller = new RGBController_LogitechG915(controller, is_tkl);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
void DetectLogitechKeyboardGPro(hid_device_info* info, const std::string& name)
{
/*-------------------------------------------------------------------------------------------------*\
| Logitech keyboards use two different usages, one for 20-byte packets and one for 64-byte packets |
| Usage 0x0602 for 20 byte, usage 0x0604 for 64 byte, both are on usage page 0xFF43 |
\*-------------------------------------------------------------------------------------------------*/
#ifdef USE_HID_USAGE
hid_device* dev_usage_0x0602 = nullptr;
hid_device* dev_usage_0x0604 = nullptr;
hid_device_info* info_temp = info;
while(info_temp)
{
if(info_temp->vendor_id == info->vendor_id // constant LOGITECH_VID
&& info_temp->product_id == info->product_id // NON-constant
&& info_temp->interface_number == info->interface_number // constant 1
&& info_temp->usage_page == info->usage_page) // constant 0xFF43
{
if(info_temp->usage == 0x0602)
{
dev_usage_0x0602 = hid_open_path(info_temp->path);
}
else if(info_temp->usage == 0x0604)
{
dev_usage_0x0604 = hid_open_path(info_temp->path);
}
}
if(dev_usage_0x0602 && dev_usage_0x0604)
{
break;
}
info_temp = info_temp->next;
}
if(dev_usage_0x0602 && dev_usage_0x0604)
{
LogitechGProKeyboardController* controller = new LogitechGProKeyboardController(dev_usage_0x0602, dev_usage_0x0604);
RGBController_LogitechGProKeyboard* rgb_controller = new RGBController_LogitechGProKeyboard(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
else
{
// Not all of them could be opened, do some cleanup
hid_close(dev_usage_0x0602);
hid_close(dev_usage_0x0604);
}
#else
hid_device* dev = hid_open_path(info->path);
if(dev)
{
LogitechGProKeyboardController* controller = new LogitechGProKeyboardController(dev, dev);
RGBController_LogitechGProKeyboard* rgb_controller = new RGBController_LogitechGProKeyboard(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
#endif
}
/*-----------------------------------------------------*\
| Logitech Mice |
\*-----------------------------------------------------*/
@@ -456,7 +524,7 @@ static void addLogitechLightsyncMouse2zone(hid_device_info* info, const std::str
#else
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
LogitechGLightsyncController* controller = new LogitechGLightsyncController(dev, dev, info->path, hid_dev_index, hid_feature_index, hid_fctn_ase_id);
@@ -566,8 +634,11 @@ REGISTER_HID_DETECTOR_IP ("Logitech G813 RGB Mechanical Gaming Keyboard", Dete
REGISTER_HID_DETECTOR_IP ("Logitech G815 RGB Mechanical Gaming Keyboard", DetectLogitechKeyboardG815, LOGITECH_VID, LOGITECH_G815_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G910 Orion Spark", DetectLogitechKeyboardG910, LOGITECH_VID, LOGITECH_G910_ORION_SPARK_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G910 Orion Spectrum", DetectLogitechKeyboardG910, LOGITECH_VID, LOGITECH_G910_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G Pro RGB Mechanical Gaming Keyboard", DetectLogitechKeyboardGPro, LOGITECH_VID, LOGITECH_GPRO_KEYBOARD_1_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IPU("Logitech G915 Wireless RGB Mechanical Gaming Keyboard", DetectLogitechKeyboardG915, LOGITECH_VID, LOGITECH_G915_RECEIVER_PID, 2, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G915 Wireless RGB Mechanical Gaming Keyboard (Wired)", DetectLogitechKeyboardG915Wired, LOGITECH_VID, LOGITECH_G915_WIRED_PID, 2, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G915TKL Wireless RGB Mechanical Gaming Keyboard", DetectLogitechKeyboardG915, LOGITECH_VID, LOGITECH_G915TKL_RECEIVER_PID, 2, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G915TKL Wireless RGB Mechanical Gaming Keyboard (Wired)", DetectLogitechKeyboardG915Wired, LOGITECH_VID, LOGITECH_G915TKL_WIRED_PID, 2, 0xFF00, 2);
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
| Mice |
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
@@ -794,6 +865,7 @@ REGISTER_HID_DETECTOR_IPU("Logitech G703 Wireless Gaming Mouse",
REGISTER_HID_DETECTOR_IPU("Logitech G703 Hero Wireless Gaming Mouse", DetectLogitechWireless, LOGITECH_VID, LOGITECH_G703_HERO_LIGHTSPEED_VIRTUAL_PID, 2, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G900 Wireless Gaming Mouse", DetectLogitechWireless, LOGITECH_VID, LOGITECH_G900_LIGHTSPEED_VIRTUAL_PID, 2, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G903 Wireless Gaming Mouse", DetectLogitechWireless, LOGITECH_VID, LOGITECH_G903_LIGHTSPEED_VIRTUAL_PID, 2, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G903 Hero Wireless Gaming Mouse", DetectLogitechWireless, LOGITECH_VID, LOGITECH_G903_LIGHTSPEED_VIRTUAL_HERO_PID, 2, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G Pro Wireless Gaming Mouse", DetectLogitechWireless, LOGITECH_VID, LOGITECH_G_PRO_WIRELESS_VIRTUAL_PID, 2, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech Powerplay Mat", DetectLogitechWireless, LOGITECH_VID, LOGITECH_POWERPLAY_MAT_VIRTUAL_PID, 2, 0xFF00, 2);
@@ -812,5 +884,6 @@ REGISTER_HID_DETECTOR_IPU("Logitech G703 Wireless Gaming Mouse (wired)",
REGISTER_HID_DETECTOR_IPU("Logitech G703 Hero Wireless Gaming Mouse (wired)", DetectLogitechWired, LOGITECH_VID, LOGITECH_G703_HERO_LIGHTSPEED_PID, 1, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G900 Wireless Gaming Mouse (wired)", DetectLogitechWired, LOGITECH_VID, LOGITECH_G900_LIGHTSPEED_PID, 1, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G903 Wireless Gaming Mouse (wired)", DetectLogitechWired, LOGITECH_VID, LOGITECH_G903_LIGHTSPEED_PID, 1, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G903 Hero Wireless Gaming Mouse (wired)", DetectLogitechWired, LOGITECH_VID, LOGITECH_G903_LIGHTSPEED_HERO_PID, 1, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G Pro Wireless Gaming Mouse (wired)", DetectLogitechWired, LOGITECH_VID, LOGITECH_G_PRO_WIRELESS_PID, 2, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G733 Gaming Headset", DetectLogitechWired, LOGITECH_VID, LOGITECH_G733_PID, 2, 0xFF43, 514);
@@ -0,0 +1,186 @@
/*-----------------------------------------*\
| LogitechGProController.cpp |
| |
| Driver for Logitech G Pro |
| keyboard light controller |
| |
| sanchezzzs 20/10/2021 |
\*-----------------------------------------*/
#include "LogitechGProKeyboardController.h"
#include <cstring>
LogitechGProKeyboardController::LogitechGProKeyboardController(hid_device* dev_handle_0x11, hid_device* dev_handle_0x12)
{
dev_pkt_0x11 = dev_handle_0x11;
dev_pkt_0x12 = dev_handle_0x12;
}
LogitechGProKeyboardController::~LogitechGProKeyboardController()
{
hid_close(dev_pkt_0x11);
hid_close(dev_pkt_0x12);
}
std::string LogitechGProKeyboardController::GetSerialString()
{
wchar_t serial_string[128];
int ret = hid_get_serial_number_string(dev_pkt_0x11, serial_string, 128);
if(ret != 0)
{
return("");
}
std::wstring return_wstring = serial_string;
std::string return_string(return_wstring.begin(), return_wstring.end());
return(return_string);
}
void LogitechGProKeyboardController::Commit()
{
SendCommit();
}
void LogitechGProKeyboardController::SetDirect
(
unsigned char zone,
unsigned char frame_count,
unsigned char * frame_data
)
{
SendDirectFrame(zone, frame_count, frame_data);
}
void LogitechGProKeyboardController::SetMode
(
unsigned char mode,
unsigned short speed,
unsigned char red,
unsigned char green,
unsigned char blue
)
{
SendMode(LOGITECH_GPRO_ZONE_MODE_KEYBOARD, mode, speed, red, green, blue);
SendMode(LOGITECH_GPRO_ZONE_MODE_LOGO, mode, speed, red, green, blue);
SendCommit();
}
/*-------------------------------------------------------------------------------------------------*\
| Private packet sending functions. |
\*-------------------------------------------------------------------------------------------------*/
void LogitechGProKeyboardController::SendCommit()
{
char usb_buf[20];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Commit packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x11;
usb_buf[0x01] = 0xFF;
usb_buf[0x02] = 0x0C;
usb_buf[0x03] = 0x5D;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
hid_read(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
}
void LogitechGProKeyboardController::SendDirectFrame
(
unsigned char zone,
unsigned char frame_count,
unsigned char * frame_data
)
{
char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Lighting Control packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x12;
usb_buf[0x01] = 0xFF;
usb_buf[0x02] = 0x0C;
usb_buf[0x03] = 0x3D;
usb_buf[0x05] = zone;
usb_buf[0x07] = frame_count;
/*-----------------------------------------------------*\
| Copy in frame data |
\*-----------------------------------------------------*/
memcpy(&usb_buf[0x08], frame_data, frame_count * 4);
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev_pkt_0x12, (unsigned char *)usb_buf, 64);
hid_read(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
}
void LogitechGProKeyboardController::SendMode
(
unsigned char zone,
unsigned char mode,
unsigned short speed,
unsigned char red,
unsigned char green,
unsigned char blue
)
{
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] = 0x0D;
usb_buf[0x03] = 0x3D;
usb_buf[0x04] = zone;
usb_buf[0x05] = mode;
usb_buf[0x06] = red;
usb_buf[0x07] = green;
usb_buf[0x08] = blue;
speed = 100 * speed;
if(mode == LOGITECH_GPRO_MODE_CYCLE)
{
usb_buf[0x0B] = speed >> 8;
usb_buf[0x0C] = speed & 0xFF;
usb_buf[0x0D] = 0x64;
}
else if(mode == LOGITECH_GPRO_MODE_BREATHING)
{
usb_buf[0x09] = speed >> 8;
usb_buf[0x0A] = speed & 0xFF;
usb_buf[0x0C] = 0x64;
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
hid_read(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
}
@@ -0,0 +1,99 @@
/*-----------------------------------------*\
| LogitechGProController.h |
| |
| Definitions and types for Logitech G Pro |
| keyboard light controller |
| |
| sanchezzzs 20/10/2021 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
LOGITECH_GPRO_ZONE_MODE_KEYBOARD = 0x00,
LOGITECH_GPRO_ZONE_MODE_LOGO = 0x01,
};
enum
{
LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD = 0x01,
LOGITECH_GPRO_ZONE_DIRECT_MEDIA = 0x02,
LOGITECH_GPRO_ZONE_DIRECT_LOGO = 0x10,
LOGITECH_GPRO_ZONE_DIRECT_INDICATORS = 0x40,
};
enum
{
LOGITECH_GPRO_MODE_OFF = 0x00,
LOGITECH_GPRO_MODE_STATIC = 0x01,
LOGITECH_GPRO_MODE_BREATHING = 0x02,
LOGITECH_GPRO_MODE_CYCLE = 0x03,
LOGITECH_GPRO_MODE_WAVE = 0x04,
};
/*---------------------------------------------------------------------------------------------*\
| Speed is 1000 for fast and 20000 for slow. |
| Values are multiplied by 100 later to give lots of GUI steps. |
\*---------------------------------------------------------------------------------------------*/
enum
{
LOGITECH_GPRO_SPEED_SLOWEST = 0xC8, /* Slowest speed */
LOGITECH_GPRO_SPEED_NORMAL = 0x32, /* Normal speed */
LOGITECH_GPRO_SPEED_FASTEST = 0x0A, /* Fastest speed */
};
class LogitechGProKeyboardController
{
public:
LogitechGProKeyboardController(hid_device* dev_handle_0x11, hid_device* dev_handle_0x12);
~LogitechGProKeyboardController();
std::string GetSerialString();
void Commit();
void SetDirect
(
unsigned char zone,
unsigned char frame_count,
unsigned char * frame_data
);
void SetMode
(
unsigned char mode,
unsigned short speed,
unsigned char red,
unsigned char green,
unsigned char blue
);
private:
hid_device* dev_pkt_0x11;
hid_device* dev_pkt_0x12;
void SendDirectFrame
(
unsigned char zone,
unsigned char frame_count,
unsigned char * frame_data
);
void SendMode
(
unsigned char zone,
unsigned char mode,
unsigned short speed,
unsigned char red,
unsigned char green,
unsigned char blue
);
void SendCommit();
};
@@ -242,13 +242,21 @@ bool logitech_device::connected()
}
}
uint8_t logitech_device::getLEDinfo()
uint8_t logitech_device::getLED_count()
{
return leds.size();
}
logitech_led logitech_device::getLED_info(uint8_t LED_num)
{
/*-----------------------------------------------------------------*\
| Get all info about the LEDs and Zones |
\*-----------------------------------------------------------------*/
return leds.size();
if(!(LED_num < 0 || LED_num > leds.size()))
{
return leds[LED_num];
}
}
void logitech_device::flushReadQueue()
@@ -331,6 +339,29 @@ uint8_t logitech_device::getFeatureIndex(uint16_t feature_page)
return feature_index;
}
uint16_t logitech_device::getFeaturePage(uint8_t feature_index)
{
/*-----------------------------------------------------------------*\
| Get the feature page from the feature_list |
| Return the mapped feature page given the feature index |
| for this device or else return 0 |
\*-----------------------------------------------------------------*/
rvrse_features rvrse_feature_list = reverse_map(feature_list);
rvrse_features::iterator find_page = rvrse_feature_list.find(feature_index);
if (find_page == rvrse_feature_list.end())
{
LOG_DEBUG("[%s] Feature index %02X not found!", device_name.c_str(), feature_index);
//TODO: Handle cache miss
return 0;
}
else
{
return find_page->second;
}
}
int logitech_device::getDeviceFeatureList()
{
int result = 0;
@@ -454,6 +485,7 @@ void logitech_device::getRGBconfig()
| Then use it to get the name for this device |
\*-----------------------------------------------------------------*/
hid_device* dev_use2 = getDevice(2);
uint16_t feature_page = getFeaturePage(RGB_feature_index);
uint8_t led_response = 0;
uint8_t led_counter = 0;
@@ -469,40 +501,130 @@ void logitech_device::getRGBconfig()
longFAPrequest get_count;
get_count.init(device_index, RGB_feature_index, LOGITECH_CMD_RGB_EFFECTS_GET_COUNT);
result = hid_write(dev_use2, get_count.buffer, get_count.size());
do
if(feature_page == LOGITECH_HIDPP_PAGE_RGB_EFFECTS1)
{
result = hid_read_timeout(dev_use2, response.buffer, response.size(), LOGITECH_PROTOCOL_TIMEOUT);
LOG_DEBUG("[%s] LED Count - %02X : %04X %04X %04X %04X %02X %02X %02X %02X %02X %02X %02X", device_name.c_str(),
response.data[0], (response.data[1] << 8 | response.data[2]), (response.data[3] << 8 | response.data[4]), (response.data[5] << 8 | response.data[6]),
(response.data[7] << 8 | response.data[8]), response.data[9], response.data[10], response.data[11], response.data[12], response.data[13], response.data[14], response.data[15]);
} while ((result == 20) && (get_count.feature_index != response.feature_index) && (get_count.feature_command != response.feature_command));
result = hid_write(dev_use2, get_count.buffer, get_count.size());
do
{
result = hid_read_timeout(dev_use2, response.buffer, response.size(), LOGITECH_PROTOCOL_TIMEOUT);
LOG_DEBUG("[%s] FP8070 - LED Count - %02X : %04X %04X %04X %04X %02X %02X %02X %02X %02X %02X %02X", device_name.c_str(),
response.data[0], (response.data[1] << 8 | response.data[2]), (response.data[3] << 8 | response.data[4]), (response.data[5] << 8 | response.data[6]),
(response.data[7] << 8 | response.data[8]), response.data[9], response.data[10], response.data[11], response.data[12], response.data[13], response.data[14], response.data[15]);
} while ((result == 20) && (get_count.feature_index != response.feature_index) && (get_count.feature_command != response.feature_command));
led_response = response.data[0];
led_response = response.data[0];
get_count.feature_command = LOGITECH_CMD_RGB_EFFECTS_GET_INFO;
do
get_count.feature_command = LOGITECH_CMD_RGB_EFFECTS_GET_INFO;
for(size_t i = 0; i < led_response; i++)
{
get_count.data[0] = i;
result = hid_write(dev_use2, get_count.buffer, get_count.size());
result = hid_read_timeout(dev_use2, response.buffer, response.size(), LOGITECH_PROTOCOL_TIMEOUT);
LOG_DEBUG("[%s] FP8070 - LED %02i - %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X", device_name.c_str(), get_count.data[0],
response.data[0], response.data[1], response.data[2], response.data[3], response.data[4], response.data[5], response.data[6], response.data[7],
response.data[8], response.data[9], response.data[10], response.data[11], response.data[12], response.data[13], response.data[14], response.data[15]);
if( result == 20 &&
get_count.feature_index == response.feature_index &&
get_count.feature_command == response.feature_command &&
response.data[0] != 0x10 &&
response.data[1] != 0x02
)
{
//If the response is the correct length (i.e. no USB error) and is for the RGB_feature_index and LOGITECH_CMD_RGB_EFFECTS_GET_INFO and no error occured with the led_counter then bump the counter
logitech_led new_led;
new_led.location = response.data[1] << 8 | response.data[2];
new_led.fx_count = response.data[3];
for(uint8_t i = 0; i < new_led.fx_count; i++)
{
blankFAPmessage fx_response;
fx_response.init();
longFAPrequest get_effect;
get_effect.init(device_index, RGB_feature_index, LOGITECH_CMD_RGB_EFFECTS_GET_CONTROL);
get_effect.data[0] = get_count.data[0];
get_effect.data[1] = i;
result = hid_write(dev_use2, get_effect.buffer, get_effect.size());
result = hid_read_timeout(dev_use2, fx_response.buffer, fx_response.size(), LOGITECH_PROTOCOL_TIMEOUT);
LOG_DEBUG("[%s] FP8070 - LED %02i Effect %02X - %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X", device_name.c_str(), get_count.data[0], i,
fx_response.data[0], fx_response.data[1], fx_response.data[2], fx_response.data[3], fx_response.data[4], fx_response.data[5], fx_response.data[6], fx_response.data[7],
fx_response.data[8], fx_response.data[9], fx_response.data[10], fx_response.data[11], fx_response.data[12], fx_response.data[13], fx_response.data[14], fx_response.data[15]);
logitech_fx new_fx;
new_fx.index = i;
new_fx.mode = static_cast<LOGITECH_DEVICE_MODE>(fx_response.data[2] << 8 | fx_response.data[3]);
new_fx.speed = fx_response.data[6] << 8 | fx_response.data[7];
new_led.fx.push_back(new_fx);
}
leds.emplace(response.data[0], new_led);
}
}
}
else if(feature_page == LOGITECH_HIDPP_PAGE_RGB_EFFECTS2)
{
//TODO: Push this info into a vector for later enumeration by the RGBController
get_count.data[0] = leds.size();
get_count.data[0] = 0xFF;
get_count.data[1] = 0xFF;
get_count.data[2] = 0;
get_count.data[3] = 0;
get_count.data[4] = 0;
result = hid_write(dev_use2, get_count.buffer, get_count.size());
result = hid_read_timeout(dev_use2, response.buffer, response.size(), LOGITECH_PROTOCOL_TIMEOUT);
LOG_DEBUG("[%s] LED %02i - %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X", device_name.c_str(), led_counter,
response.data[0], response.data[1], response.data[2], response.data[3], response.data[4], response.data[5], response.data[6], response.data[7],
response.data[8], response.data[9], response.data[10], response.data[11], response.data[12], response.data[13], response.data[14], response.data[15]);
if(result == 20 && get_count.feature_index == response.feature_index && get_count.feature_command == response.feature_command && response.data[0] != 0x10 && response.data[1] != 0x02)
LOG_DEBUG("[%s] FP8071 - LED Count - %02X : %02X %02X %04X %04X %04X %02X %02X %02X %02X %02X %02X %02X", device_name.c_str(),
response.data[2], response.data[0], response.data[1], (response.data[3] << 8 | response.data[4]), (response.data[5] << 8 | response.data[6]),
(response.data[7] << 8 | response.data[8]), response.data[9], response.data[10], response.data[11], response.data[12], response.data[13], response.data[14], response.data[15]);
led_response = response.data[2];
for(size_t i = 0; i < led_response; i++)
{
//If the response is the correct length (i.e. no USB error) and is for the RGB_feature_index and LOGITECH_CMD_RGB_EFFECTS_GET_INFO and no error occured with the led_counter then bump the counter
get_count.data[0] = i;
get_count.data[1] = 0xFF;
get_count.data[2] = 0;
result = hid_write(dev_use2, get_count.buffer, get_count.size());
result = hid_read_timeout(dev_use2, response.buffer, response.size(), LOGITECH_PROTOCOL_TIMEOUT);
LOG_DEBUG("[%s] FP8071 - LED %02i - %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X", device_name.c_str(), led_counter,
response.data[0], response.data[1], response.data[2], response.data[3], response.data[4], response.data[5], response.data[6], response.data[7],
response.data[8], response.data[9], response.data[10], response.data[11], response.data[12], response.data[13], response.data[14], response.data[15]);
logitech_led new_led;
new_led.value = response.data[0];
new_led.param1 = response.data[1];
new_led.param2 = response.data[2];
new_led.param3 = response.data[3];
new_led.location = response.data[2] << 8 | response.data[3];
new_led.fx_count = response.data[4];
leds.push_back(new_led);
for(uint8_t i = 0; i < new_led.fx_count; i++)
{
blankFAPmessage fx_response;
fx_response.init();
longFAPrequest get_effect;
get_effect.init(device_index, RGB_feature_index, LOGITECH_CMD_RGB_EFFECTS_GET_INFO);
get_effect.data[0] = get_count.data[0];
get_effect.data[1] = i;
result = hid_write(dev_use2, get_effect.buffer, get_effect.size());
result = hid_read_timeout(dev_use2, fx_response.buffer, fx_response.size(), LOGITECH_PROTOCOL_TIMEOUT);
LOG_DEBUG("[%s] FP8071 - LED %02i Effect %02X - %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X", device_name.c_str(), get_count.data[0], i,
fx_response.data[0], fx_response.data[1], fx_response.data[2], fx_response.data[3], fx_response.data[4], fx_response.data[5], fx_response.data[6], fx_response.data[7],
fx_response.data[8], fx_response.data[9], fx_response.data[10], fx_response.data[11], fx_response.data[12], fx_response.data[13], fx_response.data[14], fx_response.data[15]);
logitech_fx new_fx;
new_fx.index = i;
new_fx.mode = static_cast<LOGITECH_DEVICE_MODE>(fx_response.data[2] << 8 | fx_response.data[3]);
new_fx.speed = fx_response.data[6] << 8 | fx_response.data[7];
new_led.fx.push_back(new_fx);
}
leds.emplace(response.data[0], new_led);
}
} while ((result == 20) && (get_count.feature_index == response.feature_index) && (get_count.feature_command == response.feature_command) && (response.data[0] != 0x10) && (response.data[1] != 0x02));
}
/*get_count.feature_command = LOGITECH_CMD_RGB_EFFECTS_GET_STATE;
for(std::size_t i = 0; i < feature_count; i++ )
@@ -575,13 +697,13 @@ uint8_t logitech_device::setDirectMode(bool direct)
uint8_t logitech_device::setMode(uint8_t mode, uint16_t speed, uint8_t zone, uint8_t red, uint8_t green, uint8_t blue, uint8_t brightness, bool bright_cycle_swap)
{
int result = 0;
/*-----------------------------------------------------------------*\
| Check the usage map for usage2 (0x11 Long FAP Message) then |
| set the device mode via LOGITECH_CMD_RGB_EFFECTS_SET_CONTROL |
\*-----------------------------------------------------------------*/
hid_device* dev_use2 = getDevice(2);
hid_device* dev_use2 = getDevice(2);
uint16_t feature_page = getFeaturePage(RGB_feature_index);
int result = 0;
if(dev_use2)
{
@@ -595,7 +717,7 @@ uint8_t logitech_device::setMode(uint8_t mode, uint16_t speed, uint8_t zone, uin
| Set the mode via the RGB_feature_index |
\*-----------------------------------------------------------------*/
longFAPrequest set_mode;
set_mode.init(device_index, RGB_feature_index, LOGITECH_CMD_RGB_EFFECTS_SET_CONTROL);
set_mode.init(device_index, RGB_feature_index, ((feature_page == LOGITECH_HIDPP_PAGE_RGB_EFFECTS1) ? LOGITECH_CMD_RGB_EFFECTS_SET_CONTROL : LOGITECH_CMD_RGB_EFFECTS_GET_INFO));
set_mode.data[0] = zone;
set_mode.data[1] = mode;
@@ -606,9 +728,10 @@ uint8_t logitech_device::setMode(uint8_t mode, uint16_t speed, uint8_t zone, uin
speed *= 100;
if(mode == 1) //Static
{
set_mode.data[5] = zone;
set_mode.data[5] = 0x02; //zone;
//set_mode.data[12] = 0x01; //Save to flash testing
}
else if(mode == 2) //Spectrum Cycle
else if(mode == 2) //Spectrum Cycle - LOGITECH_DEVICE_LED_SPECTRUM
{
if(bright_cycle_swap)
{
@@ -618,7 +741,7 @@ uint8_t logitech_device::setMode(uint8_t mode, uint16_t speed, uint8_t zone, uin
set_mode.data[8] = speed & 0xFF;
set_mode.data[9] = brightness;
}
else if(mode == 3) //Breathing
else if(mode == 3) //Breathing - LOGITECH_DEVICE_LED_BREATHING
{
if(bright_cycle_swap)
{
@@ -626,6 +749,7 @@ uint8_t logitech_device::setMode(uint8_t mode, uint16_t speed, uint8_t zone, uin
}
set_mode.data[5] = speed >> 8;
set_mode.data[6] = speed & 0xFF;
//set_mode.data[7] = curve_type; //Value 0-6: Default, Sine, Square, Triangle, Sawtooth, Reverse_Sawtooth, Exponent
set_mode.data[8] = brightness;
}
@@ -54,15 +54,35 @@
enum LOGITECH_DEVICE_TYPE
{
LOGITECH_DEVICE_TYPE_KEYBOARD = 0,
LOGITECH_DEVICE_TYPE_REMOTECONTROL =1,
LOGITECH_DEVICE_TYPE_NUMPAD = 2,
LOGITECH_DEVICE_TYPE_MOUSE = 3,
LOGITECH_DEVICE_TYPE_MOUSEPAD = 4,
LOGITECH_DEVICE_TYPE_TRACKBALL = 5,
LOGITECH_DEVICE_TYPE_PRESENTER = 6,
LOGITECH_DEVICE_TYPE_RECEIVER = 7,
LOGITECH_DEVICE_TYPE_HEADSET = 8
LOGITECH_DEVICE_TYPE_KEYBOARD = 0,
LOGITECH_DEVICE_TYPE_REMOTECONTROL = 1,
LOGITECH_DEVICE_TYPE_NUMPAD = 2,
LOGITECH_DEVICE_TYPE_MOUSE = 3,
LOGITECH_DEVICE_TYPE_MOUSEPAD = 4,
LOGITECH_DEVICE_TYPE_TRACKBALL = 5,
LOGITECH_DEVICE_TYPE_PRESENTER = 6,
LOGITECH_DEVICE_TYPE_RECEIVER = 7,
LOGITECH_DEVICE_TYPE_HEADSET = 8
};
enum LOGITECH_DEVICE_MODE
{
LOGITECH_DEVICE_LED_OFF = 0x0000,
LOGITECH_DEVICE_LED_ON = 0x0001,
LOGITECH_DEVICE_LED_SPECTRUM = 0x0003,
LOGITECH_DEVICE_LED_WAVE = 0x0004,
LOGITECH_DEVICE_LED_STAR = 0x0005,
LOGITECH_DEVICE_LED_BREATHING = 0x000A,
LOGITECH_DEVICE_LED_RIPPLE = 0x000B,
LOGITECH_DEVICE_LED_CUSTOM = 0x000C
};
static const char* logitech_led_locations[] = {
"Unknown",
"Primary",
"Logo",
"Left",
"Right"
};
// Used for: {GET,SET}_REGISTER_{REQ,RSP}, SET_LONG_REGISTER_RSP, GET_LONG_REGISTER_REQ
@@ -175,17 +195,39 @@ union blankFAPmessage
};
};
struct logitech_led
template<typename K, typename V>
static std::map<V, K> reverse_map(const std::map<K, V>& map)
{
uint8_t value;
uint8_t param1;
uint8_t param2;
uint8_t param3;
std::map<V, K> reversed_map;
for(const std::pair<K, V>& entry : map)
{
reversed_map[entry.second] = entry.first;
}
return reversed_map;
}
struct logitech_fx
{
uint8_t index;
uint16_t speed; //period
LOGITECH_DEVICE_MODE mode;
};
typedef std::map<uint8_t, hid_device*> usages;
typedef std::map<uint16_t, uint8_t> features;
typedef std::map<uint16_t, uint8_t> wireless_map;
typedef std::map<uint8_t, hid_device*> usages;
typedef std::map<uint16_t, uint8_t> features;
typedef std::map<uint8_t, uint16_t> rvrse_features;
typedef std::map<uint16_t, uint8_t> wireless_map;
typedef std::vector<logitech_fx> leds_fx;
struct logitech_led
{
uint16_t location;
uint8_t fx_count;
leds_fx fx;
};
int getWirelessDevice(usages _usages, uint16_t pid, wireless_map *wireless_devices); //Helper function needed outside of class
@@ -215,15 +257,17 @@ public:
bool is_valid();
void flushReadQueue();
uint8_t getFeatureIndex(uint16_t feature_page);
uint8_t getLEDinfo();
uint8_t getLED_count();
logitech_led getLED_info(uint8_t LED_num);
uint8_t setDirectMode(bool direct);
uint8_t setMode(uint8_t mode, uint16_t speed, uint8_t zone, uint8_t red, uint8_t green, uint8_t blue, uint8_t brightness, bool bright_cycle_swap);
int getDeviceName();
private:
std::vector<logitech_led> leds;
std::map<uint8_t, logitech_led> leds;
std::shared_ptr<std::mutex> mutex;
hid_device* getDevice(uint8_t usage_index);
uint16_t getFeaturePage(uint8_t feature_index);
int getDeviceFeatureList();
void getRGBconfig();
void initialiseDevice();
@@ -17,13 +17,22 @@ const size_t max_key_per_color = 13;
const size_t data_size = 16;
static unsigned int matrix_map[7][27] =
{ { 110, NA, NA, NA, NA, NA, NA, NA, NA, NA, 111, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA },
{ NA, NA, 37, NA, 54, 55, 56, 57, NA, 58, 59, 60, 61, NA, 62, 63, 64, 65, NA, 66, 67, 68, NA, 106, 107, 108, 109 },
{ 112, NA, 49, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, NA, 41, 42, 38, NA, NA, 69, 70, 71, NA, 79, 80, 81, 82 },
{ 113, NA, 39, NA, 16, 22, 4, 17, NA, 19, 24, 20, 8, 14, 15, 43, 44, 45, NA, 72, 73, 74, NA, 91, 92, 93, 83 },
{ 114, NA, 53, NA, 0, 18, 3, 5, NA, 6, 7, 9, 10, 11, 47, 48, 46, 36, NA, NA, NA, NA, NA, 88, 89, 90, NA },
{ 115, NA, 99, 96, 25, 23, 2, 21, NA, 1, NA, 13, 12, 50, 51, 52, 103, NA, NA, NA, 78, NA, NA, 85, 86, 87, 84 },
{ 116, NA, 98, 101, 100, NA, NA, NA, NA, 40, NA, NA, NA, NA, 104, 105, 97, 102, NA, 76, 77, 75, NA, 94, NA, 95, NA } };
{ { 93, NA, NA, NA, NA, NA, NA, NA, NA, NA, 94, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA },
{ NA, NA, 37, NA, 54, 55, 56, 57, NA, 58, 59, 60, 61, NA, 62, 63, 64, 65, NA, 66, 67, 68, NA, 89, 90, 91, 92 },
{ 112, NA, 49, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, NA, 41, 42, 38, NA, NA, 69, 70, 71, NA, 95, 96, 97, 98 },
{ 113, NA, 39, NA, 16, 22, 4, 17, NA, 19, 24, 20, 8, 14, 15, 43, 44, 45, NA, 72, 73, 74, NA, 107, 108, 109, 99 },
{ 114, NA, 53, NA, 0, 18, 3, 5, NA, 6, 7, 9, 10, 11, 47, 48, 46, 36, NA, NA, NA, NA, NA, 104, 105, 106, NA },
{ 115, NA, 82, 79, 25, 23, 2, 21, NA, 1, NA, 13, 12, 50, 51, 52, 86, NA, NA, NA, 78, NA, NA, 101, 102, 103, 100 },
{ 116, NA, 81, 84, 83, NA, NA, NA, NA, 40, NA, NA, NA, NA, 87, 88, 80, 85, NA, 76, 77, 75, NA, 110, NA, 111, NA } };
static unsigned int matrix_map_tkl[7][20] =
{ { 93, NA, NA, NA, NA, 94, NA, NA, NA, NA, NA, NA, 89, 90, 91, 92, NA, NA, NA, NA },
{ 37, NA, 54, 55, 56, 57, NA, 58, 59, 60, 61, NA, 62, 63, 64, 65, NA, 66, 67, 68 },
{ 49, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, NA, 41, 42, 38, NA, NA, 69, 70, 71 },
{ 39, NA, 16, 22, 4, 17, NA, 19, 24, 20, 8, 14, 15, 43, 44, 45, NA, 72, 73, 74 },
{ 53, NA, 0, 18, 3, 5, NA, 6, 7, 9, 10, 11, 47, 48, 46, 36, NA, NA, NA, NA },
{ 82, 79, 25, 23, 2, 21, NA, 1, NA, 13, 12, 50, 51, 52, 86, NA, NA, NA, 78, NA },
{ 81, 84, 83, NA, NA, NA, NA, 40, NA, NA, NA, NA, 87, 88, 80, 85, NA, 76, 77, 75 } };
static const char* zone_names[] =
{
@@ -35,6 +44,9 @@ static zone_type zone_types[] =
ZONE_TYPE_MATRIX,
};
static const unsigned int tkl_led_count = 95;
static const unsigned int full_led_count = 117;
static const unsigned int zone_sizes[] =
{
117,
@@ -129,7 +141,23 @@ static const led_type led_names[] =
{ "Key: Left Arrow", LOGITECH_G915_ZONE_DIRECT_KEYBOARD, 0x50 },
{ "Key: Down Arrow", LOGITECH_G915_ZONE_DIRECT_KEYBOARD, 0x51 },
{ "Key: Up Arrow", LOGITECH_G915_ZONE_DIRECT_KEYBOARD, 0x52 },
{ "Key: Num Lock", LOGITECH_G915_ZONE_DIRECT_KEYBOARD, 0x53 },
{ "Key: \\ (ISO)", LOGITECH_G915_ZONE_DIRECT_KEYBOARD, 0x64 },//ISO only
{ "Key: Menu", LOGITECH_G915_ZONE_DIRECT_KEYBOARD, 0x65 },
{ "Key: Left Control", LOGITECH_G915_ZONE_MODE_MODIFIERS, 0xE0 },
{ "Key: Left Shift", LOGITECH_G915_ZONE_MODE_MODIFIERS, 0xE1 },
{ "Key: Left Alt", LOGITECH_G915_ZONE_MODE_MODIFIERS, 0xE2 },
{ "Key: Left Windows", LOGITECH_G915_ZONE_MODE_MODIFIERS, 0xE3 },
{ "Key: Right Control", LOGITECH_G915_ZONE_MODE_MODIFIERS, 0xE4 },
{ "Key: Right Shift", LOGITECH_G915_ZONE_MODE_MODIFIERS, 0xE5 },
{ "Key: Right Alt", LOGITECH_G915_ZONE_MODE_MODIFIERS, 0xE6 },
{ "Key: Right Windows", LOGITECH_G915_ZONE_MODE_MODIFIERS, 0xE7 },
{ "Key: Media Previous", LOGITECH_G915_ZONE_DIRECT_MEDIA, 0x9E },
{ "Key: Media Play/Pause", LOGITECH_G915_ZONE_DIRECT_MEDIA, 0x9B },
{ "Key: Media Next", LOGITECH_G915_ZONE_DIRECT_MEDIA, 0x9D },
{ "Key: Media Mute", LOGITECH_G915_ZONE_DIRECT_MEDIA, 0x9C },
{ "Logo", LOGITECH_G915_ZONE_DIRECT_LOGO, 0x01 },
{ "Key: Brightness", LOGITECH_G915_ZONE_DIRECT_INDICATORS, 0x99 },
{ "Key: Num Lock", LOGITECH_G915_ZONE_DIRECT_KEYBOARD, 0x53 }, // First Non-TKL Key
{ "Key: Number Pad /", LOGITECH_G915_ZONE_DIRECT_KEYBOARD, 0x54 },
{ "Key: Number Pad *", LOGITECH_G915_ZONE_DIRECT_KEYBOARD, 0x55 },
{ "Key: Number Pad -", LOGITECH_G915_ZONE_DIRECT_KEYBOARD, 0x56 },
@@ -146,22 +174,6 @@ static const led_type led_names[] =
{ "Key: Number Pad 9", LOGITECH_G915_ZONE_DIRECT_KEYBOARD, 0x61 },
{ "Key: Number Pad 0", LOGITECH_G915_ZONE_DIRECT_KEYBOARD, 0x62 },
{ "Key: Number Pad .", LOGITECH_G915_ZONE_DIRECT_KEYBOARD, 0x63 },
{ "Key: \\ (ISO)", LOGITECH_G915_ZONE_DIRECT_KEYBOARD, 0x64 },//ISO only
{ "Key: Menu", LOGITECH_G915_ZONE_DIRECT_KEYBOARD, 0x65 },
{ "Key: Left Control", LOGITECH_G915_ZONE_MODE_MODIFIERS, 0xE0 },
{ "Key: Left Shift", LOGITECH_G915_ZONE_MODE_MODIFIERS, 0xE1 },
{ "Key: Left Alt", LOGITECH_G915_ZONE_MODE_MODIFIERS, 0xE2 },
{ "Key: Left Windows", LOGITECH_G915_ZONE_MODE_MODIFIERS, 0xE3 },
{ "Key: Right Control", LOGITECH_G915_ZONE_MODE_MODIFIERS, 0xE4 },
{ "Key: Right Shift", LOGITECH_G915_ZONE_MODE_MODIFIERS, 0xE5 },
{ "Key: Right Alt", LOGITECH_G915_ZONE_MODE_MODIFIERS, 0xE6 },
{ "Key: Right Windows", LOGITECH_G915_ZONE_MODE_MODIFIERS, 0xE7 },
{ "Key: Media Previous", LOGITECH_G915_ZONE_DIRECT_MEDIA, 0x9E },
{ "Key: Media Play/Pause", LOGITECH_G915_ZONE_DIRECT_MEDIA, 0x9B },
{ "Key: Media Next", LOGITECH_G915_ZONE_DIRECT_MEDIA, 0x9D },
{ "Key: Media Mute", LOGITECH_G915_ZONE_DIRECT_MEDIA, 0x9C },
{ "Logo", LOGITECH_G915_ZONE_DIRECT_LOGO, 0x01 },
{ "Lighting", LOGITECH_G915_ZONE_DIRECT_INDICATORS, 0x99 },
{ "Key: G1", LOGITECH_G915_ZONE_MODE_GKEYS, 0x01 },
{ "Key: G2", LOGITECH_G915_ZONE_MODE_GKEYS, 0x02 },
{ "Key: G3", LOGITECH_G915_ZONE_MODE_GKEYS, 0x03 },
@@ -169,15 +181,24 @@ static const led_type led_names[] =
{ "Key: G5", LOGITECH_G915_ZONE_MODE_GKEYS, 0x05 },
};
RGBController_LogitechG915::RGBController_LogitechG915(LogitechG915Controller* logitech_ptr)
RGBController_LogitechG915::RGBController_LogitechG915(LogitechG915Controller* logitech_ptr, bool tkl)
{
logitech = logitech_ptr;
is_tkl = tkl;
name = "Logitech G915 Keyboard Device";
vendor = "Logitech";
type = DEVICE_TYPE_KEYBOARD;
description = "Logitech G915 Keyboard Device";
serial = logitech->GetSerialString();
if(is_tkl)
{
name = "Logitech G915TKL Keyboard Device";
}
else
{
name = "Logitech G915 Keyboard Device";
}
description = name;
logitech = logitech_ptr;
vendor = "Logitech";
type = DEVICE_TYPE_KEYBOARD;
serial = logitech->GetSerialString();
mode Direct;
Direct.name = "Direct";
@@ -249,22 +270,32 @@ void RGBController_LogitechG915::SetupZones()
/*---------------------------------------------------------*\
| Set up zones |
\*---------------------------------------------------------*/
unsigned int total_led_count = 0;
for(unsigned int zone_idx = 0; zone_idx < 1; zone_idx++)
{
zone new_zone;
new_zone.name = zone_names[zone_idx];
new_zone.type = zone_types[zone_idx];
new_zone.leds_min = zone_sizes[zone_idx];
new_zone.leds_max = zone_sizes[zone_idx];
new_zone.leds_count = zone_sizes[zone_idx];
new_zone.leds_count = (is_tkl) ? tkl_led_count : full_led_count;
new_zone.leds_min = new_zone.leds_count;
new_zone.leds_max = new_zone.leds_count;
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 = 27;
new_zone.matrix_map->map = (unsigned int *)&matrix_map;
if(is_tkl)
{
new_zone.matrix_map->map = (unsigned int *)&matrix_map_tkl;
new_zone.matrix_map->height = 7;
new_zone.matrix_map->width = 20;
}
else
{
new_zone.matrix_map->map = (unsigned int *)&matrix_map;
new_zone.matrix_map->height = 7;
new_zone.matrix_map->width = 27;
}
}
else
{
@@ -273,7 +304,7 @@ void RGBController_LogitechG915::SetupZones()
zones.push_back(new_zone);
total_led_count += zone_sizes[zone_idx];
total_led_count += new_zone.leds_count;
}
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
@@ -14,13 +14,13 @@
class RGBController_LogitechG915 : public RGBController
{
public:
RGBController_LogitechG915(LogitechG915Controller* logitech_ptr);
RGBController_LogitechG915(LogitechG915Controller* logitech_ptr, bool tkl);
~RGBController_LogitechG915();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
@@ -29,6 +29,8 @@ public:
void DeviceUpdateMode();
private:
bool is_tkl;
LogitechG915Controller* logitech;
std::vector<RGBColor> current_colors;
};
@@ -0,0 +1,370 @@
/*-----------------------------------------*\
| RGBController_LogitechGPro.cpp |
| |
| Generic RGB Interface for Logitech G Pro |
| Keyboard |
| |
| sanchezzzs 20/10/2021 |
\*-----------------------------------------*/
#include "RGBController_LogitechGProKeyboard.h"
//0xFFFFFFFF indicates an unused entry in matrix
#define NA 0xFFFFFFFF
static unsigned int matrix_map[7][19] =
{ { 89, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 93, 92, NA, NA, 91, NA, 90 },
{ 37, NA, 54, 55, 56, 57, NA, 58, 59, 60, 61, NA, 62, 63, 64, 65, 66, 67, 68 },
{ 49, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, NA, 41, 42, 38, NA, 69, 70, 71 },
{ 39, NA, 16, 22, 4, 17, NA, 19, 24, 20, 8, 14, 15, 43, 44, 45, 72, 73, 74 },
{ 53, NA, 0, 18, 3, 5, NA, 6, 7, 9, 10, 11, 47, 48, 46, 36, NA, NA, NA },
{ 82, 79, 25, 23, 2, 21, NA, 1, NA, 13, 12, 50, 51, 52, 86, NA, NA, 78, NA },
{ 81, 84, 83, NA, NA, NA, NA, 40, NA, NA, NA, NA, 87, 88, 80, 85, 76, 77, 75 } };
static const char* zone_names[] =
{
"Keyboard",
};
static zone_type zone_types[] =
{
ZONE_TYPE_MATRIX,
};
static const unsigned int zone_sizes[] =
{
94,
};
typedef struct
{
const char * name;
const unsigned char zone;
const unsigned char idx;
} led_type;
static const led_type led_names[] =
{
/* Key Label Zone, Index */
{ "Key: A", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x04 },//00
{ "Key: B", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x05 },
{ "Key: C", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x06 },
{ "Key: D", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x07 },
{ "Key: E", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x08 },
{ "Key: F", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x09 },
{ "Key: G", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x0A },
{ "Key: H", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x0B },
{ "Key: I", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x0C },
{ "Key: J", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x0D },
{ "Key: K", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x0E },//10
{ "Key: L", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x0F },
{ "Key: M", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x10 },
{ "Key: N", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x11 },
{ "Key: O", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x12 },
{ "Key: P", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x13 },
{ "Key: Q", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x14 },
{ "Key: R", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x15 },
{ "Key: S", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x16 },
{ "Key: T", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x17 },
{ "Key: U", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x18 },//20
{ "Key: V", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x19 },
{ "Key: W", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x1A },
{ "Key: X", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x1B },
{ "Key: Y", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x1C },
{ "Key: Z", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x1D },
{ "Key: 1", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x1E },
{ "Key: 2", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x1F },
{ "Key: 3", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x20 },
{ "Key: 4", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x21 },
{ "Key: 5", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x22 },//30
{ "Key: 6", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x23 },
{ "Key: 7", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x24 },
{ "Key: 8", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x25 },
{ "Key: 9", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x26 },
{ "Key: 0", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x27 },
{ "Key: Enter", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x28 },
{ "Key: Escape", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x29 },
{ "Key: Backspace", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x2A },
{ "Key: Tab", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x2B },
{ "Key: Space", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x2C },//40
{ "Key: -", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x2D },
{ "Key: =", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x2E },
{ "Key: [", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x2F },
{ "Key: ]", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x30 },
{ "Key: \\ (ANSI)", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x31 },//ANSI only
{ "Key: #", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x32 },//ISO only
{ "Key: ;", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x33 },
{ "Key: '", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x34 },
{ "Key: `", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x35 },
{ "Key: ,", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x36 },//50
{ "Key: .", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x37 },
{ "Key: /", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x38 },
{ "Key: Caps Lock", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x39 },
{ "Key: F1", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x3A },
{ "Key: F2", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x3B },
{ "Key: F3", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x3C },
{ "Key: F4", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x3D },
{ "Key: F5", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x3E },
{ "Key: F6", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x3F },
{ "Key: F7", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x40 },//60
{ "Key: F8", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x41 },
{ "Key: F9", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x42 },
{ "Key: F10", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x43 },
{ "Key: F11", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x44 },
{ "Key: F12", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x45 },
{ "Key: Print Screen", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x46 },
{ "Key: Scroll Lock", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x47 },
{ "Key: Pause/Break", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x48 },
{ "Key: Insert", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x49 },
{ "Key: Home", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x4A },//70
{ "Key: Page Up", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x4B },
{ "Key: Delete", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x4C },
{ "Key: End", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x4D },
{ "Key: Page Down", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x4E },
{ "Key: Right Arrow", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x4F },
{ "Key: Left Arrow", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x50 },
{ "Key: Down Arrow", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x51 },
{ "Key: Up Arrow", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x52 },
{ "Key: \\ (ISO)", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x64 },//ISO only
{ "Key: Menu", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0x65 },//80
{ "Key: Left Control", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0xE0 },
{ "Key: Left Shift", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0xE1 },
{ "Key: Left Alt", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0xE2 },
{ "Key: Left Windows", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0xE3 },
{ "Key: Right Control", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0xE4 },
{ "Key: Right Shift", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0xE5 },
{ "Key: Right Alt", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0xE6 },
{ "Key: Fn", LOGITECH_GPRO_ZONE_DIRECT_KEYBOARD, 0xE7 },
{ "Logo", LOGITECH_GPRO_ZONE_DIRECT_LOGO, 0x01 },
{ "Lighting", LOGITECH_GPRO_ZONE_DIRECT_INDICATORS, 0x01 },//90
{ "Game Mode", LOGITECH_GPRO_ZONE_DIRECT_INDICATORS, 0x02 },
{ "Caps Lock Indicator", LOGITECH_GPRO_ZONE_DIRECT_INDICATORS, 0x03 },
{ "Scroll Lock Indicator", LOGITECH_GPRO_ZONE_DIRECT_INDICATORS, 0x04 },//93
};
RGBController_LogitechGProKeyboard::RGBController_LogitechGProKeyboard(LogitechGProKeyboardController* logitech_ptr)
{
logitech = logitech_ptr;
name = "Logitech Keyboard Device";
vendor = "Logitech";
type = DEVICE_TYPE_KEYBOARD;
description = "Logitech Keyboard Device";
serial = logitech->GetSerialString();
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);
mode Static;
Static.name = "Static";
Static.value = LOGITECH_GPRO_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Static.colors_min = 1;
Static.colors_max = 1;
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
Static.colors.resize(1);
modes.push_back(Static);
mode Off;
Off.name = "Off";
Off.value = LOGITECH_GPRO_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Cycle;
Cycle.name = "Cycle";
Cycle.value = LOGITECH_GPRO_MODE_CYCLE;
Cycle.flags = MODE_FLAG_HAS_SPEED;
Cycle.color_mode = MODE_COLORS_NONE;
Cycle.speed_min = LOGITECH_GPRO_SPEED_SLOWEST;
Cycle.speed_max = LOGITECH_GPRO_SPEED_FASTEST;
Cycle.speed = LOGITECH_GPRO_SPEED_NORMAL;
modes.push_back(Cycle);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = LOGITECH_GPRO_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED;
Breathing.colors_min = 1;
Breathing.colors_max = 1;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.colors.resize(1);
Breathing.speed_min = LOGITECH_GPRO_SPEED_SLOWEST;
Breathing.speed_max = LOGITECH_GPRO_SPEED_FASTEST;
Breathing.speed = LOGITECH_GPRO_SPEED_NORMAL;
modes.push_back(Breathing);
SetupZones();
}
RGBController_LogitechGProKeyboard::~RGBController_LogitechGProKeyboard()
{
/*---------------------------------------------------------*\
| Delete the matrix map |
\*---------------------------------------------------------*/
for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++)
{
if(zones[zone_index].matrix_map != NULL)
{
delete zones[zone_index].matrix_map;
}
}
delete logitech;
}
void RGBController_LogitechGProKeyboard::SetupZones()
{
/*---------------------------------------------------------*\
| Set up zones |
\*---------------------------------------------------------*/
unsigned int total_led_count = 0;
for(unsigned int zone_idx = 0; zone_idx < 1; zone_idx++)
{
zone new_zone;
new_zone.name = zone_names[zone_idx];
new_zone.type = zone_types[zone_idx];
new_zone.leds_min = zone_sizes[zone_idx];
new_zone.leds_max = zone_sizes[zone_idx];
new_zone.leds_count = zone_sizes[zone_idx];
if(zone_types[zone_idx] == ZONE_TYPE_MATRIX)
{
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = 7;
new_zone.matrix_map->width = 19;
new_zone.matrix_map->map = (unsigned int *)&matrix_map;
}
else
{
new_zone.matrix_map = NULL;
}
zones.push_back(new_zone);
total_led_count += zone_sizes[zone_idx];
}
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
{
led new_led;
new_led.name = led_names[led_idx].name;
new_led.value = ( led_names[led_idx].zone << 8 ) + led_names[led_idx].idx;
leds.push_back(new_led);
}
SetupColors();
}
void RGBController_LogitechGProKeyboard::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_LogitechGProKeyboard::DeviceUpdateLEDs()
{
#define MAX_FRAMES_PER_PACKET 0x0E
unsigned char frame_buf[MAX_FRAMES_PER_PACKET * 4];
unsigned char frame_cnt = 0;
unsigned char prev_zone = 0;
unsigned char zone = 0;
unsigned char idx = 0;
/*---------------------------------------------------------*\
| TODO: Send packets with multiple LED frames |
\*---------------------------------------------------------*/
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
{
zone = ( leds[led_idx].value >> 8 );
idx = ( leds[led_idx].value & 0xFF );
if((zone != prev_zone) && (frame_cnt != 0))
{
logitech->SetDirect(prev_zone, frame_cnt, frame_buf);
frame_cnt = 0;
}
frame_buf[(frame_cnt * 4) + 0] = idx;
frame_buf[(frame_cnt * 4) + 1] = RGBGetRValue(colors[led_idx]);
frame_buf[(frame_cnt * 4) + 2] = RGBGetGValue(colors[led_idx]);
frame_buf[(frame_cnt * 4) + 3] = RGBGetBValue(colors[led_idx]);
frame_cnt++;
prev_zone = zone;
if(frame_cnt == MAX_FRAMES_PER_PACKET)
{
logitech->SetDirect(prev_zone, frame_cnt, frame_buf);
frame_cnt = 0;
}
}
if(frame_cnt != 0)
{
logitech->SetDirect(prev_zone, frame_cnt, frame_buf);
}
logitech->Commit();
}
void RGBController_LogitechGProKeyboard::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_LogitechGProKeyboard::UpdateSingleLED(int led)
{
unsigned char frame[4];
unsigned char zone;
unsigned char idx;
zone = ( leds[led].value >> 8 );
idx = ( leds[led].value & 0xFF );
frame[0] = idx;
frame[1] = RGBGetRValue(colors[led]);
frame[2] = RGBGetGValue(colors[led]);
frame[3] = RGBGetBValue(colors[led]);
logitech->SetDirect(zone, 1, frame);
logitech->Commit();
}
void RGBController_LogitechGProKeyboard::SetCustomMode()
{
active_mode = 0;
}
void RGBController_LogitechGProKeyboard::DeviceUpdateMode()
{
/*---------------------------------------------------------*\
| Direct mode does not send a mode packet |
| Call UpdateLEDs to send direct packet |
\*---------------------------------------------------------*/
if(active_mode == 0xFFFF)
{
UpdateLEDs();
return;
}
unsigned char red = 0;
unsigned char grn = 0;
unsigned char blu = 0;
if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
{
red = RGBGetRValue(modes[active_mode].colors[0]);
grn = RGBGetGValue(modes[active_mode].colors[0]);
blu = RGBGetBValue(modes[active_mode].colors[0]);
}
logitech->SetMode(modes[active_mode].value, modes[active_mode].speed, red, grn, blu);
}
@@ -0,0 +1,33 @@
/*-----------------------------------------*\
| RGBController_LogitechGPro.h |
| |
| Generic RGB Interface for Logitech G Pro |
| keyboard |
| |
| sanchezzzs 20/10/2021 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "LogitechGProKeyboardController.h"
class RGBController_LogitechGProKeyboard : public RGBController
{
public:
RGBController_LogitechGProKeyboard(LogitechGProKeyboardController* logitech_ptr);
~RGBController_LogitechGProKeyboard();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
LogitechGProKeyboardController* logitech;
};
@@ -115,14 +115,33 @@ RGBController_LogitechLightspeed::~RGBController_LogitechLightspeed()
void RGBController_LogitechLightspeed::SetupZones()
{
uint8_t LED_count = logitech->lightspeed->getLEDinfo();
const std::string zone_string = "Zone";
const std::string led_string = "LED";
uint8_t led_count = logitech->lightspeed->getLED_count();
if(LED_count > 0)
if(led_count > 0)
{
for(size_t i = 0; i < LED_count; i++)
for(size_t i = 0; i < led_count; i++)
{
zone Lightspeed_logo_zone;
Lightspeed_logo_zone.name = "Zone " + std::to_string(i);
led Lightspeed_logo_led;
logitech_led new_led = logitech->lightspeed->getLED_info(i);
if(new_led.location < sizeof(logitech_led_locations) )
{
Lightspeed_logo_zone.name = logitech_led_locations[new_led.location];
Lightspeed_logo_zone.name.append(" ");
Lightspeed_logo_led.name = Lightspeed_logo_zone.name;
Lightspeed_logo_led.name.append(led_string);
Lightspeed_logo_zone.name.append(zone_string);
}
else
{
std::string name = " " + std::to_string(i);
Lightspeed_logo_zone.name = zone_string + name;
Lightspeed_logo_led.name = led_string + name;
}
Lightspeed_logo_zone.type = ZONE_TYPE_SINGLE;
Lightspeed_logo_zone.leds_min = 1;
Lightspeed_logo_zone.leds_max = 1;
@@ -130,8 +149,6 @@ void RGBController_LogitechLightspeed::SetupZones()
Lightspeed_logo_zone.matrix_map = NULL;
zones.push_back(Lightspeed_logo_zone);
led Lightspeed_logo_led;
Lightspeed_logo_led.name = "LED " + std::to_string(i);
Lightspeed_logo_led.value = i;
leds.push_back(Lightspeed_logo_led);
}
@@ -53,7 +53,11 @@ void MSIGPUController::SetRGB3(unsigned char red, unsigned char green, unsigned
void MSIGPUController::SetMode(unsigned char mode)
{
MSIGPURegisterWrite(MSI_GPU_REG_MODE, mode);
MSIGPURegisterWrite(MSI_GPU_REG_APPLY, 0x01);
}
void MSIGPUController::Save()
{
MSIGPURegisterWrite(MSI_GPU_REG_SAVE, 0x01);
}
unsigned char MSIGPUController::MSIGPURegisterRead(unsigned char reg)
@@ -27,7 +27,7 @@ enum
MSI_GPU_REG_G3 = 0x2b, /* MSI GPU G3 Register */
MSI_GPU_REG_B3 = 0x2c, /* MSI GPU B3 Register */
MSI_GPU_REG_MODE = 0x22, /* MSI GPU Mode Selection Register */
MSI_GPU_REG_APPLY = 0x3f, /* MSI GPU Apply Changes Register */
MSI_GPU_REG_SAVE = 0x3f, /* MSI GPU Save Changes Register */
};
enum
@@ -67,6 +67,7 @@ public:
void SetRGB3(unsigned char red, unsigned char green, unsigned char blue);
void SetMode(unsigned char mode);
void Save();
unsigned char MSIGPURegisterRead(unsigned char reg);
void MSIGPURegisterWrite(unsigned char reg, unsigned char val);
@@ -7,6 +7,7 @@
#include "Detector.h"
#include "MSIGPUController.h"
#include "LogManager.h"
#include "RGBController.h"
#include "RGBController_MSIGPU.h"
#include "i2c_smbus.h"
@@ -25,6 +26,7 @@ typedef struct
} msi_gpu_pci_device;
#define MSI_GPU_NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
#define MSI_CONTROLLER_NAME "MSI GPU"
static const msi_gpu_pci_device device_list[] =
{
@@ -42,10 +44,10 @@ static const msi_gpu_pci_device device_list[] =
{ NVIDIA_VEN, NVIDIA_RTX2070_DEV, MSI_SUB_VEN, MSI_RTX2070_GAMING_SUB_DEV, "MSI GeForce RTX 2070 Gaming" },
{ NVIDIA_VEN, NVIDIA_RTX2070_DEV, MSI_SUB_VEN, MSI_RTX2070_ARMOR_SUB_DEV, "MSI GeForce RTX 2070 ARMOR" },
{ NVIDIA_VEN, NVIDIA_RTX2070_OC_DEV, MSI_SUB_VEN, MSI_RTX2070_ARMOR_SUB_DEV, "MSI GeForce RTX 2070 ARMOR OC" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_DEV, MSI_SUB_VEN, MSI_RTX2070S_GAMING_TRIO_SUB_DEV, "MSI GeForce RTX 2070 Super Gaming Trio" },
{ 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" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_DEV, MSI_SUB_VEN, MSI_RTX2070S_GAMING_Z_TRIO_SUB_DEV, "MSI GeForce RTX 2070 Super Gaming Z Trio" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_OC_DEV, MSI_SUB_VEN, MSI_RTX2070S_GAMING_TRIO_SUB_DEV, "MSI GeForce RTX 2070 Super Gaming Trio" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_OC_DEV, MSI_SUB_VEN, MSI_RTX2070S_GAMING_X_SUB_DEV, "MSI GeForce RTX 2070 Super Gaming X" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_OC_DEV, MSI_SUB_VEN, MSI_RTX2070S_GAMING_X_TRIO_SUB_DEV, "MSI GeForce RTX 2070 Super Gaming X Trio" },
{ NVIDIA_VEN, NVIDIA_RTX2070S_OC_DEV, MSI_SUB_VEN, MSI_RTX2070S_GAMING_Z_TRIO_SUB_DEV, "MSI GeForce RTX 2070 Super Gaming Z Trio" },
{ NVIDIA_VEN, NVIDIA_RTX2080_DEV, MSI_SUB_VEN, MSI_RTX2080_GAMING_TRIO_SUB_DEV, "MSI GeForce RTX 2080 Gaming Trio" },
{ NVIDIA_VEN, NVIDIA_RTX2080_A_DEV, MSI_SUB_VEN, MSI_RTX2080_GAMING_X_TRIO_SUB_DEV, "MSI GeForce RTX 2080 Gaming X Trio" },
{ NVIDIA_VEN, NVIDIA_RTX2080_A_DEV, MSI_SUB_VEN, MSI_RTX2080_SEA_HAWK_EK_X_SUB_DEV, "MSI GeForce RTX 2080 Sea Hawk EK X" },
@@ -60,9 +62,11 @@ static const msi_gpu_pci_device device_list[] =
{ NVIDIA_VEN, NVIDIA_RTX3070_LHR_DEV, MSI_SUB_VEN, MSI_RTX3070_SUPRIM_X_LHR_SUB_DEV, "MSI GeForce RTX 3070 8GB Suprim X LHR" },
{ NVIDIA_VEN, NVIDIA_RTX3070TI_DEV, MSI_SUB_VEN, MSI_RTX3070TI_GAMING_X_TRIO_SUB_DEV, "MSI GeForce RTX 3070 Ti 8GB Gaming X Trio" },
{ NVIDIA_VEN, NVIDIA_RTX3070TI_DEV, MSI_SUB_VEN, MSI_RTX3070TI_SUPRIM_X_SUB_DEV, "MSI GeForce RTX 3070 Ti Suprim X 8G" },
{ NVIDIA_VEN, NVIDIA_RTX3080_DEV, MSI_SUB_VEN, MSI_RTX3080_GAMING_Z_TRIO_SUB_DEV, "MSI GeForce RTX 3080 10GB Gaming Z Trio" },
{ NVIDIA_VEN, NVIDIA_RTX3080_LHR_DEV, MSI_SUB_VEN, MSI_RTX3080_GAMING_Z_TRIO_SUB_DEV, "MSI GeForce RTX 3080 10GB Gaming Z Trio LHR" },
{ NVIDIA_VEN, NVIDIA_RTX3080_DEV, MSI_SUB_VEN, MSI_RTX3080_GAMING_X_TRIO_SUB_DEV, "MSI GeForce RTX 3080 10GB Gaming X Trio" },
{ NVIDIA_VEN, NVIDIA_RTX3080_DEV, MSI_SUB_VEN, MSI_RTX3080_SUPRIM_X_SUB_DEV, "MSI GeForce RTX 3080 Suprim X 10G" },
{ NVIDIA_VEN, NVIDIA_RTX3080_LHR_DEV, MSI_SUB_VEN, MSI_RTX3080_SUPRIM_X_SUB_DEV, "MSI GeForce RTX 3080 Suprim X 10G LHR" },
{ NVIDIA_VEN, NVIDIA_RTX3080TI_DEV, MSI_SUB_VEN, MSI_RTX3080TI_GAMING_X_TRIO_SUB_DEV, "MSI GeForce RTX 3080 Ti Gaming X Trio 12G" },
{ NVIDIA_VEN, NVIDIA_RTX3080TI_DEV, MSI_SUB_VEN, MSI_RTX3080TI_SUPRIM_X_SUB_DEV, "MSI GeForce RTX 3080 Ti Suprim X 12G" },
{ NVIDIA_VEN, NVIDIA_RTX3090_DEV, MSI_SUB_VEN, MSI_RTX3090_GAMING_X_TRIO_SUB_DEV, "MSI GeForce RTX 3090 24GB Gaming X Trio" },
@@ -97,6 +101,7 @@ void DetectMSIGPUControllers(std::vector<i2c_smbus_interface*> &busses)
busses[bus]->pci_subsystem_vendor == device_list[dev_idx].pci_subsystem_vendor &&
busses[bus]->pci_subsystem_device == device_list[dev_idx].pci_subsystem_device)
{
LOG_DEBUG(GPU_DETECT_MESSAGE, MSI_CONTROLLER_NAME, bus, device_list[dev_idx].pci_device, device_list[dev_idx].pci_subsystem_device, device_list[dev_idx].name );
new_msi_gpu = new MSIGPUController(busses[bus]);
new_controller = new RGBController_MSIGPU(new_msi_gpu);
new_controller->name = device_list[dev_idx].name;
@@ -39,30 +39,30 @@ RGBController_MSIGPU::RGBController_MSIGPU(MSIGPUController * msi_gpu_ptr)
mode Off;
Off.name = "Off";
Off.value = MSI_GPU_MODE_OFF;
Off.flags = 0;
Off.flags = MODE_FLAG_MANUAL_SAVE;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = MSI_GPU_MODE_RAINBOW;
Rainbow.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Rainbow.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
Rainbow.speed_min = 0;
Rainbow.speed_max = 2;
Rainbow.color_mode = MODE_COLORS_NONE;
modes.push_back(Rainbow);
mode Static;
Static.name = "Static";
Static.value = MSI_GPU_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 Direct;
Direct.name = "Direct";
Direct.value = MSI_GPU_MODE_STATIC;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Raindrop;
Raindrop.name = "Raindrop";
Raindrop.value = MSI_GPU_MODE_RAINDROP;
Raindrop.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
Raindrop.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE;
Raindrop.speed_min = 0;
Raindrop.speed_max = 2;
Raindrop.color_mode = MODE_COLORS_PER_LED;
@@ -71,7 +71,7 @@ RGBController_MSIGPU::RGBController_MSIGPU(MSIGPUController * msi_gpu_ptr)
mode Magic;
Magic.name = "Magic";
Magic.value = MSI_GPU_MODE_MAGIC;
Magic.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Magic.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
Magic.speed_min = 0;
Magic.speed_max = 2;
Magic.color_mode = MODE_COLORS_NONE;
@@ -80,7 +80,7 @@ RGBController_MSIGPU::RGBController_MSIGPU(MSIGPUController * msi_gpu_ptr)
mode Patrolling;
Patrolling.name = "Patrolling";
Patrolling.value = MSI_GPU_MODE_PATROLLING;
Patrolling.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
Patrolling.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE;
Patrolling.speed_min = 0;
Patrolling.speed_max = 2;
Patrolling.color_mode = MODE_COLORS_PER_LED;
@@ -89,7 +89,7 @@ RGBController_MSIGPU::RGBController_MSIGPU(MSIGPUController * msi_gpu_ptr)
mode Streaming;
Streaming.name = "Streaming";
Streaming.value = MSI_GPU_MODE_STREAMING;
Streaming.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Streaming.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
Streaming.speed_min = 0;
Streaming.speed_max = 2;
Streaming.color_mode = MODE_COLORS_NONE;
@@ -98,7 +98,7 @@ RGBController_MSIGPU::RGBController_MSIGPU(MSIGPUController * msi_gpu_ptr)
mode Lightning;
Lightning.name = "Lightning";
Lightning.value = MSI_GPU_MODE_LIGHTNING;
Lightning.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Lightning.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
Lightning.speed_min = 0;
Lightning.speed_max = 2;
Lightning.color_mode = MODE_COLORS_NONE;
@@ -107,7 +107,7 @@ RGBController_MSIGPU::RGBController_MSIGPU(MSIGPUController * msi_gpu_ptr)
mode Wave;
Wave.name = "Wave";
Wave.value = MSI_GPU_MODE_WAVE;
Wave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
Wave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE;
Wave.speed_min = 0;
Wave.speed_max = 2;
Wave.color_mode = MODE_COLORS_PER_LED;
@@ -116,7 +116,7 @@ RGBController_MSIGPU::RGBController_MSIGPU(MSIGPUController * msi_gpu_ptr)
mode Meteor;
Meteor.name = "Meteor";
Meteor.value = MSI_GPU_MODE_METEOR;
Meteor.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
Meteor.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE;
Meteor.speed_min = 0;
Meteor.speed_max = 2;
Meteor.color_mode = MODE_COLORS_PER_LED;
@@ -125,7 +125,7 @@ RGBController_MSIGPU::RGBController_MSIGPU(MSIGPUController * msi_gpu_ptr)
mode Stack;
Stack.name = "Stack";
Stack.value = MSI_GPU_MODE_STACK;
Stack.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
Stack.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE;
Stack.speed_min = 0;
Stack.speed_max = 2;
Stack.color_mode = MODE_COLORS_PER_LED;
@@ -134,7 +134,7 @@ RGBController_MSIGPU::RGBController_MSIGPU(MSIGPUController * msi_gpu_ptr)
mode Rhythm;
Rhythm.name = "Rhythm";
Rhythm.value = MSI_GPU_MODE_RHYTHM;
Rhythm.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
Rhythm.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE;
Rhythm.speed_min = 0;
Rhythm.speed_max = 2;
Rhythm.color_mode = MODE_COLORS_PER_LED;
@@ -143,7 +143,7 @@ RGBController_MSIGPU::RGBController_MSIGPU(MSIGPUController * msi_gpu_ptr)
mode Flowing;
Flowing.name = "Flowing";
Flowing.value = MSI_GPU_MODE_FLOWING;
Flowing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
Flowing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE;
Flowing.speed_min = 0;
Flowing.speed_max = 2;
Flowing.color_mode = MODE_COLORS_PER_LED;
@@ -152,7 +152,7 @@ RGBController_MSIGPU::RGBController_MSIGPU(MSIGPUController * msi_gpu_ptr)
mode Whirling;
Whirling.name = "Whirling";
Whirling.value = MSI_GPU_MODE_WHIRLING;
Whirling.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
Whirling.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE;
Whirling.speed_min = 0;
Whirling.speed_max = 2;
Whirling.color_mode = MODE_COLORS_PER_LED;
@@ -161,7 +161,7 @@ RGBController_MSIGPU::RGBController_MSIGPU(MSIGPUController * msi_gpu_ptr)
mode Twisting;
Twisting.name = "Twisting";
Twisting.value = MSI_GPU_MODE_TWISTING;
Twisting.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
Twisting.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE;
Twisting.speed_min = 0;
Twisting.speed_max = 2;
Twisting.color_mode = MODE_COLORS_PER_LED;
@@ -170,7 +170,7 @@ RGBController_MSIGPU::RGBController_MSIGPU(MSIGPUController * msi_gpu_ptr)
mode Laminating;
Laminating.name = "Laminating";
Laminating.value = MSI_GPU_MODE_LAMINATING;
Laminating.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
Laminating.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE;
Laminating.speed_min = 0;
Laminating.speed_max = 2;
Laminating.color_mode = MODE_COLORS_PER_LED;
@@ -179,7 +179,7 @@ RGBController_MSIGPU::RGBController_MSIGPU(MSIGPUController * msi_gpu_ptr)
mode Fadein;
Fadein.name = "Fadein";
Fadein.value = MSI_GPU_MODE_FADEIN;
Fadein.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
Fadein.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE;
Fadein.speed_min = 0;
Fadein.speed_max = 2;
Fadein.color_mode = MODE_COLORS_PER_LED;
@@ -188,7 +188,7 @@ RGBController_MSIGPU::RGBController_MSIGPU(MSIGPUController * msi_gpu_ptr)
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = MSI_GPU_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE;
Breathing.speed_min = 0;
Breathing.speed_max = 2;
Breathing.color_mode = MODE_COLORS_PER_LED;
@@ -197,7 +197,7 @@ RGBController_MSIGPU::RGBController_MSIGPU(MSIGPUController * msi_gpu_ptr)
mode flashing;
flashing.name = "Flashing";
flashing.value = MSI_GPU_MODE_FLASHING;
flashing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
flashing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE;
flashing.speed_min = 0;
flashing.speed_max = 2;
flashing.color_mode = MODE_COLORS_PER_LED;
@@ -206,7 +206,7 @@ RGBController_MSIGPU::RGBController_MSIGPU(MSIGPUController * msi_gpu_ptr)
mode doubleflashing;
doubleflashing.name = "Doubleflashing";
doubleflashing.value = MSI_GPU_MODE_DOUBLEFLASHING;
doubleflashing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
doubleflashing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE;
doubleflashing.speed_min = 0;
doubleflashing.speed_max = 2;
doubleflashing.color_mode = MODE_COLORS_PER_LED;
@@ -320,3 +320,8 @@ void RGBController_MSIGPU::DeviceUpdateMode()
msi_gpu->SetMode(modes[active_mode].value);
}
void RGBController_MSIGPU::DeviceSaveMode()
{
msi_gpu->Save();
}
@@ -26,6 +26,7 @@ public:
void SetCustomMode();
void DeviceUpdateMode();
void DeviceSaveMode();
private:
MSIGPUController* msi_gpu;
@@ -63,8 +63,10 @@ void DetectMSIMysticLight185Controllers(hid_device_info* info, const std::string
/*-------------------------------------------------------------*\
| MSI Mystic Light 162-byte Devices |
\*-------------------------------------------------------------*/
REGISTER_HID_DETECTOR_PU("MSI Mystic Light MS_1720", DetectMSIMysticLight162Controllers, MSI_USB_VID, 0x1720, 0x0001, 0x00); //MSI MPG Z390 Gaming Edge AC
REGISTER_HID_DETECTOR_PU("MSI Mystic Light MS_7B12", DetectMSIMysticLight162Controllers, MSI_USB_VID, 0x7B12, 0x0001, 0x00);
REGISTER_HID_DETECTOR_PU("MSI Mystic Light MS_7B17", DetectMSIMysticLight162Controllers, MSI_USB_VID, 0x7B17, 0x0001, 0x00);
REGISTER_HID_DETECTOR_PU("MSI Mystic Light MS_7B18", DetectMSIMysticLight162Controllers, MSI_USB_VID, 0x7B18, 0x0001, 0x00);
REGISTER_HID_DETECTOR_PU("MSI Mystic Light MS_7B85", DetectMSIMysticLight162Controllers, MSI_USB_VID, 0x7B85, 0x0001, 0x00);
/*-------------------------------------------------------------*\
@@ -95,6 +97,7 @@ REGISTER_HID_DETECTOR_PU("MSI Mystic Light MS_7D07", DetectMSIMysticLight185C
REGISTER_HID_DETECTOR_PU("MSI Mystic Light MS_7D09", DetectMSIMysticLight185Controllers, MSI_USB_VID, 0x7D09, 0x0001, 0x00);
REGISTER_HID_DETECTOR_PU("MSI Mystic Light MS_7D13", DetectMSIMysticLight185Controllers, MSI_USB_VID, 0x7D13, 0x0001, 0x00);
REGISTER_HID_DETECTOR_PU("MSI Mystic Light MS_7D15", DetectMSIMysticLight185Controllers, MSI_USB_VID, 0x7D15, 0x0001, 0x00);
REGISTER_HID_DETECTOR_PU("MSI Mystic Light MS_7D25", DetectMSIMysticLight185Controllers, MSI_USB_VID, 0x7D25, 0x0001, 0x00); // MSI PRO Z690-A WiFi DDR4
REGISTER_HID_DETECTOR_PU("MSI Mystic Light MS_7D54", DetectMSIMysticLight185Controllers, MSI_USB_VID, 0x7D54, 0x0001, 0x00);
#ifdef ENABLE_UNTESTED_MYSTIC_LIGHT
@@ -1,4 +1,5 @@
#include "Detector.h"
#include "LogManager.h"
#include "PNYGPUController.h"
#include "RGBController.h"
#include "RGBController_PNYGPU.h"
@@ -31,22 +32,19 @@ typedef struct
static const gpu_pci_device device_list[] =
{
{ NVIDIA_VEN, NVIDIA_RTX3090_DEV, PNY_SUB_VEN, PNY_RTX_3090_XLR8_REVEL_EPIC_X_SUB_DEV, PNY_RGB, "PNY XLR8 Revel EPIC-X RTX 3090" },
{ NVIDIA_VEN, NVIDIA_RTX3060_DEV, PALIT_SUB_VEN, PALIT_RTX3060_SUB_DEV, PNY_RGB, "Palit 3060" },
{ NVIDIA_VEN, NVIDIA_RTX3060_LHR_DEV, PALIT_SUB_VEN, PALIT_RTX3060_LHR_SUB_DEV, PNY_RGB, "Palit 3060 LHR" },
{ NVIDIA_VEN, NVIDIA_RTX3060TI_DEV, PALIT_SUB_VEN, PALIT_RTX3060TI_SUB_DEV, PNY_RGB, "Palit 3060Ti" },
{ NVIDIA_VEN, NVIDIA_RTX3060TI_LHR_DEV, PALIT_SUB_VEN, PALIT_RTX3060TI_LHR_SUB_DEV, PNY_RGB, "Palit 3060Ti" },
{ NVIDIA_VEN, NVIDIA_RTX3070_DEV, PALIT_SUB_VEN, PALIT_RTX3070_SUB_DEV, PNY_RGB, "Palit 3070" },
{ NVIDIA_VEN, NVIDIA_RTX3070_LHR_DEV, PALIT_SUB_VEN, PALIT_RTX3070_LHR_SUB_DEV, PNY_RGB, "Palit 3070 LHR" },
{ NVIDIA_VEN, NVIDIA_RTX3070TI_DEV, PALIT_SUB_VEN, PALIT_RTX3070TI_SUB_DEV, PNY_RGB, "Palit 3070Ti" },
{ NVIDIA_VEN, NVIDIA_RTX3080_DEV, PALIT_SUB_VEN, PALIT_RTX3080_SUB_DEV, PNY_RGB, "Palit 3080" },
{ NVIDIA_VEN, NVIDIA_RTX3080_LHR_DEV, PALIT_SUB_VEN, PALIT_RTX3080_LHR_SUB_DEV, PNY_RGB, "Palit 3080 LHR" },
{ NVIDIA_VEN, NVIDIA_RTX3080TI_DEV, PALIT_SUB_VEN, PALIT_RTX3080TI_SUB_DEV, PNY_RGB, "Palit 3080Ti" },
{ NVIDIA_VEN, NVIDIA_RTX3090_DEV, PALIT_SUB_VEN, PALIT_RTX3090_SUB_DEV, PNY_RGB, "Palit 3090" }
{ NVIDIA_VEN, NVIDIA_RTX3090_DEV, PNY_SUB_VEN, PNY_RTX_3090_XLR8_REVEL_EPIC_X_SUB_DEV, PNY_RGB, "PNY XLR8 Revel EPIC-X RTX 3090" },
{ NVIDIA_VEN, NVIDIA_RTX3060_DEV, PALIT_SUB_VEN, PALIT_RTX3060_SUB_DEV, PNY_RGB, "Palit 3060" },
{ NVIDIA_VEN, NVIDIA_RTX3060_LHR_DEV, PALIT_SUB_VEN, PALIT_RTX3060_LHR_SUB_DEV, PNY_RGB, "Palit 3060 LHR" },
{ NVIDIA_VEN, NVIDIA_RTX3060TI_DEV, PALIT_SUB_VEN, PALIT_RTX3060TI_SUB_DEV, PNY_RGB, "Palit 3060Ti" },
{ NVIDIA_VEN, NVIDIA_RTX3060TI_LHR_DEV, PALIT_SUB_VEN, PALIT_RTX3060TI_LHR_SUB_DEV, PNY_RGB, "Palit 3060Ti" },
{ NVIDIA_VEN, NVIDIA_RTX3070_DEV, PALIT_SUB_VEN, PALIT_RTX3070_SUB_DEV, PNY_RGB, "Palit 3070" },
{ NVIDIA_VEN, NVIDIA_RTX3070_LHR_DEV, PALIT_SUB_VEN, PALIT_RTX3070_LHR_SUB_DEV, PNY_RGB, "Palit 3070 LHR" },
{ NVIDIA_VEN, NVIDIA_RTX3070TI_DEV, PALIT_SUB_VEN, PALIT_RTX3070TI_GAMING_PRO_SUB_DEV, PNY_RGB, "Palit 3070Ti GamingPro" },
{ NVIDIA_VEN, NVIDIA_RTX3070TI_DEV, PALIT_SUB_VEN, PALIT_RTX3070TI_SUB_DEV, PNY_RGB, "Palit 3070Ti" },
{ NVIDIA_VEN, NVIDIA_RTX3080_DEV, PALIT_SUB_VEN, PALIT_RTX3080_SUB_DEV, PNY_RGB, "Palit 3080" },
{ NVIDIA_VEN, NVIDIA_RTX3080_LHR_DEV, PALIT_SUB_VEN, PALIT_RTX3080_LHR_SUB_DEV, PNY_RGB, "Palit 3080 LHR" },
{ NVIDIA_VEN, NVIDIA_RTX3080TI_DEV, PALIT_SUB_VEN, PALIT_RTX3080TI_SUB_DEV, PNY_RGB, "Palit 3080Ti" },
{ NVIDIA_VEN, NVIDIA_RTX3090_DEV, PALIT_SUB_VEN, PALIT_RTX3090_SUB_DEV, PNY_RGB, "Palit 3090" }
};
/******************************************************************************************\
@@ -80,6 +78,7 @@ void DetectPNYGPUControllers(std::vector<i2c_smbus_interface*>& busses)
{
case PNY_RGB:
{
LOG_DEBUG(GPU_DETECT_MESSAGE, "PNY GPU", bus, device_list[dev_idx].pci_device, device_list[dev_idx].pci_subsystem_device, device_list[dev_idx].name );
PNYGPUController* new_controller;
RGBController_PNYGPU* new_rgbcontroller;
@@ -13,9 +13,11 @@
#include "Detector.h"
#include "QMKOpenRGBRev9Controller.h"
#include "QMKOpenRGBRevBController.h"
#include "QMKOpenRGBRevDController.h"
#include "RGBController.h"
#include "RGBController_QMKOpenRGBRev9.h"
#include "RGBController_QMKOpenRGBRevB.h"
#include "RGBController_QMKOpenRGBRevD.h"
#include "LogManager.h"
#include <hidapi/hidapi.h>
@@ -25,6 +27,7 @@
#define QMK_OPENRGB_PROTOCOL_VERSION_9 0x09
#define QMK_OPENRGB_PROTOCOL_VERSION_B 0x0B
#define QMK_OPENRGB_PROTOCOL_VERSION_C 0x0C
#define QMK_OPENRGB_PROTOCOL_VERSION_D 0x0D
/*-----------------------------------------------------*\
| Usage and Usage Page |
@@ -93,6 +96,13 @@ void DetectQMKOpenRGBControllers(hid_device_info *info, const std::string&)
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
break;
case QMK_OPENRGB_PROTOCOL_VERSION_D:
{
QMKOpenRGBRevDController* controller = new QMKOpenRGBRevDController(dev, info->path);
RGBController_QMKOpenRGBRevD* rgb_controller = new RGBController_QMKOpenRGBRevD(controller, true);
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
break;
default:
if (version == 0)
{
@@ -105,7 +115,7 @@ void DetectQMKOpenRGBControllers(hid_device_info *info, const std::string&)
"For officaly supported QMK boards grab <a href=\"https://github.com/Kasper24/QMK-OpenRGB\">url</a> \n"
"For Sonix boards grab <a href=\"https://github.com/SonixQMK/qmk_firmware/tree/sn32_openrgb\">url</a>", version);
}
else if (version > QMK_OPENRGB_PROTOCOL_VERSION_C)
else if (version > QMK_OPENRGB_PROTOCOL_VERSION_D)
{
LOG_WARNING("[QMK OpenRGB] Detection failed - the detected keyboard is using version protocol %i which is not supported by this OpenRGB build. Please update OpenRGB!", version);
}
@@ -0,0 +1,525 @@
/*-------------------------------------------------------------------*\
| QMKOpenRGBRevDController.cpp |
| |
| Driver for QMK keyboards using OpenRGB Protocol (Revision D) |
| |
| Kasper 10th Octobber 2020 |
| Jath03 28th May 2021 |
\*-------------------------------------------------------------------*/
#include "QMKOpenRGBRevDController.h"
using namespace std::chrono_literals;
static std::map<uint8_t, std::string> QMKKeycodeToKeynameMap
{
{ 0, "" }, { 1, "Right Fn" }, { 2, "" }, { 3, "" },
{ 4, "A" }, { 5, "B" }, { 6, "C" }, { 7, "D" },
{ 8, "E" }, { 9, "F" }, { 10, "G" }, { 11, "H" },
{ 12, "I" }, { 13, "J" }, { 14, "K" }, { 15, "L" },
{ 16, "M" }, { 17, "N" }, { 18, "O" }, { 19, "P" },
{ 20, "Q" }, { 21, "R" }, { 22, "S" }, { 23, "T" },
{ 24, "U" }, { 25, "V" }, { 26, "W" }, { 27, "X" },
{ 28, "Y" }, { 29, "Z" }, { 30, "1" }, { 31, "2" },
{ 32, "3" }, { 33, "4" }, { 34, "5" }, { 35, "6" },
{ 36, "7" }, { 37, "8" }, { 38, "9" }, { 39, "0" },
{ 40, "Enter" }, { 41, "Escape" }, { 42, "Backspace" }, { 43, "Tab" },
{ 44, "Space" }, { 45, "-" }, { 46, "=" }, { 47, "[" },
{ 48, "]" }, { 49, "\\ (ANSI)" }, { 50, "" }, { 51, ";" },
{ 52, "'" }, { 53, "`" }, { 54, "," }, { 55, "." },
{ 56, "/" }, { 57, "Caps Lock" }, { 58, "F1" }, { 59, "F2" },
{ 60, "F3" }, { 61, "F4" }, { 62, "F5" }, { 63, "F6" },
{ 64, "F7" }, { 65, "F8" }, { 66, "F9" }, { 67, "F10" },
{ 68, "F11" }, { 69, "F12" }, { 70, "Print Screen" }, { 71, "Scroll Lock" },
{ 72, "Pause/Break" }, { 73, "Insert" }, { 74, "Home" }, { 75, "Page Up" },
{ 76, "Delete" }, { 77, "End" }, { 78, "Page Down" }, { 79, "Right Arrow" },
{ 80, "Left Arrow" }, { 81, "Down Arrow" }, { 82, "Up Arrow" }, { 83, "Num Lock" },
{ 84, "Number Pad /" }, { 85, "Number Pad *" }, { 86, "Number Pad -" }, { 87, "Number Pad +" },
{ 88, "Number Pad Enter" }, { 89, "Number Pad 1" }, { 90, "Number Pad 2" }, { 91, "Number Pad 3" },
{ 92, "Number Pad 4" }, { 93, "Number Pad 5" }, { 94, "Number Pad 6" }, { 95, "Number Pad 7" },
{ 96, "Number Pad 8" }, { 97, "Number Pad 9" }, { 98, "Number Pad 0" }, { 99, "Number Pad ." },
{ 100, "" }, { 101, "Menu" }, { 102, "" }, { 103, "" },
{ 104, "" }, { 105, "" }, { 106, "" }, { 107, "" },
{ 108, "" }, { 109, "" }, { 110, "" }, { 111, "" },
{ 112, "" }, { 113, "" }, { 114, "" }, { 115, "" },
{ 116, "" }, { 117, "" }, { 118, "" }, { 119, "" },
{ 120, "" }, { 121, "" }, { 122, "" }, { 123, "" },
{ 124, "" }, { 125, "" }, { 126, "" }, { 127, "" },
{ 128, "" }, { 129, "" }, { 130, "" }, { 131, "" },
{ 132, "" }, { 133, "" }, { 134, "" }, { 135, "" },
{ 136, "" }, { 137, "" }, { 138, "" }, { 139, "" },
{ 140, "" }, { 141, "" }, { 142, "" }, { 143, "" },
{ 144, "" }, { 145, "" }, { 146, "" }, { 147, "" },
{ 148, "" }, { 149, "" }, { 150, "" }, { 151, "" },
{ 152, "" }, { 153, "" }, { 154, "" }, { 155, "" },
{ 156, "" }, { 157, "" }, { 158, "" }, { 159, "" },
{ 160, "" }, { 161, "" }, { 162, "" }, { 163, "" }, { 164, "" },
/*Space Cadet Left Shift*/ { 216, "Left Shift"}, /*Space Cadet Right Shift*/ { 217, "Right Shift"},
{ 224, "Left Control" }, { 225, "Left Shift" }, { 226, "Left Alt" }, { 227, "Left Windows" },
{ 228, "Right Control" }, { 229, "Right Shift" }, { 230, "Right Alt" }, { 231, "Right Windows" },
};
QMKOpenRGBRevDController::QMKOpenRGBRevDController(hid_device *dev_handle, const char *path)
{
/*-------------------------------------------------*\
| Get QMKOpenRGB settings |
\*-------------------------------------------------*/
json qmk_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("QMKOpenRGBDevices");
if(qmk_settings.contains("leds_per_update"))
{
if(qmk_settings["leds_per_update"] > 15)
{
qmk_settings["leds_per_update"] = 15;
}
else if(qmk_settings["leds_per_update"] < 1)
{
qmk_settings["leds_per_update"] = 1;
}
SettingsManager* settings_manager = ResourceManager::get()->GetSettingsManager();
settings_manager->SetSettings("QMKOpenRGBDevices", qmk_settings);
settings_manager->SaveSettings();
leds_per_update = qmk_settings["leds_per_update"];
}
else
{
leds_per_update = 15;
}
if(qmk_settings.contains("delay"))
{
delay = (unsigned int)qmk_settings["delay"] * 1ms;
}
else
{
delay = 0ms;
}
dev = dev_handle;
location = path;
GetDeviceInfo();
GetModeInfo();
}
QMKOpenRGBRevDController::~QMKOpenRGBRevDController()
{
hid_close(dev);
}
std::string QMKOpenRGBRevDController::GetLocation()
{
return location;
}
std::string QMKOpenRGBRevDController::GetDeviceName()
{
return device_name;
}
std::string QMKOpenRGBRevDController::GetDeviceVendor()
{
return device_vendor;
}
unsigned int QMKOpenRGBRevDController::GetTotalNumberOfLEDs()
{
return total_number_of_leds;
}
unsigned int QMKOpenRGBRevDController::GetTotalNumberOfLEDsWithEmptySpace()
{
return total_number_of_leds_with_empty_space;
}
unsigned int QMKOpenRGBRevDController::GetMode()
{
return mode;
}
unsigned int QMKOpenRGBRevDController::GetModeSpeed()
{
return mode_speed;
}
unsigned int QMKOpenRGBRevDController::GetModeColor()
{
return mode_color;
}
std::vector<point_t> QMKOpenRGBRevDController::GetLEDPoints()
{
return led_points;
}
std::vector<unsigned int> QMKOpenRGBRevDController::GetLEDFlags()
{
return led_flags;
}
std::vector<std::string> QMKOpenRGBRevDController::GetLEDNames()
{
return led_names;
}
std::vector<RGBColor> QMKOpenRGBRevDController::GetLEDColors()
{
return led_colors;
}
std::vector<unsigned int> QMKOpenRGBRevDController::GetLEDValues()
{
return led_values;
}
unsigned int QMKOpenRGBRevDController::GetProtocolVersion()
{
unsigned char usb_buf[QMK_OPENRGB_PACKET_SIZE];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, QMK_OPENRGB_PACKET_SIZE);
/*-----------------------------------------------------*\
| Set up config table request packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = QMK_OPENRGB_GET_PROTOCOL_VERSION;
int bytes_read = 0;
do
{
hid_write(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE);
bytes_read = hid_read_timeout(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE, QMK_OPENRGB_HID_READ_TIMEOUT);
} while(bytes_read <= 0);
return usb_buf[1];
}
std::string QMKOpenRGBRevDController::GetQMKVersion()
{
unsigned char usb_buf[QMK_OPENRGB_PACKET_SIZE];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, QMK_OPENRGB_PACKET_SIZE);
/*-----------------------------------------------------*\
| Set up config table request packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = QMK_OPENRGB_GET_QMK_VERSION;
hid_write(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE);
hid_read(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE);
std::string qmk_version;
int i = 1;
while (usb_buf[i] != 0)
{
qmk_version.push_back(usb_buf[i]);
i++;
}
return qmk_version;
}
void QMKOpenRGBRevDController::GetDeviceInfo()
{
unsigned char usb_buf[QMK_OPENRGB_PACKET_SIZE];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, QMK_OPENRGB_PACKET_SIZE);
/*-----------------------------------------------------*\
| Set up config table request packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = QMK_OPENRGB_GET_DEVICE_INFO;
int bytes_read = 0;
do
{
hid_write(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE);
bytes_read = hid_read_timeout(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE, QMK_OPENRGB_HID_READ_TIMEOUT);
} while(bytes_read <= 0);
total_number_of_leds = usb_buf[QMK_OPENRGB_TOTAL_NUMBER_OF_LEDS_BYTE];
total_number_of_leds_with_empty_space = usb_buf[QMK_OPENRGB_TOTAL_NUMBER_OF_LEDS_WITH_EMPTY_SPACE_BYTE];
int i = QMK_OPENRGB_TOTAL_NUMBER_OF_LEDS_WITH_EMPTY_SPACE_BYTE + 1;
while (usb_buf[i] != 0)
{
device_name.push_back(usb_buf[i]);
i++;
}
i++;
while (usb_buf[i] != 0)
{
device_vendor.push_back(usb_buf[i]);
i++;
}
}
void QMKOpenRGBRevDController::GetModeInfo()
{
unsigned char usb_buf[QMK_OPENRGB_PACKET_SIZE];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, QMK_OPENRGB_PACKET_SIZE);
/*-----------------------------------------------------*\
| Set up config table request packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = QMK_OPENRGB_GET_MODE_INFO;
int bytes_read = 0;
do
{
hid_write(dev, usb_buf, 65);
bytes_read = hid_read_timeout(dev, usb_buf, 65, QMK_OPENRGB_HID_READ_TIMEOUT);
} while(bytes_read <= 0);
mode = usb_buf[QMK_OPENRGB_MODE_BYTE];
mode_speed = usb_buf[QMK_OPENRGB_SPEED_BYTE];
/*-----------------------------------------------------*\
| QMK hue range is between 0-255 so hue needs to be |
| converted |
\*-----------------------------------------------------*/
unsigned int oldRange = 255;
unsigned int newRange = 359;
unsigned int convertedHue = (usb_buf[QMK_OPENRGB_HUE_BYTE] * newRange / oldRange);
hsv_t hsv;
hsv.hue = convertedHue;
hsv.saturation = usb_buf[QMK_OPENRGB_SATURATION_BYTE];
hsv.value = usb_buf[QMK_OPENRGB_VALUE_BYTE];
mode_color = hsv2rgb(&hsv);
}
void QMKOpenRGBRevDController::GetLEDInfo(unsigned int leds_count)
{
unsigned int leds_sent = 0;
unsigned int leds_per_update_info = 8;
std::vector<point_t> underglow_points;
std::vector<unsigned int> underglow_flags;
std::vector<std::string> underglow_names;
std::vector<RGBColor> underglow_colors;
std::vector<unsigned int> underglow_values;
while (leds_sent < leds_count)
{
if ((leds_count - leds_sent) < leds_per_update_info)
{
leds_per_update_info = leds_count - leds_sent;
}
unsigned char usb_buf[QMK_OPENRGB_PACKET_SIZE];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, QMK_OPENRGB_PACKET_SIZE);
/*-----------------------------------------------------*\
| Set up config table request packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = QMK_OPENRGB_GET_LED_INFO;
usb_buf[0x02] = leds_sent;
usb_buf[0x03] = leds_per_update_info;
int bytes_read = 0;
do
{
hid_write(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE);
bytes_read = hid_read_timeout(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE, QMK_OPENRGB_HID_READ_TIMEOUT);
} while(bytes_read <= 0);
for (unsigned int led_idx = 0; led_idx < leds_per_update_info; led_idx++)
{
if(usb_buf[(led_idx * 7) + QMK_OPENRGB_FLAG_BYTE] != QMK_OPENRGB_FAILURE)
{
if(usb_buf[(led_idx * 7) + QMK_OPENRGB_FLAG_BYTE] & 2)
{
underglow_points.push_back(point_t{usb_buf[(led_idx * 7) + QMK_OPENRGB_POINT_X_BYTE], usb_buf[(led_idx * 7) + QMK_OPENRGB_POINT_Y_BYTE]});
underglow_flags.push_back(usb_buf[(led_idx * 7) + QMK_OPENRGB_FLAG_BYTE]);
underglow_colors.push_back(ToRGBColor(usb_buf[(led_idx * 7) + QMK_OPENRGB_R_COLOR_BYTE], usb_buf[(led_idx * 7) + QMK_OPENRGB_G_COLOR_BYTE], usb_buf[(led_idx * 7) + QMK_OPENRGB_B_COLOR_BYTE]));
underglow_values.push_back(underglow_values.size() + led_values.size());
}
else
{
led_points.push_back(point_t{usb_buf[(led_idx * 7) + QMK_OPENRGB_POINT_X_BYTE], usb_buf[(led_idx * 7) + QMK_OPENRGB_POINT_Y_BYTE]});
led_flags.push_back(usb_buf[(led_idx * 7) + QMK_OPENRGB_FLAG_BYTE]);
led_colors.push_back(ToRGBColor(usb_buf[(led_idx * 7) + QMK_OPENRGB_R_COLOR_BYTE], usb_buf[(led_idx * 7) + QMK_OPENRGB_G_COLOR_BYTE], usb_buf[(led_idx * 7) + QMK_OPENRGB_B_COLOR_BYTE]));
led_values.push_back(underglow_values.size() + led_values.size());
}
}
if(usb_buf[(led_idx * 7) + QMK_OPENRGB_KEYCODE_BYTE] != 0)
{
if (QMKKeycodeToKeynameMap.count(usb_buf[(led_idx * 7) + QMK_OPENRGB_KEYCODE_BYTE]) > 0)
{
led_names.push_back("Key: " + QMKKeycodeToKeynameMap[usb_buf[(led_idx * 7) + QMK_OPENRGB_KEYCODE_BYTE]]);
}
else
{
led_names.push_back("Key: ");
}
}
else if(usb_buf[(led_idx * 7) + QMK_OPENRGB_FLAG_BYTE] & 2){
underglow_names.push_back("Underglow: " + std::to_string(underglow_names.size() + led_names.size()));
}
}
leds_sent += leds_per_update_info;
}
led_points.insert(led_points.end(), underglow_points.begin(), underglow_points.end());
led_flags.insert(led_flags.end(), underglow_flags.begin(), underglow_flags.end());
led_colors.insert(led_colors.end(), underglow_colors.begin(), underglow_colors.end());
led_names.insert(led_names.end(), underglow_names.begin(), underglow_names.end());
led_values.insert(led_values.end(), underglow_values.begin(), underglow_values.end());
}
std::vector<unsigned int> QMKOpenRGBRevDController::GetEnabledModes()
{
unsigned char usb_buf[QMK_OPENRGB_PACKET_SIZE];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, QMK_OPENRGB_PACKET_SIZE);
/*-----------------------------------------------------*\
| Set up config table request packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = QMK_OPENRGB_GET_ENABLED_MODES;
int bytes_read = 0;
do
{
hid_write(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE);
bytes_read = hid_read_timeout(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE, QMK_OPENRGB_HID_READ_TIMEOUT);
} while(bytes_read <= 0);
std::vector<unsigned int> enabled_modes;
int i = 1;
while (usb_buf[i] != 0)
{
enabled_modes.push_back(usb_buf[i]);
i++;
}
return enabled_modes;
}
void QMKOpenRGBRevDController::SetMode(hsv_t hsv_color, unsigned char mode, unsigned char speed, bool save)
{
unsigned char usb_buf[QMK_OPENRGB_PACKET_SIZE];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, QMK_OPENRGB_PACKET_SIZE);
/*-----------------------------------------------------*\
| Set up config table request packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = QMK_OPENRGB_SET_MODE;
usb_buf[0x02] = hsv_color.hue * 255 / 359;
usb_buf[0x03] = hsv_color.saturation;
usb_buf[0x04] = hsv_color.value;
usb_buf[0x05] = mode;
usb_buf[0x06] = speed;
usb_buf[0x07] = save;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
hid_read_timeout(dev, usb_buf, 65, QMK_OPENRGB_HID_READ_TIMEOUT);
}
void QMKOpenRGBRevDController::DirectModeSetSingleLED(unsigned int led, unsigned char red, unsigned char green, unsigned char blue)
{
unsigned char usb_buf[QMK_OPENRGB_PACKET_SIZE];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, QMK_OPENRGB_PACKET_SIZE);
/*-----------------------------------------------------*\
| Set up config table request packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = QMK_OPENRGB_DIRECT_MODE_SET_SINGLE_LED;
usb_buf[0x02] = led_values[led];
usb_buf[0x03] = red;
usb_buf[0x04] = green;
usb_buf[0x05] = blue;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
hid_read_timeout(dev, usb_buf, 65, QMK_OPENRGB_HID_READ_TIMEOUT);
}
void QMKOpenRGBRevDController::DirectModeSetLEDs(std::vector<RGBColor> colors, unsigned int leds_count)
{
unsigned int leds_sent = 0;
unsigned int tmp_leds_per_update = leds_per_update;
while (leds_sent < leds_count)
{
if ((leds_count - leds_sent) < tmp_leds_per_update)
{
tmp_leds_per_update = leds_count - leds_sent;
}
unsigned char usb_buf[QMK_OPENRGB_PACKET_SIZE];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, QMK_OPENRGB_PACKET_SIZE);
/*-----------------------------------------------------*\
| Set up config table request packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = QMK_OPENRGB_DIRECT_MODE_SET_LEDS;
usb_buf[0x02] = tmp_leds_per_update;
for (unsigned int led_idx = 0; led_idx < tmp_leds_per_update; led_idx++)
{
usb_buf[(led_idx * 4) + 3] = led_values[led_idx + leds_sent];
usb_buf[(led_idx * 4) + 4] = RGBGetRValue(colors[led_idx + leds_sent]);
usb_buf[(led_idx * 4) + 5] = RGBGetGValue(colors[led_idx + leds_sent]);
usb_buf[(led_idx * 4) + 6] = RGBGetBValue(colors[led_idx + leds_sent]);
}
hid_write(dev, usb_buf, 65);
if(delay > 0ms)
{
std::this_thread::sleep_for(delay);
}
leds_sent += tmp_leds_per_update;
}
}
@@ -0,0 +1,72 @@
/*-------------------------------------------------------------------*\
| QMKOpenRGBRevDController.h |
| |
| Driver for QMK keyboards using OpenRGB Protocol (Revision D) |
| |
| Kasper 10th Octobber 2020 |
| Jath03 28th May 2021 |
\*-------------------------------------------------------------------*/
#pragma once
#include "QMKOpenRGBController.h"
class QMKOpenRGBRevDController
{
public:
QMKOpenRGBRevDController(hid_device *dev_handle, const char *path);
~QMKOpenRGBRevDController();
std::string GetLocation();
std::string GetDeviceName();
std::string GetDeviceVendor();
unsigned int GetTotalNumberOfLEDs();
unsigned int GetTotalNumberOfLEDsWithEmptySpace();
unsigned int GetMode();
unsigned int GetModeSpeed();
unsigned int GetModeColor();
std::vector<point_t> GetLEDPoints();
std::vector<unsigned int> GetLEDFlags();
std::vector<std::string> GetLEDNames();
std::vector<RGBColor> GetLEDColors();
std::vector<unsigned int> GetLEDValues();
unsigned int GetProtocolVersion();
std::string GetQMKVersion();
void GetDeviceInfo();
void GetModeInfo();
void GetLEDInfo(unsigned int leds_count);
std::vector<unsigned int> GetEnabledModes();
void SetMode(hsv_t hsv_color, unsigned char mode, unsigned char speed, bool save);
void DirectModeSetSingleLED(unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
void DirectModeSetLEDs(std::vector<RGBColor> colors, unsigned int num_colors);
protected:
hid_device *dev;
private:
unsigned int leds_per_update;
std::string location;
std::string device_name;
std::string device_vendor;
std::chrono::milliseconds delay;
unsigned int total_number_of_leds;
unsigned int total_number_of_leds_with_empty_space;
unsigned int mode;
unsigned int mode_speed;
RGBColor mode_color;
std::vector<point_t> led_points;
std::vector<unsigned int> led_flags;
std::vector<std::string> led_names;
std::vector<RGBColor> led_colors;
std::vector<unsigned int> led_values;
};
@@ -0,0 +1,783 @@
/*-------------------------------------------------------------------*\
| RGBController_QMKOpenRGBRevD.cpp |
| |
| Driver for QMK keyboards using OpenRGB Protocol (Revision D) |
| |
| Kasper 10th Octobber 2020 |
| Jath03 28th May 2021 |
\*-------------------------------------------------------------------*/
#include "hsv.h"
#include "LogManager.h"
#include "RGBController_QMKOpenRGBRevD.h"
RGBController_QMKOpenRGBRevD::RGBController_QMKOpenRGBRevD(QMKOpenRGBRevDController* controller_ptr, bool save)
{
controller = controller_ptr;
name = controller->GetDeviceName();
vendor = controller->GetDeviceVendor();
description = "QMK OpenRGB Device (Protocol Version " + std::to_string(controller->GetProtocolVersion()) + ")";
type = DEVICE_TYPE_KEYBOARD;
location = controller->GetLocation();
version = controller->GetQMKVersion();
unsigned int current_mode = 1;
std::vector<unsigned int> enabled_modes = controller->GetEnabledModes();
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_SOLID_COLOR) != enabled_modes.end())
{
InitializeMode("Static", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR, MODE_COLORS_MODE_SPECIFIC, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_ALPHA_MOD) != enabled_modes.end())
{
InitializeMode("Alpha Mod", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_GRADIENT_UP_DOWN) != enabled_modes.end())
{
InitializeMode("Gradient Up Down", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_GRADIENT_LEFT_RIGHT) != enabled_modes.end())
{
InitializeMode("Gradient Left Right", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_BREATHING) != enabled_modes.end())
{
InitializeMode("Breathing", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_BAND_SAT) != enabled_modes.end())
{
InitializeMode("Band Saturation", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_BAND_VAL) != enabled_modes.end())
{
InitializeMode("Band Value", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_BAND_PINWHEEL_SAT) != enabled_modes.end())
{
InitializeMode("Band Pinwheel Saturation", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_BAND_PINWHEEL_VAL) != enabled_modes.end())
{
InitializeMode("Band Pinwheel Value", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_BAND_SPIRAL_SAT) != enabled_modes.end())
{
InitializeMode("Band Spiral Saturation", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_BAND_SPIRAL_VAL) != enabled_modes.end())
{
InitializeMode("Band Spiral Value", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_CYCLE_ALL) != enabled_modes.end())
{
InitializeMode("Cycle All", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_CYCLE_LEFT_RIGHT) != enabled_modes.end())
{
InitializeMode("Cycle Left Right", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_CYCLE_UP_DOWN) != enabled_modes.end())
{
InitializeMode("Cycle Up Down", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_CYCLE_OUT_IN) != enabled_modes.end())
{
InitializeMode("Cycle Out In", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_CYCLE_OUT_IN_DUAL) != enabled_modes.end())
{
InitializeMode("Cycle Out In Dual", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_RAINBOW_MOVING_CHEVRON) != enabled_modes.end())
{
InitializeMode("Rainbow Moving Chevron", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_CYCLE_PINWHEEL) != enabled_modes.end())
{
InitializeMode("Cycle Pinwheel", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_CYCLE_SPIRAL) != enabled_modes.end())
{
InitializeMode("Cycle Spiral", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_DUAL_BEACON) != enabled_modes.end())
{
InitializeMode("Dual Beacon", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_RAINBOW_BEACON) != enabled_modes.end())
{
InitializeMode("Rainbow Beacon", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_RAINBOW_PINWHEELS) != enabled_modes.end())
{
InitializeMode("Rainbow Pinwheels", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_RAINDROPS) != enabled_modes.end())
{
InitializeMode("Raindrops", current_mode, 0, MODE_COLORS_NONE, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_JELLYBEAN_RAINDROPS) != enabled_modes.end())
{
InitializeMode("Jellybean Raindrops", current_mode, 0, MODE_COLORS_NONE, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_HUE_BREATHING) != enabled_modes.end())
{
InitializeMode("Hue Breathing", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_HUE_PENDULUM) != enabled_modes.end())
{
InitializeMode("Hue Pendulum", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_HUE_WAVE) != enabled_modes.end())
{
InitializeMode("Hue Wave", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_TYPING_HEATMAP) != enabled_modes.end())
{
InitializeMode("Typing Heatmap", current_mode, 0, MODE_COLORS_NONE, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_DIGITAL_RAIN) != enabled_modes.end())
{
InitializeMode("Digital Rain", current_mode, 0, MODE_COLORS_NONE, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_SOLID_REACTIVE_SIMPLE) != enabled_modes.end())
{
InitializeMode("Solid Reactive Simple", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_SOLID_REACTIVE) != enabled_modes.end())
{
InitializeMode("Solid Reactive", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_SOLID_REACTIVE_WIDE) != enabled_modes.end())
{
InitializeMode("Solid Reactive Wide", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_SOLID_REACTIVE_MULTIWIDE) != enabled_modes.end())
{
InitializeMode("Solid Reactive Multi Wide", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_SOLID_REACTIVE_CROSS) != enabled_modes.end())
{
InitializeMode("Solid Reactive Cross", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_SOLID_REACTIVE_MULTICROSS) != enabled_modes.end())
{
InitializeMode("Solid Reactive Multi Cross", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_SOLID_REACTIVE_NEXUS) != enabled_modes.end())
{
InitializeMode("Solid Reactive Nexus", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_SOLID_REACTIVE_MULTINEXUS) != enabled_modes.end())
{
InitializeMode("Solid Reactive Multi Nexus", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_SPLASH) != enabled_modes.end())
{
InitializeMode("Rainbow Reactive Splash", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_MULTISPLASH) != enabled_modes.end())
{
InitializeMode("Rainbow Reactive Multi Splash", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_SOLID_SPLASH) != enabled_modes.end())
{
InitializeMode("Solid Reactive Splash", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_SOLID_MULTISPLASH) != enabled_modes.end())
{
InitializeMode("Solid Reactive Multi Splash", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_OPENRGB_DIRECT) != enabled_modes.end())
{
InitializeMode("Direct", current_mode, MODE_FLAG_HAS_PER_LED_COLOR, MODE_COLORS_PER_LED, save);
}
/*-----------------------------------------------------*\
| As we are insertting direct mode at index 0 |
| for it to be the first mode in the UI there will |
| be a mismatch between the values. QMK has direct |
| mode last in order, while in OpenRGB it's first. |
\*-----------------------------------------------------*/
if(controller->GetMode() == (current_mode - 1))
{
active_mode = 0;
}
else
{
active_mode = controller->GetMode();
}
SetupZones();
}
RGBController_QMKOpenRGBRevD::~RGBController_QMKOpenRGBRevD()
{
for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++)
{
if(zones[zone_index].matrix_map != NULL)
{
delete zones[zone_index].matrix_map;
}
}
}
void RGBController_QMKOpenRGBRevD::SetupZones()
{
/*---------------------------------------------------------*\
| Get the number of LEDs from the device |
\*---------------------------------------------------------*/
const unsigned int total_number_of_leds = controller->GetTotalNumberOfLEDs();
const unsigned int total_number_of_leds_with_empty_space = controller->GetTotalNumberOfLEDsWithEmptySpace();
/*---------------------------------------------------------*\
| Get information for each LED |
\*---------------------------------------------------------*/
controller->GetLEDInfo(std::max(total_number_of_leds, total_number_of_leds_with_empty_space));
/*---------------------------------------------------------*\
| Get LED vectors from controller |
\*---------------------------------------------------------*/
std::vector<point_t> led_points = controller->GetLEDPoints();
std::vector<unsigned int> led_flags = controller->GetLEDFlags();
std::vector<std::string> led_names = controller->GetLEDNames();
std::vector<unsigned int> led_values = controller->GetLEDValues();
/*---------------------------------------------------------*\
| Count key LEDs and underglow LEDs |
\*---------------------------------------------------------*/
unsigned int number_of_key_leds;
unsigned int number_of_underglow_leds;
CountKeyTypes(led_flags, total_number_of_leds, number_of_key_leds, number_of_underglow_leds);
/*---------------------------------------------------------*\
| Count total LEDs and check if underglow exists |
\*---------------------------------------------------------*/
unsigned int number_of_leds = number_of_key_leds + number_of_underglow_leds;
bool has_underglow = number_of_underglow_leds > 0;
/*---------------------------------------------------------*\
| Create sets for row and column position values |
\*---------------------------------------------------------*/
std::set<int> rows, columns;
for (unsigned int i = 0; i < number_of_leds; i++)
{
rows.insert(led_points[i].y);
columns.insert(led_points[i].x);
}
/*---------------------------------------------------------*\
| Calculate matrix map from QMK positions |
\*---------------------------------------------------------*/
unsigned int divisor = CalculateDivisor(led_points, rows, columns);
VectorMatrix matrix_map;
VectorMatrix underglow_map;
PlaceLEDsInMaps(rows, columns, divisor, led_points, led_flags, matrix_map, underglow_map);
CleanMatrixMaps(matrix_map, underglow_map, rows.size(), has_underglow);
/*---------------------------------------------------------*\
| These vectors are class members because if they go out of |
| scope, the underlying array (used by each zones' |
| matrix_map) is unallocated. |
\*---------------------------------------------------------*/
flat_matrix_map = FlattenMatrixMap(matrix_map);
flat_underglow_map = FlattenMatrixMap(underglow_map);
/*---------------------------------------------------------*\
| Create Keyboard zone |
\*---------------------------------------------------------*/
zone keys_zone;
keys_zone.name = "Keyboard";
keys_zone.type = ZONE_TYPE_MATRIX;
keys_zone.leds_min = number_of_key_leds;
keys_zone.leds_max = keys_zone.leds_min;
keys_zone.leds_count = keys_zone.leds_min;
keys_zone.matrix_map = new matrix_map_type;
keys_zone.matrix_map->width = matrix_map[0].size();
keys_zone.matrix_map->height = matrix_map.size();
keys_zone.matrix_map->map = flat_matrix_map.data();
zones.push_back(keys_zone);
/*---------------------------------------------------------*\
| Create Underglow zone if it exists |
\*---------------------------------------------------------*/
if(has_underglow)
{
zone underglow_zone;
underglow_zone.name = "Underglow";
underglow_zone.type = ZONE_TYPE_MATRIX;
underglow_zone.leds_min = number_of_underglow_leds;
underglow_zone.leds_max = underglow_zone.leds_min;
underglow_zone.leds_count = underglow_zone.leds_min;
underglow_zone.matrix_map = new matrix_map_type;
underglow_zone.matrix_map->width = underglow_map[0].size();
underglow_zone.matrix_map->height = underglow_map.size();
underglow_zone.matrix_map->map = flat_underglow_map.data();
zones.push_back(underglow_zone);
}
/*---------------------------------------------------------*\
| Create LEDs |
\*---------------------------------------------------------*/
for(unsigned int led_idx = 0; led_idx < number_of_leds; led_idx++)
{
led keyboard_led;
if(led_idx < led_names.size())
{
keyboard_led.name = led_names[led_idx];
}
if(led_idx < led_values.size()){
keyboard_led.value = led_values[led_idx];
}
else
{
keyboard_led.value = led_idx;
}
leds.push_back(keyboard_led);
}
/*---------------------------------------------------------*\
| Setup Colors |
\*---------------------------------------------------------*/
SetupColors();
/*---------------------------------------------------------*\
| Initialize colors from device values |
\*---------------------------------------------------------*/
for(unsigned int i = 0; i < leds.size(); i++)
{
colors[i] = controller->GetLEDColors()[i];
}
}
void RGBController_QMKOpenRGBRevD::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_QMKOpenRGBRevD::DeviceUpdateLEDs()
{
controller->DirectModeSetLEDs(colors, controller->GetTotalNumberOfLEDs());
}
void RGBController_QMKOpenRGBRevD::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_QMKOpenRGBRevD::UpdateSingleLED(int led)
{
RGBColor color = colors[led];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
controller->DirectModeSetSingleLED(led, red, grn, blu);
}
void RGBController_QMKOpenRGBRevD::SetCustomMode()
{
active_mode = 0;
}
void RGBController_QMKOpenRGBRevD::DeviceUpdateMode()
{
if(modes[active_mode].color_mode == MODE_COLORS_PER_LED)
{
controller->SetMode({ 0, 255, 255 }, modes[active_mode].value, 127, false);
}
else if(modes[active_mode].color_mode == MODE_COLORS_NONE)
{
controller->SetMode({ 0, 255, 255 }, modes[active_mode].value, modes[active_mode].speed, false);
}
else if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
{
RGBColor rgb_color = modes[active_mode].colors[0];
hsv_t hsv_color;
rgb2hsv(rgb_color, &hsv_color);
if(modes[active_mode].flags & MODE_FLAG_HAS_SPEED)
{
controller->SetMode(hsv_color, modes[active_mode].value, modes[active_mode].speed, false);
}
else
{
controller->SetMode(hsv_color, modes[active_mode].value, 127, false);
}
}
}
void RGBController_QMKOpenRGBRevD::DeviceSaveMode()
{
if(modes[active_mode].color_mode == MODE_COLORS_NONE)
{
controller->SetMode({ 0, 255, 255 }, modes[active_mode].value, modes[active_mode].speed, true);
}
else if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
{
RGBColor rgb_color = modes[active_mode].colors[0];
hsv_t hsv_color;
rgb2hsv(rgb_color, &hsv_color);
if(modes[active_mode].flags & MODE_FLAG_HAS_SPEED)
{
controller->SetMode(hsv_color, modes[active_mode].value, modes[active_mode].speed, true);
}
else
{
controller->SetMode(hsv_color, modes[active_mode].value, 127, true);
}
}
}
void RGBController_QMKOpenRGBRevD::InitializeMode
(
std::string name,
unsigned int &current_mode,
unsigned int flags,
unsigned int color_mode,
bool save
)
{
mode qmk_mode;
qmk_mode.name = name;
qmk_mode.value = current_mode++;
qmk_mode.flags = flags;
qmk_mode.color_mode = color_mode;
if(flags & MODE_FLAG_HAS_SPEED)
{
qmk_mode.speed_min = QMK_OPENRGB_SPEED_SLOWEST;
qmk_mode.speed_max = QMK_OPENRGB_SPEED_FASTEST;
qmk_mode.speed = QMK_OPENRGB_SPEED_NORMAL;
}
if(flags & MODE_FLAG_HAS_MODE_SPECIFIC_COLOR)
{
qmk_mode.colors_min = 1;
qmk_mode.colors_max = 1;
qmk_mode.colors.resize(1);
qmk_mode.colors[0] = controller->GetModeColor();
}
/*-----------------------------------------------------*\
| Direct mode it the last mode on the QMK firmware |
| but we still want it to appear first on the UI |
\*-----------------------------------------------------*/
if(flags & MODE_FLAG_HAS_PER_LED_COLOR)
{
modes.insert(modes.begin(), qmk_mode);
}
else
{
/*-----------------------------------------------------*\
| Every mode apart from direct is save-able |
\*-----------------------------------------------------*/
if(save == true)
{
qmk_mode.flags = flags | MODE_FLAG_MANUAL_SAVE;
}
modes.push_back(qmk_mode);
}
}
unsigned int RGBController_QMKOpenRGBRevD::CalculateDivisor
(
std::vector<point_t> led_points,
std::set<int> rows,
std::set<int> columns
)
{
std::vector< std::vector<point_t> > row_points(rows.size());
for(const point_t &pt : led_points)
{
for(const int &i : rows)
{
if(pt.y == i)
{
row_points[std::distance(rows.begin(), rows.find(i))].push_back(pt);
}
}
}
int last_pos;
std::vector<int> distances;
for(const std::vector<point_t> &row : row_points)
{
last_pos = 0;
std::for_each(row.begin(), row.end(), [&distances, &last_pos](const point_t &pt)
{
distances.push_back(pt.x - last_pos);
last_pos = pt.x;
});
}
std::map<int, int> counts;
for(const int &i : distances)
{
counts[i]++;
}
unsigned int divisor = distances[0];
for(const std::pair<int, int> &i : counts)
{
if(counts[divisor] < i.second)
{
divisor = i.first;
}
}
return divisor;
}
void RGBController_QMKOpenRGBRevD::CountKeyTypes
(
std::vector<unsigned int> led_flags,
unsigned int total_led_count,
unsigned int& key_leds,
unsigned int& underglow_leds
)
{
underglow_leds = 0;
key_leds = 0;
for(unsigned int i = 0; i < total_led_count; i++)
{
if(led_flags[i] & 2)
{
underglow_leds++;
}
else if(led_flags[i] != 0)
{
key_leds++;
}
}
}
void RGBController_QMKOpenRGBRevD::PlaceLEDsInMaps
(
std::set<int> unique_rows,
std::set<int> unique_cols,
unsigned int divisor,
std::vector<point_t> led_points,
std::vector<unsigned int> led_flags,
VectorMatrix& matrix_map_xl,
VectorMatrix& underglow_map_xl
)
{
matrix_map_xl = MakeEmptyMatrixMap(unique_rows.size(), std::round(255/divisor) + 10);
underglow_map_xl = MakeEmptyMatrixMap(unique_rows.size(), std::round(255/divisor) + 10);
unsigned int x = 0;
unsigned int y = 0;
unsigned int openrgb_idx = 0;
unsigned int underglow_counter = 0;
for(unsigned int i = 0; i < controller->GetTotalNumberOfLEDs(); i++)
{
if(led_points[i].x != 255 && led_points[i].y != 255)
{
bool underglow = led_flags[i] & 2;
x = std::round(led_points[i].x/divisor);
y = std::distance(unique_rows.begin(), unique_rows.find(led_points[i].y));
if(!underglow)
{
while(matrix_map_xl[y][x] != NO_LED)
{
x++;
}
matrix_map_xl[y][x] = i;
}
else
{
while(underglow_map_xl[y][x] != NO_LED)
{
x++;
}
underglow_map_xl[y][x] = underglow_counter;
underglow_counter++;
}
}
}
}
VectorMatrix RGBController_QMKOpenRGBRevD::MakeEmptyMatrixMap
(
unsigned int height,
unsigned int width
)
{
std::vector<std::vector<unsigned int> > matrix_map(height);
for (unsigned int i = 0; i < height; i++)
{
for (unsigned int j = 0; j < width; j++)
{
matrix_map[i].push_back(NO_LED);
}
}
return matrix_map;
}
void RGBController_QMKOpenRGBRevD::CleanMatrixMaps
(
VectorMatrix& matrix_map,
VectorMatrix& underglow_map,
unsigned int height,
bool has_underglow
)
{
bool empty_col = true;
bool empty_col_udg = true;
bool empty_row = true;
int width = 0;
int width_udg = 0;
std::vector<int> empty_rows;
bool can_break;
bool can_break_udg;
for(unsigned int i = 0; i < height; i++)
{
empty_row = true;
can_break = false;
can_break_udg = false;
for(std::size_t j = matrix_map[i].size() - 1; j --> 0; )
{
if(matrix_map[i][j] != NO_LED && width < (j + 1) && !can_break)
{
width = (j + 1);
can_break = true;
empty_row = false;
}
else if(matrix_map[i][j] != NO_LED)
{
empty_row = false;
}
if(underglow_map[i][j] != NO_LED && width_udg < (j + 1) && !can_break_udg)
{
width_udg = (j + 1);
can_break_udg = true;
}
if (can_break && can_break_udg) break;
}
if(matrix_map[i][0] != NO_LED)
{
empty_col = false;
}
if(underglow_map[i][0] != NO_LED)
{
empty_col_udg = false;
}
if(empty_row)
{
empty_rows.push_back(i);
}
}
unsigned int new_height = height - empty_rows.size();
width = empty_col ? width - 1 : width;
width_udg = empty_col_udg && empty_col ? width_udg - 1 : width_udg;
for(unsigned int i = empty_rows.size(); i --> 0; )
{
matrix_map.erase(matrix_map.begin()+empty_rows[i]);
}
for(unsigned int i = 0; i < new_height; i++)
{
if(empty_col)
{
matrix_map[i].erase(matrix_map[i].begin(), matrix_map[i].begin() + 1);
}
if(empty_col_udg && empty_col)
{
underglow_map[i].erase(underglow_map[i].begin(), underglow_map[i].begin() + 1);
}
matrix_map[i].erase(matrix_map[i].begin()+width, matrix_map[i].end());
if(has_underglow)
{
underglow_map[i].erase(underglow_map[i].begin()+width_udg, underglow_map[i].end());
}
}
if(has_underglow)
{
for(unsigned int i = new_height; i < height; i++)
{
underglow_map[i].erase(underglow_map[i].begin()+width_udg, underglow_map[i].end());
}
}
}
std::vector<unsigned int> RGBController_QMKOpenRGBRevD::FlattenMatrixMap
(
VectorMatrix matrix_map
)
{
std::vector<unsigned int> flat_map;
for(const std::vector<unsigned int> &row : matrix_map)
{
for(const unsigned int &item : row)
{
flat_map.push_back(item);
}
}
return flat_map;
}
@@ -0,0 +1,98 @@
/*-------------------------------------------------------------------*\
| RGBController_QMKOpenRGBRevD.h |
| |
| Driver for QMK keyboards using OpenRGB Protocol (Revision D) |
| |
| Kasper 10th Octobber 2020 |
| Jath03 28th May 2021 |
\*-------------------------------------------------------------------*/
#pragma once
#include "RGBController.h"
#include "QMKOpenRGBRevDController.h"
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#define NO_LED 0xFFFFFFFF
typedef std::vector<std::vector<unsigned int>> VectorMatrix;
class RGBController_QMKOpenRGBRevD : public RGBController
{
public:
RGBController_QMKOpenRGBRevD(QMKOpenRGBRevDController* controller_ptr, bool save);
~RGBController_QMKOpenRGBRevD();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
void DeviceSaveMode();
private:
QMKOpenRGBRevDController* controller;
std::vector<unsigned int> flat_matrix_map;
std::vector<unsigned int> flat_underglow_map;
void InitializeMode
(
std::string name,
unsigned int &current_mode,
unsigned int flags,
unsigned int color_mode,
bool save
);
unsigned int CalculateDivisor
(
std::vector<point_t> led_points,
std::set<int> rows,
std::set<int> columns
);
void CountKeyTypes
(
std::vector<unsigned int> led_flags,
unsigned int total_led_count,
unsigned int& key_leds,
unsigned int& underglow_leds
);
void PlaceLEDsInMaps
(
std::set<int> unique_rows,
std::set<int> unique_cols,
unsigned int divisor,
std::vector<point_t> led_points,
std::vector<unsigned int> led_flags,
VectorMatrix& matrix_map_xl,
VectorMatrix& underglow_map_xl
);
VectorMatrix MakeEmptyMatrixMap
(
unsigned int height,
unsigned int width
);
void CleanMatrixMaps
(
VectorMatrix& matrix_map,
VectorMatrix& underglow_map,
unsigned int height,
bool has_underglow
);
std::vector<unsigned int> FlattenMatrixMap
(
VectorMatrix matrix_map
);
};
@@ -49,6 +49,7 @@ RazerController::RazerController(hid_device* dev_handle, hid_device* dev_argb_ha
{
case RAZER_BLACKWIDOW_ELITE_PID:
case RAZER_BLACKWIDOW_2019_PID:
case RAZER_BLACKWIDOW_V3_MINI_WIRED_PID:
case RAZER_CYNOSA_V2_PID:
case RAZER_ORNATA_CHROMA_V2_PID:
case RAZER_TARTARUS_CHROMA_PID:
@@ -56,6 +57,7 @@ RazerController::RazerController(hid_device* dev_handle, hid_device* dev_argb_ha
case RAZER_DEATHADDER_CHROMA_PID:
case RAZER_MAMBA_ELITE_PID:
case RAZER_NAGA_EPIC_CHROMA_PID:
case RAZER_NAGA_LEFT_HANDED_PID:
case RAZER_KRAKEN_KITTY_EDITION_PID:
case RAZER_BASE_STATION_V2_CHROMA_PID:
case RAZER_MOUSE_BUNGEE_V3_CHROMA_PID:
@@ -76,6 +78,12 @@ RazerController::RazerController(hid_device* dev_handle, hid_device* dev_argb_ha
dev_transaction_id = 0x3F;
}
break;
case RAZER_BLACKWIDOW_V3_MINI_WIRELESS_PID:
{
dev_transaction_id = 0x9F;
break;
}
case RAZER_GOLIATHUS_CHROMA_PID:
case RAZER_GOLIATHUS_CHROMA_EXTENDED_PID:
@@ -108,7 +116,9 @@ RazerController::RazerController(hid_device* dev_handle, hid_device* dev_argb_ha
case RAZER_CHARGING_PAD_CHROMA_PID:
case RAZER_CHROMA_HDK_PID:
case RAZER_CORE_X_PID:
case RAZER_DEATHADDER_ELITE_PID:
case RAZER_FIREFLY_V2_PID:
case RAZER_NAGA_LEFT_HANDED_PID:
case RAZER_O11_DYNAMIC_PID:
dev_led_id = RAZER_LED_ID_ZERO;
break;
@@ -122,6 +132,8 @@ RazerController::RazerController(hid_device* dev_handle, hid_device* dev_argb_ha
case RAZER_BLACKWIDOW_V3_PRO_BLUETOOTH_PID:
case RAZER_BLACKWIDOW_V3_PRO_WIRELESS_PID:
case RAZER_BLACKWIDOW_V3_TKL_PID:
case RAZER_BLACKWIDOW_V3_MINI_WIRED_PID:
case RAZER_BLACKWIDOW_V3_MINI_WIRELESS_PID:
case RAZER_CYNOSA_CHROMA_PID:
case RAZER_CYNOSA_LITE_PID:
case RAZER_CYNOSA_V2_PID:
@@ -129,6 +141,8 @@ RazerController::RazerController(hid_device* dev_handle, hid_device* dev_argb_ha
case RAZER_HUNTSMAN_PID:
case RAZER_HUNTSMAN_MINI_PID:
case RAZER_HUNTSMAN_TE_PID:
case RAZER_HUNTSMAN_V2_ANALOG_PID:
case RAZER_HUNTSMAN_V2_TKL_PID:
case RAZER_ORNATA_CHROMA_PID:
case RAZER_ORNATA_CHROMA_V2_PID:
case RAZER_CORE_PID:
@@ -200,6 +214,8 @@ RazerController::RazerController(hid_device* dev_handle, hid_device* dev_argb_ha
case RAZER_BLACKWIDOW_V3_PRO_BLUETOOTH_PID:
case RAZER_BLACKWIDOW_V3_PRO_WIRELESS_PID:
case RAZER_BLACKWIDOW_V3_TKL_PID:
case RAZER_BLACKWIDOW_V3_MINI_WIRED_PID:
case RAZER_BLACKWIDOW_V3_MINI_WIRELESS_PID:
case RAZER_CHARGING_PAD_CHROMA_PID:
case RAZER_CHROMA_HDK_PID:
case RAZER_CHROMA_PC_CASE_LIGHTING_KIT_PID:
@@ -221,6 +237,8 @@ RazerController::RazerController(hid_device* dev_handle, hid_device* dev_argb_ha
case RAZER_HUNTSMAN_PID:
case RAZER_HUNTSMAN_MINI_PID:
case RAZER_HUNTSMAN_TE_PID:
case RAZER_HUNTSMAN_V2_ANALOG_PID:
case RAZER_HUNTSMAN_V2_TKL_PID:
case RAZER_KRAKEN_KITTY_EDITION_PID:
case RAZER_LANCEHEAD_TE_WIRED_PID:
case RAZER_LANCEHEAD_2017_WIRED_PID:
@@ -232,6 +250,7 @@ RazerController::RazerController(hid_device* dev_handle, hid_device* dev_argb_ha
case RAZER_MAMBA_ELITE_PID:
case RAZER_MOUSE_BUNGEE_V3_CHROMA_PID:
case RAZER_MOUSE_DOCK_CHROMA_PID:
case RAZER_NAGA_LEFT_HANDED_PID:
case RAZER_NAGA_TRINITY_PID:
case RAZER_NOMMO_CHROMA_PID:
case RAZER_NOMMO_PRO_PID:
@@ -440,6 +459,8 @@ bool RazerController::SupportsWave()
case RAZER_BLACKWIDOW_V3_PRO_BLUETOOTH_PID:
case RAZER_BLACKWIDOW_V3_PRO_WIRELESS_PID:
case RAZER_BLACKWIDOW_V3_TKL_PID:
case RAZER_BLACKWIDOW_V3_MINI_WIRED_PID:
case RAZER_BLACKWIDOW_V3_MINI_WIRELESS_PID:
case RAZER_BLACKWIDOW_X_CHROMA_PID:
case RAZER_BLACKWIDOW_X_CHROMA_TE_PID:
case RAZER_BLADE_2016_PID:
@@ -477,6 +498,8 @@ bool RazerController::SupportsWave()
case RAZER_HUNTSMAN_ELITE_PID:
case RAZER_HUNTSMAN_MINI_PID:
case RAZER_HUNTSMAN_TE_PID:
case RAZER_HUNTSMAN_V2_ANALOG_PID:
case RAZER_HUNTSMAN_V2_TKL_PID:
case RAZER_ORBWEAVER_CHROMA_PID:
case RAZER_TARTARUS_V2_PID:
@@ -489,6 +512,7 @@ bool RazerController::SupportsWave()
case RAZER_MAMBA_2015_WIRED_PID:
case RAZER_MAMBA_2015_WIRELESS_PID:
case RAZER_MAMBA_TE_PID:
case RAZER_NAGA_LEFT_HANDED_PID:
/*-----------------------------------------------------*\
| Headsets |
@@ -10,6 +10,8 @@
#include "RGBController_RazerKraken.h"
#include <hidapi/hidapi.h>
#include <unordered_set>
static bool openrazer_checked = false;
static bool openrazer_enabled = false;
@@ -88,6 +90,21 @@ void DetectRazerControllers(hid_device_info* info, const std::string& name)
* *
\******************************************************************************************/
/*---------------------------------------------------------------------*\
| Tracks the paths used in DetectRazerARGBControllers so multiple Razer |
| devices can be detected without all controlling the same device. |
\*---------------------------------------------------------------------*/
static std::unordered_set<std::string> used_paths;
/*--------------------------------------------------------------------------------*\
| Removes all entries in used_paths so device discovery does not skip any of them. |
\*--------------------------------------------------------------------------------*/
void ResetRazerARGBControllersPaths()
{
used_paths.clear();
}
void DetectRazerARGBControllers(hid_device_info* info, const std::string& name)
{
/*-------------------------------------------------------------------------------------------------*\
@@ -102,19 +119,31 @@ void DetectRazerARGBControllers(hid_device_info* info, const std::string& name)
hid_device* dev_interface_1 = nullptr;
hid_device_info* info_full = hid_enumerate(RAZER_VID, RAZER_CHROMA_ADDRESSABLE_RGB_CONTROLLER_PID);
hid_device_info* info_temp = info_full;
/*--------------------------------------------------------------------------------------------*\
| Keep track of paths so they can be added to used_paths only if both interfaces can be found. |
\*--------------------------------------------------------------------------------------------*/
std::string dev_interface_0_path;
std::string dev_interface_1_path;
while(info_temp)
{
if(info_temp->vendor_id == info->vendor_id
&& info_temp->product_id == info->product_id )
/*----------------------------------------------------------------------------*\
| Check for paths used on an already registered Razer ARGB controller to avoid |
| registering multiple controllers that refer to the same physical hardware. |
\*----------------------------------------------------------------------------*/
if(info_temp->vendor_id == info->vendor_id
&& info_temp->product_id == info->product_id
&& used_paths.find(info_temp->path) == used_paths.end() )
{
if(info_temp->interface_number == 0)
{
dev_interface_0 = hid_open_path(info_temp->path);
dev_interface_0 = hid_open_path(info_temp->path);
dev_interface_0_path = info_temp->path;
}
else if(info_temp->interface_number == 1)
{
dev_interface_1 = hid_open_path(info_temp->path);
dev_interface_1_path = info_temp->path;
}
}
if(dev_interface_0 && dev_interface_1)
@@ -131,6 +160,8 @@ void DetectRazerARGBControllers(hid_device_info* info, const std::string& name)
RazerController* controller = new RazerController(dev_interface_0, dev_interface_1, info->path, info->product_id, name);
RGBController_RazerAddressable* rgb_controller = new RGBController_RazerAddressable(controller);
ResourceManager::get()->RegisterRGBController(rgb_controller);
used_paths.insert(dev_interface_0_path);
used_paths.insert(dev_interface_1_path);
}
else
{
@@ -221,6 +252,8 @@ REGISTER_HID_DETECTOR_IPU("Razer Blackwidow V3 Pro (Wired)", Det
// REGISTER_HID_DETECTOR_PU ("Razer Blackwidow V3 Pro (Bluetooth)", DetectRazerControllers, RAZER_VID, RAZER_BLACKWIDOW_V3_PRO_BLUETOOTH_PID, 0x01, 0x00);
REGISTER_HID_DETECTOR_IPU("Razer Blackwidow V3 Pro (Wireless)", DetectRazerControllers, RAZER_VID, RAZER_BLACKWIDOW_V3_PRO_WIRELESS_PID, 0x03, 0x0C, 0x01);
REGISTER_HID_DETECTOR_IPU("Razer Blackwidow V3 TKL", DetectRazerControllers, RAZER_VID, RAZER_BLACKWIDOW_V3_TKL_PID, 0x00, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Blackwidow V3 Mini (Wired)", DetectRazerControllers, RAZER_VID, RAZER_BLACKWIDOW_V3_MINI_WIRED_PID, 0x03, 0x0C, 0x01);
REGISTER_HID_DETECTOR_IPU("Razer Blackwidow V3 Mini (Wireless)", DetectRazerControllers, RAZER_VID, RAZER_BLACKWIDOW_V3_MINI_WIRELESS_PID, 0x03, 0x0C, 0x01);
REGISTER_HID_DETECTOR_IPU("Razer Blackwidow X Chroma", DetectRazerControllers, RAZER_VID, RAZER_BLACKWIDOW_X_CHROMA_PID, 0x02, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Blackwidow X Chroma Tournament Edition", DetectRazerControllers, RAZER_VID, RAZER_BLACKWIDOW_X_CHROMA_TE_PID, 0x02, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Cynosa Chroma", DetectRazerControllers, RAZER_VID, RAZER_CYNOSA_CHROMA_PID, 0x02, 0x01, 0x02);
@@ -231,6 +264,8 @@ REGISTER_HID_DETECTOR_IPU("Razer Huntsman", Det
REGISTER_HID_DETECTOR_IPU("Razer Huntsman Elite", DetectRazerControllers, RAZER_VID, RAZER_HUNTSMAN_ELITE_PID, 0x02, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Huntsman Mini", DetectRazerControllers, RAZER_VID, RAZER_HUNTSMAN_MINI_PID, 0x02, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Huntsman Tournament Edition", DetectRazerControllers, RAZER_VID, RAZER_HUNTSMAN_TE_PID, 0x02, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Huntsman V2 Analog", DetectRazerControllers, RAZER_VID, RAZER_HUNTSMAN_V2_ANALOG_PID, 0x03, 0x0C, 0x01);
REGISTER_HID_DETECTOR_IPU("Razer Huntsman V2 TKL", DetectRazerControllers, RAZER_VID, RAZER_HUNTSMAN_V2_TKL_PID, 0x03, 0x0C, 0x01);
REGISTER_HID_DETECTOR_IPU("Razer Ornata Chroma", DetectRazerControllers, RAZER_VID, RAZER_ORNATA_CHROMA_PID, 0x02, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Ornata Chroma V2", DetectRazerControllers, RAZER_VID, RAZER_ORNATA_CHROMA_V2_PID, 0x02, 0x01, 0x02);
@@ -302,6 +337,7 @@ REGISTER_HID_DETECTOR_IPU("Razer Mamba Elite", Det
REGISTER_HID_DETECTOR_IPU("Razer Mamba Tournament Edition", DetectRazerControllers, RAZER_VID, RAZER_MAMBA_TE_PID, 0x00, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Naga Chroma", DetectRazerControllers, RAZER_VID, RAZER_NAGA_CHROMA_PID, 0x00, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Naga Epic Chroma", DetectRazerControllers, RAZER_VID, RAZER_NAGA_EPIC_CHROMA_PID, 0x00, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Naga Left Handed", DetectRazerControllers, RAZER_VID, RAZER_NAGA_LEFT_HANDED_PID, 0x00, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Naga Hex V2", DetectRazerControllers, RAZER_VID, RAZER_NAGA_HEX_V2_PID, 0x00, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Naga Trinity", DetectRazerControllers, RAZER_VID, RAZER_NAGA_TRINITY_PID, 0x00, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Viper", DetectRazerControllers, RAZER_VID, RAZER_VIPER_PID, 0x00, 0x01, 0x02);
@@ -343,9 +379,10 @@ REGISTER_HID_DETECTOR_IPU("Razer Base Station Chroma", Det
REGISTER_HID_DETECTOR_IPU("Razer Base Station V2 Chroma", DetectRazerControllers, RAZER_VID, RAZER_BASE_STATION_V2_CHROMA_PID, 0x00, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Charging Pad Chroma", DetectRazerControllers, RAZER_VID, RAZER_CHARGING_PAD_CHROMA_PID, 0x00, 0x0C, 0x01);
REGISTER_HID_DETECTOR_I ("Razer Chroma Addressable RGB Controller", DetectRazerARGBControllers, RAZER_VID, RAZER_CHROMA_ADDRESSABLE_RGB_CONTROLLER_PID, 0x00 );
REGISTER_DYNAMIC_DETECTOR("Razer Chrome Addressable RGB Controller Setup", ResetRazerARGBControllersPaths );
REGISTER_HID_DETECTOR_IPU("Razer Chroma HDK", DetectRazerControllers, RAZER_VID, RAZER_CHROMA_HDK_PID, 0x02, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Chroma Mug Holder", DetectRazerControllers, RAZER_VID, RAZER_CHROMA_MUG_PID, 0x00, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Chroma PC Case Lighting Kit", DetectRazerControllers, RAZER_VID, RAZER_CHROMA_PC_CASE_LIGHTING_KIT_PID, 0x00, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Chroma PC Case Lighting Kit", DetectRazerControllers, RAZER_VID, RAZER_CHROMA_PC_CASE_LIGHTING_KIT_PID, 0x02, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Core", DetectRazerControllers, RAZER_VID, RAZER_CORE_PID, 0x00, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Core X", DetectRazerControllers, RAZER_VID, RAZER_CORE_X_PID, 0x00, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Mouse Bungee V3 Chroma", DetectRazerControllers, RAZER_VID, RAZER_MOUSE_BUNGEE_V3_CHROMA_PID, 0x00, 0x01, 0x02);
+546 -5
View File
@@ -22,6 +22,8 @@
#define RAZER_BLACKWIDOW_LITE_PID 0x0235
#define RAZER_BLACKWIDOW_OVERWATCH_PID 0x0211
#define RAZER_BLACKWIDOW_V3_PID 0x024E
#define RAZER_BLACKWIDOW_V3_MINI_WIRED_PID 0x0258
#define RAZER_BLACKWIDOW_V3_MINI_WIRELESS_PID 0x0271
#define RAZER_BLACKWIDOW_V3_PRO_WIRED_PID 0x025A
#define RAZER_BLACKWIDOW_V3_PRO_BLUETOOTH_PID 0x025B
#define RAZER_BLACKWIDOW_V3_PRO_WIRELESS_PID 0x025C
@@ -72,6 +74,8 @@
#define RAZER_HUNTSMAN_PID 0x0227
#define RAZER_HUNTSMAN_MINI_PID 0x0257
#define RAZER_HUNTSMAN_TE_PID 0x0243
#define RAZER_HUNTSMAN_V2_ANALOG_PID 0x0266
#define RAZER_HUNTSMAN_V2_TKL_PID 0x026B
#define RAZER_ORBWEAVER_CHROMA_PID 0x0207
#define RAZER_ORNATA_CHROMA_PID 0x021E
#define RAZER_ORNATA_CHROMA_V2_PID 0x025D
@@ -131,6 +135,7 @@
#define RAZER_NAGA_HEX_PID 0x0041
#define RAZER_NAGA_HEX_RED_PID 0x0036
#define RAZER_NAGA_HEX_V2_PID 0x0050
#define RAZER_NAGA_LEFT_HANDED_PID 0x008D
#define RAZER_NAGA_TRINITY_PID 0x0067
#define RAZER_OROCHI_2011_PID 0x0013
#define RAZER_OROCHI_2013_PID 0x0039
@@ -522,6 +527,86 @@ static const razer_key blackwidow_v3_tkl_keymap[] =
{ 0, 5, 17, "Key: Right Arrow" },
};
#define BLACKWIDOW_V3_MINI_KEYMAP_SIZE (sizeof(blackwidow_v3_mini_keymap) / sizeof(blackwidow_v3_mini_keymap[0]))
static const razer_key blackwidow_v3_mini_keymap[] =
{
/*---------------------------------------------------------------------*\
| Zone, Row, Column, Key |
\*---------------------------------------------------------------------*/
{ 0, 0, 0, "Key: Escape" },
{ 0, 0, 1, "Key: 1" },
{ 0, 0, 2, "Key: 2" },
{ 0, 0, 3, "Key: 3" },
{ 0, 0, 4, "Key: 4" },
{ 0, 0, 5, "Key: 5" },
{ 0, 0, 6, "Key: 6" },
{ 0, 0, 7, "Key: 7" },
{ 0, 0, 8, "Key: 8" },
{ 0, 0, 9, "Key: 9" },
{ 0, 0, 10, "Key: 0" },
{ 0, 0, 11, "Key: -" },
{ 0, 0, 12, "Key: =" },
{ 0, 0, 14, "Key: Backspace" },
{ 0, 0, 15, "Key: Delete" },
{ 0, 1, 0, "Key: Tab" },
{ 0, 1, 1, "Key: Q" },
{ 0, 1, 2, "Key: W" },
{ 0, 1, 3, "Key: E" },
{ 0, 1, 4, "Key: R" },
{ 0, 1, 5, "Key: T" },
{ 0, 1, 6, "Key: Y" },
{ 0, 1, 7, "Key: U" },
{ 0, 1, 8, "Key: I" },
{ 0, 1, 9, "Key: O" },
{ 0, 1, 10, "Key: P" },
{ 0, 1, 11, "Key: [" },
{ 0, 1, 12, "Key: ]" },
{ 0, 1, 13, "Key: \\ (ANSI)" },
{ 0, 1, 15, "Key: Page Up" },
{ 0, 2, 0, "Key: Caps Lock" },
{ 0, 2, 1, "Key: A" },
{ 0, 2, 2, "Key: S" },
{ 0, 2, 3, "Key: D" },
{ 0, 2, 4, "Key: F" },
{ 0, 2, 5, "Key: G" },
{ 0, 2, 6, "Key: H" },
{ 0, 2, 7, "Key: J" },
{ 0, 2, 8, "Key: K" },
{ 0, 2, 9, "Key: L" },
{ 0, 2, 10, "Key: ;" },
{ 0, 2, 11, "Key: '" },
{ 0, 2, 12, "Key: #" },
{ 0, 2, 13, "Key: Enter" },
{ 0, 2, 15, "Key: Page Down" },
{ 0, 3, 0, "Key: Left Shift" },
{ 0, 3, 1, "Key: \\ (ISO)" },
{ 0, 3, 2, "Key: Z" },
{ 0, 3, 3, "Key: X" },
{ 0, 3, 4, "Key: C" },
{ 0, 3, 5, "Key: V" },
{ 0, 3, 6, "Key: B" },
{ 0, 3, 7, "Key: N" },
{ 0, 3, 8, "Key: M" },
{ 0, 3, 9, "Key: ," },
{ 0, 3, 10, "Key: ." },
{ 0, 3, 11, "Key: /" },
{ 0, 3, 13, "Key: Right Shift" },
{ 0, 3, 14, "Key: Up Arrow" },
{ 0, 3, 15, "Key: Insert" },
{ 0, 4, 0, "Key: Left Control" },
{ 0, 4, 1, "Key: Left Windows" },
{ 0, 4, 2, "Key: Left Alt" },
{ 0, 4, 6, "Key: Space" },
{ 0, 4, 7, "Logo" },
{ 0, 4, 10, "Key: Right Alt" },
{ 0, 4, 11, "Key: Right Fn" },
{ 0, 4, 12, "Key: Right Control" },
{ 0, 4, 13, "Key: Left Arrow" },
{ 0, 4, 14, "Key: Down Arrow" },
{ 0, 4, 15, "Key: Right Arrow" },
};
#define BOOK_13_2020_KEYMAP_SIZE (sizeof(book_13_2020_keymap) / sizeof(book_13_2020_keymap[0]))
static const razer_key book_13_2020_keymap[] =
@@ -1121,6 +1206,125 @@ static const razer_key huntsman_elite_keymap[] =
{ 0, 5, 20, "Key: Number Pad ." },
};
#define HUNTSMAN_V2_ANALOG_KEYMAP_SIZE (sizeof(huntsman_v2_analog_keymap) / sizeof(huntsman_v2_analog_keymap[0]))
static const razer_key huntsman_v2_analog_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, 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, 7, "Key: Space" },
{ 0, 5, 11, "Key: Right Alt" },
{ 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 HUNTSMAN_KEYMAP_SIZE (sizeof(huntsman_keymap) / sizeof(huntsman_keymap[0]))
static const razer_key huntsman_keymap[] =
@@ -1406,6 +1610,104 @@ static const razer_key huntsman_te_keymap[] =
{ 0, 5, 17, "Key: Right Arrow" },
};
#define HUNTSMAN_V2_TKL_KEYMAP_SIZE (sizeof(huntsman_v2_tkl_keymap) / sizeof(huntsman_v2_tkl_keymap[0]))
static const razer_key huntsman_v2_tkl_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, 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, 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, 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, 5, 1, "Key: Left Control" },
{ 0, 5, 2, "Key: Left Windows" },
{ 0, 5, 3, "Key: Left Alt" },
{ 0, 5, 7, "Key: Space" },
{ 0, 5, 11, "Key: Right Alt" },
{ 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" },
};
#define BLACKWIDOW_ELITE_KEYMAP_SIZE (sizeof(blackwidow_elite_keymap) / sizeof(blackwidow_elite_keymap[0]))
static const razer_key blackwidow_elite_keymap[] =
@@ -1991,6 +2293,36 @@ static const razer_key ornata_chroma_keymap[] =
{ 0, 5, 20, "Key: Number Pad ." },
};
#define TARTARUS_V2_KEYMAP_SIZE (sizeof(tartarus_v2_keymap) / sizeof(tartarus_v2_keymap[0]))
static const razer_key tartarus_v2_keymap[] =
{
/*---------------------------------------------------------------------*\
| Zone, Row, Column, Key |
\*---------------------------------------------------------------------*/
{ 0, 0, 0, "Key: 01" },
{ 0, 0, 1, "Key: 02" },
{ 0, 0, 2, "Key: 03" },
{ 0, 0, 3, "Key: 04" },
{ 0, 0, 4, "Key: 05" },
{ 0, 1, 0, "Key: 06" },
{ 0, 1, 1, "Key: 07" },
{ 0, 1, 2, "Key: 08" },
{ 0, 1, 3, "Key: 09" },
{ 0, 1, 4, "Key: 10" },
{ 0, 2, 0, "Key: 11" },
{ 0, 2, 1, "Key: 12" },
{ 0, 2, 2, "Key: 13" },
{ 0, 2, 3, "Key: 14" },
{ 0, 2, 4, "Key: 15" },
{ 0, 3, 0, "Key: 16" },
{ 0, 3, 1, "Key: 17" },
{ 0, 3, 2, "Key: 18" },
{ 0, 3, 3, "Key: 19" },
{ 0, 3, 4, "Key: Scroll Wheel" },
{ 0, 3, 5, "Key: 20" },
};
/*-------------------------------------------------------------------------*\
| KEYBOARDS |
\*-------------------------------------------------------------------------*/
@@ -2380,6 +2712,68 @@ static const razer_device blackwidow_v3_tkl_device =
BLACKWIDOW_V3_TKL_KEYMAP_SIZE
};
/*-------------------------------------------------------------*\
| Razer Blackwidow V3 Mini (Wired) 1532:0258 |
| |
| Zone "Keyboard" |
| Matrix |
| 5 Rows, 16 Columns |
\*-------------------------------------------------------------*/
static const razer_zone blackwidow_v3_mini_zone =
{
"Keyboard",
ZONE_TYPE_MATRIX,
5,
16
};
static const razer_device blackwidow_v3_mini_wired_device =
{
"Razer BlackWidow V3 Mini (Wired)",
RAZER_BLACKWIDOW_V3_MINI_WIRED_PID,
DEVICE_TYPE_KEYBOARD,
true,
5,
16,
{
&blackwidow_v3_mini_zone,
NULL,
NULL,
NULL,
NULL,
NULL
},
blackwidow_v3_mini_keymap,
BLACKWIDOW_V3_MINI_KEYMAP_SIZE
};
/*-------------------------------------------------------------*\
| Razer Blackwidow V3 Mini (Wireless) 1532:0271 |
| |
| Zone "Keyboard" |
| Matrix |
| 5 Rows, 16 Columns |
\*-------------------------------------------------------------*/
static const razer_device blackwidow_v3_mini_wireless_device =
{
"Razer BlackWidow V3 Mini (Wireless)",
RAZER_BLACKWIDOW_V3_MINI_WIRELESS_PID,
DEVICE_TYPE_KEYBOARD,
true,
5,
16,
{
&blackwidow_v3_mini_zone,
NULL,
NULL,
NULL,
NULL,
NULL
},
blackwidow_v3_mini_keymap,
BLACKWIDOW_V3_MINI_KEYMAP_SIZE
};
/*-------------------------------------------------------------*\
| Razer Blackwidow X Chroma 1532:0216 |
| |
@@ -2707,6 +3101,53 @@ static const razer_device huntsman_elite_device =
HUNTSMAN_ELITE_KEYMAP_SIZE
};
/*-------------------------------------------------------------*\
| Razer Huntsman V2 Analog |
| |
| Zone "Keyboard" |
| Matrix |
| 6 Rows, 22 Columns |
| |
| Zone "Underglow" |
| Matrix |
| 3 Rows, 22 Columns |
\*-------------------------------------------------------------*/
static const razer_zone huntsman_v2_analog_keyboard_zone =
{
"Keyboard",
ZONE_TYPE_MATRIX,
6,
22
};
static const razer_zone huntsman_v2_analog_underglow_zone =
{
"Underglow",
ZONE_TYPE_MATRIX,
3,
22
};
static const razer_device huntsman_v2_analog_device =
{
"Razer Huntsman V2 Analog",
RAZER_HUNTSMAN_V2_ANALOG_PID,
DEVICE_TYPE_KEYBOARD,
true,
9,
22,
{
&huntsman_v2_analog_keyboard_zone,
&huntsman_v2_analog_underglow_zone,
NULL,
NULL,
NULL,
NULL
},
huntsman_v2_analog_keymap,
HUNTSMAN_V2_ANALOG_KEYMAP_SIZE
};
/*-------------------------------------------------------------*\
| Razer Huntsman Mini 1532:0257 |
| |
@@ -2777,6 +3218,41 @@ static const razer_device huntsman_te_device =
HUNTSMAN_TE_KEYMAP_SIZE
};
/*-------------------------------------------------------------*\
| Razer Huntsman V2 TKL 1532:026B |
| |
| Zone "Keyboard" |
| Matrix |
| 6 Rows, 18 Columns |
\*-------------------------------------------------------------*/
static const razer_zone huntsman_v2_tkl_zone =
{
"Keyboard",
ZONE_TYPE_MATRIX,
6,
18
};
static const razer_device huntsman_v2_tkl_device =
{
"Razer Huntsman V2 TKL",
RAZER_HUNTSMAN_V2_TKL_PID,
DEVICE_TYPE_KEYBOARD,
true,
6,
18,
{
&huntsman_v2_tkl_zone,
NULL,
NULL,
NULL,
NULL,
NULL
},
huntsman_v2_tkl_keymap,
HUNTSMAN_V2_TKL_KEYMAP_SIZE
};
/*-------------------------------------------------------------------------*\
| LAPTOPS |
\*-------------------------------------------------------------------------*/
@@ -5367,6 +5843,7 @@ static const razer_device naga_chroma_device =
0
};
/*-------------------------------------------------------------*\
| Razer Naga Hex V2 1532:0050 |
| |
@@ -5426,6 +5903,65 @@ static const razer_device naga_hex_v2_device =
0
};
/*-------------------------------------------------------------*\
| Razer Naga Left Handed 1532:008D |
| |
| Zone "Logo" |
| Single |
| 1 LED |
| |
| Zone "Scroll Wheel" |
| Single |
| 1 LED |
| |
| Zone "Numpad" |
| Single |
| 1 LED |
\*-------------------------------------------------------------*/
static const razer_zone naga_left_handed_logo_zone =
{
"Logo",
ZONE_TYPE_SINGLE,
1,
1
};
static const razer_zone naga_left_handed_scroll_wheel_zone =
{
"Scroll Wheel",
ZONE_TYPE_SINGLE,
1,
1
};
static const razer_zone naga_left_handed_numpad_zone =
{
"Numpad",
ZONE_TYPE_SINGLE,
1,
1
};
static const razer_device naga_left_handed_device =
{
"Razer Naga Left Handed",
RAZER_NAGA_LEFT_HANDED_PID,
DEVICE_TYPE_MOUSE,
false,
1,
3,
{
&naga_left_handed_logo_zone,
&naga_left_handed_scroll_wheel_zone,
&naga_left_handed_numpad_zone,
NULL,
NULL,
NULL
},
NULL,
0
};
/*-------------------------------------------------------------*\
| Razer Naga Trinity 1532:0067 |
| |
@@ -5751,14 +6287,14 @@ static const razer_device tartarus_chroma_device =
| |
| Zone "Keypad" |
| Matrix |
| 4 Rows, 5 Columns |
| 4 Rows, 6 Columns |
\*-------------------------------------------------------------*/
static const razer_zone tartarus_v2_zone =
{
"Keypad",
ZONE_TYPE_MATRIX,
4,
5
6
};
static const razer_device tartarus_v2_device =
@@ -5768,7 +6304,7 @@ static const razer_device tartarus_v2_device =
DEVICE_TYPE_KEYBOARD,
true,
4,
5,
6,
{
&tartarus_v2_zone,
NULL,
@@ -5777,8 +6313,8 @@ static const razer_device tartarus_v2_device =
NULL,
NULL
},
NULL,
0
tartarus_v2_keymap,
TARTARUS_V2_KEYMAP_SIZE
};
/*-------------------------------------------------------------------------*\
@@ -6875,6 +7411,8 @@ static const razer_device* device_list[] =
&blackwidow_v3_pro_wireless_device,
&blackwidow_v3_pro_bluetooth_device,
&blackwidow_v3_tkl_device,
&blackwidow_v3_mini_wired_device,
&blackwidow_v3_mini_wireless_device,
&blackwidow_x_chroma_device,
&blackwidow_x_chroma_te_device,
&cynosa_chroma_device,
@@ -6885,6 +7423,8 @@ static const razer_device* device_list[] =
&huntsman_elite_device,
&huntsman_mini_device,
&huntsman_te_device,
&huntsman_v2_analog_device,
&huntsman_v2_tkl_device,
&ornata_chroma_device,
/*-----------------------------------------------------------------*\
| LAPTOPS |
@@ -6955,6 +7495,7 @@ static const razer_device* device_list[] =
&naga_chroma_device,
&naga_epic_chroma_device,
&naga_hex_v2_device,
&naga_left_handed_device,
&naga_trinity_device,
&viper_mini_device,
&viper_ultimate_wired_device,
@@ -0,0 +1,245 @@
/*-----------------------------------------*\
| RGBController_RoccatVulcanAimo.cpp |
| |
| Generic RGB Interface for OpenRGB |
| |
| |
| Mola19 17/12/2021 |
\*-----------------------------------------*/
#include "RGBController_RoccatVulcanAimo.h"
#include <vector>
#define NA 0xFFFFFFFF
static unsigned int matrix_map[6][22] =
{ { 0, NA, 11, 17, 23, 28, NA, 48, 53, 59, 65, 78, 84, 85, 86, 99, 103, 108, NA, NA, NA, NA },
{ 1, 6, 12, 18, 24, 29, 33, 49, 54, 60, 66, 72, 79, 87, NA, 100, 104, 109, 113, 119, 124, 129 },
{ 2, NA, 7, 13, 19, 25, 30, 34, 50, 55, 61, 67, 73, 80, NA, 101, 105, 110, 114, 120, 125, 130 },
{ 3, NA, 8, 14, 20, 26, 31, 35, 51, 56, 62, 68, 74, 96, 88, NA, NA, NA, 115, 121, 126, NA },
{ 4, NA, 9, 15, 21, 27, 32, 36, 52, 57, 63, 69, 75, 82, NA, NA, 106, NA, 116, 122, 127, 131 },
{ 5, 10, 16, NA, NA, NA, 37, NA, NA, NA, NA, 70, 76, 83, 89, 102, 107, 111, 117, NA, 128, NA } };
static const unsigned int zone_size = 132;
static const char *led_names[] =
{
"Key: Escape",
"Key: ^",
"Key: Tab",
"Key: Caps Lock",
"Key: Left Shift",
"Key: Left Control",
"Key: 1",
"Key: Q",
"Key: A",
"Key: <",
"Key: Left Windows",
"Key: F1",
"Key: 2",
"Key: W",
"Key: S",
"Key: Y",
"Key: Left Alt",
"Key: F2",
"Key: 3",
"Key: E",
"Key: D",
"Key: X",
"Unused",
"Key: F3",
"Key: 4",
"Key: R",
"Key: F",
"Key: C",
"Key: F4",
"Key: 5",
"Key: T",
"Key: G",
"Key: V",
"Key: 6",
"Key: Z",
"Key: H",
"Key: B",
"Key: Space",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Key: F5",
"Key: 7",
"Key: U",
"Key: J",
"Key: N",
"Key: F6",
"Key: 8",
"Key: I",
"Key: K",
"Key: M",
"Unused",
"Key: F7",
"Key: 9",
"Key: O",
"Key: L",
"Key: ,",
"Unused",
"Key: F8",
"Key: 0",
"Key: P",
"Key: Ö",
"Key: .",
"Key: Right Alt",
"Unused",
"Key: ß",
"Key: Ü",
"Key: Ä",
"Key: -",
"Key: Right Fn",
"Unused",
"Key: F9",
"Key: ´",
"Key: +",
"Unused",
"Key: Right Shift",
"Key: Menu",
"Key: F10",
"Key: F11",
"Key: F12",
"Key: Backspace",
"Key: Enter",
"Key: Right Control",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Key: #",
"Unused",
"Unused",
"Key: Print Screen",
"Key: Insert",
"Key: Delete",
"Key: Left Arrow",
"Key: Scroll Lock",
"Key: Home",
"Key: End",
"Key: Up Arrow",
"Key: Down Arrow",
"Key: Pause/Break",
"Key: Page Up",
"Key: Page Down",
"Key: Right Arrow",
"Unused",
"Key: Num Lock",
"Key: Number Pad 7",
"Key: Number Pad 4",
"Key: Number Pad 1",
"Key: Number Pad 0",
"Unused",
"Key: Number Pad /",
"Key: Number Pad 8",
"Key: Number Pad 5",
"Key: Number Pad 2",
"Unused",
"Key: Number Pad *",
"Key: Number Pad 9",
"Key: Number Pad 6",
"Key: Number Pad 3",
"Key: Number Pad ,",
"Key: Number Pad -",
"Key: Number Pad +",
"Key: Number Pad Enter",
};
RGBController_RoccatVulcanAimo::RGBController_RoccatVulcanAimo(RoccatVulcanAimoController* controller_ptr)
{
controller = controller_ptr;
name = "Roccat Vulcan 120 Aimo";
vendor = "Roccat";
type = DEVICE_TYPE_KEYBOARD;
description = "Roccat Vulcan Aimo Keyboard";
location = controller->GetLocation();
serial = controller->GetSerial();
mode Direct;
Direct.name = "Direct";
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
SetupZones();
}
RGBController_RoccatVulcanAimo::~RGBController_RoccatVulcanAimo()
{
delete controller;
}
void RGBController_RoccatVulcanAimo::SetupZones()
{
/*---------------------------------------------------------*\
| Set up zones and leds per zone |
\*---------------------------------------------------------*/
zone new_zone;
new_zone.name = "Keyboard";
new_zone.type = ZONE_TYPE_MATRIX;
new_zone.leds_min = zone_size;
new_zone.leds_max = zone_size;
new_zone.leds_count = zone_size;
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = 6;
new_zone.matrix_map->width = 22;
new_zone.matrix_map->map = (unsigned int *)&matrix_map;
zones.push_back(new_zone);
for(unsigned int led_idx = 0; led_idx < zone_size; led_idx++)
{
led new_led;
new_led.name = led_names[led_idx];
leds.push_back(new_led);
}
SetupColors();
}
void RGBController_RoccatVulcanAimo::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_RoccatVulcanAimo::DeviceUpdateLEDs()
{
controller->SendColors(colors);
}
void RGBController_RoccatVulcanAimo::UpdateZoneLEDs(int /*zone_idx*/)
{
DeviceUpdateLEDs();
}
void RGBController_RoccatVulcanAimo::UpdateSingleLED(int /*led_idx*/)
{
DeviceUpdateLEDs();
}
void RGBController_RoccatVulcanAimo::SetCustomMode()
{
active_mode = 0;
}
void RGBController_RoccatVulcanAimo::DeviceUpdateMode()
{
/*---------------------------------------------------------*\
| Changing modes is currently not implemented |
\*---------------------------------------------------------*/
}
@@ -0,0 +1,33 @@
/*-----------------------------------------*\
| RGBController_RoccatVulcanAimo.h |
| |
| Generic RGB Interface for Roccat Vulcan |
| Aimo controller |
| |
| Mola19 17/12/2021 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "RoccatVulcanAimoController.h"
class RGBController_RoccatVulcanAimo : public RGBController
{
public:
RGBController_RoccatVulcanAimo(RoccatVulcanAimoController* controller_ptr);
~RGBController_RoccatVulcanAimo();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
RoccatVulcanAimoController* controller;
};
@@ -8,23 +8,44 @@
#include "Detector.h"
#include "RoccatKoneAimoController.h"
#include "RoccatVulcanAimoController.h"
#include "RGBController.h"
#include "RGBController_RoccatKoneAimo.h"
#include "RGBController_RoccatVulcanAimo.h"
#include <hidapi/hidapi.h>
#define ROCCAT_VID 0x1E7D
void DetectRoccatControllers(hid_device_info* info, const std::string& name)
#define ROCCAT_KONE_AIMO_PID 0x2E27
#define ROCCAT_KONE_AIMO_16K_PID 0x2E2C
#define ROCCAT_VULCAN_120_AIMO_PID 0x3098
void DetectRoccatMouseControllers(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if (dev)
if(dev)
{
RoccatKoneAimoController * controller = new RoccatKoneAimoController(dev, info->path);
RoccatKoneAimoController * controller = new RoccatKoneAimoController(dev, info->path);
RGBController_RoccatKoneAimo * rgb_controller = new RGBController_RoccatKoneAimo(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
} /* DetectRoccatControllers() */
}
REGISTER_HID_DETECTOR_IPU("Roccat Kone Aimo 16K", DetectRoccatControllers, ROCCAT_VID, 0x2E2C, 0, 0x0B, 0);
REGISTER_HID_DETECTOR_IPU("Roccat Kone Aimo", DetectRoccatControllers, ROCCAT_VID, 0x2E27, 0, 0x0B, 0);
void DetectRoccatKeyboardControllers(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
RoccatVulcanAimoController * controller = new RoccatVulcanAimoController(dev, info->path);
RGBController_RoccatVulcanAimo * rgb_controller = new RGBController_RoccatVulcanAimo(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
REGISTER_HID_DETECTOR_IPU("Roccat Kone Aimo", DetectRoccatMouseControllers, ROCCAT_VID, ROCCAT_KONE_AIMO_PID, 0, 0x0B, 0);
REGISTER_HID_DETECTOR_IPU("Roccat Kone Aimo 16K", DetectRoccatMouseControllers, ROCCAT_VID, ROCCAT_KONE_AIMO_16K_PID, 0, 0x0B, 0);
REGISTER_HID_DETECTOR_IP ("Roccat Vulcan 120 Aimo", DetectRoccatKeyboardControllers, ROCCAT_VID, ROCCAT_VULCAN_120_AIMO_PID, 3, 1);
@@ -0,0 +1,75 @@
/*-------------------------------------------------------------------*\
| RoccatVulcanAimoController.cpp |
| |
| Driver for Roccat Vulcan Aimo Mouse |
| |
| Mola19 17/12/2021 |
| |
\*-------------------------------------------------------------------*/
#include "RoccatVulcanAimoController.h"
#include <cstring>
RoccatVulcanAimoController::RoccatVulcanAimoController(hid_device* dev_handle, char *path)
{
dev = dev_handle;
location = path;
}
RoccatVulcanAimoController::~RoccatVulcanAimoController()
{
hid_close(dev);
}
std::string RoccatVulcanAimoController::GetSerial()
{
wchar_t serial_string[128];
int ret = hid_get_serial_number_string(dev, serial_string, 128);
if(ret != 0)
{
return("");
}
std::wstring return_wstring = serial_string;
std::string return_string(return_wstring.begin(), return_wstring.end());
return(return_string);
}
std::string RoccatVulcanAimoController::GetLocation()
{
return("HID: " + location);
}
void RoccatVulcanAimoController::SendColors(std::vector<RGBColor> colors)
{
unsigned char bufs[7][65];
bufs[0][1] = 0xA1;
bufs[0][2] = 0x01;
bufs[0][3] = 0x01;
bufs[0][4] = 0xB4;
for(int z = 0; z < 11; z++)
{
for(int l = 0; l < 12; l++)
{
int placeR = (z * 36) + 4 + l + 0;
bufs[placeR / 64][placeR % 64 + 1] = RGBGetRValue(colors[z * 12 + l]);
int placeG = (z * 36) + 4 + l + 12;
bufs[placeG / 64][placeG % 64 + 1] = RGBGetGValue(colors[z * 12 + l]);
int placeB = (z * 36) + 4 + l + 24;
bufs[placeB / 64][placeB % 64 + 1] = RGBGetBValue(colors[z * 12 + l]);
}
}
for(int p = 0; p < 7; p++)
{
hid_write(dev, bufs[p], 65);
}
}
@@ -0,0 +1,31 @@
/*-------------------------------------------------------------------*\
| RoccatVulcanAimoController.h |
| |
| Driver for Roccat Vulcan Aimo Keyboard |
| |
| Mola19 17/12/2021 |
| |
\*-------------------------------------------------------------------*/
#pragma once
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
class RoccatVulcanAimoController
{
public:
RoccatVulcanAimoController(hid_device* dev_handle, char *path);
~RoccatVulcanAimoController();
std::string GetSerial();
std::string GetLocation();
void SendColors(std::vector<RGBColor> colors);
private:
std::string location;
hid_device* dev;
};
+2
View File
@@ -15,6 +15,8 @@
#define SMBUS_CHECK_DEVICE_MESSAGE_EN "[%s] Bus %02d is a motherboard and the subvendor matches the one for %s, looking for a device at %02X"
#define SMBUS_CHECK_DEVICE_FAILURE_EN "[%s] Bus %02d is not a motherboard or the subvendor does not match the one for %s, skipping detection"
#define GPU_DETECT_MESSAGE "[%s] Found a device match at Bus %02d for Device %04X and SubDevice %04X: %s"
using json = nlohmann::json;
enum
+49 -5
View File
@@ -32,7 +32,7 @@ greaterThan(QT_MAJOR_VERSION, 4) {
#-----------------------------------------------------------------------------------------------#
# Application Configuration #
#-----------------------------------------------------------------------------------------------#
VERSION = 0.61
VERSION = 0.7
TARGET = OpenRGB
TEMPLATE = app
@@ -94,9 +94,11 @@ INCLUDEPATH +=
Controllers/DasKeyboardController/ \
Controllers/DebugController/ \
Controllers/DuckyKeyboardController/ \
Controllers/DygmaRaiseController/ \
Controllers/E131Controller/ \
Controllers/EKController/ \
Controllers/ENESMBusController/ \
Controllers/ENESMBusController/ENESMBusInterface \
Controllers/EspurnaController/ \
Controllers/EVGAGPUController/ \
Controllers/EVisionKeyboardController/ \
@@ -109,6 +111,7 @@ INCLUDEPATH +=
Controllers/GigabyteRGBFusion2USBController/ \
Controllers/GigabyteRGBFusionController/ \
Controllers/GigabyteRGBFusionGPUController/ \
Controllers/GigabyteRGBFusion2GPUController/ \
Controllers/HoltekController/ \
Controllers/HPOmen30LController/ \
Controllers/HyperXDRAMController/ \
@@ -229,10 +232,13 @@ HEADERS +=
Controllers/AsusAuraUSBController/AsusAuraMainboardController.h \
Controllers/AsusAuraUSBController/AsusAuraMouseController.h \
Controllers/AsusAuraUSBController/AsusAuraMouseDevices.h \
Controllers/AsusAuraUSBController/AsusAuraStrixEvolveController.h \
Controllers/AsusAuraUSBController/AsusAuraTUFKeyboardController.h \
Controllers/AsusAuraUSBController/AsusAuraTUFKeyboardLayouts.h \
Controllers/AsusAuraUSBController/RGBController_AsusAuraHeadsetStand.h \
Controllers/AsusAuraUSBController/RGBController_AsusAuraKeyboard.h \
Controllers/AsusAuraUSBController/RGBController_AsusAuraMouse.h \
Controllers/AsusAuraUSBController/RGBController_AsusAuraStrixEvolve.h \
Controllers/AsusAuraUSBController/RGBController_AsusAuraTUFKeyboard.h \
Controllers/AsusAuraUSBController/RGBController_AsusAuraUSB.h \
Controllers/BlinkyTapeController/BlinkyTapeController.h \
@@ -279,12 +285,16 @@ HEADERS +=
Controllers/DasKeyboardController/RGBController_DasKeyboard.h \
Controllers/DuckyKeyboardController/DuckyKeyboardController.h \
Controllers/DuckyKeyboardController/RGBController_DuckyKeyboard.h \
Controllers/DygmaRaiseController/DygmaRaiseController.h \
Controllers/DygmaRaiseController/RGBController_DygmaRaise.h \
Controllers/DebugController/RGBController_Debug.h \
Controllers/E131Controller/RGBController_E131.h \
Controllers/EKController/EKController.h \
Controllers/EKController/RGBController_EKController.h \
Controllers/ENESMBusController/ENESMBusController.h \
Controllers/ENESMBusController/RGBController_ENESMBus.h \
Controllers/ENESMBusController/ENESMBusInterface/ENESMBusInterface.h \
Controllers/ENESMBusController/ENESMBusInterface/ENESMBusInterface_i2c_smbus.h \
Controllers/EspurnaController/EspurnaController.h \
Controllers/EspurnaController/RGBController_Espurna.h \
Controllers/EVGAGPUController/EVGAGP102Controller.h \
@@ -319,6 +329,8 @@ HEADERS +=
Controllers/GigabyteRGBFusionController/RGBController_GigabyteRGBFusion.h \
Controllers/GigabyteRGBFusionGPUController/GigabyteRGBFusionGPUController.h \
Controllers/GigabyteRGBFusionGPUController/RGBController_GigabyteRGBFusionGPU.h \
Controllers/GigabyteRGBFusion2GPUController/GigabyteRGBFusion2GPUController.h \
Controllers/GigabyteRGBFusion2GPUController/RGBController_GigabyteRGBFusion2GPU.h \
Controllers/HoltekController/HoltekA070Controller.h \
Controllers/HoltekController/HoltekA1FAController.h \
Controllers/HoltekController/RGBController_HoltekA070.h \
@@ -357,6 +369,7 @@ HEADERS +=
Controllers/LogitechController/LogitechG560Controller.h \
Controllers/LogitechController/LogitechG933Controller.h \
Controllers/LogitechController/LogitechG810Controller.h \
Controllers/LogitechController/LogitechGProKeyboardController.h \
Controllers/LogitechController/LogitechG910Controller.h \
Controllers/LogitechController/LogitechG815Controller.h \
Controllers/LogitechController/LogitechG915Controller.h \
@@ -368,6 +381,7 @@ HEADERS +=
Controllers/LogitechController/RGBController_LogitechG560.h \
Controllers/LogitechController/RGBController_LogitechG933.h \
Controllers/LogitechController/RGBController_LogitechG810.h \
Controllers/LogitechController/RGBController_LogitechGProKeyboard.h \
Controllers/LogitechController/RGBController_LogitechG910.h \
Controllers/LogitechController/RGBController_LogitechG815.h \
Controllers/LogitechController/RGBController_LogitechG915.h \
@@ -405,8 +419,10 @@ HEADERS +=
Controllers/QMKOpenRGBController/QMKOpenRGBController.h \
Controllers/QMKOpenRGBController/QMKOpenRGBRev9Controller.h \
Controllers/QMKOpenRGBController/QMKOpenRGBRevBController.h \
Controllers/QMKOpenRGBController/QMKOpenRGBRevDController.h \
Controllers/QMKOpenRGBController/RGBController_QMKOpenRGBRev9.h \
Controllers/QMKOpenRGBController/RGBController_QMKOpenRGBRevB.h \
Controllers/QMKOpenRGBController/RGBController_QMKOpenRGBRevD.h \
Controllers/RazerController/RazerController.h \
Controllers/RazerController/RazerKrakenController.h \
Controllers/RazerController/RazerDevices.h \
@@ -416,7 +432,9 @@ HEADERS +=
Controllers/RedragonController/RedragonM711Controller.h \
Controllers/RedragonController/RGBController_RedragonM711.h \
Controllers/RoccatController/RGBController_RoccatKoneAimo.h \
Controllers/RoccatController/RGBController_RoccatVulcanAimo.h \
Controllers/RoccatController/RoccatKoneAimoController.h \
Controllers/RoccatController/RoccatVulcanAimoController.h \
Controllers/SapphireGPUController/SapphireNitroGlowV1Controller.h \
Controllers/SapphireGPUController/SapphireNitroGlowV3Controller.h \
Controllers/SapphireGPUController/RGBController_SapphireNitroGlowV1.h \
@@ -585,11 +603,13 @@ SOURCES +=
Controllers/AsusAuraUSBController/AsusAuraKeyboardController.cpp \
Controllers/AsusAuraUSBController/AsusAuraMainboardController.cpp \
Controllers/AsusAuraUSBController/AsusAuraMouseController.cpp \
Controllers/AsusAuraUSBController/AsusAuraStrixEvolveController.cpp \
Controllers/AsusAuraUSBController/AsusAuraTUFKeyboardController.cpp \
Controllers/AsusAuraUSBController/AsusAuraUSBControllerDetect.cpp \
Controllers/AsusAuraUSBController/RGBController_AsusAuraHeadsetStand.cpp \
Controllers/AsusAuraUSBController/RGBController_AsusAuraKeyboard.cpp \
Controllers/AsusAuraUSBController/RGBController_AsusAuraMouse.cpp \
Controllers/AsusAuraUSBController/RGBController_AsusAuraStrixEvolve.cpp \
Controllers/AsusAuraUSBController/RGBController_AsusAuraTUFKeyboard.cpp \
Controllers/AsusAuraUSBController/RGBController_AsusAuraUSB.cpp \
Controllers/BlinkyTapeController/BlinkyTapeController.cpp \
@@ -653,6 +673,9 @@ SOURCES +=
Controllers/DuckyKeyboardController/DuckyKeyboardControllerDetect.cpp \
Controllers/DuckyKeyboardController/RGBController_DuckyKeyboard.cpp \
Controllers/DebugController/RGBController_Debug.cpp \
Controllers/DygmaRaiseController/DygmaRaiseController.cpp \
Controllers/DygmaRaiseController/DygmaRaiseControllerDetect.cpp \
Controllers/DygmaRaiseController/RGBController_DygmaRaise.cpp \
Controllers/E131Controller/E131ControllerDetect.cpp \
Controllers/E131Controller/RGBController_E131.cpp \
Controllers/EKController/EKControllerDetect.cpp \
@@ -661,6 +684,7 @@ SOURCES +=
Controllers/ENESMBusController/ENESMBusController.cpp \
Controllers/ENESMBusController/ENESMBusControllerDetect.cpp \
Controllers/ENESMBusController/RGBController_ENESMBus.cpp \
Controllers/ENESMBusController/ENESMBusInterface/ENESMBusInterface_i2c_smbus.cpp \
Controllers/EspurnaController/EspurnaController.cpp \
Controllers/EspurnaController/EspurnaControllerDetect.cpp \
Controllers/EspurnaController/RGBController_Espurna.cpp \
@@ -706,6 +730,9 @@ SOURCES +=
Controllers/GigabyteRGBFusionGPUController/GigabyteRGBFusionGPUController.cpp \
Controllers/GigabyteRGBFusionGPUController/GigabyteRGBFusionGPUControllerDetect.cpp \
Controllers/GigabyteRGBFusionGPUController/RGBController_GigabyteRGBFusionGPU.cpp \
Controllers/GigabyteRGBFusion2GPUController/GigabyteRGBFusion2GPUController.cpp \
Controllers/GigabyteRGBFusion2GPUController/GigabyteRGBFusion2GPUControllerDetect.cpp \
Controllers/GigabyteRGBFusion2GPUController/RGBController_GigabyteRGBFusion2GPU.cpp \
Controllers/HoltekController/HoltekA070Controller.cpp \
Controllers/HoltekController/HoltekA1FAController.cpp \
Controllers/HoltekController/HoltekControllerDetect.cpp \
@@ -753,6 +780,7 @@ SOURCES +=
Controllers/LogitechController/LogitechG560Controller.cpp \
Controllers/LogitechController/LogitechG933Controller.cpp \
Controllers/LogitechController/LogitechG810Controller.cpp \
Controllers/LogitechController/LogitechGProKeyboardController.cpp \
Controllers/LogitechController/LogitechG910Controller.cpp \
Controllers/LogitechController/LogitechG815Controller.cpp \
Controllers/LogitechController/LogitechG915Controller.cpp \
@@ -764,6 +792,7 @@ SOURCES +=
Controllers/LogitechController/RGBController_LogitechG560.cpp \
Controllers/LogitechController/RGBController_LogitechG933.cpp \
Controllers/LogitechController/RGBController_LogitechG810.cpp \
Controllers/LogitechController/RGBController_LogitechGProKeyboard.cpp \
Controllers/LogitechController/RGBController_LogitechG910.cpp \
Controllers/LogitechController/RGBController_LogitechG815.cpp \
Controllers/LogitechController/RGBController_LogitechG915.cpp \
@@ -812,8 +841,10 @@ SOURCES +=
Controllers/QMKOpenRGBController/QMKOpenRGBControllerDetect.cpp \
Controllers/QMKOpenRGBController/QMKOpenRGBRev9Controller.cpp \
Controllers/QMKOpenRGBController/QMKOpenRGBRevBController.cpp \
Controllers/QMKOpenRGBController/QMKOpenRGBRevDController.cpp \
Controllers/QMKOpenRGBController/RGBController_QMKOpenRGBRev9.cpp \
Controllers/QMKOpenRGBController/RGBController_QMKOpenRGBRevB.cpp \
Controllers/QMKOpenRGBController/RGBController_QMKOpenRGBRevD.cpp \
Controllers/RazerController/RazerController.cpp \
Controllers/RazerController/RazerKrakenController.cpp \
Controllers/RazerController/RazerControllerDetect.cpp \
@@ -824,7 +855,9 @@ SOURCES +=
Controllers/RedragonController/RedragonControllerDetect.cpp \
Controllers/RedragonController/RGBController_RedragonM711.cpp \
Controllers/RoccatController/RGBController_RoccatKoneAimo.cpp \
Controllers/RoccatController/RGBController_RoccatVulcanAimo.cpp \
Controllers/RoccatController/RoccatKoneAimoController.cpp \
Controllers/RoccatController/RoccatVulcanAimoController.cpp \
Controllers/RoccatController/RoccatControllerDetect.cpp \
Controllers/SapphireGPUController/SapphireNitroGlowV1Controller.cpp \
Controllers/SapphireGPUController/SapphireNitroGlowV3Controller.cpp \
@@ -1036,6 +1069,8 @@ win32:SOURCES +=
AutoStart/AutoStart-Windows.cpp \
Controllers/AsusTUFLaptopController/AsusTUFLaptopWMIDetect.cpp \
Controllers/AsusTUFLaptopController/RGBController_AsusTUFLaptopWMI.cpp \
Controllers/ENESMBusController/XPGSpectrixS40GDetect_Windows.cpp \
Controllers/ENESMBusController/ENESMBusInterface/ENESMBusInterface_SpectrixS40G_Windows.cpp \
Controllers/OpenRazerController/OpenRazerWindowsDetect.cpp \
Controllers/OpenRazerController/RGBController_OpenRazerWindows.cpp \
@@ -1053,6 +1088,7 @@ win32:HEADERS +=
wmi/acpiwmi.h \
AutoStart/AutoStart-Windows.h \
Controllers/AsusTUFLaptopController/RGBController_AsusTUFLaptopWMI.h \
Controllers/ENESMBusController/ENESMBusInterface/ENESMBusInterface_SpectrixS40G_Windows.h \
Controllers/OpenRazerController/RGBController_OpenRazerWindows.h \
win32:contains(QMAKE_TARGET.arch, x86_64) {
@@ -1141,6 +1177,7 @@ unix:!macx {
HEADERS += \
i2c_smbus/i2c_smbus_linux.h \
AutoStart/AutoStart-Linux.h \
Controllers/ENESMBusController/ENESMBusInterface/ENESMBusInterface_SpectrixS40G.h \
Controllers/FaustusController/RGBController_Faustus.h \
Controllers/LinuxLEDController/LinuxLEDController.h \
Controllers/LinuxLEDController/RGBController_LinuxLED.h \
@@ -1185,6 +1222,8 @@ unix:!macx {
i2c_smbus/i2c_smbus_linux.cpp \
serial_port/find_usb_serial_port_linux.cpp \
AutoStart/AutoStart-Linux.cpp \
Controllers/ENESMBusController/XPGSpectrixS40GDetect.cpp \
Controllers/ENESMBusController/ENESMBusInterface/ENESMBusInterface_SpectrixS40G.cpp \
Controllers/FaustusController/RGBController_Faustus.cpp \
Controllers/LinuxLEDController/LinuxLEDController.cpp \
Controllers/LinuxLEDController/LinuxLEDControllerDetect.cpp \
@@ -1203,11 +1242,13 @@ unix:!macx {
target.path=$$PREFIX/bin/
desktop.path=$$PREFIX/share/applications/
desktop.files+=qt/OpenRGB.desktop
pixmap.path=$$PREFIX/share/pixmaps/
pixmap.files+=qt/OpenRGB.png
rules.path=/lib/udev/rules.d/
icon.path=$$PREFIX/share/icons/hicolor/128x128/apps/
icon.files+=qt/OpenRGB.png
metainfo.path=$$PREFIX/share/metainfo/
metainfo.files+=qt/org.openrgb.OpenRGB.metainfo.xml
rules.path=$$PREFIX/lib/udev/rules.d/
rules.files+=60-openrgb.rules
INSTALLS += target desktop pixmap rules
INSTALLS += target desktop icon metainfo rules
}
unix:!macx:CONFIG(asan) {
@@ -1231,6 +1272,9 @@ macx {
DEFINES += \
USE_HID_USAGE \
QMAKE_CXXFLAGS += \
-Wno-narrowing \
HEADERS += \
AutoStart/AutoStart-MacOS.h \
+7 -1
View File
@@ -17,7 +17,13 @@
#define OpenRGBPluginInterface_IID "com.OpenRGBPluginInterface"
#define OPENRGB_PLUGIN_API_VERSION 1
/*-----------------------------------------------------------------------------------------------------*\
| OpenRGB Plugin API Versions |
| 0: OpenRGB 0.6 Unversioned, early plugin API. |
| 1: OpenRGB 0.61 First versioned API, introduced with plugin settings changes |
| 2: OpenRGB 0.7 First released versioned API, callback unregister functions in ResourceManager |
\*-----------------------------------------------------------------------------------------------------*/
#define OPENRGB_PLUGIN_API_VERSION 2
/*-----------------------------------------------------------------------------------------------------*\
| Plugin Tab Location Values |
+2 -3
View File
@@ -32,9 +32,8 @@ This project interacts directly with hardware using reverse engineered protocols
There have been two instances of hardware damage in OpenRGB's development and we've taken precautions to prevent it from happening again.
* The MSI Mystic Light code reportedly bricked the RGB on certain MSI boards when sending certain modes. This code has been disabled and MSI Mystic Light motherboards will not work with OpenRGB at this time.
* The Mystic Light motherboard code bricked the RGB controller of some MSI motherboards. The code was disabled and reworked. We have been re-adding these motherboards to the support list as we verify that the new code works with them. Affected boards can be unbricked with a Nuvoton Nu-Link adapter.
* 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.
* To enable the MSI Mystic Light code, you must uncomment the detection macro in the Mystic Light controller detection code and recompile.
![OpenRGB_Device_View](https://gitlab.com/CalcProgrammer1/OpenRGB/-/wikis/uploads/e1d8d4603ecdd04f1acbcf6b2314fc66/OpenRGB_0.31_Device_View.PNG)
@@ -192,7 +191,7 @@ There have been two instances of hardware damage in OpenRGB's development and we
* OpenRGB provides a plugin interface for adding features to the OpenRGB application. The following projects provide additional functionality in the form of plugins.
* OpenRGB E1.31 Receiver Plugin (by me): https://gitlab.com/CalcProgrammer1/OpenRGBE131ReceiverPlugin
* Effects Engine Plugin (by herosilas12, morg): https://gitlab.com/OpenRGBDevelopers/OpenRGBEffectPlugin
* Effects Engine Plugin (by herosilas12, morg): https://gitlab.com/OpenRGBDevelopers/OpenRGBEffectsPlugin
* OpenRGB Visual Map Plugin (by morg): https://gitlab.com/OpenRGBDevelopers/OpenRGBVisualMapPlugin
* Scheduler Plugin (by morg): https://gitlab.com/OpenRGBDevelopers/OpenRGBSchedulerPlugin
* Skin Plugin (by morg): https://gitlab.com/OpenRGBDevelopers/openrgbskinplugin
+4 -2
View File
@@ -1553,13 +1553,13 @@ void RGBController::DeviceCallThreadFunction()
{
if(CallFlag_UpdateMode.load() == true)
{
CallFlag_UpdateMode = false;
DeviceUpdateMode();
CallFlag_UpdateMode = false;
}
if(CallFlag_UpdateLEDs.load() == true)
{
CallFlag_UpdateLEDs = false;
DeviceUpdateLEDs();
CallFlag_UpdateLEDs = false;
}
else
{
@@ -1605,6 +1605,8 @@ std::string device_type_to_str(device_type type)
return "Light";
case DEVICE_TYPE_SPEAKER:
return "Speaker";
case DEVICE_TYPE_STORAGE:
return "Storage";
case DEVICE_TYPE_VIRTUAL:
return "Virtual";
default:
+1
View File
@@ -131,6 +131,7 @@ enum
DEVICE_TYPE_LIGHT,
DEVICE_TYPE_SPEAKER,
DEVICE_TYPE_VIRTUAL,
DEVICE_TYPE_STORAGE,
DEVICE_TYPE_UNKNOWN
};
+83 -7
View File
@@ -232,6 +232,22 @@ void ResourceManager::RegisterDeviceListChangeCallback(DeviceListChangeCallback
{
DeviceListChangeCallbacks.push_back(new_callback);
DeviceListChangeCallbackArgs.push_back(new_callback_arg);
LOG_TRACE("[ResourceManager] Registered device list change callback. Total callbacks registered: %d", DeviceListChangeCallbacks.size());
}
void ResourceManager::UnregisterDeviceListChangeCallback(DeviceListChangeCallback callback, void * callback_arg)
{
for(size_t idx = 0; idx < DeviceListChangeCallbacks.size(); idx++)
{
if(DeviceListChangeCallbacks[idx] == callback && DeviceListChangeCallbackArgs[idx] == callback_arg)
{
DeviceListChangeCallbacks.erase(DeviceListChangeCallbacks.begin() + idx);
DeviceListChangeCallbackArgs.erase(DeviceListChangeCallbackArgs.begin() + idx);
}
}
LOG_TRACE("[ResourceManager] Unregistered device list change callback. Total callbacks registered: %d", DeviceListChangeCallbacks.size());
}
void ResourceManager::RegisterI2CBusListChangeCallback(I2CBusListChangeCallback new_callback, void * new_callback_arg)
@@ -240,10 +256,38 @@ void ResourceManager::RegisterI2CBusListChangeCallback(I2CBusListChangeCallback
I2CBusListChangeCallbackArgs.push_back(new_callback_arg);
}
void ResourceManager::UnregisterI2CBusListChangeCallback(I2CBusListChangeCallback callback, void * callback_arg)
{
for(size_t idx = 0; idx < I2CBusListChangeCallbacks.size(); idx++)
{
if(I2CBusListChangeCallbacks[idx] == callback && I2CBusListChangeCallbackArgs[idx] == callback_arg)
{
I2CBusListChangeCallbacks.erase(I2CBusListChangeCallbacks.begin() + idx);
I2CBusListChangeCallbackArgs.erase(I2CBusListChangeCallbackArgs.begin() + idx);
}
}
}
void ResourceManager::RegisterDetectionProgressCallback(DetectionProgressCallback new_callback, void *new_callback_arg)
{
DetectionProgressCallbacks.push_back(new_callback);
DetectionProgressCallbackArgs.push_back(new_callback_arg);
LOG_TRACE("[ResourceManager] Registered detection progress callback. Total callbacks registered: %d", DetectionProgressCallbacks.size());
}
void ResourceManager::UnregisterDetectionProgressCallback(DetectionProgressCallback callback, void *callback_arg)
{
for(size_t idx = 0; idx < DetectionProgressCallbacks.size(); idx++)
{
if(DetectionProgressCallbacks[idx] == callback && DetectionProgressCallbackArgs[idx] == callback_arg)
{
DetectionProgressCallbacks.erase(DetectionProgressCallbacks.begin() + idx);
DetectionProgressCallbackArgs.erase(DetectionProgressCallbackArgs.begin() + idx);
}
}
LOG_TRACE("[ResourceManager] Unregistered detection progress callback. Total callbacks registered: %d", DetectionProgressCallbacks.size());
}
void ResourceManager::RegisterDetectionStartCallback(DetectionStartCallback new_callback, void *new_callback_arg)
@@ -252,12 +296,36 @@ void ResourceManager::RegisterDetectionStartCallback(DetectionStartCallback new_
DetectionStartCallbackArgs.push_back(new_callback_arg);
}
void ResourceManager::UnregisterDetectionStartCallback(DetectionStartCallback callback, void *callback_arg)
{
for(size_t idx = 0; idx < DetectionStartCallbacks.size(); idx++)
{
if(DetectionStartCallbacks[idx] == callback && DetectionStartCallbackArgs[idx] == callback_arg)
{
DetectionStartCallbacks.erase(DetectionStartCallbacks.begin() + idx);
DetectionStartCallbackArgs.erase(DetectionStartCallbackArgs.begin() + idx);
}
}
}
void ResourceManager::RegisterDetectionEndCallback(DetectionEndCallback new_callback, void *new_callback_arg)
{
DetectionEndCallbacks.push_back(new_callback);
DetectionEndCallbackArgs.push_back(new_callback_arg);
}
void ResourceManager::UnregisterDetectionEndCallback(DetectionEndCallback callback, void *callback_arg)
{
for(size_t idx = 0; idx < DetectionEndCallbacks.size(); idx++)
{
if(DetectionEndCallbacks[idx] == callback && DetectionEndCallbackArgs[idx] == callback_arg)
{
DetectionEndCallbacks.erase(DetectionEndCallbacks.begin() + idx);
DetectionEndCallbackArgs.erase(DetectionEndCallbackArgs.begin() + idx);
}
}
}
void ResourceManager::UpdateDeviceList()
{
DeviceListChangeMutex.lock();
@@ -318,6 +386,8 @@ void ResourceManager::DeviceListChanged()
/*-------------------------------------------------*\
| Device list has changed, call the callbacks |
\*-------------------------------------------------*/
LOG_TRACE("[ResourceManager] Calling device list change callbacks.");
for(unsigned int callback_idx = 0; callback_idx < DeviceListChangeCallbacks.size(); callback_idx++)
{
ResourceManager::DeviceListChangeCallbacks[callback_idx](DeviceListChangeCallbackArgs[callback_idx]);
@@ -331,6 +401,8 @@ void ResourceManager::DetectionProgressChanged()
/*-------------------------------------------------*\
| Detection progress has changed, call the callbacks|
\*-------------------------------------------------*/
LOG_TRACE("[ResourceManager] Calling detection progress callbacks.");
for(unsigned int callback_idx = 0; callback_idx < DetectionProgressCallbacks.size(); callback_idx++)
{
DetectionProgressCallbacks[callback_idx](DetectionProgressCallbackArgs[callback_idx]);
@@ -569,6 +641,8 @@ void ResourceManager::DetectDevices()
/*-----------------------------------------------------*\
| Call detection start callbacks |
\*-----------------------------------------------------*/
LOG_TRACE("[ResourceManager] Calling detection start callbacks.");
for(unsigned int callback_idx = 0; callback_idx < DetectionStartCallbacks.size(); callback_idx++)
{
DetectionStartCallbacks[callback_idx](DetectionStartCallbackArgs[callback_idx]);
@@ -1110,17 +1184,19 @@ void ResourceManager::DetectDevicesThreadFunction()
\*-------------------------------------------------*/
if(i2c_interface_fail)
{
const char* i2c_message = "One or more I2C/SMBus interfaces failed to initialize.\r"
const char* i2c_message = "<h2>WARNING:</h2>"
"<p>One or more I2C/SMBus interfaces failed to initialize.</p>"
"<p>RGB DRAM modules and some motherboards' onboard RGB lighting will not be available without I2C/SMBus.</p>"
#ifdef _WIN32
"On Windows, this is usually caused by a failure to load the inpout32 driver.\r"
"You must run OpenRGB as administrator at least once to allow inpout32 to set up.\r"
"<p>On Windows, this is usually caused by a failure to load the inpout32 driver. "
"You must run OpenRGB as administrator at least once to allow inpout32 to set up.</p>"
#endif
#ifdef __linux__
"On Linux, this is usually because the i2c-dev module is not loaded.\r"
"You must load the i2c-dev module along with the correct i2c driver for your motherboard.\r"
"This is usually i2c-piix4 for AMD systems and i2c-i801 for Intel systems.\r"
"<p>On Linux, this is usually because the i2c-dev module is not loaded. "
"You must load the i2c-dev module along with the correct i2c driver for your motherboard. "
"This is usually i2c-piix4 for AMD systems and i2c-i801 for Intel systems.</p>"
#endif
"See https://help.openrgb.org for additional troubleshooting.";
"<p>See <a href='https://help.openrgb.org/'>help.openrgb.org</a> for additional troubleshooting steps if you keep seeing this message.<br></p>";
LOG_DIALOG("%s", i2c_message);
}
+12
View File
@@ -67,6 +67,12 @@ public:
virtual void RegisterDetectionEndCallback(DetectionEndCallback new_callback, void * new_callback_arg) = 0;
virtual void RegisterI2CBusListChangeCallback(I2CBusListChangeCallback new_callback, void * new_callback_arg) = 0;
virtual void UnregisterDeviceListChangeCallback(DeviceListChangeCallback callback, void * callback_arg) = 0;
virtual void UnregisterDetectionProgressCallback(DetectionProgressCallback callback, void *callback_arg) = 0;
virtual void UnregisterDetectionStartCallback(DetectionStartCallback callback, void *callback_arg) = 0;
virtual void UnregisterDetectionEndCallback(DetectionEndCallback callback, void *callback_arg) = 0;
virtual void UnregisterI2CBusListChangeCallback(I2CBusListChangeCallback callback, void * callback_arg) = 0;
virtual std::vector<RGBController*> & GetRGBControllers() = 0;
virtual unsigned int GetDetectionPercent() = 0;
@@ -120,6 +126,12 @@ public:
void RegisterDetectionEndCallback(DetectionEndCallback new_callback, void * new_callback_arg);
void RegisterI2CBusListChangeCallback(I2CBusListChangeCallback new_callback, void * new_callback_arg);
void UnregisterDeviceListChangeCallback(DeviceListChangeCallback callback, void * callback_arg);
void UnregisterDetectionProgressCallback(DetectionProgressCallback callback, void *callback_arg);
void UnregisterDetectionStartCallback(DetectionStartCallback callback, void *callback_arg);
void UnregisterDetectionEndCallback(DetectionEndCallback callback, void *callback_arg);
void UnregisterI2CBusListChangeCallback(I2CBusListChangeCallback callback, void * callback_arg);
bool GetDetectionEnabled();
unsigned int GetDetectionPercent();
const char* GetDetectionString();
+1 -1
View File
@@ -1,4 +1,4 @@
openrgb (0.61.1) UNRELEASED; urgency=medium
openrgb (0.7.0) UNRELEASED; urgency=medium
* Builds from git master. See git history for more information.
+5
View File
@@ -8,6 +8,7 @@
\*-------------------------------------------------------------------*/
#include "dmiinfo.h"
#include "LogManager.h"
#ifdef WIN32
#include "wmi.h"
@@ -35,6 +36,7 @@ DMIInfo::DMIInfo()
if (hres)
{
LOG_DEBUG("[DMI Info] Unable to read from %s", WMI);
return;
}
@@ -62,7 +64,10 @@ DMIInfo::DMIInfo()
manufacturer = "";
if ((access(SYSFSDMI "/board_vendor", R_OK)!=0) && (access(SYSFSDMI "/board_name", R_OK)!=0))
{
LOG_DEBUG("[DMI Info] Unable to read from %s", SYSFSDMI);
return;
}
std::ifstream mftr(SYSFSDMI "/board_vendor", std::ifstream::in);
getline(mftr, manufacturer);
+2
View File
@@ -14,6 +14,8 @@
#ifdef WIN32
#include "wmi.h"
#define WMI "WMI"
#else
#include <unistd.h> //Linux specific filesystem operation
#include <fstream>
+12 -9
View File
@@ -1,15 +1,15 @@
%global _name OpenRGB
Name: openrgb
Version: 0.6.1
Release: 1%{?dist}
Version: 0.7
Release: 0%{?dist}
Summary: Open source RGB lighting control that doesn't depend on manufacturer software
License: GPLv2
URL: https://gitlab.com/CalcProgrammer1/%{_name}
Source0: OpenRGB.tar.gz
BuildRequires: gcc-c++ libusb-devel libstdc++-devel qt5-qtbase-devel desktop-file-utils hidapi-devel mbedtls-devel
BuildRequires: gcc-c++ libusb-devel libstdc++-devel qt5-qtbase-devel desktop-file-utils hidapi-devel mbedtls-devel systemd-rpm-macros
Requires: hicolor-icon-theme
%description
@@ -28,9 +28,6 @@ cd %{_builddir}
%install
%make_install INSTALL_ROOT=%{buildroot}
#icon
install -Dpm 644 qt/%{_name}.png %{buildroot}%{_datadir}/icons/hicolor/128x128/apps/%{_name}.png
#desktop
desktop-file-install %{_sourcedir}/%{_name}/qt/%{_name}.desktop
@@ -42,14 +39,20 @@ fi
%files
%{_bindir}/%{name}
%{_datadir}/icons/hicolor/128x128/apps/%{_name}.png
%{_datadir}/icons/hicolor/*/apps/%{_name}.png
%{_datadir}/applications/%{_name}.desktop
%{_datadir}/pixmaps/%{_name}.png
/lib/udev/rules.d/60-%{name}.rules
%{_metainfodir}/org.%{name}.%{_name}.metainfo.xml
%{_udevrulesdir}/60-%{name}.rules
%license LICENSE
%doc README.md
%changelog
* Thu Dec 30 2021 Adam Honse <[email protected]> - 0.7-0
- Updated to 0.7
* Sun Dec 12 2021 Artem Polishchuk <[email protected]> - 0.6.1-2
- build: Fix udev rules install path | MR#933
* Tue Jun 1 2021 Adam Honse <[email protected]> - 0.6.1-0
- Updated to 0.6-1

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