Compare commits

...
Author SHA1 Message Date
Adam Honse befb783f2d Add ROG Strix Scope TKL to Aura Keyboard detector 2021-06-05 15:29:55 -05:00
Jeff P fe11115f32 Add support for Corsair Commander Core / Elite Capellix
Amended for code style by Adam Honse <[email protected]>
2021-06-04 22:45:36 -05:00
Adam Honse 9a00f1d6d8 Fix CI for Philips Hue changes
* Debian builder has been upgraded to buster due to incompatible mbedtls package on stretch
  * Mint 19, Ubuntu 18.04 have been disabled for testing as they use incompatible mbedtls packages
2021-06-05 03:18:12 +00:00
Adam Honse b7e2103f41 Disable parsing certificate, it doesn't appear to be necessary to control Hue and prevents build on older mbedtls releases 2021-06-05 03:18:12 +00:00
Adam Honse 87043cde65 Fix issue with Windows in hueplusplus library 2021-06-05 03:18:12 +00:00
Adam Honse 2aaf7017ee Philips Hue (Standard and Entertainment Mode) Support using hueplusplus library
* Dependency hueplusplus-1.0.0 added from https://github.com/enwi/hueplusplus/releases/tag/v1.0.0
* Dependency mbedtls-2.24.0 added (Windows-only) from https://github.com/ARMmbed/mbedtls/releases/tag/mbedtls-2.24.0
2021-06-05 03:18:12 +00:00
mike 22acdd1fed Check return code from hid_get_serial_number_string() in GetSerialString()
Amended for code style by Adam Honse <[email protected]>
2021-06-04 22:14:05 -05:00
Thomas greenwood 4e4eade335 Pad commands for 0x62 with 4 zero bytes 2021-06-05 02:52:37 +00:00
Joe Smith 9f7812bc7b No more qt5-default package in debian
[Looks](https://askubuntu.com/questions/1335184/qt5-default-not-in-ubuntu-21-04) like this [was removed](https://bugs.launchpad.net/ubuntu/+source/qtbase-opensource-src/+bug/1926802) in Debian `bullseye` + Ubuntu `21.04`.
2021-06-05 02:18:02 +00:00
TheRogueZeta 6029a5b0c5 Add Non OC 2060S PCIe ID, correct RAM 2021-06-04 15:51:15 -07:00
TheRogueZeta 74a49ec3e6 Add ASUS ROG Strix RTX 2060S A8G Evo to detector 2021-06-04 15:50:17 -07:00
Short_String_Dev 21dd2ee66a Add ASUS ROG STRIX 2070 A8G Gaming 2021-06-04 08:57:23 -04:00
Short_String_Dev f76d78775c Add ASUS ROG STRIX 2070 O8G Gaming 2021-06-04 08:25:15 -04:00
TheRogueZeta af01ff5de3 Add ASUS ROG Strix 1080 O8G to detector 2021-06-03 17:53:40 +00:00
Tom Greenwood f2f84fc7e3 Add support for Gigabyte RTX3060 Gaming OC 12GB 2021-06-03 17:07:48 +00:00
TheRogueZeta 939f46c025 G Pro Wired are only 1 zone devices 2021-06-03 08:31:37 -07:00
TheRogueZeta a1469041e5 Add ASUS ROG Strix 1070 Gaming to detector 2021-06-03 02:27:14 +00:00
TheRogueZeta f39b57fadc Add Gigabyte RTX 2060 Gaming OC Pro to the detector 2021-06-03 02:26:00 +00:00
Dennis Piecha 08a985a216 Add ASUS ROG STRIX RTX 2070S O8G Gaming 8G 2021-06-02 22:01:52 +02:00
Harry Kane 7054badf4f Update URL to HTTPS 2021-06-02 03:30:01 +00:00
SR_team 332a04f94c Add missing key for ANSI layout of Logitech G815 into LED View 2021-06-01 20:41:57 +00:00
TheRogueZeta ae88771e79 Correct G502 Wireless (wired) PID in linux builds 2021-06-01 00:19:50 -07:00
TheRogueZeta 09e524314f Correct G502 PS and G502 Hero detector changes. 2021-05-31 23:47:37 -07:00
Adam Honse 8e8573e7d0 Increment version number post-release 2021-06-01 01:35:51 -05:00
Adam Honse 405ff7f6a5 OpenRGB version 0.6 2021-06-01 00:05:08 -05:00
Adam Honse 563ff31fe3 Wait up to 5 seconds for the local server connection to retrieve all controllers before continuing, so that CLI mode has all controllers available for applying changes 2021-05-31 23:44:33 -05:00
Chris 4a6c4f0e52 Adding test stages to Linux builds
* Build based on new OpenRGB docker image (Debian Stretch)
* Adapting AppImage build scripts to new docker image
* Changing postinstall script to avoid error

+ Adding test stage keyword
+ Adding needs keyword
+ Debian 10       Buster 32bit & 64bit
+ Debian 11       Bullseye 32bit & 64bit
+ Fedora 34       v34 64bit only
+ Ubuntu 18.04LTS Bionic 32bit & 64bit
+ Ubuntu 20.04LTS Focal 64bit only
+ Ubuntu 20.10    Groovy 64bit only
+ Mint   20.1     Ulyssa 32bit & 64bit

Amended to leave Bullseye builds in place by Adam Honse <[email protected]>
2021-05-31 23:32:09 -05:00
TheRogueZeta be838aa1d6 Update Logitech Lightspeed detector names 2021-06-01 04:13:46 +00:00
Adam Honse 68b0287cdd Make detectors for QMK OpenRGB controller configurable 2021-05-31 18:35:07 -05:00
Adam Honse d18f66f995 Implement dynamic detectors - run-once functions that can register detectors dynamically 2021-05-31 13:55:22 -05:00
Chris 259ba898b0 Enumerate Wireless connected Logitech Lightspeed (Unifying) devices
+ Added common library for Logitech Protocol
    + Moved wireless detection to the LogitechProtocolCommon.cpp
    + Adding Direct Mode to the wireless control
    + Copying the mutex from Lightsync controller to avoid interference
    + Adding LED count info to controller constructor

+ Created a new Logitech class
    + Added Feature list enumeration
    + Added DeviceName detection from device

* Changed LogitechGProWirelessController to accomodate generic devices
    * LED count from device is now used in RGBController setup

+ Adding Windows specific detection as Linux Kernel handles this already.
+ Adding virtual PIDS for wireless detection
    * LOGITECH G403
    * LOGITECH G502
    * LOGITECH G703
    * LOGITECH G900
    * LOGITECH G903
    * LOGITECH GPRO
+ Adding Logitech G900 Wired Gaming Mouse PID
+ Adding other all lightspeed mice to wired detector for testing
    * Genericised and optimised code paths
    * Speed up wireless detection

Commit amended for code style by Adam Honse <[email protected]>
2021-05-31 10:59:04 -07:00
Adam Honse d8252281ce Prevent theme box from saving theme setting until initialized 2021-05-30 21:08:23 -07:00
Kasper a5928518c1 Implement QMK OpenRGB Procotol
This commit squashes commits by:

    Kasper <[email protected]>
    jath03 <[email protected]>
    Adam Honse <[email protected]>

Commits squashed and amended for code style by Adam Honse <[email protected]>
2021-05-30 18:41:55 -05:00
Felipe Guaycuru b3b392b3e2 Make Corsair K55 behavior be closer to iCue's 2021-05-30 22:33:31 +00:00
Adam Honse 1df6e8f559 Add geometry settings to settings page 2021-05-28 12:07:38 -05:00
morg c1b9f79052 Add settings page under settings tab 2021-05-28 16:37:41 +00:00
Adam Honse 4764198df7 Add Logitech G910 Orion Spark 2021-05-27 10:25:20 -05:00
Kasper f04da17e4e Corsair hydro platinum fix soft brick once again by increasing delay to 5ms 2021-05-27 14:31:43 +00:00
Adam Honse 6dda941d97 Add debug logging for Aura SMBus DRAM detection 2021-05-26 00:41:57 -05:00
harre b2be4a9411 Added include needed by arch #1427 2021-05-26 02:09:50 +00:00
Adam Honse 9b974d7108 Update Logitech G910 LED list to add G keys and second Logo, update matrix 2021-05-25 19:15:45 -05:00
Adam Honse 4509b9d2e9 Initial support for Logitech G910 Orion Spectrum - G Keys and G910 bottom logo not working yet 2021-05-25 15:38:53 -05:00
Adam Honse 4287128fb4 Attempt to implement !513 using shared mutex pointer for each detected mouse/mousemat combo 2021-05-25 11:48:16 -05:00
Adam Honse a2a93daaab Add numerical_labels setting to UserInterface settings 2021-05-24 23:08:39 -05:00
Kasper f9c7df21f1 Add a number as a label for LEDs that otherwise would be nameless in DeviceView 2021-05-24 22:51:37 -05:00
k1-801 65623d3978 Autoclose updated
Commit amended for code style by Adam Honse <[email protected]>
2021-05-24 22:45:24 -05:00
k1-801 abfb6ea22d Tiny fixups (server conn info leak closed, log va leak closed, config dir optimized)
Commit amended for code style by Adam Honse <[email protected]>
2021-05-24 22:41:12 -05:00
Adam Honse 33b840b2b9 Revert change disabling redetection of i2c interfaces and fix disconnected WMI failure by always reconnecting before query 2021-05-24 18:38:26 -05:00
Adam Honse 2a3a736f09 Don't delete i2c bus list on redetect, as WMI query issues prevent them from being redetected 2021-05-24 17:00:18 -05:00
Adam Honse 8ada7cd6da Add MSI Mystic Light 185 7D13 (MSI MEG B550 Unify), tested on Discord by Markellus 2021-05-23 23:25:47 -05:00
Adam Honse cb656ebdf7 Don't print Running standalone message when local server connection succeeds 2021-05-23 23:22:46 -05:00
TheRogueZeta 707df85d1f DMI Info for MSI-RGB boards 2021-05-23 00:08:43 -07:00
TheRogueZeta 78955de65f Get DMI info for MSI USB boards 2021-05-23 00:08:43 -07:00
edbgon a8e2feddbe New controller for SteelSeries QCK Mousemat 2021-05-22 23:49:20 -05:00
TheRogueZeta fd31b4db7d Fixed Dev and Feature index for PowerPlay 2021-05-22 15:48:06 -07:00
TheRogueZeta a87d2aead7 PowerPlay mat should only be 1 zone. 2021-05-22 15:45:34 -07:00
Adam Honse 2afddf9bbf Only join/delete E1.31 keepalive thread if it has actually been created 2021-05-21 20:43:14 -05:00
TheRogueZeta 1f2d298e14 Add ASUS ROG-STRIX-RTX2080-O8G-GAMING 2021-05-22 00:42:52 +00:00
Adam Honse cdae9b1e78 Fix client registration for auto-detected local server 2021-05-21 19:25:12 -05:00
Diogo Trindade 4c6653bdb4 Asus ROG Strix Flare - Added ISO LEDs 2021-05-22 00:01:32 +00:00
Adam Honse e5d16dedcc Add option in settings file to pass client controllers through to server 2021-05-21 16:58:42 -05:00
Adam Honse d103906c75 Override UpdateLEDs() for RGBController_Network to always process synchronously 2021-05-21 16:39:03 -05:00
Adam Honse 5e959f6bc3 Add Pipeline Status badge to README 2021-05-20 20:56:40 +00:00
Adam Honse 618faf42ec Use block writes for updating all LEDs at once on ASUS Aura SMBus 2021-05-19 21:49:22 -05:00
edbgon 961fbc2585 Update rules file in accordance to detectors 2021-05-19 09:44:15 +02:00
Adam Honse eb9710ee26 Fix name change 2021-05-18 23:21:56 -05:00
Adam Honse 39de6fc175 Code style cleanup for Logitech G Lightsync RGBController 2021-05-18 22:57:45 -05:00
Adam Honse 39d989891e Code style cleanup for Logitech detector 2021-05-18 22:53:38 -05:00
TheRogueZeta 734912732c Rework individual Logitech mouse controllers into a single shared controller and add Direct mode.
Squashes all commits from Merge Request !495
2021-05-19 03:25:55 +00:00
Adam Honse 47160ac7cd Add visitors badge to README 2021-05-18 18:26:14 +00:00
Daniel Augustin 9f0fa7eb67 Add Asus Aura on Asus H570-PRO Motherboards 2021-05-17 18:42:22 -05:00
TheRogueZeta a6cfcdeb1d Retrieve motherboard name for ASUS boards via DMI
Commits squashed and amended for code style by Adam Honse <[email protected]>
2021-05-17 18:34:21 -05:00
Cheerpipe cf922db7d5 G815 performance tweaks
* Remove some unnecessary operations on the G815 controller
* Use reserved memory for key color array to avoid excessive memory copy on vector pushback

Commits squashed and commit message amended by Adam Honse <[email protected]>
2021-05-17 18:29:17 -05:00
Cheerpipe 8a56a5103c Packet read size fix. Should be 20, not 200
This bug causes rare unwanted volume changes.
2021-05-17 17:41:59 +00:00
TheRogueZeta 3026a10ff8 Add ASUS ROG STRIX RTX 2080 Ti O11G Gaming 2021-05-17 13:17:44 +00:00
morg f54ecd8b1b Add detection start and end callbacks 2021-05-17 08:14:00 -05:00
Adam Honse d88f9979a9 Rework network client callback pipeline - route callbacks from clients through ResourceManager so that device list callbacks get called. Fixes remote devices not showing up in plugins. 2021-05-14 23:29:34 -05:00
Martin Hartl 94370c24a8 cli: Fix mode specific colors for range 2021-05-14 15:14:11 +02:00
nightsky30 c29a38a8c9 Fix the number of LEDs for Lancehead devices; 16 LEDs, not 18 #6 2021-05-13 23:03:06 -05:00
Artur Pieniążek 651a8d2f2a Handle K95 Platinum ANSI and ISO layouts
Commits merged by Adam Honse <[email protected]>
2021-05-13 22:51:03 -05:00
silas a51e2f8ac8 Make device list change warning callback
This will be helpful for keeping plugins from crashing

Commit amended to change callback function name for consistency by Adam Honse <[email protected]>
2021-05-13 22:30:38 -05:00
k1-801 02ba8a799e Server freed from ResourceManager
Commit amended to revert OpenRGBInterfaces.h header (may reconsider in the future) by Adam Honse
<[email protected]>
2021-05-13 22:10:41 -05:00
alpemwarrior a6bc30a31c Add 64-bit .rpm package build to CI for Fedora. 2021-05-14 02:02:28 +00:00
Chris 81bf61867f Amending QTwindow geometry config to resovle #1245
+ Code to initialise config values.
    + Added "load_geometry" variable so that you can load set values but not have to "save_on_exit"

Commit amended for code style by Adam Honse <[email protected]>
2021-05-13 20:59:32 -05:00
Martin Hartl 1f21d9ad62 Asus mainboard: Rename RGB headers
There is currently no difference in naming for the integrated
motherboard LEDs and the motherboard non-addressable RGB headers. This
commit renames the RGB headers in the RGB controller. The number of RGB
headers is read from the configuration table.

Commit amended for code style by Adam Honse <[email protected]>
2021-05-12 22:35:21 -05:00
Pol Rius 658eb3a1f7 Initialize profile_loaded properly 2021-05-12 18:27:22 +02:00
edbgon a567aa1e62 Update Ducky to support ISO layouts 2021-05-12 07:44:41 +02:00
Adam Honse d3ee9911b5 Change UI_Settings key to UserInterface 2021-05-10 22:17:11 -05:00
Chris 166bc13dec Adding ability to save QTwindow geometry to config solving #1245
+ Load window geometry from config added to constructor
+ Save window geometry to config added to destructor
+ Added an opt out boolean to allow for saving / not saving geometry
+ Consolidated the Minimize settings into the "UI_Settings" in config
+ Code to initialise config values.

Amended for code style by Adam Honse <[email protected]>
2021-05-10 22:15:20 -05:00
Adam Honse 47e4dc7431 Add MSI Mystic Light 7D09 PID to 185 byte controllers list 2021-05-10 08:47:10 -05:00
Adam Honse 20b149aeef Implement direct mode for Corsair K57, only in wired mode. 2021-05-09 15:09:29 -05:00
Adam Honse 91dd39f3f3 Start implementing Corsair Wireless (K57) controller. Detects both keyboard and dongle, no other functionality implemented yet 2021-05-08 13:40:19 -05:00
Dmitry K 647670a04a Skip Inpout-dependent detection when inpout is not available 2021-05-06 23:11:30 +00:00
morg 23db961be3 Refactor OpenRGBDialog2 + add SettingsTab as plugin location 2021-05-06 17:57:28 +02:00
morg 59a0bec399 Toggle plugins visibility for all locations 2021-05-06 01:16:06 +00:00
morg 3543218722 Automatically create the plugins folder 2021-05-06 01:02:08 +00:00
morg 0fbe96f8ec Add button to open settings folder 2021-05-06 01:00:34 +00:00
Gabriel Marcano 30f88d5fcf Fix mismatched new[] / delete
- The device description buffer was allocated using new[] in
   RGBController. Make sure to free it using delete[].
2021-05-05 02:07:19 -07:00
Adam Honse 198a246af1 Add timeouts to prevent lockup of Razer Naga Epic Chroma 2021-05-02 12:02:46 -05:00
silas 827c78da13 Fix window getting larger when spamming toggle LED view
Commit amended to only implement size hint change by Adam Honse <[email protected]>
2021-05-02 11:33:20 -05:00
Adam Honse 08d495941e Add effect handling for per-LED Razer devices 2021-05-02 01:50:19 -05:00
morg 8ee0b12ef8 Auto hide/show plugin containers
Commit amended for code style and to add comments by Adam Honse <[email protected]>
2021-05-02 00:01:52 -05:00
TheRogueZeta 84371c3cd8 Add Asus Strix 2070S A8G Gaming PCIe ID 2021-05-02 02:16:24 +00:00
morg 0b4a8ffce2 Software info: add website link, make links clickable 2021-04-30 21:02:35 +02:00
Bernhard Held 2df555d864 Add support for Gainward RTX 2070 Super Phantom 2021-04-30 16:06:34 +00:00
Adam Honse 429068760d Fix more warnings 2021-04-30 10:56:40 -05:00
Tam Do 47877193a7 rename mode to reactive, behavior is that key changes from color1 to color2 when pressed, and fades back to color1 after some time configured by the speed parameter 2021-04-30 01:42:49 +00:00
Tam Do 7952a035b5 Continued the work started by !62 with respect to adding support for Cooler Master keyboards using the libcmmk library.
Commits squashed and amended for code style by Adam Honse <[email protected]>
2021-04-30 01:42:49 +00:00
Lukas Niederbremer 7e4b9c0cb0 Add experimental Cooler Master MasterKeys support 2021-04-30 01:42:49 +00:00
shawnc722 b3e1cc6552 Fix invalid serial numbers crashing the python interface.
(cherry picked from commit a5ff98940cbe2e91ecaf2445febd87e373f35723)
2021-04-29 19:17:09 +00:00
shawnc722 13b1da9d64 Removed various brightness modes and made highest brightness into Direct mode. Can use relative intensity to set brightness, ie RGB(255,0,255) (magenta) at ~60% brightness is RGB(150,0,150)
(cherry picked from commit b43cfd3b04e9faf980e319c596be5de49140f9b0)
2021-04-29 19:14:54 +00:00
Adam Honse 5616f547e4 Fix a bunch of warnings 2021-04-29 13:42:49 -05:00
shawnc722 37d58ee1a6 Add support for ASUS GTX 1080 2021-04-29 00:17:10 +00:00
TheRogueZeta 74b05f17fd Add ASUS ROG STRIX RTX 2060 EVO Gaming 6G 2021-04-26 12:31:44 -07:00
Chris 6a8524f371 Adding ASUS GTX 1070 Strix OC
* As per yozukiRR adding 0x8599 for the ASUS GTX 1070 Strix OC
2021-04-26 09:42:38 -05:00
k1-801 ad2cd89128 Add filesystem header to select between std::filesystem and std::experimental::filesystem depending on system availability.
Commit amended by Adam Honse <[email protected]>
2021-04-25 22:55:49 -05:00
shawnc722 05d72ba96f Fixed detection of Apex 350 and tweaked display names of OG Apex 2021-04-25 17:06:57 -05:00
k1-801 402423e338 Fix a memory leak in NetworkClient 2021-04-25 16:55:15 -05:00
Adam Honse dd4865c3e0 Add initial version of the Plugin Container, which prevents plugins from resizing the window unless shown 2021-04-23 22:45:30 -05:00
Adam Honse 30623b36fd Use Debian Bullseye for CI builds 2021-04-23 22:37:39 -05:00
Chris 9b8d2c38d3 Changed "Set All Devices"
* Changed `Set All Devices` to `Apply To All Devices`
* Added a tooltip to `Apply to All`
* Added Black and White quick colour swatches and left them "not flat" to
ensure visibility in Light and Dark mode.

Commit amended to fix display issues on Windows and to group buttons in layout by Adam Honse <[email protected]>
2021-04-23 11:44:59 -05:00
1558 changed files with 388753 additions and 2716 deletions
+268 -10
View File
@@ -16,6 +16,7 @@
stages:
- build
- test
before_script:
- echo "started by ${GITLAB_USER_NAME}"
@@ -23,15 +24,15 @@ before_script:
#reusable templates
.ccache_init: &ccache_init
before_script:
- apt update
- apt install -y build-essential qtcreator qt5-default libusb-1.0-0-dev libhidapi-dev pkgconf wget git
- export QT_SELECT=qt5
- export APPIMAGE_EXTRACT_AND_RUN=1
#-----------------------------------------------------------------------#
# Linux (AppImage) 32-bit Build Target #
#-----------------------------------------------------------------------#
"Linux 32 AppImage":
<<: *ccache_init
image: i386/ubuntu:bionic
image: registry.gitlab.com/openrgbdevelopers/openrgb-linux-ci-deb-builder:buster-32
stage: build
script:
- export $(dpkg-architecture)
@@ -50,7 +51,7 @@ before_script:
#-----------------------------------------------------------------------#
"Linux 64 AppImage":
<<: *ccache_init
image: ubuntu:bionic
image: registry.gitlab.com/openrgbdevelopers/openrgb-linux-ci-deb-builder:buster-64
stage: build
script:
- export $(dpkg-architecture)
@@ -69,13 +70,12 @@ before_script:
#-----------------------------------------------------------------------#
"Linux 32 deb":
<<: *ccache_init
image: i386/ubuntu:bionic
image: registry.gitlab.com/openrgbdevelopers/openrgb-linux-ci-deb-builder:buster-32
stage: build
script:
- apt install -y debhelper
- dpkg-architecture -l
- dpkg-buildpackage --target-arch i386 -us -B
- rm -v ../openrgb-dbgsym*.ddeb
- rm -v ../openrgb-dbgsym*.deb
- mv -v ../openrgb*.deb ./
artifacts:
@@ -91,13 +91,12 @@ before_script:
#-----------------------------------------------------------------------#
"Linux 64 deb":
<<: *ccache_init
image: ubuntu:bionic
image: registry.gitlab.com/openrgbdevelopers/openrgb-linux-ci-deb-builder:buster-64
stage: build
script:
- apt install -y debhelper
- dpkg-architecture -l
- dpkg-buildpackage -us -B
- rm -v ../openrgb-dbgsym*.ddeb
- rm -v ../openrgb-dbgsym*.deb
- mv -v ../openrgb*.deb ./
artifacts:
@@ -108,6 +107,265 @@ before_script:
- openrgb-dbgsym*.deb
expire_in: 30 days
#-----------------------------------------------------------------------#
# Linux (.rpm) 64-bit Build Target #
#-----------------------------------------------------------------------#
"Linux 64 rpm":
image: fedora:34
stage: build
script:
- dnf install rpmdevtools dnf-plugins-core -y
- rpmdev-setuptree
- ls /root/
- cp fedora/OpenRGB.spec /root/rpmbuild/SPECS
- cp ../OpenRGB /root/rpmbuild/SOURCES/ -r
- cd /root/rpmbuild/SOURCES
- tar -cf OpenRGB.tar.gz OpenRGB/
- cd ..
- dnf builddep SPECS/OpenRGB.spec -y
- rpmbuild -ba SPECS/OpenRGB.spec
- cd RPMS/x86_64/
- mv openrgb*.rpm ${CI_PROJECT_DIR}/
- cd ${CI_PROJECT_DIR}
artifacts:
name: "${CI_PROJECT_NAME}_Linux_64_rpm_${CI_COMMIT_SHORT_SHA}"
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 #
#-----------------------------------------------------------------------#
"Debian 32 Buster":
image: i386/debian:buster
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 32 Bullseye test #
#-----------------------------------------------------------------------#
"Debian 32 Bullseye":
image: i386/debian:bullseye
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"
# #-----------------------------------------------------------------------#
# # 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"
#-----------------------------------------------------------------------#
# Debian 64 Bullseye test #
#-----------------------------------------------------------------------#
"Debian 64 Bullseye":
image: debian:bullseye
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"
#-----------------------------------------------------------------------#
# Fedora 64 v34 test #
#-----------------------------------------------------------------------#
"Fedora 64 v34":
image: fedora:34
stage: test
script:
- yum -y localinstall ./openrgb*64.rpm
- openrgb --version
- openrgb -l
- yum -y remove openrgb
dependencies:
- "Linux 64 rpm"
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 #
#-----------------------------------------------------------------------#
+371 -5
View File
@@ -53,6 +53,18 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="1872", TAG+="uacces
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="1889", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="18a3", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="18f3", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="18a5", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="1939", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="18af", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="18dd", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="1845", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="1875", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="1877", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="18cd", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="18cf", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="18e5", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="18e3", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="1958", TAG+="uaccess"
#---------------------------------------------------------------#
# ASUS TUF Laptops (faustus) #
@@ -70,8 +82,29 @@ ACTION=="add", SUBSYSTEM=="platform", KERNEL=="faustus", RUN+="/bin/chmod a+w /s
# #
# Mousemats: #
# Cooler Master MP750 #
# Controllers: #
# ARGB Device #
# Small ARGB Device #
# Graphics Cards: #
# Radeon RX6000 Series Reference Cards #
# Keyboards: #
# Masterkeys Pro L #
# Masterkeys Pro L White #
# Masterkeys Pro S #
# Masterkeys MK750 #
# Masterkeys SK630 #
# Masterkeys SK650 #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="2516", ATTR{idProduct}=="0109", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="2516", ATTR{idProduct}=="0105", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="2516", ATTR{idProduct}=="1011", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="2516", ATTR{idProduct}=="1000", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="2516", ATTR{idProduct}=="014d", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="2516", ATTR{idProduct}=="0047", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="2516", ATTR{idProduct}=="003c", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="2516", ATTR{idProduct}=="0067", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="2516", ATTR{idProduct}=="0089", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="2516", ATTR{idProduct}=="008d", TAG+="uaccess"
#---------------------------------------------------------------#
# Corsair Hydro Series Devices #
@@ -84,6 +117,23 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c15", TAG+="uacces
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c13", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c12", TAG+="uaccess"
#---------------------------------------------------------------#
# Corsair Hydro Platinum Series Devices #
# #
# Corsair H100i Platinum RGB #
# Corsair H100i Platinum SE RGB #
# Corsair H115i Platinum RGB #
# Corsair H100i Pro XT RGB #
# Corsair H115i Pro XT RGB #
# Corsair H150i Pro XT RGB #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c18", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c19", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c17", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c20", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c21", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c22", TAG+="uaccess"
#---------------------------------------------------------------#
# Corsair Lighting Node Devices #
# #
@@ -101,7 +151,7 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c10", TAG+="uacces
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c1e", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1d00", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1d04", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0a32", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c23", TAG+="uaccess"
#---------------------------------------------------------------#
# Corsair Peripheral Devices #
@@ -126,6 +176,12 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0a32", TAG+="uacces
# Mice: #
# Corsair M65 Pro #
# Corsair M65 RGB Elite #
# Corsair Glaive RGB #
# Corsair Glaive RGB Pro #
# Corsair Harpoon RGB #
# Corsair Harpoon RGB Pro #
# Corsair Scimitar Pro RGB #
# Corsair Sabre RGB #
# #
# Mousemats: #
# Corsair MM800 RGB Polaris #
@@ -149,27 +205,96 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b2d", TAG+="uacces
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b20", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b48", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b34", TAG+="uaccess"
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}=="1b2e", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b5a", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b3e", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b2f", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b3b", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0a34", TAG+="uaccess"
#---------------------------------------------------------------#
# Corsair Wireless Devices #
# #
# Keyboards: #
# Corsair K57 RGB Wired #
# Corsair K57 RGB Wireless #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b6e", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b62", TAG+="uaccess"
#---------------------------------------------------------------#
# Creative Devices #
# #
# Devices: #
# Creative SoundblasterX G6 #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="041e", ATTR{idProduct}=="3256", TAG+="uaccess"
#---------------------------------------------------------------#
# Ducky Keyboard Devices #
# #
# Keyboards: #
# Ducky Shine 7 One 2 RGB #
# Ducky One 2 RGB TKL #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="04d9", ATTR{idProduct}=="0348", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="04d9", ATTR{idProduct}=="0356", TAG+="uaccess"
#---------------------------------------------------------------#
# EK Controller Devices #
# #
# Controllers: #
# EK Loop Connect #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="0483", ATTR{idProduct}=="5750", TAG+="uaccess"
#---------------------------------------------------------------#
# Holtek Devices #
# #
# Mice: #
# Holtek A070 #
# Mousemats: #
# Holtek A1FA #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="04d9", ATTR{idProduct}=="a070", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="04d9", ATTR{idProduct}=="a1fa", TAG+="uaccess"
#---------------------------------------------------------------#
# HyperX Peripheral Devices #
# #
# Keyboards: #
# HyperX Alloy Elite #
# HyperX Alloy Elite 2 #
# HyperX Alloy FPS RGB #
# HyperX Alloy Origins #
# HyperX Alloy Origins Core #
# #
# Mice: #
# HyperX Pulsefire Surge #
# HyperX Pulsefire FPS Pro #
# HyperX Pulsefire Dart Wireless #
# HyperX Pulsefire Dart Wired #
# #
# Mousemats: #
# HyperX Fury Ultra #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="0951", ATTR{idProduct}=="16be", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0951", ATTR{idProduct}=="1711", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0951", ATTR{idProduct}=="16dc", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0951", ATTR{idProduct}=="16e5", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0951", ATTR{idProduct}=="16e6", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0951", ATTR{idProduct}=="16d3", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0951", ATTR{idProduct}=="16d7", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0951", ATTR{idProduct}=="16e1", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0951", ATTR{idProduct}=="16e2", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0951", ATTR{idProduct}=="1705", TAG+="uaccess"
#---------------------------------------------------------------#
@@ -184,53 +309,87 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="0cf2", ATTR{idProduct}=="7750", TAG+="uacces
# Logitech G213 #
# Logitech G512 #
# Logitech G512 RGB #
# Logitech G610 #
# Logitech G610 #1 #
# Logitech G610 #2 #
# Logitech G810 #1 #
# Logitech G810 #2 #
# Logitech G813 #
# Logitech G815 #
# #
# Mice: #
# Logitech G203 Prodigy #
# Logitech G203 Lightsync #
# Logitech G303 #
# Logitech G403 Prodigy #
# Logitech G403 Hero #
# Logitech G502 Proteus Spectrum #
# Logitech G502 Hero #
# Logitech G502 Wireless #
# Logitech G703 Wireless #
# Logitech G900 Wireless #
# Logitech G903 Wireless #
# Logitech G Lightspeed Wireless Gaming Mouse #
# Logitech G Pro Wireless Gaming Mouse (Wired) #
# Logitech G Pro Hero Gaming Mouse (Wired) #
# #
# Mousemats: #
# Logitech G Powerplay Mousepad with Lightspeed #
# #
# Speakers: #
# Logitech G560 #
# #
#---------------------------------------------------------------#
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}=="c084", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c092", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c083", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c08f", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c082", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="405d", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c332", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c08b", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c08d", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="407f", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c087", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="4070", TAG+="uaccess"
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}=="c539", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c085", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c08c", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c088", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="4079", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c53a", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="0a78", TAG+="uaccess"
#---------------------------------------------------------------#
# Metadot Das Keyboard 4Q + 5Q #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="24f0", ATTR{idProduct}=="2037", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="24f0", ATTR{idProduct}=="202b", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="24f0", ATTR{idProduct}=="2020", TAG+="uaccess"
#---------------------------------------------------------------#
# MSI Mysticlight #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="3EA4", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="4559", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="4459", 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"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7B85", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7B93", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7B94", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7B96", TAG+="uaccess"
@@ -268,6 +427,7 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C95", TAG+="uacces
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C96", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C98", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C99", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7D09", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="905D", TAG+="uaccess"
#---------------------------------------------------------------#
@@ -284,15 +444,163 @@ KERNEL=="ttyACM[0-9]*", ATTR{idVendor}=="04D8", ATTR{idProduct}=="00DF", TAG+="u
# NZXT Hue 2 Devices #
# #
# NZXT Hue 2 #
# NZXT Hue 2 Ambient #
# NZXT Motherboard #
# NZXT Smart Device V2 #
# NZXT Kraken X3 #
# NZXT RGB Fan Controller #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="1e71", ATTR{idProduct}=="2001", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1e71", ATTR{idProduct}=="2002", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1e71", ATTR{idProduct}=="2005", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1e71", ATTR{idProduct}=="2006", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1e71", ATTR{idProduct}=="2007", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1e71", ATTR{idProduct}=="2009", TAG+="uaccess"
#---------------------------------------------------------------#
# NZXT Kraken #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="1e71", ATTR{idProduct}=="170e", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1e71", ATTR{idProduct}=="1715", TAG+="uaccess"
#---------------------------------------------------------------#
# Razer Devices #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0241", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0203", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0209", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0221", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0228", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0237", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0235", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0211", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0216", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="021A", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="020F", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0224", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0233", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="023B", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0240", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="023A", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0246", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0245", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="024D", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0253", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0255", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="026F", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0210", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0225", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="022F", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0234", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="024C", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0205", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0220", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="022D", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0232", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0239", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="024A", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0252", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0259", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="022A", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="023F", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="025E", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0204", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0226", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0227", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0243", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0207", TAG+="uaccess"
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"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="022B", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0020", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="005E", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="006A", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="006B", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0042", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="005B", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0062", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0064", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0065", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0083", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0038", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="004F", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0037", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0016", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0054", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0043", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="005C", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="006E", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0071", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="008C", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0084", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="007C", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="007D", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="004C", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="002F", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0060", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0059", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="005A", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0070", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="006F", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0024", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0025", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0044", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0045", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0073", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0072", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="006C", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0046", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="002E", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0040", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0053", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="003F", TAG+="uaccess"
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}=="0013", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0039", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0048", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0032", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0034", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="008A", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0078", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="007A", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="007B", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0506", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0501", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0F19", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0504", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0527", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0510", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0F03", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0F08", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0F20", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0F26", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0F1F", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0F09", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0F07", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0F0E", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0215", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0068", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0C00", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0C04", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0C02", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0C01", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0F1D", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0517", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0518", TAG+="uaccess"
#---------------------------------------------------------------#
# Roccat Devices #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="1e7d", ATTR{idProduct}=="2e2c", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1e7d", ATTR{idProduct}=="2e27", TAG+="uaccess"
#---------------------------------------------------------------#
# Redragon Peripheral Devices #
@@ -332,6 +640,13 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="258a", ATTR{idProduct}=="0036", TAG+="uacces
SUBSYSTEMS=="usb", ATTR{idVendor}=="258a", ATTR{idProduct}=="0033", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="258a", ATTR{idProduct}=="0029", TAG+="uaccess"
#---------------------------------------------------------------#
# Sony Devices #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="05c4", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="09cc", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0ba0", TAG+="uaccess"
#---------------------------------------------------------------#
# SteelSeries Peripheral Devices #
# #
@@ -347,22 +662,62 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="258a", ATTR{idProduct}=="0029", TAG+="uacces
# SteelSeries Rival 300 CS:GO Hyperbeast Edition #
# SteelSeries Rival 300 Dota 2 Edition #
# SteelSeries Rival 300 HP Omen Edition #
# SteelSeries Rival 300 Blackops Edition #
# SteelSeries Rival 310 #
# SteelSeries Rival 310 CS:GO Howl Edition #
# SteelSeries Rival 310 PubG Edition #
# SteelSeries Rival Sensei Ten #
# SteelSeries Rival Sensei Ten CS:GO Neon Rider #
# SteelSeries Rival Sensei 310 #
# Headsets: #
# SteelSeries Siberia 350 #
# Keyboards: #
# SteelSeries Apex 5 #
# SteelSeries Apex 7 #
# SteelSeries Apex 7 TKL #
# SteelSeries Apex Pro #
# SteelSeries Apex Pro TKL #
# SteelSeries Apex M750 #
# SteelSeries Apex OG #
# SteelSeries Apex 350 #
# Mousemats: #
# SteelSeries QCK Prism Cloth #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1702", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="170c", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1814", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1729", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1384", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1710", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1714", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1394", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1716", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="171a", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1392", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1718", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1720", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="171e", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1736", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1832", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1834", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1722", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1229", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="161c", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1612", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1618", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1610", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1614", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="0616", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1202", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1206", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="150d", TAG+="uaccess"
#---------------------------------------------------------------#
# Tecknet Devices #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="04d9", ATTR{idProduct}=="fc05", TAG+="uaccess"
#---------------------------------------------------------------#
# Thermaltake Poseidon Z RGB Keyboard #
@@ -376,3 +731,14 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="264a", ATTR{idProduct}=="1FA[5-9]", TAG+="ua
SUBSYSTEMS=="usb", ATTR{idVendor}=="264a", ATTR{idProduct}=="1FA[A-F]", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="264a", ATTR{idProduct}=="1FB[0-5]", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="264a", ATTR{idProduct}=="226[0-3]", TAG+="uaccess"
#---------------------------------------------------------------#
# Wooting Devices #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="03eb", ATTR{idProduct}=="ff01", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="03eb", ATTR{idProduct}=="ff02", TAG+="uaccess"
#---------------------------------------------------------------#
# Zalman ZSync Devices #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="1c57", ATTR{idProduct}=="7ed0", TAG+="uaccess"
@@ -52,7 +52,12 @@ char* AMDWraithPrismController::GetDeviceName()
std::string AMDWraithPrismController::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());
@@ -54,8 +54,13 @@ std::string PolychromeUSBController::GetDeviceName()
std::string PolychromeUSBController::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());
@@ -179,7 +184,8 @@ void PolychromeUSBController::WriteRGSwap
void PolychromeUSBController::WriteHeader
(
unsigned char cfg,
unsigned char configstring[]
unsigned char* configstring,
unsigned int configsize
)
{
unsigned char usb_buf[65];
@@ -194,7 +200,7 @@ void PolychromeUSBController::WriteHeader
\*-----------------------------------------------------*/
usb_buf[0x01] = POLYCHROME_USB_WRITE_HEADER;
usb_buf[0x03] = cfg;
memcpy(&usb_buf[4], configstring, sizeof(configstring));
memcpy(&usb_buf[4], configstring, configsize);
/*-----------------------------------------------------*\
| Send packet |
@@ -207,7 +213,7 @@ PolychromeZoneInfo PolychromeUSBController::GetZoneConfig(unsigned char zone)
{
unsigned char usb_buf[65];
PolychromeZoneInfo zoneinfo;
unsigned char all;
//unsigned char all;
unsigned char r;
unsigned char g;
unsigned char b;
@@ -242,7 +248,7 @@ PolychromeZoneInfo PolychromeUSBController::GetZoneConfig(unsigned char zone)
zoneinfo.color = ToRGBColor(r,g,b);
zoneinfo.speed = usb_buf[0x08];
zoneinfo.zone = usb_buf[0x03];
all = usb_buf[0x10];
//all = usb_buf[0x10];
return(zoneinfo);
}
@@ -128,8 +128,9 @@ public:
void WriteHeader
(
unsigned char cfg,
unsigned char configstring []
unsigned char cfg,
unsigned char* configstring,
unsigned int configsize
);
protected:
@@ -20,7 +20,7 @@
#define ASROCK_MOTHERBOARD_1_PID 0x01A2
#define ASROCK_DESKMINI_ADDRESSABLE_LED_STRIP_PID 0x01A6
void DetectPolychromeUSBControllers(hid_device_info* info, const std::string& name)
void DetectPolychromeUSBControllers(hid_device_info* info, const std::string& /*name*/)
{
hid_device* dev = hid_open_path(info->path);
@@ -33,4 +33,4 @@ void DetectPolychromeUSBControllers(hid_device_info* info, const std::string& na
}
REGISTER_HID_DETECTOR("ASRock Polychrome USB", DetectPolychromeUSBControllers, ASROCK_VID, ASROCK_MOTHERBOARD_1_PID);
REGISTER_HID_DETECTOR("ASRock Deskmini Addressable LED Strip", DetectPolychromeUSBControllers, ASROCK_VID, ASROCK_DESKMINI_ADDRESSABLE_LED_STRIP_PID);
REGISTER_HID_DETECTOR("ASRock Deskmini Addressable LED Strip", DetectPolychromeUSBControllers, ASROCK_VID, ASROCK_DESKMINI_ADDRESSABLE_LED_STRIP_PID);
@@ -171,16 +171,6 @@ RGBController_PolychromeUSB::RGBController_PolychromeUSB(PolychromeUSBController
void RGBController_PolychromeUSB::SetupZones()
{
/*-------------------------------------------------*\
| Only set LED count on the first run |
\*-------------------------------------------------*/
bool first_run = false;
if(zones.size() == 0)
{
first_run = true;
}
/*-------------------------------------------------*\
| Clear any existing color/LED configuration |
\*-------------------------------------------------*/
@@ -191,7 +181,6 @@ void RGBController_PolychromeUSB::SetupZones()
/*-------------------------------------------------*\
| Set zones and leds |
\*-------------------------------------------------*/
int addressableCounter = 1;
for(unsigned int channel_idx = 0; channel_idx < zones.size(); channel_idx++)
{
PolychromeDeviceInfo device_info = polychrome->GetPolychromeDevices()[channel_idx];
@@ -269,8 +258,8 @@ void RGBController_PolychromeUSB::ResizeZone(int zone, int new_size)
zonecfg[i]=zones[i].leds_count;
}
unsigned char zonecmd = POLYCHROME_USB_LEDCOUNT_CFG;
// WriteHeader(zonecmd, zonecfg);
// unsigned char zonecmd = POLYCHROME_USB_LEDCOUNT_CFG;
// WriteHeader(zonecmd, zonecfg, sizeof(zonecfg));
}
void RGBController_PolychromeUSB::DeviceUpdateLEDs()
@@ -316,7 +305,6 @@ void RGBController_PolychromeUSB::UpdateSingleLED(int led)
unsigned char RGBController_PolychromeUSB::GetDeviceMode(unsigned char zone)
{
int dev_mode;
int color_mode = MODE_COLORS_PER_LED;
dev_mode = polychrome->GetZoneConfig(zone).mode;
active_mode = dev_mode;
@@ -40,7 +40,12 @@ std::string AuraCoreController::GetDeviceLocation()
std::string AuraCoreController::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());
@@ -32,14 +32,26 @@ typedef struct
static const gpu_pci_device device_list[] =
{
{ NVIDIA_VEN, NVIDIA_GTX1060_DEV, ASUS_SUB_VEN, ASUS_GTX1060_STRIX, 0x29, "ASUS GTX 1060 Strix" },
{ NVIDIA_VEN, NVIDIA_GTX1660TI_DEV, ASUS_SUB_VEN, ASUS_ROG_GTX1660TI_OC, 0x2A, "ASUS ROG GTX 1660 Ti OC 6G" },
{ NVIDIA_VEN, NVIDIA_GTX1080_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_GTX1080_A8G_GAMING, 0x29, "ASUS ROG Strix GTX1080 A8G Gaming" },
{ NVIDIA_VEN, NVIDIA_GTX1080TI_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_GTX1080TI_GAMING, 0x29, "ASUS ROG Strix GTX1080 Ti 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_RX5700XT_STRIX_GAMING_OC, 0x2A, "ASUS RX 5700XT Strix Gaming OC" },
{ AMD_GPU_VEN, AMD_POLARIS_DEV, ASUS_SUB_VEN, ASUS_RX580_STRIX_GAMING_OC, 0x29, "ASUS RX 580 Strix Gaming OC" }
};
{ 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" },
{ NVIDIA_VEN, NVIDIA_GTX1070_DEV, ASUS_SUB_VEN, ASUS_GTX1070_STRIX_OC, 0x29, "ASUS GTX 1070 Strix OC" },
{ NVIDIA_VEN, NVIDIA_GTX1080_DEV, ASUS_SUB_VEN, ASUS_GTX1080_STRIX, 0x29, "ASUS GTX 1080 Strix OC" },
{ NVIDIA_VEN, NVIDIA_GTX1080_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_GTX1080_A8G_GAMING, 0x29, "ASUS ROG Strix GTX1080 A8G Gaming" },
{ NVIDIA_VEN, NVIDIA_GTX1080_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_GTX1080_O8G_GAMING, 0x29, "ASUS ROG Strix GTX1080 O8G Gaming" },
{ NVIDIA_VEN, NVIDIA_GTX1080TI_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_GTX1080TI_GAMING, 0x29, "ASUS ROG Strix GTX1080 Ti Gaming" },
{ NVIDIA_VEN, NVIDIA_GTX1660TI_DEV, ASUS_SUB_VEN, ASUS_ROG_GTX1660TI_OC, 0x2A, "ASUS ROG GTX 1660 Ti OC 6G" },
{ NVIDIA_VEN, NVIDIA_RTX2060_TU106_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX2060_EVO_GAMING, 0x2A, "ASUS ROG STRIX RTX 2060 EVO Gaming 6G" },
{ NVIDIA_VEN, NVIDIA_RTX2060S_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX2060S_A8G_EVO_GAMING, 0x2A, "ASUS ROG STRIX RTX 2060S A8G EVO Gaming 6G"},
{ 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_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_RTX2080TI_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_RX5700XT_STRIX_GAMING_OC, 0x2A, "ASUS RX 5700XT Strix Gaming OC" },
{ AMD_GPU_VEN, AMD_POLARIS_DEV, ASUS_SUB_VEN, ASUS_RX580_STRIX_GAMING_OC, 0x29, "ASUS RX 580 Strix Gaming OC" }
};
/******************************************************************************************\
* *
@@ -194,38 +194,38 @@ unsigned char AuraSMBusController::GetLEDBlue(unsigned int led)
return(AuraRegisterRead(direct_reg + ( 3 * led ) + 1));
}
void AuraSMBusController::SetAllColorsDirect(unsigned char red, unsigned char green, unsigned char blue)
void AuraSMBusController::SetAllColorsDirect(RGBColor* colors)
{
unsigned char* colors = new unsigned char[led_count * 3];
unsigned char* color_buf = new unsigned char[led_count * 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]);
}
AuraRegisterWriteBlock(direct_reg, colors, led_count * 3);
AuraRegisterWriteBlock(direct_reg, color_buf, led_count * 3);
delete colors;
delete color_buf;
}
void AuraSMBusController::SetAllColorsEffect(unsigned char red, unsigned char green, unsigned char blue)
void AuraSMBusController::SetAllColorsEffect(RGBColor* colors)
{
unsigned char* colors = new unsigned char[led_count * 3];
unsigned char* color_buf = new unsigned char[led_count * 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]);
}
AuraRegisterWriteBlock(effect_reg, colors, led_count * 3);
AuraRegisterWriteBlock(effect_reg, color_buf, led_count * 3);
AuraRegisterWrite(AURA_REG_APPLY, AURA_APPLY_VAL);
delete[] colors;
delete[] color_buf;
}
void AuraSMBusController::SetDirect(unsigned char direct)
@@ -7,6 +7,8 @@
| Adam Honse (CalcProgrammer1) 8/19/2018 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include "i2c_smbus.h"
@@ -87,8 +89,8 @@ public:
unsigned char GetLEDRed(unsigned int led);
unsigned char GetLEDGreen(unsigned int led);
unsigned char GetLEDBlue(unsigned int led);
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);
@@ -1,5 +1,6 @@
#include "Detector.h"
#include "AsusAuraSMBusController.h"
#include "LogManager.h"
#include "RGBController.h"
#include "RGBController_AsusAuraSMBus.h"
#include "i2c_smbus.h"
@@ -7,6 +8,7 @@
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include "dependencies/dmiinfo.h"
using namespace std::chrono_literals;
@@ -87,21 +89,32 @@ bool TestForAsusAuraSMBusController(i2c_smbus_interface* bus, unsigned char addr
{
bool pass = false;
LOG_DEBUG("Testing address %02X for Aura SMBus controller", address);
int res = bus->i2c_smbus_write_quick(address, I2C_SMBUS_WRITE);
if (res >= 0)
{
pass = true;
LOG_DEBUG("Detected an I2C device at address %02X, testing register range for Aura SMBus", address);
for (int i = 0xA0; i < 0xB0; i++)
{
res = bus->i2c_smbus_read_byte_data(address, i);
if (res != (i - 0xA0))
{
LOG_DEBUG("Detection failed testing register %02X. Expected %02X, got %02X.", i, (i - 0xA0), res);
pass = false;
}
}
if(pass)
{
LOG_DEBUG("Detection successful, address %02X appears to be an Aura SMBus controller", address);
}
}
return(pass);
@@ -122,24 +135,24 @@ bool TestForAsusAuraSMBusController(i2c_smbus_interface* bus, unsigned char addr
* *
\******************************************************************************************/
void DetectAsusAuraSMBusControllers(std::vector<i2c_smbus_interface*> &busses)
void DetectAsusAuraSMBusDRAMControllers(std::vector<i2c_smbus_interface*> &busses)
{
AuraSMBusController* new_aura;
RGBController_AuraSMBus* new_controller;
for (unsigned int bus = 0; bus < busses.size(); bus++)
{
int address_list_idx = -1;
IF_DRAM_SMBUS(busses[bus]->pci_vendor, busses[bus]->pci_device)
{
// Remap Aura-enabled RAM modules on 0x77
LOG_DEBUG("Remapping Aura SMBus RAM modules on 0x77");
for (unsigned int slot = 0; slot < 8; slot++)
{
int res = busses[bus]->i2c_smbus_write_quick(0x77, I2C_SMBUS_WRITE);
if (res < 0)
{
LOG_DEBUG("No device detected at address 0x77, aborting remap");
break;
}
@@ -149,6 +162,8 @@ void DetectAsusAuraSMBusControllers(std::vector<i2c_smbus_interface*> &busses)
if(address_list_idx < AURA_RAM_ADDRESS_COUNT)
{
LOG_DEBUG("Testing address %02X to see if there is a device there", aura_ram_addresses[address_list_idx]);
res = busses[bus]->i2c_smbus_write_quick(aura_ram_addresses[address_list_idx], I2C_SMBUS_WRITE);
}
else
@@ -159,6 +174,8 @@ void DetectAsusAuraSMBusControllers(std::vector<i2c_smbus_interface*> &busses)
if(address_list_idx < AURA_RAM_ADDRESS_COUNT)
{
LOG_DEBUG("Remapping slot %d to address %02X", slot, aura_ram_addresses[address_list_idx]);
AsusAuraRegisterWrite(busses[bus], 0x77, AURA_REG_SLOT_INDEX, slot);
AsusAuraRegisterWrite(busses[bus], 0x77, AURA_REG_I2C_ADDRESS, (aura_ram_addresses[address_list_idx] << 1));
}
@@ -169,14 +186,25 @@ void DetectAsusAuraSMBusControllers(std::vector<i2c_smbus_interface*> &busses)
{
if (TestForAsusAuraSMBusController(busses[bus], aura_ram_addresses[address_list_idx]))
{
new_aura = new AuraSMBusController(busses[bus], aura_ram_addresses[address_list_idx]);
new_controller = new RGBController_AuraSMBus(new_aura);
ResourceManager::get()->RegisterRGBController(new_controller);
AuraSMBusController* controller = new AuraSMBusController(busses[bus], aura_ram_addresses[address_list_idx]);
RGBController_AuraSMBus* rgb_controller = new RGBController_AuraSMBus(controller);
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
std::this_thread::sleep_for(1ms);
}
}
}
} /* DetectAuraSMBusDRAMControllers() */
void DetectAsusAuraSMBusMotherboardControllers(std::vector<i2c_smbus_interface*> &busses)
{
AuraSMBusController* new_aura;
RGBController_AuraSMBus* new_controller;
for (unsigned int bus = 0; bus < busses.size(); bus++)
{
int address_list_idx = -1;
// Add Aura-enabled motherboard controllers
IF_MOBO_SMBUS(busses[bus]->pci_vendor, busses[bus]->pci_device)
@@ -185,9 +213,11 @@ void DetectAsusAuraSMBusControllers(std::vector<i2c_smbus_interface*> &busses)
{
if (TestForAsusAuraSMBusController(busses[bus], aura_mobo_addresses[address_list_idx]))
{
new_aura = new AuraSMBusController(busses[bus], aura_mobo_addresses[address_list_idx]);
new_controller = new RGBController_AuraSMBus(new_aura);
ResourceManager::get()->RegisterRGBController(new_controller);
DMIInfo dmi;
AuraSMBusController* controller = new AuraSMBusController(busses[bus], aura_mobo_addresses[address_list_idx]);
RGBController_AuraSMBus* rgb_controller = new RGBController_AuraSMBus(controller);
rgb_controller->name = "ASUS " + dmi.getMainboard();
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
std::this_thread::sleep_for(1ms);
@@ -195,6 +225,7 @@ void DetectAsusAuraSMBusControllers(std::vector<i2c_smbus_interface*> &busses)
}
}
} /* DetectAuraSMBusControllers() */
} /* DetectAuraSMBusMotherboardControllers() */
REGISTER_I2C_DETECTOR("ASUS Aura SMBus", DetectAsusAuraSMBusControllers);
REGISTER_I2C_DETECTOR("ASUS Aura SMBus DRAM", DetectAsusAuraSMBusDRAMControllers);
REGISTER_I2C_DETECTOR("ASUS Aura SMBus Motherboard", DetectAsusAuraSMBusMotherboardControllers);
@@ -58,20 +58,13 @@ int RGBController_AuraSMBus::GetDeviceMode()
void RGBController_AuraSMBus::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)
{
aura->SetLEDColorDirect(led, red, grn, blu);
}
else
{
aura->SetLEDColorEffect(led, red, grn, blu);
}
aura->SetAllColorsDirect(&colors[0]);
}
else
{
aura->SetAllColorsEffect(&colors[0]);
}
}
@@ -17,7 +17,7 @@ AuraAddressableController::AuraAddressableController(hid_device* dev_handle, con
\*-----------------------------------------------------*/
for(int i = 0; i < config_table[0x02]; ++i)
{
device_info.push_back({0x01, (unsigned char)i, 0x01, AuraDeviceType::ADDRESSABLE});
device_info.push_back({0x01, (unsigned char)i, 0x01, 0, AuraDeviceType::ADDRESSABLE});
}
}
@@ -30,7 +30,12 @@ std::string AuraKeyboardController::GetDeviceLocation()
std::string AuraKeyboardController::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());
@@ -12,17 +12,26 @@
AuraMainboardController::AuraMainboardController(hid_device* dev_handle, const char* path) : AuraUSBController(dev_handle, path), mode(AURA_MODE_DIRECT)
{
unsigned char num_total_mainboard_leds = config_table[0x1B];
unsigned char num_rgb_headers = config_table[0x1D];
unsigned char num_addressable_headers = config_table[0x02];
if(num_total_mainboard_leds < num_rgb_headers)
{
num_rgb_headers = 0;
}
/*-----------------------------------------------------*\
| Add mainboard device |
\*-----------------------------------------------------*/
device_info.push_back({0x00, 0x04, config_table[0x1B], AuraDeviceType::FIXED});
device_info.push_back({0x00, 0x04, num_total_mainboard_leds, num_rgb_headers, AuraDeviceType::FIXED});
/*-----------------------------------------------------*\
| Add addressable devices |
\*-----------------------------------------------------*/
for(int i = 0; i < config_table[0x02]; ++i)
for(int i = 0; i < num_addressable_headers; i++)
{
device_info.push_back({0x01, (unsigned char)i, 0x01, AuraDeviceType::ADDRESSABLE});
device_info.push_back({0x01, (unsigned char)i, 0x01, 0, AuraDeviceType::ADDRESSABLE});
}
}
@@ -142,7 +151,7 @@ void AuraMainboardController::SendEffect
void AuraMainboardController::SendColor
(
unsigned char channel,
unsigned char /*channel*/,
unsigned char start_led,
unsigned char led_count,
unsigned char* led_data
@@ -196,4 +205,4 @@ void AuraMainboardController::SendCommit()
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
}
}
@@ -30,7 +30,12 @@ std::string AuraMouseController::GetDeviceLocation()
std::string AuraMouseController::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());
@@ -42,7 +42,12 @@ std::string AuraUSBController::GetDeviceName()
std::string AuraUSBController::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());
@@ -53,6 +53,7 @@ struct AuraDeviceInfo
unsigned char effect_channel;
unsigned char direct_channel;
unsigned char num_leds;
unsigned char num_headers;
AuraDeviceType device_type;
};
@@ -9,6 +9,7 @@
#include "RGBController_AsusAuraMouse.h"
#include <stdexcept>
#include <hidapi/hidapi.h>
#include "dependencies/dmiinfo.h"
#define AURA_USB_VID 0x0B05
#define AURA_TERMINAL_PID 0x1889
@@ -18,6 +19,7 @@
#define AURA_ADDRESSABLE_4_PID 0x18A5
#define AURA_MOTHERBOARD_1_PID 0x18F3
#define AURA_MOTHERBOARD_2_PID 0x1939
#define AURA_MOTHERBOARD_3_PID 0x19AF
#define AURA_ROG_GLADIUS_II_CORE_PID 0x18DD
#define AURA_ROG_GLADIUS_II_PID 0x1845
#define AURA_ROG_STRIX_FLARE_PID 0x1875
@@ -26,9 +28,10 @@
#define AURA_ROG_STRIX_FLARE_PNK_LTD_PID 0x18CF
#define AURA_ROG_CHAKRAM_WIRELESS_PID 0x18E5
#define AURA_ROG_CHAKRAM_WIRED_1_PID 0x18E3
#define AURA_ROG_STRIX_SCOPE_TKL_PID 0x190C
#define AURA_ROG_CHAKRAM_WIRED_2_PID 0x1958
void DetectAsusAuraUSBAddressable(hid_device_info* info, const std::string& name)
void DetectAsusAuraUSBTerminal(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
@@ -41,6 +44,20 @@ void DetectAsusAuraUSBAddressable(hid_device_info* info, const std::string& name
}
}
void DetectAsusAuraUSBAddressable(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
DMIInfo dmi;
AuraAddressableController* controller = new AuraAddressableController(dev, info->path);
RGBController_AuraUSB* rgb_controller = new RGBController_AuraUSB(controller);
rgb_controller->name = "ASUS " + dmi.getMainboard() + " Addressable";
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
void DetectAsusAuraUSBMotherboards(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
@@ -48,9 +65,10 @@ void DetectAsusAuraUSBMotherboards(hid_device_info* info, const std::string& nam
{
try
{
DMIInfo dmi;
AuraMainboardController* controller = new AuraMainboardController(dev, info->path);
RGBController_AuraUSB* rgb_controller = new RGBController_AuraUSB(controller);
rgb_controller->name = name;
rgb_controller->name = "ASUS " + dmi.getMainboard();
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
catch(std::runtime_error&)
@@ -84,13 +102,14 @@ void DetectAsusAuraUSBMice(hid_device_info* info, const std::string& name)
}
}
REGISTER_HID_DETECTOR ("ASUS ROG AURA Terminal", DetectAsusAuraUSBAddressable, AURA_USB_VID, AURA_TERMINAL_PID);
REGISTER_HID_DETECTOR ("ASUS ROG AURA Terminal", DetectAsusAuraUSBTerminal, AURA_USB_VID, AURA_TERMINAL_PID);
REGISTER_HID_DETECTOR ("ASUS Aura Addressable", DetectAsusAuraUSBAddressable, AURA_USB_VID, AURA_ADDRESSABLE_1_PID);
REGISTER_HID_DETECTOR ("ASUS Aura Addressable", DetectAsusAuraUSBAddressable, AURA_USB_VID, AURA_ADDRESSABLE_2_PID);
REGISTER_HID_DETECTOR ("ASUS Aura Addressable", DetectAsusAuraUSBAddressable, AURA_USB_VID, AURA_ADDRESSABLE_3_PID);
REGISTER_HID_DETECTOR ("ASUS Aura Addressable", DetectAsusAuraUSBAddressable, AURA_USB_VID, AURA_ADDRESSABLE_4_PID);
REGISTER_HID_DETECTOR ("ASUS Aura Motherboard", DetectAsusAuraUSBMotherboards, AURA_USB_VID, AURA_MOTHERBOARD_1_PID);
REGISTER_HID_DETECTOR ("ASUS Aura Motherboard", DetectAsusAuraUSBMotherboards, AURA_USB_VID, AURA_MOTHERBOARD_2_PID);
REGISTER_HID_DETECTOR ("ASUS Aura Motherboard", DetectAsusAuraUSBMotherboards, AURA_USB_VID, AURA_MOTHERBOARD_3_PID);
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius II Core", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_II_CORE_PID, 0, 0xFF01);
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius II", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_II_PID, 2, 0xFF01);
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius II Origin", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_II_ORIGIN_PID, 2, 0xFF01);
@@ -99,4 +118,5 @@ REGISTER_HID_DETECTOR_IP("ASUS ROG Chakram (Wireless)", DetectAsusAuraUS
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 Strix Flare", DetectAsusAuraUSBKeyboards, AURA_USB_VID, AURA_ROG_STRIX_FLARE_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IP("ASUS ROG Strix Flare PNK LTD", DetectAsusAuraUSBKeyboards, AURA_USB_VID, AURA_ROG_STRIX_FLARE_PNK_LTD_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IP("ASUS ROG Strix Flare PNK LTD", DetectAsusAuraUSBKeyboards, AURA_USB_VID, AURA_ROG_STRIX_FLARE_PNK_LTD_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IP("ASUS ROG Strix Scope TKL", DetectAsusAuraUSBKeyboards, AURA_USB_VID, AURA_ROG_STRIX_SCOPE_TKL_PID, 1, 0xFF00);
@@ -13,12 +13,12 @@
#define NA 0xFFFFFFFF
static unsigned int matrix_map[6][22] =
{ { 0, NA, 12, 17, 22, 27, 37, 42, 48, 53, 59, 64, 67, 68, NA, 74, 78, 83, NA, NA, NA, NA },
{ 1, 7, 13, 18, 23, 28, 33, 38, 43, 49, 54, 60, 65, 69, NA, 75, 79, 84, 87, 92, 96, 101 },
{ 2, NA, 8, 14, 19, 24, 29, 34, 39, 44, 50, 55, 61, 66, 70, 76, 80, 85, 88, 93, 97, 102 },
{ 3, NA, 9, 15, 20, 25, 30, 35, 40, 45, 51, 56, 62, 71, NA, NA, NA, NA, 89, 94, 98, NA },
{ 4, NA, 10, 16, 21, 26, 31, 36, 41, 46, 52, 57, NA, NA, 72, NA, 81, NA, 90, 95, 99, 103 },
{ 5, 6, 11, NA, NA, NA, NA, 32, NA, 47, NA, 58, 63, 73, NA, 77, 82, 86, 91, NA, 100, NA } };
{ { 0, NA, 13, 18, 23, 28, 38, 43, 49, 54, 60, 65, 69, 70, NA, 76, 80, 85, NA, NA, NA, NA },
{ 1, 8, 14, 19, 24, 29, 34, 39, 44, 50, 55, 61, 66, 71, NA, 77, 81, 86, 89, 94, 98, 103 },
{ 2, NA, 9, 15, 20, 25, 30, 35, 40, 45, 51, 56, 62, 67, 72, 78, 82, 87, 90, 95, 99, 104 },
{ 3, NA, 10, 16, 21, 26, 31, 36, 41, 46, 52, 57, 63, 68, 73, NA, NA, NA, 91, 96, 100, NA },
{ 4, 6, 11, 17, 22, 27, 32, 37, 42, 47, 53, 58, NA, NA, 74, NA, 83, NA, 92, 97, 101, 105 },
{ 5, 7, 12, NA, NA, NA, NA, 33, NA, 48, NA, 59, 64, 75, NA, 79, 84, 88, 93, NA, 102, NA } };
static const char* zone_names[] =
{
@@ -36,7 +36,7 @@ static zone_type zone_types[] =
static const unsigned int zone_sizes[] =
{
104,
106,
1,
2,
};
@@ -56,6 +56,7 @@ static const led_type led_names[] =
{ "Key: Caps Lock", 0x03 },
{ "Key: Left Shift", 0x04 },
{ "Key: Left Control", 0x05 },
{ "Key: \\ (ISO)", 0x0C },
{ "Key: Left Windows", 0x0D },
{ "Key: 1", 0x11 },
{ "Key: Q", 0x12 },
@@ -117,6 +118,7 @@ static const led_type led_names[] =
{ "Key: F10", 0x68 },
{ "Key: =", 0x69 },
{ "Key: ]", 0x6A },
{ "Key: #", 0x6B },
{ "Key: F11", 0x70 },
{ "Key: F12", 0x78 },
{ "Key: Backspace", 0x79 },
@@ -237,7 +239,7 @@ void RGBController_AuraKeyboard::ResizeZone(int /*zone*/, int /*new_size*/)
void RGBController_AuraKeyboard::DeviceUpdateLEDs()
{
unsigned char frame_buf[107 * 4];
unsigned char frame_buf[109 * 4];
/*---------------------------------------------------------*\
| TODO: Send packets with multiple LED frames |
@@ -250,7 +252,7 @@ for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
frame_buf[(led_idx * 4) + 3] = RGBGetBValue(colors[led_idx]);
}
aura->SendDirect(107, frame_buf);
aura->SendDirect(109, frame_buf);
}
void RGBController_AuraKeyboard::UpdateZoneLEDs(int /*zone*/)
@@ -159,13 +159,24 @@ void RGBController_AuraUSB::SetupZones()
}
}
unsigned int num_mainboard_leds = device_info.num_leds - device_info.num_headers;
for (unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
{
unsigned led_idx = led_ch_idx + 1;
led new_led;
new_led.name = zones[channel_idx].name;
new_led.name.append(", LED ");
new_led.name.append(std::to_string(led_ch_idx + 1));
if(device_info.device_type == AuraDeviceType::FIXED && led_ch_idx >= num_mainboard_leds)
{
new_led.name.append(", RGB Header ");
led_idx -= num_mainboard_leds;
}
else
{
new_led.name.append(", LED ");
}
new_led.name.append(std::to_string(led_idx));
new_led.value = channel_idx;
leds.push_back(new_led);
@@ -204,7 +204,7 @@ void CMARGBController::SetLedsDirect(RGBColor *led_colours, unsigned int led_cou
/*---------------------------------------------*\
| Set up the RGB triplets to send |
\*---------------------------------------------*/
for(int i = 0; i < led_count; i++)
for(unsigned int i = 0; i < led_count; i++)
{
RGBColor colour = led_colours[i];
@@ -0,0 +1,167 @@
/*-------------------------------------------------------------------*\
| CMMKController.cpp |
| |
| Driver for Coolermaster MasterKeys Keyboards |
| |
| Lukas N (chmod222) 28th Jun 2020 |
| Tam D (too.manyhobbies) 25th Apr 2021 |
| |
\*-------------------------------------------------------------------*/
#include "CMMKController.h"
CMMKController::CMMKController(hid_device* dev, hid_device_info* dev_info)
{
location = dev_info->path;
const int szTemp = 256;
wchar_t tmpName[szTemp];
hid_get_manufacturer_string(dev, tmpName, szTemp);
std::wstring wName = std::wstring(tmpName);
device_name = std::string(wName.begin(), wName.end());
hid_get_product_string(dev, tmpName, szTemp);
wName = std::wstring(tmpName);
device_name.append(" ").append(std::string(wName.begin(), wName.end()));
cmmk_attach_path(&cmmk_handle, dev_info->path, dev_info->product_id, -1);
char buf[32] = {0};
cmmk_get_firmware_version(&cmmk_handle, buf, 32);
firmware_version = buf;
}
CMMKController::~CMMKController()
{
cmmk_detach(&cmmk_handle);
}
std::string CMMKController::GetDeviceName()
{
return device_name;
}
std::string CMMKController::GetLocation()
{
return location;
}
std::string CMMKController::GetFirmwareVersion()
{
return firmware_version;
}
void CMMKController::SetFirmwareControl()
{
ActivateMode(CMMK_FIRMWARE);
}
void CMMKController::SetManualControl()
{
ActivateMode(CMMK_MANUAL);
}
void CMMKController::SetSingle(int row, int col, struct rgb color)
{
cmmk_set_single_key(&cmmk_handle, row, col, &color);
}
void CMMKController::SetAll(struct cmmk_color_matrix const& colors)
{
cmmk_set_leds(&cmmk_handle, &colors);
}
void CMMKController::SetAllSingle(struct rgb color)
{
cmmk_set_all_single(&cmmk_handle, &color);
}
void CMMKController::SetMode(cmmk_effect_fully_lit eff)
{
ActivateEffect(CMMK_EFFECT_FULLY_LIT);
cmmk_set_effect_fully_lit(&cmmk_handle, &eff);
}
void CMMKController::SetMode(cmmk_effect_breathe eff)
{
ActivateEffect(CMMK_EFFECT_BREATHE);
cmmk_set_effect_breathe(&cmmk_handle, &eff);
}
void CMMKController::SetMode(cmmk_effect_cycle eff)
{
ActivateEffect(CMMK_EFFECT_CYCLE);
cmmk_set_effect_cycle(&cmmk_handle, &eff);
}
void CMMKController::SetMode(cmmk_effect_single eff)
{
ActivateEffect(CMMK_EFFECT_SINGLE);
cmmk_set_effect_single(&cmmk_handle, &eff);
}
void CMMKController::SetMode(cmmk_effect_wave eff)
{
ActivateEffect(CMMK_EFFECT_WAVE);
cmmk_set_effect_wave(&cmmk_handle, &eff);
}
void CMMKController::SetMode(cmmk_effect_ripple eff)
{
ActivateEffect(CMMK_EFFECT_RIPPLE);
cmmk_set_effect_ripple(&cmmk_handle, &eff);
}
void CMMKController::SetMode(cmmk_effect_cross eff)
{
ActivateEffect(CMMK_EFFECT_CROSS);
cmmk_set_effect_cross(&cmmk_handle, &eff);
}
void CMMKController::SetMode(cmmk_effect_raindrops eff)
{
ActivateEffect(CMMK_EFFECT_RAINDROPS);
cmmk_set_effect_raindrops(&cmmk_handle, &eff);
}
void CMMKController::SetMode(cmmk_effect_stars eff)
{
ActivateEffect(CMMK_EFFECT_STARS);
cmmk_set_effect_stars(&cmmk_handle, &eff);
}
void CMMKController::SetMode(cmmk_effect_snake eff)
{
ActivateEffect(CMMK_EFFECT_SNAKE);
cmmk_set_effect_snake(&cmmk_handle, &eff);
}
bool CMMKController::PositionValid(int y, int x)
{
return(cmmk_lookup_key_id(&cmmk_handle, y, x) >= 0);
}
void CMMKController::ActivateMode(int mode)
{
if (current_mode != mode)
{
cmmk_set_control_mode(&cmmk_handle, mode);
current_mode = mode;
current_effect = -1;
}
}
void CMMKController::ActivateEffect(int effect)
{
ActivateMode(CMMK_EFFECT);
if (current_effect != effect)
{
cmmk_set_active_effect(&cmmk_handle, (enum cmmk_effect_id)effect);
current_effect = effect;
}
}
@@ -0,0 +1,58 @@
/*-------------------------------------------------------------------*\
| CMMKController.h |
| |
| Driver for Coolermaster MasterKeys keyboards |
| |
| Lukas N (chmod222) 28th Jun 2020 |
| |
\*-------------------------------------------------------------------*/
#include <string>
#include <hidapi/hidapi.h>
#include <libcmmk/libcmmk.h>
#pragma once
class CMMKController
{
public:
CMMKController(hid_device* dev_handle, hid_device_info* dev_info);
~CMMKController();
std::string GetDeviceName();
std::string GetLocation();
std::string GetFirmwareVersion();
void SetFirmwareControl();
void SetManualControl();
void SetSingle(int row, int col, struct rgb color);
void SetAll(struct cmmk_color_matrix const& colors);
void SetAllSingle(struct rgb color);
void SetMode(cmmk_effect_fully_lit eff);
void SetMode(cmmk_effect_breathe eff);
void SetMode(cmmk_effect_cycle eff);
void SetMode(cmmk_effect_single eff);
void SetMode(cmmk_effect_wave eff);
void SetMode(cmmk_effect_ripple eff);
void SetMode(cmmk_effect_cross eff);
void SetMode(cmmk_effect_raindrops eff);
void SetMode(cmmk_effect_stars eff);
void SetMode(cmmk_effect_snake eff);
bool PositionValid(int y, int x);
private:
void ActivateMode(int mode);
void ActivateEffect(int effect);
int current_mode = -1;
int current_effect = -1;
std::string device_name;
std::string location;
std::string firmware_version;
mutable struct cmmk cmmk_handle;
};
@@ -147,7 +147,7 @@ void CMSmallARGBController::SetMode(unsigned char mode, unsigned char speed, RGB
SendUpdate();
}
void CMSmallARGBController::SetLedsDirect(RGBColor *led_colours, unsigned int led_count)
void CMSmallARGBController::SetLedsDirect(RGBColor* /*led_colours*/, unsigned int /*led_count*/)
{
// Mode not yet Tested
/*
@@ -3,20 +3,28 @@
#include "CMARGBcontroller.h"
#include "CMSmallARGBController.h"
#include "CMR6000Controller.h"
#include "CMMKController.h"
#include "RGBController.h"
#include "RGBController_CMMP750Controller.h"
#include "RGBController_CMARGBController.h"
#include "RGBController_CMSmallARGBController.h"
#include "RGBController_CMR6000Controller.h"
#include "RGBController_CMMKController.h"
#include <hidapi/hidapi.h>
#define COOLERMASTER_VID 0x2516
#define COOLERMASTER_VID 0x2516
#define COOLERMASTER_MP750_XL_PID 0x0109
#define COOLERMASTER_MP750_MEDIUM_PID 0x0105
#define COOLERMASTER_ARGB_PID 0x1011
#define COOLERMASTER_SMALL_ARGB_PID 0x1000
#define COOLERMASTER_RADEON_6000_PID 0x014D
#define COOLERMASTER_MP750_XL_PID 0x0109
#define COOLERMASTER_MP750_MEDIUM_PID 0x0105
#define COOLERMASTER_ARGB_PID 0x1011
#define COOLERMASTER_SMALL_ARGB_PID 0x1000
#define COOLERMASTER_RADEON_6000_PID 0x014D
#define COOLERMASTER_MASTERKEYS_PRO_L_PID CMMK_USB_MASTERKEYS_MK750
#define COOLERMASTER_MASTERKEYS_PRO_L_WHITE_PID CMMK_USB_MASTERKEYS_PRO_L_WHITE
#define COOLERMASTER_MASTERKEYS_PRO_S_PID CMMK_USB_MASTERKEYS_PRO_S
#define COOLERMASTER_MASTERKEYS_MK750_PID CMMK_USB_MASTERKEYS_MK750
#define COOLERMASTER_MASTERKEYS_SK630_PID CMMK_USB_MASTERKEYS_SK630
#define COOLERMASTER_MASTERKEYS_SK650_PID CMMK_USB_MASTERKEYS_SK650
/******************************************************************************************\
* *
@@ -77,8 +85,27 @@ void DetectCoolerMasterGPU(hid_device_info* info, const std::string&)
}
}
REGISTER_HID_DETECTOR_PU ("Cooler Master MP750 XL", DetectCoolerMasterMousemats, COOLERMASTER_VID, COOLERMASTER_MP750_XL_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 ARGB", DetectCoolerMasterARGB, COOLERMASTER_VID, COOLERMASTER_ARGB_PID, 0, 0xFF00, 1);
REGISTER_HID_DETECTOR_IPU("Cooler Master Smalll ARGB", DetectCoolerMasterSmallARGB, COOLERMASTER_VID, COOLERMASTER_SMALL_ARGB_PID, 0, 0xFF00, 1);
REGISTER_HID_DETECTOR_I ("Cooler Master Radeon 6000 GPU", DetectCoolerMasterGPU, COOLERMASTER_VID, COOLERMASTER_RADEON_6000_PID, 1);
void DetectCoolerMasterKeyboards(hid_device_info* info, const std::string&)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
CMMKController* controller = new CMMKController(dev, info);
RGBController_CMMKController* rgb_controller = new RGBController_CMMKController(controller);
// Constructor sets the name
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
REGISTER_HID_DETECTOR_PU ("Cooler Master MP750 XL", DetectCoolerMasterMousemats, COOLERMASTER_VID, COOLERMASTER_MP750_XL_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);
REGISTER_HID_DETECTOR_IPU("Cooler Master MasterKeys Pro S", DetectCoolerMasterKeyboards, COOLERMASTER_VID, COOLERMASTER_MASTERKEYS_PRO_S_PID, 1, 0xFF00, 1);
REGISTER_HID_DETECTOR_IPU("Cooler Master MK570", DetectCoolerMasterKeyboards, COOLERMASTER_VID, COOLERMASTER_MASTERKEYS_MK750_PID, 1, 0xFF00, 1);
REGISTER_HID_DETECTOR_IPU("Cooler Master SK630", DetectCoolerMasterKeyboards, COOLERMASTER_VID, COOLERMASTER_MASTERKEYS_SK630_PID, 1, 0xFF00, 1);
REGISTER_HID_DETECTOR_IPU("Cooler Master SK650", DetectCoolerMasterKeyboards, COOLERMASTER_VID, COOLERMASTER_MASTERKEYS_SK650_PID, 1, 0xFF00, 1);
REGISTER_HID_DETECTOR_IPU("Cooler Master ARGB", DetectCoolerMasterARGB, COOLERMASTER_VID, COOLERMASTER_ARGB_PID, 0, 0xFF00, 1);
REGISTER_HID_DETECTOR_IPU("Cooler Master Smalll ARGB", DetectCoolerMasterSmallARGB, COOLERMASTER_VID, COOLERMASTER_SMALL_ARGB_PID, 0, 0xFF00, 1);
REGISTER_HID_DETECTOR_I ("Cooler Master Radeon 6000 GPU", DetectCoolerMasterGPU, COOLERMASTER_VID, COOLERMASTER_RADEON_6000_PID, 1 );
@@ -336,7 +336,7 @@ void RGBController_CMARGBController::DeviceUpdateLEDs()
}
}
void RGBController_CMARGBController::UpdateZoneLEDs(int zone)
void RGBController_CMARGBController::UpdateZoneLEDs(int /*zone*/)
{
//cmargb->SetLedsDirect( zones[zone].colors, zones[zone].leds_count );
}
@@ -0,0 +1,467 @@
/*-------------------------------------------------------------------*\
| RGBController_CMMKController.cpp |
| |
| Driver for Coolermaster MasterKeys keyboards |
| |
| Lukas N (chmod222) 28th Jun 2020 |
| Tam D (too.manyhobbies) 25th Apr 2021 |
| |
\*-------------------------------------------------------------------*/
#include "RGBController_CMMKController.h"
#include <sstream>
using namespace std::chrono_literals;
#define CMMK_SPEED_MIN CMMK_SPEED0
#define CMMK_SPEED_MID CMMK_SPEED2
#define CMMK_SPEED_MAX CMMK_SPEED4
#define CMMK_MODE_FIRMWARE 0xFF
#define CMMK_MODE_MANUAL 0x7F
RGBController_CMMKController::RGBController_CMMKController(CMMKController* cmmk_ctrl)
{
cmmk = cmmk_ctrl;
name = cmmk->GetDeviceName();
type = DEVICE_TYPE_KEYBOARD;
description = "Cooler Master MasterKeys Device";
version = cmmk->GetFirmwareVersion();
serial = "";
location = cmmk->GetLocation();
mode Direct;
Direct.name = "Direct";
Direct.value = CMMK_MODE_MANUAL;
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 = CMMK_EFFECT_FULLY_LIT;
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
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 = CMMK_EFFECT_BREATHE;
Breathing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED;
Breathing.speed_min = 0x20;
Breathing.speed_max = 0x20;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.colors_min = 1;
Breathing.colors_max = 1;
Breathing.colors.resize(1);
modes.push_back(Breathing);
mode Cycle;
Cycle.name = "Spectrum Cycle";
Cycle.value = CMMK_EFFECT_CYCLE;
Cycle.flags = MODE_FLAG_HAS_SPEED;
Cycle.speed_min = CMMK_SPEED_MIN;
Cycle.speed_max = CMMK_SPEED_MAX;
Cycle.color_mode = MODE_COLORS_NONE;
modes.push_back(Cycle);
mode Reactive;
Reactive.name = "Reactive";
Reactive.value = CMMK_EFFECT_SINGLE;
Reactive.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED;
Reactive.speed_min = CMMK_SPEED_MIN;
Reactive.speed_max = CMMK_SPEED_MAX;
Reactive.color_mode = MODE_COLORS_MODE_SPECIFIC;
Reactive.colors_min = 2;
Reactive.colors_max = 2;
Reactive.colors.resize(2);
modes.push_back(Reactive);
mode Wave;
Wave.name = "Rainbow Wave";
Wave.value = CMMK_EFFECT_WAVE;
Wave.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_DIRECTION_UD;
Wave.speed_min = CMMK_SPEED_MIN;
Wave.speed_max = CMMK_SPEED_MAX;
Wave.color_mode = MODE_COLORS_MODE_SPECIFIC;
Wave.colors_min = 1;
Wave.colors_max = 1;
Wave.colors.resize(1);
modes.push_back(Wave);
mode Ripple;
Ripple.name = "Ripple Effect";
Ripple.value = CMMK_EFFECT_RIPPLE;
Ripple.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED;
Ripple.speed_min = CMMK_SPEED_MIN;
Ripple.speed_max = CMMK_SPEED_MAX;
Ripple.colors_min = 2;
Ripple.colors_max = 2;
Ripple.colors.resize(2);
modes.push_back(Ripple);
mode Cross;
Cross.name = "Cross";
Cross.value = CMMK_EFFECT_CROSS;
Cross.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED;
Cross.speed_min = CMMK_SPEED_MIN;
Cross.speed_max = CMMK_SPEED_MAX;
Cross.colors_min = 2;
Cross.colors_max = 2;
Cross.colors.resize(2);
modes.push_back(Cross);
mode Raindrops;
Raindrops.name = "Raindrops";
Raindrops.value = CMMK_EFFECT_RAINDROPS;
Raindrops.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED;
Raindrops.speed_min = CMMK_SPEED_MIN;
Raindrops.speed_max = CMMK_SPEED_MAX;
Raindrops.colors_min = 2;
Raindrops.colors_max = 2;
Raindrops.colors.resize(2);
modes.push_back(Raindrops);
mode Stars;
Stars.name = "Starfield";
Stars.value = CMMK_EFFECT_STARS;
Stars.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED;
Stars.speed_min = CMMK_SPEED_MIN;
Stars.speed_max = CMMK_SPEED_MAX;
Stars.colors_min = 2;
Stars.colors_max = 2;
Stars.colors.resize(2);
modes.push_back(Stars);
mode Snake;
Snake.name = "Snake";
Snake.value = CMMK_EFFECT_SNAKE;
Snake.flags = MODE_FLAG_HAS_SPEED;
Snake.speed_min = CMMK_SPEED_MIN;
Snake.speed_max = CMMK_SPEED_MAX;
modes.push_back(Snake);
mode FirmwareControl;
FirmwareControl.name = "Firmware Controlled";
FirmwareControl.value = 0xFF;
FirmwareControl.flags = 0;
modes.push_back(FirmwareControl);
SetupZones();
}
RGBController_CMMKController::~RGBController_CMMKController()
{
delete cmmk;
}
void RGBController_CMMKController::SetupMatrixMap()
{
for(int y = 0; y < CMMK_ROWS_MAX; y++)
{
for(int x = 0; x < CMMK_COLS_MAX; x++)
{
matrix_map[y][x] = 0xFFFFFFFF;
}
}
for(size_t i = 0; i < leds.size(); i++)
{
led& l = leds[i];
int y = (l.value & 0xFF00) >> 8;
int x = (l.value & 0xFF);
matrix_map[y][x] = i;
}
}
void RGBController_CMMKController::SetupZones()
{
for(int y = 0; y < CMMK_ROWS_MAX; y++)
{
for(int x = 0; x < CMMK_COLS_MAX; x++)
{
if(!cmmk->PositionValid(y, x))
{
continue;
}
std::stringstream namestrm;
led key;
namestrm << "Key @ Row " << (y + 1) << ", Column" << (x + 1);
key.name = namestrm.str();
key.value = (y & 0xFF) << 8 | (x & 0xFF);
leds.push_back(key);
}
}
zone KeyboardZone;
KeyboardZone.name = "Keyboard";
KeyboardZone.type = ZONE_TYPE_MATRIX;
KeyboardZone.leds_min = leds.size();
KeyboardZone.leds_max = leds.size();
KeyboardZone.leds_count = leds.size();
KeyboardZone.matrix_map = new matrix_map_type;
KeyboardZone.matrix_map->height = CMMK_ROWS_MAX;
KeyboardZone.matrix_map->width = CMMK_COLS_MAX;
KeyboardZone.matrix_map->map = (unsigned int *)&matrix_map;
zones.push_back(KeyboardZone);
SetupMatrixMap();
SetupColors();
}
void RGBController_CMMKController::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
struct rgb map_to_cmmk_rgb(RGBColor input)
{
return rgb
{
(uint8_t)RGBGetRValue(input),
(uint8_t)RGBGetGValue(input),
(uint8_t)RGBGetBValue(input)
};
}
enum cmmk_wave_direction map_to_cmmk_dir(int input)
{
switch(input)
{
case MODE_DIRECTION_LEFT:
return CMMK_RIGHT_TO_LEFT;
case MODE_DIRECTION_RIGHT:
return CMMK_LEFT_TO_RIGHT;
case MODE_DIRECTION_UP:
return CMMK_FRONT_TO_BACK;
case MODE_DIRECTION_DOWN:
return CMMK_BACK_TO_FRONT;
default:
return CMMK_RIGHT_TO_LEFT;
}
}
void copy_buffers(led* buf, RGBColor* colbuf, size_t n, struct cmmk_color_matrix& mat, std::atomic<bool>& dirty)
{
dirty.store(false);
for(size_t i = 0; i < n; i++)
{
led const& selected_led = buf[i];
int y = (selected_led.value & 0xFF00) >> 8;
int x = selected_led.value & 0xFF;
struct rgb col = map_to_cmmk_rgb(colbuf[i]);
struct rgb ecol = mat.data[y][x];
if(ecol.R != col.R || ecol.G != col.G || ecol.B != col.B)
{
dirty.store(true);
mat.data[y][x] = col;
}
}
}
void RGBController_CMMKController::DeviceUpdateLEDs()
{
copy_buffers(leds.data(), colors.data(), leds.size(), current_matrix, dirty);
if(force_update.load() || dirty.load())
{
cmmk->SetAll(current_matrix);
force_update.store(false);
}
}
void RGBController_CMMKController::UpdateZoneLEDs(int zone_idx)
{
zone& z = zones[zone_idx];
copy_buffers(z.leds, z.colors, z.leds_count, current_matrix, dirty);
if(force_update.load() || dirty.load())
{
cmmk->SetAll(current_matrix);
force_update.store(false);
}
}
void RGBController_CMMKController::UpdateSingleLED(int led_idx)
{
led& selected_led = leds[led_idx];
int y = (selected_led.value & 0xFF00) >> 8;
int x = selected_led.value & 0xFF;
current_matrix.data[y][x] = map_to_cmmk_rgb(colors[led_idx]);
cmmk->SetSingle(y, x, map_to_cmmk_rgb(colors[led_idx]));
dirty.store(false);
}
void RGBController_CMMKController::SetCustomMode()
{
active_mode = 1;
}
void RGBController_CMMKController::DeviceUpdateMode()
{
force_update.store(true);
switch(modes[active_mode].value)
{
case CMMK_MODE_FIRMWARE:
cmmk->SetFirmwareControl();
break;
case CMMK_MODE_MANUAL:
cmmk->SetManualControl();
break;
case CMMK_EFFECT_FULLY_LIT:
{
cmmk_effect_fully_lit fully_lit_effect;
fully_lit_effect.color = map_to_cmmk_rgb(modes[active_mode].colors[0]);
cmmk->SetMode(fully_lit_effect);
}
break;
case CMMK_EFFECT_BREATHE:
{
cmmk_effect_breathe breathe_effect;
breathe_effect.speed = (uint8_t)modes[active_mode].speed;
breathe_effect.color = map_to_cmmk_rgb(modes[active_mode].colors[0]);
cmmk->SetMode(breathe_effect);
}
break;
case CMMK_EFFECT_CYCLE:
{
cmmk_effect_cycle cycle_effect;
cycle_effect.speed = (uint8_t)modes[active_mode].speed;
cmmk->SetMode(cycle_effect);
}
break;
case CMMK_EFFECT_SINGLE:
{
cmmk_effect_single single_effect;
single_effect.speed = (uint8_t)modes[active_mode].speed;
single_effect.active = map_to_cmmk_rgb(modes[active_mode].colors[0]);
single_effect.rest = map_to_cmmk_rgb(modes[active_mode].colors[1]);
cmmk->SetMode(single_effect);
}
break;
case CMMK_EFFECT_WAVE:
{
cmmk_effect_wave wave_effect;
wave_effect.speed = (uint8_t)modes[active_mode].speed;
wave_effect.direction = map_to_cmmk_dir(modes[active_mode].direction);
wave_effect.start = map_to_cmmk_rgb(modes[active_mode].colors[0]);
cmmk->SetMode(wave_effect);
}
break;
case CMMK_EFFECT_RIPPLE:
{
cmmk_effect_ripple ripple_effect;
ripple_effect.speed = (uint8_t)modes[active_mode].speed;
ripple_effect.active = map_to_cmmk_rgb(modes[active_mode].colors[0]);
ripple_effect.rest = map_to_cmmk_rgb(modes[active_mode].colors[1]);
if(modes[active_mode].color_mode == MODE_COLORS_RANDOM)
{
ripple_effect.ripple_type = CMMK_RIPPLE_RANDOM_COLOR;
}
else
{
ripple_effect.ripple_type = CMMK_RIPPLE_GIVEN_COLOR;
}
cmmk->SetMode(ripple_effect);
}
break;
case CMMK_EFFECT_CROSS:
{
cmmk_effect_cross cross_effect;
cross_effect.speed = (uint8_t)modes[active_mode].speed;
cross_effect.active = map_to_cmmk_rgb(modes[active_mode].colors[0]);
cross_effect.rest = map_to_cmmk_rgb(modes[active_mode].colors[1]);
cmmk->SetMode(cross_effect);
}
break;
case CMMK_EFFECT_RAINDROPS:
{
cmmk_effect_raindrops raindrops_effect;
raindrops_effect.speed = (uint8_t)modes[active_mode].speed;
raindrops_effect.interval = CMMK_SPEED_MID;
raindrops_effect.active = map_to_cmmk_rgb(modes[active_mode].colors[0]);
raindrops_effect.rest = map_to_cmmk_rgb(modes[active_mode].colors[1]);
cmmk->SetMode(raindrops_effect);
}
break;
case CMMK_EFFECT_STARS:
{
cmmk_effect_stars stars_effect;
stars_effect.speed = (uint8_t)modes[active_mode].speed;
stars_effect.interval = CMMK_SPEED_MID;
stars_effect.active = map_to_cmmk_rgb(modes[active_mode].colors[0]);
stars_effect.rest = map_to_cmmk_rgb(modes[active_mode].colors[1]);
cmmk->SetMode(stars_effect);
}
break;
case CMMK_EFFECT_SNAKE:
{
cmmk_effect_snake snake_effect;
snake_effect.speed = (uint8_t)modes[active_mode].speed;
cmmk->SetMode(snake_effect);
}
break;
}
}
@@ -0,0 +1,42 @@
/*-------------------------------------------------------------------*\
| RGBController_CMMKController.h |
| |
| Driver for Coolermaster MasterKeys keyboards |
| |
| Lukas N (chmod222) 28th Jun 2020 |
| Tam D (too.manyhobbies) 25th Apr 2021 |
| |
\*-------------------------------------------------------------------*/
#pragma once
#include "RGBController.h"
#include "CMMKController.h"
class RGBController_CMMKController : public RGBController
{
public:
RGBController_CMMKController(CMMKController* cmmk_ptr);
~RGBController_CMMKController();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
void SetupMatrixMap();
CMMKController* cmmk;
int matrix_map[CMMK_ROWS_MAX][CMMK_COLS_MAX];
struct cmmk_color_matrix current_matrix;
std::atomic<bool> dirty;
std::atomic<bool> force_update;
};
@@ -87,7 +87,7 @@ RGBController_CMMP750Controller::~RGBController_CMMP750Controller()
int RGBController_CMMP750Controller::GetDeviceMode()
{
int temp_mode = cmmp750->GetMode();
for( int i = 0; i < modes.size(); i++)
for(unsigned int i = 0; i < modes.size(); i++)
{
if (temp_mode == modes[i].value)
{
@@ -224,14 +224,14 @@ void RGBController_CMSmallARGBController::DeviceUpdateLEDs()
}
}
void RGBController_CMSmallARGBController::UpdateZoneLEDs(int zone)
void RGBController_CMSmallARGBController::UpdateZoneLEDs(int /*zone*/)
{
bool random_colours = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
//bool random_colours = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
//cmargb->SetLedsDirect(zones[zone].colors, random_colours);
}
void RGBController_CMSmallARGBController::UpdateSingleLED(int led)
void RGBController_CMSmallARGBController::UpdateSingleLED(int /*led*/)
{
//cmargb->SetMode( modes[active_mode].value, modes[active_mode].speed );
//cmargb->SetLedsDirect( zones[0].colors, zones[0].leds_count );
@@ -0,0 +1,276 @@
/*---------------------------------------------------------*\
| CorsairCommanderCoreController.cpp |
| |
| Processing Code for Corsair Commander Core |
| |
| Jeff P. |
\*---------------------------------------------------------*/
#include "CorsairCommanderCoreController.h"
#include <cstring>
#include <iomanip>
#include <iostream>
using namespace std::chrono_literals;
CorsairCommanderCoreController::CorsairCommanderCoreController(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
location = path;
keepalive_thread_run = 1;
controller_ready = 0;
/*-----------------------------------------------------*\
| Initialize controller |
\*-----------------------------------------------------*/
InitController();
/*-----------------------------------------------------*\
| Start keepalive thread |
\*-----------------------------------------------------*/
keepalive_thread = new std::thread(&CorsairCommanderCoreController::KeepaliveThread, this);
}
CorsairCommanderCoreController::~CorsairCommanderCoreController()
{
/*-----------------------------------------------------*\
| Close keepalive thread |
\*-----------------------------------------------------*/
keepalive_thread_run = 0;
keepalive_thread->join();
delete keepalive_thread;
/*-----------------------------------------------------*\
| Close HID device |
\*-----------------------------------------------------*/
hid_close(dev);
}
void CorsairCommanderCoreController::InitController()
{
/*-----------------------------------------------------*\
| Packet sequence to put controller into direct mode |
\*-----------------------------------------------------*/
unsigned char buffarray[][5] =
{
{0x08, 0x01, 0x03, 0x00, 0x02},
{0x08, 0x0D, 0x00, 0x22, 0x00},
};
SendMultiPkt(buffarray, sizeof(buffarray) / sizeof(buffarray[0]), sizeof(buffarray)[0] / sizeof(buffarray[0][0]));
SetFanMode();
}
std::string CorsairCommanderCoreController::GetLocationString()
{
return("HID: " + location);
}
void CorsairCommanderCoreController::KeepaliveThread()
{
while(keepalive_thread_run.load())
{
if (controller_ready)
{
if((std::chrono::steady_clock::now() - last_commit_time) > std::chrono::seconds(10))
{
SendCommit();
}
}
std::this_thread::sleep_for(1s);
}
}
void CorsairCommanderCoreController::SendCommit()
{
if(!lastcolors.empty())
{
/*-----------------------------------------------------*\
| If colors remain to be sent, send them |
\*-----------------------------------------------------*/
SetDirectColor(lastcolors, lastzones);
}
else
{
unsigned char usb_buf[1025];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Update last commit time |
\*-----------------------------------------------------*/
last_commit_time = std::chrono::steady_clock::now();
/*-----------------------------------------------------*\
| Set up Commit packet |
\*-----------------------------------------------------*/
memset(usb_buf, 0, CORSAIR_COMMANDER_CORE_PACKET_SIZE);
usb_buf[0] = 0x00;
usb_buf[1] = 0x08;
usb_buf[2] = 0x06;
usb_buf[4] = 0xBD;
usb_buf[5] = 0x02;
usb_buf[8] = 0x12;
hid_write(dev, usb_buf, CORSAIR_COMMANDER_CORE_PACKET_SIZE);
}
}
void CorsairCommanderCoreController::SendMultiPkt(unsigned char buffarray[][5], int r, int c)
{
/*---------------------------------------------------------*\
| Private function to send multiple packets |
\*---------------------------------------------------------*/
unsigned char* hidtemp = new unsigned char[CORSAIR_COMMANDER_CORE_PACKET_SIZE];
for(unsigned int i = 0; i < r; i++)
{
memset(hidtemp, 0, CORSAIR_COMMANDER_CORE_PACKET_SIZE);
for(unsigned int j = 0; j < c; j++)
{
hidtemp[j+1] = buffarray[i][j];
}
hid_write(dev, hidtemp, CORSAIR_COMMANDER_CORE_PACKET_SIZE);
hid_read(dev, hidtemp, CORSAIR_COMMANDER_CORE_PACKET_SIZE);
}
}
void CorsairCommanderCoreController::SetDirectColor
(
std::vector<RGBColor> colors,
std::vector<zone> zones
)
{
if(controller_ready == 1 && ((std::chrono::steady_clock::now() - last_commit_time) > std::chrono::milliseconds(33)))
{
lastcolors = colors;
lastzones = zones;
int packet_offset = CORSAIR_COMMANDER_CORE_PREAMBLE_OFFSET;
int led_idx = 0;
int channel_idx = 0;
unsigned char* usb_buf = new unsigned char[CORSAIR_COMMANDER_CORE_PACKET_SIZE];
memset(usb_buf, 0, CORSAIR_COMMANDER_CORE_PACKET_SIZE);
/*-----------------------------------------------------*\
| Prepare color information packet |
\*-----------------------------------------------------*/
usb_buf[0] = 0x00;
usb_buf[1] = 0x08;
usb_buf[2] = 0x06;
usb_buf[4] = 0xBD;
usb_buf[5] = 0x02;
usb_buf[8] = 0x12;
for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
/*-------------------------------------------------*\
| Add led colors |
\*-------------------------------------------------*/
for(unsigned int i = led_idx; i < led_idx + zones[zone_idx].leds_count; i++)
{
usb_buf[packet_offset] = RGBGetRValue(colors[i]);
usb_buf[packet_offset+1] = RGBGetGValue(colors[i]);
usb_buf[packet_offset+2] = RGBGetBValue(colors[i]);
packet_offset = packet_offset + 3;
}
led_idx = led_idx + zones[zone_idx].leds_count;
/*-------------------------------------------------*\
| Move offset for pump zone with less than 29 LEDs |
\*-------------------------------------------------*/
if(zone_idx == 0)
{
packet_offset = packet_offset + 3 * (29 - zones[zone_idx].leds_count);
}
/*-------------------------------------------------*\
| Move offset for fans with less than 34 LEDs |
\*-------------------------------------------------*/
if(zone_idx != 0)
{
packet_offset = packet_offset + 3 * (34 - zones[zone_idx].leds_count);
}
channel_idx++;
}
/*-----------------------------------------------------*\
| Sending a direct mode color packet resets the timeout |
\*-----------------------------------------------------*/
last_commit_time = std::chrono::steady_clock::now();
hid_write(dev, usb_buf, CORSAIR_COMMANDER_CORE_PACKET_SIZE);
}
}
void CorsairCommanderCoreController::SetFanMode()
{
/*--------------------------------------------------------------------------------------------------*\
| Force controller to 6 QL fan mode to expose maximum number of LEDs per rgb port (34 LEDs per port) |
\*--------------------------------------------------------------------------------------------------*/
unsigned char usb_buf[1025];
unsigned char buffarray4[][5] =
{
{0x08, 0x05, 0x01, 0x01, 0x00},
{0x08, 0x0D, 0x01, 0x1E, 0x00},
{0x08, 0x09, 0x01, 0x00, 0x00}
};
SendMultiPkt(buffarray4, sizeof(buffarray4) / sizeof(buffarray4[0]), sizeof(buffarray4)[0] / sizeof(buffarray4[0][0]));
memset(usb_buf, 0, sizeof(usb_buf));
usb_buf[0] = 0x00;
usb_buf[1] = 0x08;
usb_buf[2] = 0x06;
usb_buf[3] = 0x01;
usb_buf[4] = 0x11;
usb_buf[8] = 0x0D;
usb_buf[10] = 0x07;
usb_buf[11] = 0x01;
usb_buf[12] = 0x08;
for(unsigned int i = 13; i < 25; i = i + 2)
{
usb_buf[i] = 0x01;
usb_buf[i + 1] = 0x06;
}
hid_write(dev, usb_buf, CORSAIR_COMMANDER_CORE_PACKET_SIZE);
hid_read(dev, usb_buf, CORSAIR_COMMANDER_CORE_PACKET_SIZE);
unsigned char buffarray2[][5] =
{
{0x08, 0x05, 0x01, 0x01, 0x00},
{0x08, 0x15, 0x01, 0x00, 0x00}
};
SendMultiPkt(buffarray2, sizeof(buffarray2) / sizeof(buffarray2[0]), sizeof(buffarray2)[0] / sizeof(buffarray2[0][0]));
memset(usb_buf, 0, CORSAIR_COMMANDER_CORE_PACKET_SIZE);
usb_buf[0] = 0x00;
usb_buf[1] = 0x08;
usb_buf[2] = 0x06;
usb_buf[4] = 0xBD;
usb_buf[5] = 0x02;
usb_buf[8] = 0x12;
hid_write(dev, usb_buf, CORSAIR_COMMANDER_CORE_PACKET_SIZE);
hid_read(dev, usb_buf, CORSAIR_COMMANDER_CORE_PACKET_SIZE);
controller_ready = 1;
}
@@ -0,0 +1,65 @@
/*---------------------------------------------------------*\
| CorsairCommanderCoreController.h |
| |
| Definitions for Corsair Commander Core |
| Based on code by: |
| Adam Honse ([email protected]), 8/17/2020 |
| |
| Jeff P. |
\*---------------------------------------------------------*/
#include "RGBController.h"
#include <vector>
#include <chrono>
#include <hidapi/hidapi.h>
#pragma once
#define CORSAIR_COMMANDER_CORE_PACKET_SIZE 1025
#define CORSAIR_COMMANDER_CORE_PREAMBLE_OFFSET 10
#define CORSAIR_ELITE_CAPELLIX_PUMP_LED_OFFSET 87
#define CORSAIR_QL_FAN_ZONE_OFFSET 102
#define CORSAIR_COMMANDER_CORE_NUM_CHANNELS 6
enum
{
CORSAIR_COMMANDER_CORE_MODE_DIRECT = 0x00,
};
class CorsairCommanderCoreController
{
public:
CorsairCommanderCoreController(hid_device* dev_handle, const char* path);
~CorsairCommanderCoreController();
std::string GetLocationString();
void SetDirectColor
(
std::vector<RGBColor>,
std::vector<zone>
);
void KeepaliveThread();
void SetFanMode();
private:
hid_device* dev;
std::thread* keepalive_thread;
std::atomic<bool> keepalive_thread_run;
std::atomic<bool> controller_ready;
std::string location;
std::vector<RGBColor> lastcolors;
std::vector<zone> lastzones;
std::chrono::time_point<std::chrono::steady_clock> last_commit_time;
void SendMultiPkt
(
unsigned char buffarray[][5],
int r,
int c
);
void SendCommit();
void InitController();
};
@@ -0,0 +1,41 @@
#include "Detector.h"
#include "CorsairCommanderCoreController.h"
#include "RGBController.h"
#include "RGBController_CorsairCommanderCore.h"
#include <vector>
#include <hidapi/hidapi.h>
/*-----------------------------------------------------*\
| Corsair vendor ID |
\*-----------------------------------------------------*/
#define CORSAIR_VID 0x1B1C
/*-----------------------------------------------------*\
| Commander Core product IDs |
\*-----------------------------------------------------*/
#define CORSAIR_H150I_COMMANDER_CORE_PID 0x0C1C
/******************************************************************************************\
* *
* DetectCorsairCapellixControllers *
* *
* Tests the USB address to see if a Corsair RGB Cooler controller exists there. *
* *
\******************************************************************************************/
void DetectCorsairCapellixHIDControllers(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
CorsairCommanderCoreController* controller = new CorsairCommanderCoreController(dev, info->path);
RGBController_CorsairCommanderCore* rgb_controller = new RGBController_CorsairCommanderCore(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
REGISTER_HID_DETECTOR_PU("Corsair Commander Core", DetectCorsairCapellixHIDControllers, CORSAIR_VID, CORSAIR_H150I_COMMANDER_CORE_PID, 0xFF42, 0x01);
@@ -0,0 +1,125 @@
/*-----------------------------------------*\
| RGBController_CorsairCapellix.cpp |
| |
| Generic RGB Interface for Corsair |
| Commander Core |
| |
| Jeff P. |
\*-----------------------------------------*/
#include "RGBController_CorsairCommanderCore.h"
RGBController_CorsairCommanderCore::RGBController_CorsairCommanderCore(CorsairCommanderCoreController* corsair_ptr)
{
corsair = corsair_ptr;
vendor = "Corsair";
description = "Corsair Commander Core";
type = DEVICE_TYPE_COOLER;
location = corsair->GetLocationString();
SetupZones();
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);
}
RGBController_CorsairCommanderCore::~RGBController_CorsairCommanderCore()
{
delete corsair;
}
void RGBController_CorsairCommanderCore::SetupZones()
{
std::atomic<bool> first_run;
first_run = 0;
if(zones.size() == 0)
{
first_run = 1;
}
zones.resize(7);
zones[0].name = "Pump";
zones[0].type = ZONE_TYPE_LINEAR;
zones[0].leds_min = 0;
zones[0].leds_max = 29;
for(unsigned int i = 1; i < (CORSAIR_COMMANDER_CORE_NUM_CHANNELS + 1); i++)
{
zones[i].name = "RGB Port " + std::to_string(i);
zones[i].type = ZONE_TYPE_LINEAR;
zones[i].leds_min = 0;
zones[i].leds_max = 34;
if(first_run)
{
zones[i].leds_count = 0;
}
}
leds.clear();
colors.clear();
for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
for (unsigned int led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
{
led new_led;
new_led.name = zones[zone_idx].name + " LED " + std::to_string(led_idx+1);
leds.push_back(new_led);
}
}
SetupColors();
}
void RGBController_CorsairCommanderCore::ResizeZone(int zone, int new_size)
{
if((size_t) zone >= zones.size())
{
return;
}
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
{
zones[zone].leds_count = new_size;
SetupZones();
}
}
void RGBController_CorsairCommanderCore::DeviceUpdateLEDs()
{
DeviceUpdateMode();
}
void RGBController_CorsairCommanderCore::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_CorsairCommanderCore::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_CorsairCommanderCore::SetCustomMode()
{
active_mode = 0;
}
void RGBController_CorsairCommanderCore::DeviceUpdateMode()
{
switch(modes[active_mode].value)
{
case CORSAIR_COMMANDER_CORE_MODE_DIRECT:
corsair->SetDirectColor(colors, zones);
break;
}
}
@@ -0,0 +1,33 @@
/*-----------------------------------------*\
| RGBController_CorsairCapellix.h |
| |
| Generic RGB Interface for Corsair |
| Commander Core |
| |
| Jeff P. |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "CorsairCommanderCoreController.h"
class RGBController_CorsairCommanderCore : public RGBController
{
public:
RGBController_CorsairCommanderCore(CorsairCommanderCoreController* corsair_ptr);
~RGBController_CorsairCommanderCore();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
CorsairCommanderCoreController* corsair;
std::vector<int> fanleds{0};
};
@@ -15,7 +15,7 @@
#include <hidapi/hidapi.h>
#define CORSAIR_HYDRO_PLATINUM_PACKET_SIZE 65
#define CORSAIR_HYDRO_PLATINUM_PACKET_DELAY 3
#define CORSAIR_HYDRO_PLATINUM_PACKET_DELAY 5
enum
{
@@ -64,7 +64,12 @@ std::string CorsairLightingNodeController::GetLocationString()
std::string CorsairLightingNodeController::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());
@@ -48,6 +48,9 @@ static unsigned int keys_k95[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
static unsigned int st100[] = { 0x00, 0x01, 0x02, 0x03, 0x05, 0x06, 0x07, 0x08, 0x04 };
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 };
CorsairPeripheralController::CorsairPeripheralController(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
@@ -56,18 +59,18 @@ CorsairPeripheralController::CorsairPeripheralController(hid_device* dev_handle,
ReadFirmwareInfo();
/*-----------------------------------------------------*\
| K95 Platinum requires additional steps |
| K55 and K95 Platinum require additional steps |
\*-----------------------------------------------------*/
if (logical_layout == CORSAIR_TYPE_K95_PLAT)
if (logical_layout == CORSAIR_TYPE_K55 || logical_layout == CORSAIR_TYPE_K95_PLAT)
{
SpecialFunctionControl();
}
LightingControl();
if (logical_layout == CORSAIR_TYPE_K95_PLAT)
if (logical_layout == CORSAIR_TYPE_K55 || logical_layout == CORSAIR_TYPE_K95_PLAT)
{
SetupK95LightingControl();
SetupK55AndK95LightingControl();
}
}
@@ -109,7 +112,12 @@ std::string CorsairPeripheralController::GetName()
std::string CorsairPeripheralController::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());
@@ -229,7 +237,6 @@ void CorsairPeripheralController::SetLEDsKeyboardFull(std::vector<RGBColor> colo
SubmitKeyboardFullColors(3, 3, 2);
}
void CorsairPeripheralController::SetLEDsMouse(std::vector<RGBColor> colors)
{
SubmitMouseColors(colors.size(), &colors[0]);
@@ -367,7 +374,7 @@ void CorsairPeripheralController::LightingControl()
| Probably a key mapping packet? |
\*-----------------------------------------------------*/
void CorsairPeripheralController::SetupK95LightingControl()
void CorsairPeripheralController::SetupK55AndK95LightingControl()
{
char usb_buf[65];
@@ -391,7 +398,16 @@ void CorsairPeripheralController::SetupK95LightingControl()
\*-----------------------------------------------------*/
hid_write(dev, (unsigned char *)usb_buf, 65);
int identifier = 0;
unsigned int* skipped_identifiers = key_mapping_k95_plat_ansi;
int skipped_identifiers_count = sizeof(key_mapping_k95_plat_ansi) / sizeof(key_mapping_k95_plat_ansi[0]);
if (physical_layout == CORSAIR_LAYOUT_ISO)
{
skipped_identifiers = key_mapping_k95_plat_iso;
skipped_identifiers_count = sizeof(key_mapping_k95_plat_iso) / sizeof(key_mapping_k95_plat_iso[0]);
}
unsigned int identifier = 0;
for (int i = 0; i < 4; i++)
{
/*-----------------------------------------------------*\
@@ -409,11 +425,12 @@ void CorsairPeripheralController::SetupK95LightingControl()
for (int j = 0; j < 30; j++)
{
while (identifier == 0x31 || identifier == 0x41 || identifier == 0x42 || identifier == 0x48
|| identifier == 0x49 || identifier == 0x51 || identifier == 0x55 || identifier == 0x6f
|| identifier == 0x7e || identifier == 0x7f || identifier == 0x80 || identifier == 0x81)
for (int j = 0; j < skipped_identifiers_count; j++)
{
identifier++;
if (identifier == skipped_identifiers[j])
{
identifier++;
}
}
usb_buf[5 + 2 * j] = identifier++;
@@ -522,7 +539,6 @@ void CorsairPeripheralController::ReadFirmwareInfo()
case 0x1B3D:
logical_layout = CORSAIR_TYPE_K55;
SpecialFunctionControl();
break;
default:
@@ -97,7 +97,7 @@ private:
int logical_layout; //Normal, K95 or K95 Platinum
void LightingControl();
void SetupK95LightingControl();
void SetupK55AndK95LightingControl();
void SpecialFunctionControl();
void ReadFirmwareInfo();
@@ -91,7 +91,7 @@ void DetectCorsairPeripheralControllers(hid_device_info* info, const std::string
/*-----------------------------------------------------------------------------------------------------*\
| Keyboards |
\*-----------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IP("Corsair K55 RGB", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_K55_RGB_PID, 1, 0xFFC2); // Not per-key, disabled for now
REGISTER_HID_DETECTOR_IP("Corsair K55 RGB", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_K55_RGB_PID, 1, 0xFFC2);
REGISTER_HID_DETECTOR_IP("Corsair K65 RGB", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_K65_RGB_PID, 1, 0xFFC2);
REGISTER_HID_DETECTOR_IP("Corsair K65 LUX RGB", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_K65_LUX_RGB_PID, 1, 0xFFC2);
REGISTER_HID_DETECTOR_IP("Corsair K65 RGB RAPIDFIRE", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_K65_RGB_RAPIDFIRE_PID, 1, 0xFFC2);
@@ -0,0 +1,222 @@
/*-----------------------------------------*\
| CorsairWirelessController.cpp |
| |
| Driver for Corsair RGB wireless keyboard |
| lighting controller |
| |
| Adam Honse (CalcProgrammer1) 5/8/2021 |
\*-----------------------------------------*/
#include "CorsairWirelessController.h"
#include <cstring>
using namespace std::chrono_literals;
CorsairWirelessController::CorsairWirelessController(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
location = path;
type = DEVICE_TYPE_KEYBOARD;
EnterDirectMode();
}
CorsairWirelessController::~CorsairWirelessController()
{
hid_close(dev);
}
device_type CorsairWirelessController::GetDeviceType()
{
return type;
}
std::string CorsairWirelessController::GetDeviceLocation()
{
return("HID: " + location);
}
std::string CorsairWirelessController::GetFirmwareString()
{
return firmware_version;
}
std::string CorsairWirelessController::GetName()
{
return name;
}
std::string CorsairWirelessController::GetSerialString()
{
wchar_t serial_string[128];
int ret = hid_get_serial_number_string(dev, serial_string, 128);
if(ret != 0)
{
return("");
}
std::wstring return_wstring = serial_string;
std::string return_string(return_wstring.begin(), return_wstring.end());
return(return_string);
}
void CorsairWirelessController::SetLEDs(std::vector<RGBColor>colors)
{
unsigned char buf[3 * 137];
for(int color = 0; color < 137; color++)
{
buf[0 + color] = RGBGetRValue(colors[color]);
buf[137 + color] = RGBGetGValue(colors[color]);
buf[274+color] = RGBGetBValue(colors[color]);
}
StartDirectMode();
SendDirectFrame(true, &buf[0]);
SendDirectFrame(false, &buf[57]);
SendDirectFrame(false, &buf[118]);
SendDirectFrame(false, &buf[179]);
SendDirectFrame(false, &buf[240]);
SendDirectFrame(false, &buf[301]);
SendDirectFrame(false, &buf[362]);
}
void CorsairWirelessController::SetLEDsKeyboardFull(std::vector<RGBColor> colors)
{
}
void CorsairWirelessController::SetName(std::string device_name)
{
name = device_name;
}
/*-------------------------------------------------------------------------------------------------*\
| Private packet sending functions. |
\*-------------------------------------------------------------------------------------------------*/
void CorsairWirelessController::EnterDirectMode()
{
char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Submit Mouse Colors packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0x80;
usb_buf[0x02] = 0x01;
usb_buf[0x03] = 0x03;
usb_buf[0x04] = 0x00;
usb_buf[0x05] = 0x02;
/*-----------------------------------------------------*\
| Send packet using feature reports, as headset stand |
| seems to not update completely using HID writes |
\*-----------------------------------------------------*/
hid_write(dev, (unsigned char *)usb_buf, 65);
}
void CorsairWirelessController::StartDirectMode()
{
char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Submit Mouse Colors packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0x80;
usb_buf[0x02] = 0x0D;
usb_buf[0x03] = 0x00;
usb_buf[0x04] = 0x01;
/*-----------------------------------------------------*\
| Send packet using feature reports, as headset stand |
| seems to not update completely using HID writes |
\*-----------------------------------------------------*/
hid_write(dev, (unsigned char *)usb_buf, 65);
}
void CorsairWirelessController::ExitDirectMode()
{
char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Submit Mouse Colors packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0x80;
usb_buf[0x02] = 0x01;
usb_buf[0x03] = 0x03;
usb_buf[0x04] = 0x00;
usb_buf[0x05] = 0x01;
/*-----------------------------------------------------*\
| Send packet using feature reports, as headset stand |
| seems to not update completely using HID writes |
\*-----------------------------------------------------*/
hid_write(dev, (unsigned char *)usb_buf, 65);
}
void CorsairWirelessController::SendDirectFrame(bool first_frame, unsigned char* data)
{
char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Submit Mouse Colors packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0x80;
usb_buf[0x02] = first_frame ? 0x06 : 0x07;
usb_buf[0x03] = 0x00;
if(first_frame)
{
usb_buf[0x04] = 0x9B;
usb_buf[0x05] = 0x01;
}
/*-----------------------------------------------------*\
| Copy in colors in <RED> <GREEN> <BLUE> order |
\*-----------------------------------------------------*/
if(first_frame)
{
memcpy(&usb_buf[0x08], data, 57);
}
else
{
memcpy(&usb_buf[0x04], data, 61);
}
/*-----------------------------------------------------*\
| Send packet using feature reports, as headset stand |
| seems to not update completely using HID writes |
\*-----------------------------------------------------*/
hid_write(dev, (unsigned char *)usb_buf, 65);
}
@@ -0,0 +1,45 @@
/*-----------------------------------------*\
| CorsairWirelessController.h |
| |
| Definitions and types for Corsair RGB |
| wireless keyboard lighting controller |
| |
| Adam Honse (CalcProgrammer1) 5/8/2021 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
class CorsairWirelessController
{
public:
CorsairWirelessController(hid_device* dev_handle, const char* path);
~CorsairWirelessController();
device_type GetDeviceType();
std::string GetDeviceLocation();
std::string GetFirmwareString();
std::string GetName();
std::string GetSerialString();
void SetLEDs(std::vector<RGBColor> colors);
void SetLEDsKeyboardFull(std::vector<RGBColor> colors);
void SetName(std::string device_name);
private:
hid_device* dev;
std::string firmware_version;
std::string location;
std::string name;
device_type type;
void EnterDirectMode();
void ExitDirectMode();
void StartDirectMode();
void SendDirectFrame(bool first_frame, unsigned char* data);
};
@@ -0,0 +1,50 @@
#include "Detector.h"
#include "CorsairWirelessController.h"
#include "RGBController.h"
#include "RGBController_CorsairWireless.h"
#include <hidapi/hidapi.h>
/*-----------------------------------------------------*\
| Corsair vendor ID |
\*-----------------------------------------------------*/
#define CORSAIR_VID 0x1B1C
/*-----------------------------------------------------*\
| Keyboard product IDs |
\*-----------------------------------------------------*/
#define CORSAIR_K57_RGB_WIRED_PID 0x1B6E
#define CORSAIR_K57_RGB_WIRELESS_PID 0x1B62
/******************************************************************************************\
* *
* DetectCorsairWirelessControllers *
* *
* Tests the USB address to see if a Corsair RGB Keyboard controller exists there. *
* *
\******************************************************************************************/
void DetectCorsairWirelessControllers(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if( dev )
{
CorsairWirelessController* controller = new CorsairWirelessController(dev, info->path);
controller->SetName(name);
if(controller->GetDeviceType() != DEVICE_TYPE_UNKNOWN)
{
RGBController_CorsairWireless* rgb_controller = new RGBController_CorsairWireless(controller);
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
else
{
delete controller;
}
}
} /* DetectCorsairWirelessControllers() */
/*-----------------------------------------------------------------------------------------------------*\
| Keyboards |
\*-----------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IPU("Corsair K57 RGB (Wired)", DetectCorsairWirelessControllers, CORSAIR_VID, CORSAIR_K57_RGB_WIRED_PID, 1, 0xFF42, 1);
//REGISTER_HID_DETECTOR_IPU("Corsair K57 RGB (Wireless)", DetectCorsairWirelessControllers, CORSAIR_VID, CORSAIR_K57_RGB_WIRELESS_PID, 1, 0xFF42, 1);
@@ -0,0 +1,326 @@
/*-----------------------------------------*\
| RGBController_CorsairWireless.cpp |
| |
| Generic RGB Interface for Corsair RGB |
| wireless keyboard devices |
| |
| Adam Honse (CalcProgrammer1) 5/8/2021 |
\*-----------------------------------------*/
#include "RGBController_CorsairWireless.h"
using namespace std::chrono_literals;
//0xFFFFFFFF indicates an unused entry in matrix
#define NA 0xFFFFFFFF
static unsigned int matrix_map[7][24] =
{ { NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0, 1, NA, NA, NA },
{ 131, 41, NA, 58, 59, 60, 61, NA, 62, 63, 64, 65, NA, 66, 67, 68, 69, 70, 71, 72, NA, NA, NA, NA },
{ 132, 53, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, NA, 45, 46, 42, NA, 73, 74, 75, 83, 84, 85, 86 },
{ 133, 43, NA, 20, 26, 8, 21, NA, 23, 28, 24, 12, 18, 19, 47, 48, 49, 76, 77, 78, 95, 96, 97, 87 },
{ 134, 57, NA, 4, 22, 7, 9, NA, 10, 11, 13, 14, 15, 51, 52, NA, 40, NA, NA, NA, 92, 93, 94, NA },
{ 135, 106, NA, 29, 27, 6, 25, NA, 5, NA, 17, 16, 54, 55, 56, 110, NA, NA, 82, NA, 89, 90, 91, 88 },
{ 136, 105, 108, 107, NA, NA, NA, NA, 44, NA, NA, NA, NA, 111, 122, 101, 109, 80, 81, 79, 98, NA, 99, NA } };
static const char* zone_names[] =
{
"Keyboard",
};
static const unsigned int zone_sizes[] =
{
137
};
static const zone_type zone_types[] =
{
ZONE_TYPE_MATRIX,
};
static const char* led_names[] =
{
"Power/Wireless Indicator",
"Lock/Macro Indicator",
"N/A",
"N/A",
"Key: A",
"Key: B",
"Key: C",
"Key: D",
"Key: E",
"Key: F",
"Key: G",
"Key: H",
"Key: I",
"Key: J",
"Key: K",
"Key: L",
"Key: M",
"Key: N",
"Key: O",
"Key: P",
"Key: Q",
"Key: R",
"Key: S",
"Key: T",
"Key: U",
"Key: V",
"Key: W",
"Key: X",
"Key: Y",
"Key: Z",
"Key: 1",
"Key: 2",
"Key: 3",
"Key: 4",
"Key: 5",
"Key: 6",
"Key: 7",
"Key: 8",
"Key: 9",
"Key: 0",
"Key: Enter",
"Key: Escape",
"Key: Backspace",
"Key: Tab",
"Key: Space",
"Key: -",
"Key: =",
"Key: [",
"Key: ]",
"Key: \\ (ANSI)",
"Unused",
"Key: ;",
"Key: '",
"Key: `",
"Key: ,",
"Key: .",
"Key: /",
"Key: Caps Lock",
"Key: F1",
"Key: F2",
"Key: F3",
"Key: F4",
"Key: F5",
"Key: F6",
"Key: F7",
"Key: F8",
"Key: F9",
"Key: F10",
"Key: F11",
"Key: F12",
"Key: Print Screen",
"Key: Scroll Lock",
"Key: Pause/Break",
"Key: Insert",
"Key: Home",
"Key: Page Up",
"Key: Delete",
"Key: End",
"Key: Page Down",
"Key: Right Arrow",
"Key: Left Arrow",
"Key: Down Arrow",
"Key: Up Arrow",
"Key: Num Lock",
"Key: Number Pad /",
"Key: Number Pad *",
"Key: Number Pad -",
"Key: Number Pad +",
"Key: Number Pad Enter",
"Key: Number Pad 1",
"Key: Number Pad 2",
"Key: Number Pad 3",
"Key: Number Pad 4",
"Key: Number Pad 5",
"Key: Number Pad 6",
"Key: Number Pad 7",
"Key: Number Pad 8",
"Key: Number Pad 9",
"Key: Number Pad 0",
"Key: Number Pad .",
"Unused",
"Key: Menu",
"Unused",
"Unused",
"Unused",
"Left Control",
"Left Shift",
"Left Alt",
"Left Windows",
"Right Control",
"Right Shift",
"Right Alt",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Key: Right Fn",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Key: G1",
"Key: G2",
"Key: G3",
"Key: G4",
"Key: G5",
"Key: G6",
};
RGBController_CorsairWireless::RGBController_CorsairWireless(CorsairWirelessController* corsair_ptr)
{
corsair = corsair_ptr;
name = corsair->GetName();
vendor = "Corsair";
description = "Corsair RGB Peripheral Device";
type = corsair->GetDeviceType();
version = corsair->GetFirmwareString();
location = corsair->GetDeviceLocation();
serial = corsair->GetSerialString();
mode Direct;
Direct.name = "Direct";
Direct.value = 0;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
SetupZones();
/*-----------------------------------------------------*\
| The Corsair Lighting Node Pro requires a packet within|
| 20 seconds of sending the lighting change in order |
| to not revert back into rainbow mode. Start a thread |
| to continuously send a keepalive packet every 5s |
\*-----------------------------------------------------*/
keepalive_thread_run = 1;
keepalive_thread = new std::thread(&RGBController_CorsairWireless::KeepaliveThread, this);
}
RGBController_CorsairWireless::~RGBController_CorsairWireless()
{
/*---------------------------------------------------------*\
| 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 corsair;
}
void RGBController_CorsairWireless::SetupZones()
{
/*---------------------------------------------------------*\
| Determine number of zones |
| For now, keyboard has 2 zones and mousemat has 1 |
\*---------------------------------------------------------*/
unsigned int num_zones = 1;
/*---------------------------------------------------------*\
| Set up zones |
\*---------------------------------------------------------*/
unsigned int total_led_count = 0;
for(unsigned int zone_idx = 0; zone_idx < num_zones; zone_idx++)
{
zone new_zone;
new_zone.name = zone_names[zone_idx];
new_zone.type = zone_types[zone_idx];
new_zone.leds_min = zone_sizes[zone_idx];
new_zone.leds_max = zone_sizes[zone_idx];
new_zone.leds_count = zone_sizes[zone_idx];
if(zone_types[zone_idx] == ZONE_TYPE_MATRIX)
{
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = 7;
new_zone.matrix_map->width = 24;
new_zone.matrix_map->map = (unsigned int *)&matrix_map;
}
else
{
new_zone.matrix_map = NULL;
}
zones.push_back(new_zone);
total_led_count += new_zone.leds_count;
}
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
{
led new_led;
new_led.name = led_names[led_idx];
leds.push_back(new_led);
}
SetupColors();
}
void RGBController_CorsairWireless::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_CorsairWireless::DeviceUpdateLEDs()
{
last_update_time = std::chrono::steady_clock::now();
corsair->SetLEDs(colors);
}
void RGBController_CorsairWireless::UpdateZoneLEDs(int /*zone*/)
{
corsair->SetLEDs(colors);
}
void RGBController_CorsairWireless::UpdateSingleLED(int /*led*/)
{
corsair->SetLEDs(colors);
}
void RGBController_CorsairWireless::SetCustomMode()
{
active_mode = 0;
}
void RGBController_CorsairWireless::DeviceUpdateMode()
{
}
void RGBController_CorsairWireless::KeepaliveThread()
{
while(keepalive_thread_run.load())
{
if(active_mode == 0)
{
if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(5000))
{
DeviceUpdateLEDs();
}
}
std::this_thread::sleep_for(1000ms);
}
}
@@ -0,0 +1,41 @@
/*-----------------------------------------*\
| RGBController_CorsairWireless.h |
| |
| Generic RGB Interface for Corsair RGB |
| wireless keyboard devices |
| |
| Adam Honse (CalcProgrammer1) 5/8/2021 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "CorsairWirelessController.h"
class RGBController_CorsairWireless : public RGBController
{
public:
RGBController_CorsairWireless(CorsairWirelessController* corsair_ptr);
~RGBController_CorsairWireless();
int physical_layout;
int logical_layout;
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
void KeepaliveThread();
private:
CorsairWirelessController* corsair;
std::thread* keepalive_thread;
std::atomic<bool> keepalive_thread_run;
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
};
@@ -38,7 +38,7 @@ std::string DasKeyboardController::GetSerialString()
int err = hid_get_serial_number_string(dev, serial_string, 128);
std::string return_string;
if(!err)
if(err == 0)
{
std::wstring return_wstring = serial_string;
return_string = std::string(return_wstring.begin(), return_wstring.end());
@@ -31,7 +31,12 @@ std::string DuckyKeyboardController::GetDeviceLocation()
std::string DuckyKeyboardController::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());
@@ -16,8 +16,8 @@ static unsigned int matrix_map[6][23] =
{ { 0, NA, 12, 18, 24, 30, NA, 42, 48, 54, 60, NA, 66, 72, 78, 84, 90, 96, 102, 108, 114, 120, 126 },
{ 1, 7, 13, 19, 25, 31, 37, 43, 49, 55, 61, NA, 67, 73, 85, NA, 91, 97, 103, 109, 115, 121, 127 },
{ 2, NA, 8, 14, 20, 26, NA, 32, 38, 44, 50, 56, 62, 68, 74, 86, 92, 98, 104, 110, 116, 122, 128 },
{ 3, NA, 9, 15, 21, 27, NA, 33, 39, 45, 51, 57, 63, 69, 87, NA, NA, NA, NA, 111, 117, 123, NA },
{ 4, NA, 16, 22, 28, 34, NA, 40, NA, 46, 52, 58, 64, 70, 82, NA, NA, 100, NA, 112, 118, 124, 131 },
{ 3, NA, 9, 15, 21, 27, NA, 33, 39, 45, 51, 57, 63, 69, 75, 87, NA, NA, NA, 111, 117, 123, NA },
{ 4, 10, 16, 22, 28, 34, NA, 40, NA, 46, 52, 58, 64, 70, 82, NA, NA, 100, NA, 112, 118, 124, 131 },
{ 5, 11, 17, NA, NA, NA, NA, 41, NA, NA, NA, NA, 65, 77, 83, 89, 95, 101, 107, 113, NA, 125, NA } };
static const char* zone_names[] =
@@ -47,7 +47,7 @@ static const char *led_names[] =
"Key: 1",
"Key: Q",
"Key: A",
"Unused",
"Key: \\ (ISO)",
"Key: Left Windows",
"Key: F1",
"Key: 2",
@@ -112,7 +112,7 @@ static const char *led_names[] =
"Key: F10",
"Key: =",
"Key: ]",
"Unused",
"Key: #",
"Unused",
"Key: Right Windows",
"Key: F11",
@@ -293,9 +293,13 @@ RGBController_E131::RGBController_E131(std::vector<E131Device> device_list)
RGBController_E131::~RGBController_E131()
{
keepalive_thread_run = 0;
keepalive_thread->join();
delete keepalive_thread;
if(keepalive_thread != nullptr)
{
keepalive_thread_run = 0;
keepalive_thread->join();
delete keepalive_thread;
}
/*---------------------------------------------------------*\
| Delete the matrix map |
\*---------------------------------------------------------*/
@@ -124,6 +124,8 @@ int RGBController_EVGAGPUv2::getModeIndex(unsigned char mode_value)
return mode_index;
}
}
return 0;
}
void RGBController_EVGAGPUv2::SetupZones()
@@ -33,7 +33,12 @@ std::string EVisionKeyboardController::GetDeviceLocation()
std::string EVisionKeyboardController::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());
@@ -24,7 +24,7 @@
* *
\******************************************************************************************/
void DetectEVisionKeyboards(hid_device_info* info, const std::string& name)
void DetectEVisionKeyboards(hid_device_info* info, const std::string& /*name*/)
{
hid_device* dev = hid_open_path(info->path);
if( dev )
@@ -43,4 +43,4 @@ REGISTER_HID_DETECTOR_IP("EVision Keyboard 0C45:5204", DetectEVisionKeyboards,
REGISTER_HID_DETECTOR_IP("EVision Keyboard 0C45:5104", DetectEVisionKeyboards, EVISION_KEYBOARD_VID, REDRAGON_K552_PID, 1, EVISION_KEYBOARD_USAGE_PAGE);
REGISTER_HID_DETECTOR_IP("EVision Keyboard 0C45:5004", DetectEVisionKeyboards, EVISION_KEYBOARD_VID, REDRAGON_K556_PID, 1, EVISION_KEYBOARD_USAGE_PAGE);
REGISTER_HID_DETECTOR_IP("EVision Keyboard 0C45:652F", DetectEVisionKeyboards, EVISION_KEYBOARD_VID, TECWARE_PHANTOM_ELITE_PID, 1, EVISION_KEYBOARD_USAGE_PAGE);
REGISTER_HID_DETECTOR_IP("EVision Keyboard 0C45:8520", DetectEVisionKeyboards, EVISION_KEYBOARD_VID, WARRIOR_KANE_TC235, 1, EVISION_KEYBOARD_USAGE_PAGE);
REGISTER_HID_DETECTOR_IP("EVision Keyboard 0C45:8520", DetectEVisionKeyboards, EVISION_KEYBOARD_VID, WARRIOR_KANE_TC235, 1, EVISION_KEYBOARD_USAGE_PAGE);
@@ -113,7 +113,7 @@ void FanBusInterface::write_queue
{
unsigned char fanbus_msg[] = { 0x00, int_addr, dev_addr, val, 0xFF };
for(int i = 0; i < sizeof(fanbus_msg); i++)
for(unsigned int i = 0; i < sizeof(fanbus_msg); i++)
{
fanbus_msg_queued.push_back(fanbus_msg[i]);
}
@@ -43,7 +43,7 @@ void RGBController_FanBus::SetupZones()
led_zone.matrix_map = NULL;
zones.push_back(led_zone);
for(int led_idx = 0; led_idx < led_zone.leds_count; led_idx++)
for(unsigned int led_idx = 0; led_idx < led_zone.leds_count; led_idx++)
{
led new_led;
new_led.name = "LED ";
@@ -41,6 +41,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_RTX3070_DEV, GAINWARD_SUB_VEN, NVIDIA_RTX3070_DEV, RGB_V2, "Gainward RTX 3070 Phoenix" },
};
@@ -30,7 +30,12 @@ std::string ATC800Controller::GetDeviceLocation()
std::string ATC800Controller::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());
@@ -36,6 +36,15 @@ void RGBFusionGPUController::SetColor(unsigned char red, unsigned char green, un
bus->i2c_smbus_write_byte(dev, red);
bus->i2c_smbus_write_byte(dev, green);
bus->i2c_smbus_write_byte(dev, blue);
// Pad commands with 4 zero-bytes for NVIDIA_RTX3060_DEV
if (dev == 0x62)
{
bus->i2c_smbus_write_byte(dev, 0x00);
bus->i2c_smbus_write_byte(dev, 0x00);
bus->i2c_smbus_write_byte(dev, 0x00);
bus->i2c_smbus_write_byte(dev, 0x00);
}
}
void RGBFusionGPUController::SetMode(unsigned char mode, unsigned char speed)
@@ -44,4 +53,13 @@ void RGBFusionGPUController::SetMode(unsigned char mode, unsigned char speed)
bus->i2c_smbus_write_byte(dev, mode);
bus->i2c_smbus_write_byte(dev, speed);
bus->i2c_smbus_write_byte(dev, 0x63);
// Pad commands with 4 zero-bytes for NVIDIA_RTX3060_DEV
if (dev == 0x62)
{
bus->i2c_smbus_write_byte(dev, 0x00);
bus->i2c_smbus_write_byte(dev, 0x00);
bus->i2c_smbus_write_byte(dev, 0x00);
bus->i2c_smbus_write_byte(dev, 0x00);
}
}
@@ -34,14 +34,16 @@ static const gpu_pci_device device_list[] =
{ NVIDIA_VEN, NVIDIA_GTX1650_DEV, GIGABYTE_SUB_VEN, GIGABYTE_GTX1650_GAMING_OC_SUB_DEV, 0x55, "Gigabyte GTX1650 Gaming OC" },
{ 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_RTX2060S_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX2060S_GAMING_SUB_DEV, 0x47, "Gigabyte RTX2060 SUPER Gaming" },
{ 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_RTX2060S_OC_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX2060S_GAMING_SUB_DEV, 0x47, "Gigabyte RTX2060 SUPER Gaming" },
{ 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_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_RTX3060TI_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX3060TI_EAGLE_OC_SUB_DEV, 0x63, "Gigabyte RTX3060 EAGLE OC 8G" },
{ NVIDIA_VEN, NVIDIA_RTX3060_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX3060_GAMING_OC_12GB_SUB_DEV, 0x62, "Gigabyte RTX3060 Gaming OC 12G" },
{ NVIDIA_VEN, NVIDIA_RTX3060TI_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX3060TI_EAGLE_OC_SUB_DEV, 0x63, "Gigabyte RTX3060 Ti EAGLE OC 8G" },
{ NVIDIA_VEN, NVIDIA_RTX3070_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX3070_VISION_OC_SUB_DEV, 0x63, "Gigabyte RTX3070 Vision 8G" },
};
@@ -67,6 +69,15 @@ bool TestForGigabyteRGBFusionGPUController(i2c_smbus_interface* bus, unsigned ch
bus->i2c_smbus_write_byte(address, 0x00);
bus->i2c_smbus_write_byte(address, 0x00);
bus->i2c_smbus_write_byte(address, 0x00);
// NVIDIA_RTX3060_DEV requires additional bytes to initialise
if (address == 0x62)
{
bus->i2c_smbus_write_byte(address, 0x00);
bus->i2c_smbus_write_byte(address, 0x00);
bus->i2c_smbus_write_byte(address, 0x00);
bus->i2c_smbus_write_byte(address, 0x00);
}
pass = true;
@@ -29,7 +29,12 @@ std::string HoltekA070Controller::GetDeviceLocation()
std::string HoltekA070Controller::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());
@@ -30,7 +30,12 @@ std::string HoltekA1FAController::GetDeviceLocation()
std::string HoltekA1FAController::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());
@@ -129,7 +129,7 @@ void RGBController_HoltekA1FA::DeviceUpdateMode()
if((active_mode < HOLTEK_A1FA_MODE_NEON) && (previous_mode < HOLTEK_A1FA_MODE_NEON))
{
//If we're switching from and to static and breathing then sync the mode colors
for ( int i = 0; i < modes[active_mode].colors_max; i++)
for(unsigned int i = 0; i < modes[active_mode].colors_max; i++)
{
modes[active_mode].colors[i] = modes[previous_mode].colors[i];
}
@@ -35,7 +35,12 @@ std::string HyperXAlloyElite2Controller::GetDeviceLocation()
std::string HyperXAlloyElite2Controller::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());
@@ -33,7 +33,12 @@ std::string HyperXAlloyOriginsController::GetDeviceLocation()
std::string HyperXAlloyOriginsController::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());
@@ -46,7 +46,12 @@ std::string HyperXKeyboardController::GetDeviceLocation()
std::string HyperXKeyboardController::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());
@@ -30,7 +30,12 @@ std::string HyperXPulsefireDartController::GetDeviceLocation()
std::string HyperXPulsefireDartController::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());
@@ -30,7 +30,12 @@ std::string HyperXPulsefireFPSProController::GetDeviceLocation()
std::string HyperXPulsefireFPSProController::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());
@@ -30,7 +30,12 @@ std::string HyperXPulsefireSurgeController::GetDeviceLocation()
std::string HyperXPulsefireSurgeController::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());
@@ -30,7 +30,12 @@ std::string HyperXMousematController::GetDeviceLocation()
std::string HyperXMousematController::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());
@@ -184,7 +184,7 @@ void LEDStripController::SetLEDsKeyboardVisualizer(std::vector<RGBColor> colors)
\*-------------------------------------------------------------*/
unsigned short sum = 0;
for (int i = 0; i < (payload_size + 1); i++)
for(unsigned int i = 0; i < (payload_size + 1); i++)
{
sum += serial_buf[i];
}
@@ -317,4 +317,4 @@ void LEDStripController::SetLEDsTPM2(std::vector<RGBColor> colors)
}
delete[] serial_buf;
}
}
@@ -1,26 +1,24 @@
#include "Detector.h"
#include "LogitechG203Controller.h"
#include "LogManager.h"
#include "LogitechProtocolCommon.h"
#include "LogitechG203LController.h"
#include "LogitechG213Controller.h"
#include "LogitechG303Controller.h"
#include "LogitechG403Controller.h"
#include "LogitechG502PSController.h"
#include "LogitechG560Controller.h"
#include "LogitechG810Controller.h"
#include "LogitechG910Controller.h"
#include "LogitechG815Controller.h"
#include "LogitechGProWirelessController.h"
#include "LogitechGPowerPlayController.h"
#include "LogitechGLightsyncController.h"
#include "LogitechLightspeedController.h"
#include "RGBController.h"
#include "RGBController_LogitechG203.h"
#include "RGBController_LogitechG203L.h"
#include "RGBController_LogitechG213.h"
#include "RGBController_LogitechG303.h"
#include "RGBController_LogitechG403.h"
#include "RGBController_LogitechG502PS.h"
#include "RGBController_LogitechG560.h"
#include "RGBController_LogitechG810.h"
#include "RGBController_LogitechG910.h"
#include "RGBController_LogitechG815.h"
#include "RGBController_LogitechGProWireless.h"
#include "RGBController_LogitechGLightsync.h"
#include "RGBController_LogitechGLightsync1zone.h"
#include "RGBController_LogitechLightspeed.h"
#include "RGBController_LogitechGPowerPlay.h"
#include <vector>
#include <hidapi/hidapi.h>
@@ -29,6 +27,7 @@
| Logitech vendor ID |
\*-----------------------------------------------------*/
#define LOGITECH_VID 0x046D
/*-----------------------------------------------------*\
| Keyboard product IDs |
\*-----------------------------------------------------*/
@@ -41,29 +40,72 @@
#define LOGITECH_G810_2_PID 0xC337
#define LOGITECH_G813_PID 0xC232
#define LOGITECH_G815_PID 0xC33F
#define LOGITECH_G910_ORION_SPARK_PID 0xC32B
#define LOGITECH_G910_PID 0xC335
/*-----------------------------------------------------*\
| Mouse product IDs |
\*-----------------------------------------------------*/
#define LOGITECH_G203_PID 0xC084
#define LOGITECH_G203L_PID 0xC092
#define LOGITECH_G203_LIGHTSYNC_PID 0xC092
#define LOGITECH_G303_PID 0xC080
#define LOGITECH_G403_PID 0xC083
#define LOGITECH_G403H_PID 0xC08F
#define LOGITECH_G502_PS_PID 0xC332
#define LOGITECH_G502H_PID 0xC08B
#define LOGITECH_G_LIGHTSPEED_WIRELESS_PID 0xC539
#define LOGITECH_GPRO_WIRED_PID 0xC085
#define LOGITECH_GPRO_HERO_WIRED_PID 0xC08C
#define LOGITECH_GPRO_WIRELESS_PID 0xC088
#define LOGITECH_G403_HERO_PID 0xC08F
#define LOGITECH_G403_LIGHTSPEED_PID 0xC082
#define LOGITECH_G502_PROTEUS_SPECTRUM_PID 0xC332
#define LOGITECH_G502_HERO_PID 0xC08B
#define LOGITECH_G502_LIGHTSPEED_PID 0xC08D
#define LOGITECH_G703_LIGHTSPEED_PID 0xC087
#define LOGITECH_G900_LIGHTSPEED_PID 0xC081
#define LOGITECH_G903_LIGHTSPEED_PID 0xC086
#define LOGITECH_G_PRO_PID 0xC085
#define LOGITECH_G_PRO_HERO_PID 0xC08C
#define LOGITECH_G_PRO_WIRELESS_PID 0xC088
/*-----------------------------------------------------*\
| Mousemat product IDs |
\*-----------------------------------------------------*/
#define LOGITECH_G_LIGHTSPEED_POWERPLAY_PID 0xC53A
/*-----------------------------------------------------*\
| Speaker product IDs |
\*-----------------------------------------------------*/
#define LOGITECH_G560_PID 0x0A78
/*-----------------------------------------------------*\
| Unifying Device IDs (Including Lightspeed receivers) |
| NB: Not used but preserved for debugging |
\*-----------------------------------------------------*/
#define LOGITECH_G_UNIFYING_RECEIVER_1_PID 0xC52B
#define LOGITECH_G_NANO_RECEIVER_PID 0xC52F
#define LOGITECH_G_G700_RECEIVER_PID 0xC531
#define LOGITECH_G_UNIFYING_RECEIVER_2_PID 0xC532
#define LOGITECH_G_G602_RECEIVER_PID 0xC537
#define LOGITECH_G_LIGHTSPEED_RECEIVER_PID 0xC539
#define LOGITECH_G403_LIGHTSPEED_VIRTUAL_PID 0x405D
#define LOGITECH_G502_LIGHTSPEED_VIRTUAL_PID 0x407F
#define LOGITECH_G703_LIGHTSPEED_VIRTUAL_PID 0x4070
#define LOGITECH_G900_LIGHTSPEED_VIRTUAL_PID 0x4053
#define LOGITECH_G903_LIGHTSPEED_VIRTUAL_PID 0x4067
#define LOGITECH_G_PRO_WIRELESS_VIRTUAL_PID 0x4079
/*-----------------------------------------------------*\
| Logitech Keyboards |
\*-----------------------------------------------------*/
void DetectLogitechKeyboardG213(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
LogitechG213Controller* controller = new LogitechG213Controller(dev, info->path);
RGBController_LogitechG213* rgb_controller = new RGBController_LogitechG213(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
void DetectLogitechKeyboardG810(hid_device_info* info, const std::string& name)
{
/*-------------------------------------------------------------------------------------------------*\
@@ -71,49 +113,51 @@ void DetectLogitechKeyboardG810(hid_device_info* info, const std::string& name)
| 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)
{
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)
{
LogitechG810Controller* controller = new LogitechG810Controller(dev_usage_0x0602, dev_usage_0x0604);
RGBController_LogitechG810* rgb_controller = new RGBController_LogitechG810(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 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)
{
LogitechG810Controller* controller = new LogitechG810Controller(dev_usage_0x0602, dev_usage_0x0604);
RGBController_LogitechG810* rgb_controller = new RGBController_LogitechG810(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)
{
LogitechG810Controller* controller = new LogitechG810Controller(dev, dev);
LogitechG810Controller* controller = new LogitechG810Controller(dev, dev);
RGBController_LogitechG810* rgb_controller = new RGBController_LogitechG810(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
@@ -121,120 +165,63 @@ void DetectLogitechKeyboardG810(hid_device_info* info, const std::string& name)
#endif
}
void DetectLogitechKeyboardG213(hid_device_info* info, const std::string& name)
void DetectLogitechKeyboardG910(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
/*-------------------------------------------------------------------------------------------------*\
| 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)
{
LogitechG213Controller* controller = new LogitechG213Controller(dev, info->path);
RGBController_LogitechG213* rgb_controller = new RGBController_LogitechG213(controller);
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)
{
LogitechG910Controller* controller = new LogitechG910Controller(dev_usage_0x0602, dev_usage_0x0604);
RGBController_LogitechG910* rgb_controller = new RGBController_LogitechG910(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
void DetectLogitechMouseG203(hid_device_info* info, const std::string& name)
{
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)
{
LogitechG203Controller* controller = new LogitechG203Controller(dev, info->path);
RGBController_LogitechG203* rgb_controller = new RGBController_LogitechG203(controller);
LogitechG910Controller* controller = new LogitechG910Controller(dev, dev);
RGBController_LogitechG910* rgb_controller = new RGBController_LogitechG910(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
void DetectLogitechMouseG203L(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
LogitechG203LController* controller = new LogitechG203LController(dev, info->path);
RGBController_LogitechG203L* rgb_controller = new RGBController_LogitechG203L(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
void DetectLogitechMouseG303(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
LogitechG303Controller* controller = new LogitechG303Controller(dev, info->path);
RGBController_LogitechG303* rgb_controller = new RGBController_LogitechG303(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
void DetectLogitechMouseG403(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
LogitechG403Controller* controller = new LogitechG403Controller(dev, info->path);
RGBController_LogitechG403* rgb_controller = new RGBController_LogitechG403(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
void DetectLogitechMouseG502PS(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
LogitechG502PSController* controller = new LogitechG502PSController(dev, info->path);
RGBController_LogitechG502PS* rgb_controller = new RGBController_LogitechG502PS(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
void DetectLogitechMouseGPRO(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
LogitechGProWirelessController* controller = new LogitechGProWirelessController(dev, info->path);
RGBController_LogitechGProWireless* rgb_controller = new RGBController_LogitechGProWireless(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
void DetectLogitechMouseGLS(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
//Add mouse
LogitechGProWirelessController* mouse_controller = new LogitechGProWirelessController(dev, info->path);
RGBController_LogitechGProWireless* mouse_rgb_controller = new RGBController_LogitechGProWireless(mouse_controller);
mouse_rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(mouse_rgb_controller);
//Add Powerplay mousemat
LogitechGPowerPlayController* mousemat_controller = new LogitechGPowerPlayController(dev, info->path);
RGBController_LogitechGPowerPlay* mousemat_rgb_controller = new RGBController_LogitechGPowerPlay(mousemat_controller);
mousemat_rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(mousemat_rgb_controller);
}
}
void DetectLogitechG560(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
//Add G560 Speaker
LogitechG560Controller* speaker_controller = new LogitechG560Controller(dev, info->path);
RGBController_LogitechG560* speaker_rgb_controller = new RGBController_LogitechG560(speaker_controller);
speaker_rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(speaker_rgb_controller);
}
#endif
}
void DetectLogitechKeyboardG815(hid_device_info* info, const std::string& name)
@@ -243,56 +230,60 @@ void DetectLogitechKeyboardG815(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 _WIN32
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)
{
LogitechG815Controller* controller = new LogitechG815Controller(dev_usage_0x0602, dev_usage_0x0604);
RGBController_LogitechG815* rgb_controller = new RGBController_LogitechG815(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
else
{
// Not all of them could be opened, do some cleanup
if(dev_usage_0x0602)
{
hid_close(dev_usage_0x0602);
}
if(dev_usage_0x0604)
{
hid_close(dev_usage_0x0604);
}
}
#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)
{
LogitechG815Controller* controller = new LogitechG815Controller(dev_usage_0x0602, dev_usage_0x0604);
RGBController_LogitechG815* rgb_controller = new RGBController_LogitechG815(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
else
{
/*-------------------------------------------------*\
| Not all of them could be opened, do some cleanup |
\*-------------------------------------------------*/
if(dev_usage_0x0602)
{
hid_close(dev_usage_0x0602);
}
if(dev_usage_0x0604)
{
hid_close(dev_usage_0x0604);
}
}
#else
hid_device* dev = hid_open_path(info->path);
if(dev)
{
LogitechG815Controller* controller = new LogitechG815Controller(dev, dev);
LogitechG815Controller* controller = new LogitechG815Controller(dev, dev);
RGBController_LogitechG815* rgb_controller = new RGBController_LogitechG815(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
@@ -300,38 +291,381 @@ void DetectLogitechKeyboardG815(hid_device_info* info, const std::string& name)
#endif
}
/*-----------------------------------------------------*\
| Logitech Mice |
\*-----------------------------------------------------*/
static void addLogitechLightsyncMouse1zone(hid_device_info* info, const std::string& name, unsigned char hid_dev_index, unsigned char hid_feature_index, unsigned char hid_fctn_ase_id)
{
#ifdef USE_HID_USAGE
{
hid_device* dev_usage_1 = nullptr;
hid_device* dev_usage_2 = 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 0x00FF
{
if (info_temp->usage == 1)
{
dev_usage_1 = hid_open_path(info_temp->path);
}
else if (info_temp->usage == 2)
{
dev_usage_2 = hid_open_path(info_temp->path);
}
}
if (dev_usage_1 && dev_usage_2)
{
break;
}
info_temp = info_temp->next;
}
if(dev_usage_1 && dev_usage_2)
{
LogitechGLightsyncController* controller = new LogitechGLightsyncController(dev_usage_1, dev_usage_2, info->path, hid_dev_index, hid_feature_index, hid_fctn_ase_id);
RGBController_LogitechGLightsync1zone* rgb_controller = new RGBController_LogitechGLightsync1zone (controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
else
{
LOG_NOTICE("Unable to open all device report endpoints, unable to add device");
hid_close(dev_usage_1);
hid_close(dev_usage_2);
}
}
#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);
RGBController_LogitechGLightsync1zone* rgb_controller = new RGBController_LogitechGLightsync1zone(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
#endif
}
static void addLogitechLightsyncMouse2zone(hid_device_info* info, const std::string& name, unsigned char hid_dev_index, unsigned char hid_feature_index, unsigned char hid_fctn_ase_id)
{
#ifdef USE_HID_USAGE
{
hid_device* dev_usage_1 = nullptr;
hid_device* dev_usage_2 = 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 0x00FF
{
if(info_temp->usage == 1)
{
dev_usage_1 = hid_open_path(info_temp->path);
}
else if(info_temp->usage == 2)
{
dev_usage_2 = hid_open_path(info_temp->path);
}
}
if(dev_usage_1 && dev_usage_2)
{
break;
}
info_temp = info_temp->next;
}
if(dev_usage_1 && dev_usage_2)
{
LogitechGLightsyncController* controller = new LogitechGLightsyncController(dev_usage_1, dev_usage_2, info->path, hid_dev_index, hid_feature_index, hid_fctn_ase_id);
RGBController_LogitechGLightsync* rgb_controller = new RGBController_LogitechGLightsync (controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
else
{
LOG_NOTICE("Unable to open all device report endpoints, unable to add device");
hid_close(dev_usage_1);
hid_close(dev_usage_2);
}
}
#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);
RGBController_LogitechGLightsync* rgb_controller = new RGBController_LogitechGLightsync(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
#endif
}
void DetectLogitechMouseG203(hid_device_info* info, const std::string& name)
{
addLogitechLightsyncMouse1zone(info, name, 0xFF, 0x0E, 0x3A);
}
void DetectLogitechMouseG203L(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
LogitechG203LController* controller = new LogitechG203LController(dev, info->path);
RGBController_LogitechG203L* rgb_controller = new RGBController_LogitechG203L(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
void DetectLogitechMouseG303(hid_device_info* info, const std::string& name)
{
addLogitechLightsyncMouse2zone(info, name, 0xFF, 0x0E, 0x3A);
}
void DetectLogitechMouseG403(hid_device_info* info, const std::string& name)
{
addLogitechLightsyncMouse2zone(info, name, 0xFF, 0x0E, 0x3A);
}
void DetectLogitechMouseG502PS(hid_device_info* info, const std::string& name)
{
addLogitechLightsyncMouse2zone(info, name, 0xFF, 0x02, 0x3A);
}
void DetectLogitechMouseGPRO(hid_device_info* info, const std::string& name)
{
addLogitechLightsyncMouse1zone(info, name, 0xFF, 0x0E, 0x3C);
}
/*-----------------------------------------------------*\
| Other Logitech Devices |
\*-----------------------------------------------------*/
void DetectLogitechG560(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
/*---------------------------------------------*\
| Add G560 Speaker |
\*---------------------------------------------*/
LogitechG560Controller* controller = new LogitechG560Controller(dev, info->path);
RGBController_LogitechG560* rgb_controller = new RGBController_LogitechG560(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
| Keyboards |
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IPU("Logitech G213", DetectLogitechKeyboardG213, LOGITECH_VID, LOGITECH_G213_PID, 1, 0xFF43, 0x0602);
REGISTER_HID_DETECTOR_IP ("Logitech G512", DetectLogitechKeyboardG810, LOGITECH_VID, LOGITECH_G512_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G512 RGB", DetectLogitechKeyboardG810, LOGITECH_VID, LOGITECH_G512_RGB_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G610 Orion", DetectLogitechKeyboardG810, LOGITECH_VID, LOGITECH_G610_1_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G610 Orion", DetectLogitechKeyboardG810, LOGITECH_VID, LOGITECH_G610_2_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G810 Orion Spectrum", DetectLogitechKeyboardG810, LOGITECH_VID, LOGITECH_G810_1_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G810 Orion Spectrum", DetectLogitechKeyboardG810, LOGITECH_VID, LOGITECH_G810_2_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G813 RGB Mechanical Gaming Keyboard", DetectLogitechKeyboardG815, LOGITECH_VID, LOGITECH_G813_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G815 RGB Mechanical Gaming Keyboard", DetectLogitechKeyboardG815, LOGITECH_VID, LOGITECH_G815_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IPU("Logitech G213", DetectLogitechKeyboardG213, LOGITECH_VID, LOGITECH_G213_PID, 1, 0xFF43, 0x0602);
REGISTER_HID_DETECTOR_IP ("Logitech G512", DetectLogitechKeyboardG810, LOGITECH_VID, LOGITECH_G512_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G512 RGB", DetectLogitechKeyboardG810, LOGITECH_VID, LOGITECH_G512_RGB_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G610 Orion", DetectLogitechKeyboardG810, LOGITECH_VID, LOGITECH_G610_1_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G610 Orion", DetectLogitechKeyboardG810, LOGITECH_VID, LOGITECH_G610_2_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G810 Orion Spectrum", DetectLogitechKeyboardG810, LOGITECH_VID, LOGITECH_G810_1_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G810 Orion Spectrum", DetectLogitechKeyboardG810, LOGITECH_VID, LOGITECH_G810_2_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G813 RGB Mechanical Gaming Keyboard", DetectLogitechKeyboardG815, LOGITECH_VID, LOGITECH_G813_PID, 1, 0xFF43);
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);
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
| Mice |
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IPU("Logitech G203 Prodigy", DetectLogitechMouseG203, LOGITECH_VID, LOGITECH_G203_PID, 1, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G203 Lightsync", DetectLogitechMouseG203L, LOGITECH_VID, LOGITECH_G203L_PID, 1, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G303 Daedalus Apex", DetectLogitechMouseG303, LOGITECH_VID, LOGITECH_G303_PID, 1, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G403 Prodigy", DetectLogitechMouseG403, LOGITECH_VID, LOGITECH_G403_PID, 1, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G403 Hero", DetectLogitechMouseG403, LOGITECH_VID, LOGITECH_G403H_PID, 1, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G502 Proteus Spectrum", DetectLogitechMouseG502PS, LOGITECH_VID, LOGITECH_G502_PS_PID, 1, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G502 Hero", DetectLogitechMouseG502PS, LOGITECH_VID, LOGITECH_G502H_PID, 1, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G Pro Gaming Mouse", DetectLogitechMouseG203, LOGITECH_VID, LOGITECH_GPRO_WIRED_PID, 1, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G Pro (HERO) Gaming Mouse", DetectLogitechMouseG203, LOGITECH_VID, LOGITECH_GPRO_HERO_WIRED_PID, 1, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G Lightspeed Wireless Gaming Mouse", DetectLogitechMouseGPRO, LOGITECH_VID, LOGITECH_G_LIGHTSPEED_WIRELESS_PID, 2, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G Pro Wireless Gaming Mouse (Wired)", DetectLogitechMouseGPRO, LOGITECH_VID, LOGITECH_GPRO_WIRELESS_PID, 2, 0xFF00, 2);
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
| Mousemats |
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IPU("Logitech G Powerplay Mousepad with Lightspeed", DetectLogitechMouseGLS, LOGITECH_VID, LOGITECH_G_LIGHTSPEED_POWERPLAY_PID, 2, 0xFF00, 2);
REGISTER_HID_DETECTOR_IP ("Logitech G203 Prodigy", DetectLogitechMouseG203, LOGITECH_VID, LOGITECH_G203_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IPU("Logitech G203 Lightsync", DetectLogitechMouseG203L, LOGITECH_VID, LOGITECH_G203_LIGHTSYNC_PID, 1, 0xFF00, 2);
REGISTER_HID_DETECTOR_IP ("Logitech G303 Daedalus Apex", DetectLogitechMouseG303, LOGITECH_VID, LOGITECH_G303_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IP ("Logitech G403 Hero", DetectLogitechMouseG403, LOGITECH_VID, LOGITECH_G403_HERO_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IP ("Logitech G502 Proteus Spectrum Gaming Mouse", DetectLogitechMouseG502PS, LOGITECH_VID, LOGITECH_G502_PROTEUS_SPECTRUM_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IP ("Logitech G502 Hero Gaming Mouse", DetectLogitechMouseG502PS, LOGITECH_VID, LOGITECH_G502_HERO_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IP ("Logitech G Pro Gaming Mouse", DetectLogitechMouseGPRO, LOGITECH_VID, LOGITECH_G_PRO_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IP ("Logitech G Pro (HERO) Gaming Mouse", DetectLogitechMouseGPRO, LOGITECH_VID, LOGITECH_G_PRO_HERO_PID, 1, 0xFF00);
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
| Speakers |
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IPU("Logitech G560 Lightsync Speaker", DetectLogitechG560, LOGITECH_VID, LOGITECH_G560_PID, 2, 0xFF43, 514);
REGISTER_HID_DETECTOR_IPU("Logitech G560 Lightsync Speaker", DetectLogitechG560, LOGITECH_VID, LOGITECH_G560_PID, 2, 0xFF43, 514);
/*---------------------------------------------------------------------------------------------------------*\
| Windows and MacOS Lightspeed Detection |
| |
| The Lightspeed receiver is a unifying receiver that will only accept 1 connection |
| We must probe the receiver to check what is currently connected |
| |
| Hat tip - kernel driver https://github.com/torvalds/linux/blob/master/drivers/hid/hid-logitech-dj.c |
| - ltunify https://github.com/Lekensteyn/ltunify/ |
\*---------------------------------------------------------------------------------------------------------*/
#if defined(_WIN32) || defined(__APPLE__)
usages BundleLogitechUsages(hid_device_info* info)
{
usages temp_usages;
/*-----------------------------------------------------------------*\
| Need a unique ID to group usages for 1 device if multiple exist |
| Grab all usages that you can open. For normal Logitech FAP |
| devices this will be usage 1, 2 and 4 |
\*-----------------------------------------------------------------*/
if(info->usage == 1)
{
while(info)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
temp_usages.emplace((uint8_t)info->usage, dev);
}
info = info->next;
}
}
return temp_usages;
}
void CreateLogitechLightspeedDevice(char *path, usages device_usages, uint8_t device_index, bool wireless, std::shared_ptr<std::mutex> mutex_ptr)
{
LogitechLightspeedController* controller = new LogitechLightspeedController(device_usages.find(2)->second, path);
controller->lightspeed = new logitech_device(path, device_usages, device_index, wireless, mutex_ptr);
RGBController_LogitechLightspeed* rgb_controller = new RGBController_LogitechLightspeed(controller);
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
void DetectLogitechLightspeedReceiver(hid_device_info* info, const std::string& /*name*/)
{
/*-----------------------------------------------------------------*\
| Need to save the PID and the device path before iterating |
| over "info" in BundleLogitechUsages() |
\*-----------------------------------------------------------------*/
char *path = info->path;
uint16_t dev_pid = info->product_id;
usages device_usages = BundleLogitechUsages(info);
wireless_map wireless_devices;
unsigned int device_count = getWirelessDevice(device_usages, dev_pid, &wireless_devices);
/*-----------------------------------------------------------------*\
| Lightspeed Receivers will only have one paired /connected device |
| Unifying Receivers can have up to 6 devices paired / connected |
\*-----------------------------------------------------------------*/
if(device_count > 0)
{
/*-------------------------------------------------*\
| Create mutex to prevent the controllers sharing a |
| receiver from interfering with each other |
\*-------------------------------------------------*/
std::shared_ptr<std::mutex> logitech_mutex = std::make_shared<std::mutex>();
for(wireless_map::iterator wd = wireless_devices.begin(); wd != wireless_devices.end(); wd++)
{
CreateLogitechLightspeedDevice(path, device_usages, wd->second, true, logitech_mutex);
}
}
}
void DetectLogitechWired(hid_device_info* info, const std::string& /*name*/)
{
/*-----------------------------------------------------------------*\
| Need to save the device path before iterating |
| over "info" in BundleLogitechUsages() |
\*-----------------------------------------------------------------*/
char *path = info->path;
usages device_usages = BundleLogitechUsages(info);
if(device_usages.size() > 0)
{
CreateLogitechLightspeedDevice(path, device_usages, 0xFF, false, nullptr);
}
}
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
| Lightspeed Receivers (Windows Wireless) |
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IP("Logitech Lightspeed Receiver", DetectLogitechLightspeedReceiver, LOGITECH_VID, LOGITECH_G_LIGHTSPEED_RECEIVER_PID, 2, 0xFF00);
REGISTER_HID_DETECTOR_IP("Logitech G Powerplay Mousepad", DetectLogitechLightspeedReceiver, LOGITECH_VID, LOGITECH_G_LIGHTSPEED_POWERPLAY_PID, 2, 0xFF00);
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
| Lightspeed Wireless Devices (Windows Wired) |
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IP("Logitech G403 Wireless Gaming Mouse (wired)", DetectLogitechWired, LOGITECH_VID, LOGITECH_G403_LIGHTSPEED_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IP("Logitech G502 Wireless Gaming Mouse (wired)", DetectLogitechWired, LOGITECH_VID, LOGITECH_G502_LIGHTSPEED_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IP("Logitech G703 Wireless Gaming Mouse (wired)", DetectLogitechWired, LOGITECH_VID, LOGITECH_G703_LIGHTSPEED_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IP("Logitech G900 Wireless Gaming Mouse (wired)", DetectLogitechWired, LOGITECH_VID, LOGITECH_G900_LIGHTSPEED_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IP("Logitech G903 Wireless Gaming Mouse (wired)", DetectLogitechWired, LOGITECH_VID, LOGITECH_G903_LIGHTSPEED_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IP("Logitech G Pro Wireless Gaming Mouse (wired)", DetectLogitechWired, LOGITECH_VID, LOGITECH_G_PRO_WIRELESS_PID, 2, 0xFF00);
#endif
/*---------------------------------------------------------------------------------------------------------*\
| Linux Lightspeed Detection |
| |
| The Linux kernel handles detecting wireless devices connected to a Unifying Receiver. |
\*---------------------------------------------------------------------------------------------------------*/
#ifdef __linux__
void CreateLogitechLightspeedDevice(hid_device_info* info, bool wireless)
{
usages device_usages;
hid_device* dev = hid_open_path(info->path);
if(dev)
{
device_usages.emplace((uint8_t)info->usage, dev);
}
if(device_usages.size() > 0)
{
LogitechLightspeedController* controller = new LogitechLightspeedController(device_usages.find(0)->second, info->path);
controller->lightspeed = new logitech_device(info->path, device_usages, 0xFF, wireless);
RGBController_LogitechLightspeed* rgb_controller = new RGBController_LogitechLightspeed(controller);
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
void DetectLogitechWireless(hid_device_info* info, const std::string& /*name*/)
{
CreateLogitechLightspeedDevice(info, true);
}
void DetectLogitechWired(hid_device_info* info, const std::string& /*name*/)
{
CreateLogitechLightspeedDevice(info, false);
}
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
| Lightspeed Devices (Linux Wireless) |
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IPU("Logitech G403 Wireless Gaming Mouse", DetectLogitechWireless, LOGITECH_VID, LOGITECH_G403_LIGHTSPEED_VIRTUAL_PID, 2, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G502 Wireless Gaming Mouse", DetectLogitechWireless, LOGITECH_VID, LOGITECH_G502_LIGHTSPEED_VIRTUAL_PID, 2, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G703 Wireless Gaming Mouse", DetectLogitechWireless, LOGITECH_VID, LOGITECH_G703_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 G Pro Wireless Gaming Mouse", DetectLogitechWireless, LOGITECH_VID, LOGITECH_G_PRO_WIRELESS_VIRTUAL_PID, 2, 0xFF00, 2);
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
| Lightspeed Wireless Devices (Linux Wired) |
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IPU("Logitech G403 Wireless Gaming Mouse (wired)", DetectLogitechWired, LOGITECH_VID, LOGITECH_G403_LIGHTSPEED_PID, 1, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G502 Wireless Gaming Mouse (wired)", DetectLogitechWired, LOGITECH_VID, LOGITECH_G502_LIGHTSPEED_PID, 1, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G703 Wireless Gaming Mouse (wired)", DetectLogitechWired, LOGITECH_VID, LOGITECH_G703_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 G Pro Wireless Gaming Mouse (wired)", DetectLogitechWired, LOGITECH_VID, LOGITECH_G_PRO_WIRELESS_PID, 2, 0xFF00, 2);
#endif
@@ -1,95 +0,0 @@
/*-----------------------------------------*\
| LogitechG203Controller.cpp |
| |
| Driver for Logitech G203 Prodigy mouse |
| lighting controller |
| |
| Adam Honse (CalcProgrammer1) 5/17/2020 |
\*-----------------------------------------*/
#include "LogitechG203Controller.h"
#include <cstring>
LogitechG203Controller::LogitechG203Controller(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
location = path;
}
LogitechG203Controller::~LogitechG203Controller()
{
hid_close(dev);
}
std::string LogitechG203Controller::GetDeviceLocation()
{
return("HID " + location);
}
std::string LogitechG203Controller::GetSerialString()
{
wchar_t serial_string[128];
hid_get_serial_number_string(dev, serial_string, 128);
std::wstring return_wstring = serial_string;
std::string return_string(return_wstring.begin(), return_wstring.end());
return(return_string);
}
/*-------------------------------------------------------------------------------------------------*\
| Private packet sending functions. |
\*-------------------------------------------------------------------------------------------------*/
void LogitechG203Controller::SendMouseMode
(
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] = 0x0E;
usb_buf[0x03] = 0x3C;
usb_buf[0x04] = 0x00;
usb_buf[0x05] = mode;
usb_buf[0x06] = red;
usb_buf[0x07] = green;
usb_buf[0x08] = blue;
speed = 100 * speed;
if(mode == LOGITECH_G203_MODE_CYCLE)
{
usb_buf[0x0B] = speed >> 8;
usb_buf[0x0C] = speed & 0xFF;
usb_buf[0x0D] = 0x64;
}
else if(mode == LOGITECH_G203_MODE_BREATHING)
{
usb_buf[0x09] = speed >> 8;
usb_buf[0x0A] = speed & 0xFF;
usb_buf[0x0C] = 0x64;
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, (unsigned char *)usb_buf, 20);
hid_read(dev, (unsigned char *)usb_buf, 20);
}
@@ -1,57 +0,0 @@
/*-----------------------------------------*\
| LogitechG203Controller.h |
| |
| Definitions and types for Logitech G203 |
| Prodigy mouse lighting controller |
| |
| Adam Honse (CalcProgrammer1) 5/17/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
LOGITECH_G203_MODE_OFF = 0x00,
LOGITECH_G203_MODE_STATIC = 0x01,
LOGITECH_G203_MODE_CYCLE = 0x02,
LOGITECH_G203_MODE_BREATHING = 0x03,
};
/*---------------------------------------------------------------------------------------------*\
| Speed is 1000 for fast and 20000 for slow. |
| Values are multiplied by 100 later to give lots of GUI steps. |
\*---------------------------------------------------------------------------------------------*/
enum
{
LOGITECH_G203_SPEED_SLOWEST = 0xC8, /* Slowest speed */
LOGITECH_G203_SPEED_NORMAL = 0x32, /* Normal speed */
LOGITECH_G203_SPEED_FASTEST = 0x0A, /* Fastest speed */
};
class LogitechG203Controller
{
public:
LogitechG203Controller(hid_device* dev_handle, const char* path);
~LogitechG203Controller();
std::string GetDeviceLocation();
std::string GetSerialString();
void SendMouseMode
(
unsigned char mode,
unsigned short speed,
unsigned char red,
unsigned char green,
unsigned char blue
);
private:
hid_device* dev;
std::string location;
};
@@ -21,7 +21,12 @@ std::string LogitechG203LController::GetDeviceLocation()
std::string LogitechG203LController::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());
@@ -28,7 +28,12 @@ std::string LogitechG213Controller::GetDeviceLocation()
std::string LogitechG213Controller::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());
@@ -1,81 +0,0 @@
/*-----------------------------------------*\
| LogitechG303Controller.cpp |
| |
| Driver for Logitech G303 Daedalus Apex |
| mouse lighting controller |
| |
| TheRogueZeta 02/14/2021 |
\*-----------------------------------------*/
#include "LogitechG303Controller.h"
#include <cstring>
LogitechG303Controller::LogitechG303Controller(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
location = path;
}
LogitechG303Controller::~LogitechG303Controller()
{
hid_close(dev);
}
std::string LogitechG303Controller::GetDeviceLocation()
{
return(location);
}
void LogitechG303Controller::SendMouseMode
(
unsigned char mode,
std::uint16_t speed,
unsigned char channel,
unsigned char red,
unsigned char green,
unsigned char blue
)
{
unsigned char usb_buf[20];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Lighting Control packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x11;
usb_buf[0x01] = 0xFF;
usb_buf[0x02] = 0x0E;
usb_buf[0x03] = 0x3C;
usb_buf[0x04] = channel;
usb_buf[0x05] = mode;
usb_buf[0x06] = red;
usb_buf[0x07] = green;
usb_buf[0x08] = blue;
speed = 100 * speed;
if(mode == LOGITECH_G303_MODE_CYCLE)
{
usb_buf[0x0B] = speed >> 8;
usb_buf[0x0C] = speed & 0xFF;
usb_buf[0x0D] = 0x64;
}
else if(mode == LOGITECH_G303_MODE_BREATHING)
{
usb_buf[0x09] = speed >> 8;
usb_buf[0x0A] = speed & 0xFF;
usb_buf[0x0C] = 0x64;
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 20);
hid_read(dev, usb_buf, 20);
}
@@ -1,57 +0,0 @@
/*-----------------------------------------*\
| LogitechG303Controller.h |
| |
| Definitions and types for Logitech G303 |
| Daedalus Apex mouse lighting controller |
| |
| TheRogueZeta 02/14/2021 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
LOGITECH_G303_MODE_OFF = 0x00,
LOGITECH_G303_MODE_STATIC = 0x01,
LOGITECH_G303_MODE_CYCLE = 0x02,
LOGITECH_G303_MODE_BREATHING = 0x03,
};
/*---------------------------------------------------------------------------------------------*\
| Speed is 1000 for fast and 20000 for slow. |
| Values are mutipled by 100 later to give lots of GUI steps. |
\*---------------------------------------------------------------------------------------------*/
enum
{
LOGITECH_G303_SPEED_SLOWEST = 0xC8, /* Slowest speed */
LOGITECH_G303_SPEED_NORMAL = 0x32, /* Normal speed */
LOGITECH_G303_SPEED_FASTEST = 0x0A, /* Fastest speed */
};
class LogitechG303Controller
{
public:
LogitechG303Controller(hid_device* dev_handle, const char* path);
~LogitechG303Controller();
std::string GetDeviceLocation();
void SendMouseMode
(
unsigned char mode,
unsigned short speed,
unsigned char channel,
unsigned char red,
unsigned char green,
unsigned char blue
);
private:
hid_device* dev;
std::string location;
};
@@ -1,92 +0,0 @@
/*-----------------------------------------*\
| LogitechG403Controller.cpp |
| |
| Driver for Logitech G403 Prodigy mouse |
| lighting controller |
| |
| Martin Hartl (inlart) 5/19/2020 |
\*-----------------------------------------*/
#include "LogitechG403Controller.h"
#include <cstring>
LogitechG403Controller::LogitechG403Controller(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
location = path;
}
LogitechG403Controller::~LogitechG403Controller()
{
hid_close(dev);
}
std::string LogitechG403Controller::GetDeviceLocation()
{
return("HID: " + location);
}
std::string LogitechG403Controller::GetSerialString()
{
wchar_t serial_string[128];
hid_get_serial_number_string(dev, serial_string, 128);
std::wstring return_wstring = serial_string;
std::string return_string(return_wstring.begin(), return_wstring.end());
return(return_string);
}
void LogitechG403Controller::SendMouseMode
(
unsigned char mode,
std::uint16_t speed,
unsigned char channel,
unsigned char red,
unsigned char green,
unsigned char blue
)
{
unsigned char usb_buf[20];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Lighting Control packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x11;
usb_buf[0x01] = 0xFF;
usb_buf[0x02] = 0x0E;
usb_buf[0x03] = 0x3C;
usb_buf[0x04] = channel;
usb_buf[0x05] = mode;
usb_buf[0x06] = red;
usb_buf[0x07] = green;
usb_buf[0x08] = blue;
speed = 100 * speed;
if(mode == LOGITECH_G403_MODE_CYCLE)
{
usb_buf[0x0B] = speed >> 8;
usb_buf[0x0C] = speed & 0xFF;
usb_buf[0x0D] = 0x64;
}
else if(mode == LOGITECH_G403_MODE_BREATHING)
{
usb_buf[0x09] = speed >> 8;
usb_buf[0x0A] = speed & 0xFF;
usb_buf[0x0C] = 0x64;
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 20);
hid_read(dev, usb_buf, 20);
}
@@ -1,58 +0,0 @@
/*-----------------------------------------*\
| LogitechG403Controller.h |
| |
| Definitions and types for Logitech G403 |
| Prodigy mouse lighting controller |
| |
| Martin Hartl (inlart) 5/19/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
LOGITECH_G403_MODE_OFF = 0x00,
LOGITECH_G403_MODE_STATIC = 0x01,
LOGITECH_G403_MODE_CYCLE = 0x02,
LOGITECH_G403_MODE_BREATHING = 0x03,
};
/*---------------------------------------------------------------------------------------------*\
| Speed is 1000 for fast and 20000 for slow. |
| Values are multiplied by 100 later to give lots of GUI steps. |
\*---------------------------------------------------------------------------------------------*/
enum
{
LOGITECH_G403_SPEED_SLOWEST = 0xC8, /* Slowest speed */
LOGITECH_G403_SPEED_NORMAL = 0x32, /* Normal speed */
LOGITECH_G403_SPEED_FASTEST = 0x0A, /* Fastest speed */
};
class LogitechG403Controller
{
public:
LogitechG403Controller(hid_device* dev_handle, const char* path);
~LogitechG403Controller();
std::string GetDeviceLocation();
std::string GetSerialString();
void SendMouseMode
(
unsigned char mode,
unsigned short speed,
unsigned char channel,
unsigned char red,
unsigned char green,
unsigned char blue
);
private:
hid_device* dev;
std::string location;
};
@@ -1,94 +0,0 @@
/*-----------------------------------------*\
| Logitech502PSController.cpp |
| |
| Driver for Logitech G502 Proteus |
| Spectrum mouse lighting controller |
| |
| kernzerfall 07/28/2020 |
\*-----------------------------------------*/
#include "LogitechG502PSController.h"
#include <cstring>
LogitechG502PSController::LogitechG502PSController(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
location = path;
}
LogitechG502PSController::~LogitechG502PSController()
{
hid_close(dev);
}
std::string LogitechG502PSController::GetDeviceLocation()
{
return("HID: " + location);
}
std::string LogitechG502PSController::GetSerialString()
{
wchar_t serial_string[128];
hid_get_serial_number_string(dev, serial_string, 128);
std::wstring return_wstring = serial_string;
std::string return_string(return_wstring.begin(), return_wstring.end());
return(return_string);
}
void LogitechG502PSController::SendMouseMode
(
unsigned char mode,
std::uint16_t speed,
unsigned char channel,
unsigned char red,
unsigned char green,
unsigned char blue
)
{
unsigned char usb_buf[20];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Lighting Control packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x11;
usb_buf[0x01] = 0xFF;
usb_buf[0x02] = 0x02;
usb_buf[0x03] = 0x3A;
usb_buf[0x04] = channel;
usb_buf[0x05] = mode;
usb_buf[0x06] = red;
usb_buf[0x07] = green;
usb_buf[0x08] = blue;
speed = 100 * speed;
if(mode == LOGITECH_G502_PS_MODE_CYCLE)
{
usb_buf[0x0B] = speed >> 8;
usb_buf[0x0C] = speed & 0xFF;
usb_buf[0x0D] = 0x64;
}
else if(mode == LOGITECH_G502_PS_MODE_BREATHING)
{
usb_buf[0x09] = speed >> 8;
usb_buf[0x0A] = speed & 0xFF;
usb_buf[0x0C] = 0x64;
}else if(mode == LOGITECH_G502_PS_MODE_STATIC){
usb_buf[0x09] = 0x02;
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 20);
hid_read(dev, usb_buf, 20);
}
@@ -1,59 +0,0 @@
/*-----------------------------------------*\
| Logitech502PSController.h |
| |
| Definitions and types for Logitech |
| G502 Proteus Spectrum mouse lighting |
| controller |
| |
| kernzerfall 07/28/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
LOGITECH_G502_PS_MODE_OFF = 0x00,
LOGITECH_G502_PS_MODE_STATIC = 0x01,
LOGITECH_G502_PS_MODE_CYCLE = 0x03,
LOGITECH_G502_PS_MODE_BREATHING = 0x02
};
/*---------------------------------------------------------------------------------------------*\
| Speed is 1000 for fast and 20000 for slow. |
| Values are multiplied by 100 later to give lots of GUI steps. |
\*---------------------------------------------------------------------------------------------*/
enum
{
LOGITECH_G502_PS_SPEED_SLOWEST = 0xC8, /* Slowest speed */
LOGITECH_G502_PS_SPEED_NORMAL = 0x32, /* Normal speed */
LOGITECH_G502_PS_SPEED_FASTEST = 0x0A, /* Fastest speed */
};
class LogitechG502PSController
{
public:
LogitechG502PSController(hid_device* dev_handle, const char* path);
~LogitechG502PSController();
std::string GetDeviceLocation();
std::string GetSerialString();
void SendMouseMode
(
unsigned char mode,
unsigned short speed,
unsigned char channel,
unsigned char red,
unsigned char green,
unsigned char blue
);
private:
hid_device* dev;
std::string location;
};
@@ -134,7 +134,7 @@ void LogitechG560Controller::fail_retry_write(hid_device *device, const unsigned
if(ret == 20)
{
std::this_thread::sleep_for(1ms);
hid_read_timeout(dev, usb_buf_out, LOGI_G560_LED_PACKET_SIZE, 200);
hid_read_timeout(dev, usb_buf_out, LOGI_G560_LED_PACKET_SIZE, 20);
break;
}
else
@@ -25,7 +25,12 @@ LogitechG810Controller::~LogitechG810Controller()
std::string LogitechG810Controller::GetSerialString()
{
wchar_t serial_string[128];
hid_get_serial_number_string(dev_pkt_0x11, 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());
@@ -24,7 +24,12 @@ LogitechG815Controller::~LogitechG815Controller()
std::string LogitechG815Controller::GetSerialString()
{
wchar_t serial_string[128];
hid_get_serial_number_string(dev_pkt_0x11, 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());
@@ -0,0 +1,186 @@
/*-----------------------------------------*\
| LogitechG910Controller.cpp |
| |
| Driver for Logitech G910 Orion Spectrum |
| keyboard light controller |
| |
| Adam Honse (CalcProgrammer1) 6/11/2020 |
\*-----------------------------------------*/
#include "LogitechG910Controller.h"
#include <cstring>
LogitechG910Controller::LogitechG910Controller(hid_device* dev_handle_0x11, hid_device* dev_handle_0x12)
{
dev_pkt_0x11 = dev_handle_0x11;
dev_pkt_0x12 = dev_handle_0x12;
}
LogitechG910Controller::~LogitechG910Controller()
{
hid_close(dev_pkt_0x11);
hid_close(dev_pkt_0x12);
}
std::string LogitechG910Controller::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 LogitechG910Controller::Commit()
{
SendCommit();
}
void LogitechG910Controller::SetDirect
(
unsigned char zone,
unsigned char frame_count,
unsigned char * frame_data
)
{
SendDirectFrame(zone, frame_count, frame_data);
}
void LogitechG910Controller::SetMode
(
unsigned char mode,
unsigned short speed,
unsigned char red,
unsigned char green,
unsigned char blue
)
{
SendMode(LOGITECH_G910_ZONE_MODE_KEYBOARD, mode, speed, red, green, blue);
SendMode(LOGITECH_G910_ZONE_MODE_LOGO, mode, speed, red, green, blue);
SendCommit();
}
/*-------------------------------------------------------------------------------------------------*\
| Private packet sending functions. |
\*-------------------------------------------------------------------------------------------------*/
void LogitechG910Controller::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] = 0x0F;
usb_buf[0x03] = 0x5F;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
hid_read(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
}
void LogitechG910Controller::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] = 0x0F;
usb_buf[0x03] = 0x3F;
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 LogitechG910Controller::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] = 0x10;
usb_buf[0x03] = 0x3B;
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_G910_MODE_CYCLE)
{
usb_buf[0x0B] = speed >> 8;
usb_buf[0x0C] = speed & 0xFF;
usb_buf[0x0D] = 0x64;
}
else if(mode == LOGITECH_G910_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 @@
/*-----------------------------------------*\
| LogitechG910Controller.h |
| |
| Definitions and types for Logitech G910 |
| Orion Spectrum keyboard light controller |
| |
| Adam Honse (CalcProgrammer1) 6/11/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
LOGITECH_G910_ZONE_MODE_KEYBOARD = 0x00,
LOGITECH_G910_ZONE_MODE_LOGO = 0x01,
};
enum
{
LOGITECH_G910_ZONE_DIRECT_KEYBOARD = 0x01,
LOGITECH_G910_ZONE_DIRECT_GKEYS = 0x04,
LOGITECH_G910_ZONE_DIRECT_LOGO = 0x10,
LOGITECH_G910_ZONE_DIRECT_INDICATORS = 0x40,
};
enum
{
LOGITECH_G910_MODE_OFF = 0x00,
LOGITECH_G910_MODE_STATIC = 0x01,
LOGITECH_G910_MODE_BREATHING = 0x02,
LOGITECH_G910_MODE_CYCLE = 0x03,
LOGITECH_G910_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_G910_SPEED_SLOWEST = 0xC8, /* Slowest speed */
LOGITECH_G910_SPEED_NORMAL = 0x32, /* Normal speed */
LOGITECH_G910_SPEED_FASTEST = 0x0A, /* Fastest speed */
};
class LogitechG910Controller
{
public:
LogitechG910Controller(hid_device* dev_handle_0x11, hid_device* dev_handle_0x12);
~LogitechG910Controller();
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();
};
@@ -0,0 +1,181 @@
/*-----------------------------------------*\
| LogitechGLightsyncController.cpp |
| |
| Driver for Logitech G Lightsync |
| lighting controllers |
| |
| TheRogueZeta 04/21/2021 |
\*-----------------------------------------*/
#include "LogitechGLightsyncController.h"
#include <cstring>
LogitechGLightsyncController::LogitechGLightsyncController(hid_device* dev_cmd_handle, hid_device *dev_handle, const char *path, unsigned char hid_dev_index, unsigned char hid_feature_index, unsigned char hid_fctn_ase_id)
{
dev = dev_handle;
cmd_dev = dev_cmd_handle;
location = path;
dev_index = hid_dev_index;
feature_index = hid_feature_index;
fctn_ase_id = hid_fctn_ase_id;
mutex = nullptr;
}
LogitechGLightsyncController::LogitechGLightsyncController(hid_device* dev_cmd_handle, hid_device *dev_handle, const char *path, unsigned char hid_dev_index, unsigned char hid_feature_index, unsigned char hid_fctn_ase_id, std::shared_ptr<std::mutex> mutex_ptr)
{
dev = dev_handle;
cmd_dev = dev_cmd_handle;
location = path;
dev_index = hid_dev_index;
feature_index = hid_feature_index;
fctn_ase_id = hid_fctn_ase_id;
mutex = mutex_ptr;
}
LogitechGLightsyncController::~LogitechGLightsyncController()
{
hid_close(dev);
}
std::string LogitechGLightsyncController::GetDeviceLocation()
{
return (location);
}
std::string LogitechGLightsyncController::GetSerialString()
{
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);
}
void LogitechGLightsyncController::UpdateMouseLED(
unsigned char mode,
std::uint16_t speed,
unsigned char zone,
unsigned char red,
unsigned char green,
unsigned char blue,
unsigned char brightness
)
{
unsigned char usb_buf[20];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Lighting Control packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x11;
usb_buf[0x01] = dev_index;
usb_buf[0x02] = feature_index;
usb_buf[0x03] = fctn_ase_id;
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_G_LIGHTSYNC_MODE_STATIC)
{
usb_buf[0x09] = 0x02;
}
if (mode == LOGITECH_G_LIGHTSYNC_MODE_CYCLE)
{
usb_buf[0x0B] = speed >> 8;
usb_buf[0x0C] = speed & 0xFF;
usb_buf[0x0D] = brightness;
}
else if (mode == LOGITECH_G_LIGHTSYNC_MODE_BREATHING)
{
usb_buf[0x09] = speed >> 8;
usb_buf[0x0A] = speed & 0xFF;
usb_buf[0x0C] = brightness;
}
/*-----------------------------------------------------*\
| Send packet |
| This code has to be protected to avoid crashes when |
| this is called at the same time to change a powerplay |
| mat and its paired wireless mouse leds. It will |
| happen when using effects engines with high framerate |
\*-----------------------------------------------------*/
if(mutex)
{
std::lock_guard<std::mutex> guard(*mutex);
hid_write(dev, usb_buf, 20);
hid_read(dev, usb_buf, 20);
}
else
{
hid_write(dev, usb_buf, 20);
hid_read(dev, usb_buf, 20);
}
}
void LogitechGLightsyncController::SetDirectMode(bool direct)
{
char cmd_buf[7];
char usb_buf[20];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(cmd_buf, 0x00, sizeof(cmd_buf));
/*-----------------------------------------------------*\
| Set up Command Control packet |
\*-----------------------------------------------------*/
cmd_buf[0x00] = 0x10;
cmd_buf[0x01] = dev_index;
cmd_buf[0x02] = feature_index;
cmd_buf[0x03] = 0x8A;
cmd_buf[0x04] = 0x00;
cmd_buf[0x05] = 0x00;
/*-----------------------------------------------------*\
| If direct, disable save to flash |
\*-----------------------------------------------------*/
if(direct)
{
cmd_buf[0x04] = 0x01;
cmd_buf[0x05] = 0x01;
}
/*-----------------------------------------------------*\
| Send packet |
| This code has to be protected to avoid crashes when |
| this is called at the same time to change a powerplay |
| mat and its paired wireless mouse leds. It will |
| happen when using effects engines with high framerate |
\*-----------------------------------------------------*/
if(mutex)
{
std::lock_guard<std::mutex> guard(*mutex);
hid_write(cmd_dev, (unsigned char *)cmd_buf, 7);
hid_read(dev, (unsigned char *)usb_buf, 20);
}
else
{
hid_write(cmd_dev, (unsigned char *)cmd_buf, 7);
hid_read(dev, (unsigned char *)usb_buf, 20);
}
}
@@ -0,0 +1,82 @@
/*-----------------------------------------*\
| LogitechGLightsyncController.h |
| |
| Definitions and types for Logitech |
| Lightsync lighting controllers |
| |
| TheRogueZeta 04/21/2021 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#include <memory>
#pragma once
enum
{
LOGITECH_G_LIGHTSYNC_MODE_OFF = 0x00,
LOGITECH_G_LIGHTSYNC_MODE_STATIC = 0x01,
LOGITECH_G_LIGHTSYNC_MODE_CYCLE = 0x02,
LOGITECH_G_LIGHTSYNC_MODE_BREATHING = 0x03,
};
/*---------------------------------------------------------------------------------------------*\
| Speed is 1000 for fast and 20000 for slow. |
| Values are multiplied by 100 later to give lots of GUI steps. |
\*---------------------------------------------------------------------------------------------*/
enum
{
LOGITECH_G_LIGHTSYNC_SPEED_SLOWEST = 0xC8, /* Slowest speed */
LOGITECH_G_LIGHTSYNC_SPEED_NORMAL = 0x32, /* Normal speed */
LOGITECH_G_LIGHTSYNC_SPEED_FASTEST = 0x0A, /* Fastest speed */
};
class LogitechGLightsyncController
{
public:
LogitechGLightsyncController(
hid_device* dev_cmd_handle,
hid_device* dev_handle,
const char* path,
unsigned char hid_dev_index,
unsigned char hid_feature_index,
unsigned char hid_fctn_ase_id);
LogitechGLightsyncController(
hid_device* dev_cmd_handle,
hid_device* dev_handle,
const char* path,
unsigned char hid_dev_index,
unsigned char hid_feature_index,
unsigned char hid_fctn_ase_id,
std::shared_ptr<std::mutex> mutex_ptr);
~LogitechGLightsyncController();
std::string GetDeviceLocation();
std::string GetSerialString();
void UpdateMouseLED
(
unsigned char mode,
unsigned short speed,
unsigned char zone,
unsigned char red,
unsigned char green,
unsigned char blue,
unsigned char brightness
);
void SetDirectMode(bool direct);
private:
hid_device* dev;
hid_device* cmd_dev;
std::string location;
unsigned char dev_index;
unsigned char feature_index;
unsigned char fctn_ase_id;
bool direct_state;
std::shared_ptr<std::mutex> mutex;
};
@@ -1,99 +0,0 @@
/*-----------------------------------------*\
| LogitechGPowerPlayController.cpp |
| |
| Driver for Logitech G PowerPlay Wireless |
| Charging System |
| |
| TheRogueZeta 8/31/2020 |
\*-----------------------------------------*/
#include "LogitechGPowerPlayController.h"
#include <cstring>
LogitechGPowerPlayController::LogitechGPowerPlayController(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
location = path;
}
LogitechGPowerPlayController::~LogitechGPowerPlayController()
{
hid_close(dev);
}
std::string LogitechGPowerPlayController::GetDeviceLocation()
{
return("HID: " + location);
}
std::string LogitechGPowerPlayController::GetSerialString()
{
wchar_t serial_string[128];
hid_get_serial_number_string(dev, serial_string, 128);
std::wstring return_wstring = serial_string;
std::string return_string(return_wstring.begin(), return_wstring.end());
return(return_string);
}
void LogitechGPowerPlayController::SendMouseMatMode
(
unsigned char mode,
std::uint16_t speed,
unsigned char zone,
unsigned char red,
unsigned char green,
unsigned char blue
// unsigned char brightness
)
{
unsigned char usb_buf[20];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Lighting Control packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x11;
usb_buf[0x01] = 0x07;
usb_buf[0x02] = 0x0B;
usb_buf[0x03] = 0x3E;
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_G_POWERPLAY_MODE_STATIC)
{
usb_buf[0x09] = 0x02;
}
if(mode == LOGITECH_G_POWERPLAY_MODE_CYCLE)
{
usb_buf[0x0B] = speed >> 8;
usb_buf[0x0C] = speed & 0xFF;
//usb_buf[0x0D] = brightness;
usb_buf[0x0D] = 0x64;
}
else if(mode == LOGITECH_G_POWERPLAY_MODE_BREATHING)
{
usb_buf[0x09] = speed >> 8;
usb_buf[0x0A] = speed & 0xFF;
//usb_buf[0x0C] = brightness;
usb_buf[0x0C] = 0x64;
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 20);
hid_read(dev, usb_buf, 20);
}
@@ -1,59 +0,0 @@
/*-----------------------------------------*\
| LogitechGPowerPlayController.h |
| |
| Definitions and types for Logitech G |
| PowerPlay Wireless lighting controller |
| |
| TheRogueZeta 8/31/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
LOGITECH_G_POWERPLAY_MODE_OFF = 0x00,
LOGITECH_G_POWERPLAY_MODE_STATIC = 0x01,
LOGITECH_G_POWERPLAY_MODE_CYCLE = 0x02,
LOGITECH_G_POWERPLAY_MODE_BREATHING = 0x03,
};
/*---------------------------------------------------------------------------------------------*\
| Speed is 1000 for fast and 20000 for slow. |
| Values are multiplied by 100 later to give lots of GUI steps. |
\*---------------------------------------------------------------------------------------------*/
enum
{
LOGITECH_G_POWERPLAY_SPEED_SLOWEST = 0xC8, /* Slowest speed */
LOGITECH_G_POWERPLAY_SPEED_NORMAL = 0x32, /* Normal speed */
LOGITECH_G_POWERPLAY_SPEED_FASTEST = 0x0A, /* Fastest speed */
};
class LogitechGPowerPlayController
{
public:
LogitechGPowerPlayController(hid_device* dev_handle, const char* path);
~LogitechGPowerPlayController();
std::string GetDeviceLocation();
std::string GetSerialString();
void SendMouseMatMode
(
unsigned char mode,
unsigned short speed,
unsigned char zone,
unsigned char red,
unsigned char green,
unsigned char blue
// unsigned char brightness
);
private:
hid_device* dev;
std::string location;
};
@@ -1,99 +0,0 @@
/*-----------------------------------------*\
| LogitechGProWirelessController.cpp |
| |
| Driver for Logitech G Pro Wireless Gaming|
| Mouse lighting controller |
| |
| TheRogueZeta 8/5/2020 |
\*-----------------------------------------*/
#include "LogitechGProWirelessController.h"
#include <cstring>
LogitechGProWirelessController::LogitechGProWirelessController(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
location = path;
}
LogitechGProWirelessController::~LogitechGProWirelessController()
{
hid_close(dev);
}
std::string LogitechGProWirelessController::GetDeviceLocation()
{
return("HID: " + location);
}
std::string LogitechGProWirelessController::GetSerialString()
{
wchar_t serial_string[128];
hid_get_serial_number_string(dev, serial_string, 128);
std::wstring return_wstring = serial_string;
std::string return_string(return_wstring.begin(), return_wstring.end());
return(return_string);
}
void LogitechGProWirelessController::SendMouseMode
(
unsigned char mode,
std::uint16_t speed,
unsigned char zone,
unsigned char red,
unsigned char green,
unsigned char blue
// unsigned char brightness
)
{
unsigned char usb_buf[20];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Lighting Control packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x11;
usb_buf[0x01] = 0x01;
usb_buf[0x02] = 0x07;
usb_buf[0x03] = 0x3C;
usb_buf[0x04] = zone;
usb_buf[0x05] = mode;
usb_buf[0x06] = red;
usb_buf[0x07] = green;
usb_buf[0x08] = blue;
speed = 100 * speed;
if(mode == LOGITECH_G_PRO_WIRELESS_MODE_STATIC)
{
usb_buf[0x09] = 0x02;
}
if(mode == LOGITECH_G_PRO_WIRELESS_MODE_CYCLE)
{
usb_buf[0x0B] = speed >> 8;
usb_buf[0x0C] = speed & 0xFF;
//usb_buf[0x0D] = brightness;
usb_buf[0x0D] = 0x64;
}
else if(mode == LOGITECH_G_PRO_WIRELESS_MODE_BREATHING)
{
usb_buf[0x09] = speed >> 8;
usb_buf[0x0A] = speed & 0xFF;
//usb_buf[0x0C] = brightness;
usb_buf[0x0C] = 0x64;
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 20);
hid_read(dev, usb_buf, 20);
}
@@ -0,0 +1,58 @@
/*-----------------------------------------*\
| LogitechLightspeedController.cpp |
| |
| Driver for Logitech Lightspeed Wireless |
| Gaming Mice lighting controller |
| |
| TheRogueZeta 8/5/2020 |
\*-----------------------------------------*/
#include "LogitechLightspeedController.h"
#include <cstring>
LogitechLightspeedController::LogitechLightspeedController(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
location = path;
}
LogitechLightspeedController::~LogitechLightspeedController()
{
delete lightspeed;
}
std::string LogitechLightspeedController::GetDeviceLocation()
{
return("HID: " + location + " (Receiver) \r\nWireless Index: " + std::to_string(lightspeed->device_index));
}
std::string LogitechLightspeedController::GetSerialString()
{
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);
}
void LogitechLightspeedController::SendMouseMode
(
unsigned char mode,
std::uint16_t speed,
unsigned char zone,
unsigned char red,
unsigned char green,
unsigned char blue
// unsigned char brightness
)
{
lightspeed->setMode(mode, speed, zone, red, green, blue, 0x64);
}
@@ -1,13 +1,15 @@
/*-----------------------------------------*\
| LogitechGProWirelessController.h |
| LogitechLightspeedController.h |
| |
| Definitions and types for Logitech G Pro |
| Wireless Gaming Mouse lighting controller|
| Definitions and types for Logitech G |
| Lightsync Wireless Gaming Mice lighting |
| controller |
| |
| TheRogueZeta 8/5/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include "LogitechProtocolCommon.h"
#include <string>
#include <hidapi/hidapi.h>
@@ -33,12 +35,14 @@ enum
LOGITECH_G_PRO_WIRELESS_SPEED_FASTEST = 0x0A, /* Fastest speed */
};
class LogitechGProWirelessController
class LogitechLightspeedController
{
public:
LogitechGProWirelessController(hid_device* dev_handle, const char* path);
~LogitechGProWirelessController();
LogitechLightspeedController(hid_device* dev_handle, const char* path);
~LogitechLightspeedController();
logitech_device* lightspeed;
std::string GetDeviceLocation();
std::string GetSerialString();
@@ -0,0 +1,587 @@
/*-------------------------------------------------------------------*\
| LogitechProtocolCommon.cpp |
| |
| Common Logitech RAP and FAP protocol calls |
| |
| Chris M (Dr_No) 4th May 2021 |
| |
\*-------------------------------------------------------------------*/
#include <LogitechProtocolCommon.h>
static std::vector<uint16_t> logitech_RGB_pages =
{
0x8070,
0x8071
};
int getWirelessDevice(usages device_usages, uint16_t pid, wireless_map *wireless_devices)
{
int result;
hid_device* dev_use1;
usages::iterator find_usage = device_usages.find(1);
if (find_usage == device_usages.end())
{
LOG_NOTICE("Unable get_Wireless_Device due to missing FAP Short Message (0x10) usage");
LOG_DEBUG("Dumping device usages:");
for(usages::iterator dev = device_usages.begin(); dev != device_usages.end(); dev++)
{
LOG_DEBUG("Usage index:\t%i", dev->first);
}
}
else
{
dev_use1 = find_usage->second;
/*-----------------------------------------------------------------*\
| Create a buffer for reads |
\*-----------------------------------------------------------------*/
blankFAPmessage response;
response.init();
shortFAPrequest get_connected_devices;
get_connected_devices.init(LOGITECH_RECEIVER_ADDRESS, LOGITECH_GET_REGISTER_REQUEST);
result = hid_write(dev_use1, get_connected_devices.buffer, get_connected_devices.size());
result = hid_read_timeout(dev_use1, response.buffer, response.size(), LOGITECH_PROTOCOL_TIMEOUT);
bool wireless_notifications = response.data[1] & 1; //Connected devices is a flag
if (!wireless_notifications)
{
response.init(); //zero out the response
get_connected_devices.init(LOGITECH_RECEIVER_ADDRESS, LOGITECH_SET_REGISTER_REQUEST);
get_connected_devices.data[1] = 1;
result = hid_write(dev_use1, get_connected_devices.buffer, get_connected_devices.size());
result = hid_read_timeout(dev_use1, response.buffer, response.size(), LOGITECH_PROTOCOL_TIMEOUT);
if(get_connected_devices.feature_index == 0x8F)
{
LOG_ERROR("Logitech Protocol error: %02X %02X %02X %02X %02X %02X %02X", get_connected_devices.report_id, get_connected_devices.device_index, get_connected_devices.feature_index, get_connected_devices.feature_command, get_connected_devices.data[0], get_connected_devices.data[1], get_connected_devices.data[2]);
}
}
response.init(); //zero out the response
get_connected_devices.init(LOGITECH_RECEIVER_ADDRESS, LOGITECH_GET_REGISTER_REQUEST);
get_connected_devices.feature_command = 0x02; //0x02 Connection State register. Essentially asking for count of paired devices
result = hid_write(dev_use1, get_connected_devices.buffer, get_connected_devices.size());
result = hid_read_timeout(dev_use1, response.buffer, response.size(), LOGITECH_PROTOCOL_TIMEOUT);
unsigned int device_count = response.data[1];
LOG_NOTICE("Count of connected devices to %4X: %i", pid, device_count);
if (device_count > 0)
{
LOG_NOTICE("Faking a reconnect to get device list");
device_count++; //Add 1 to the device_count to include the receiver
response.init();
get_connected_devices.init(LOGITECH_RECEIVER_ADDRESS, LOGITECH_SET_REGISTER_REQUEST);
get_connected_devices.feature_index = LOGITECH_SET_REGISTER_REQUEST;
get_connected_devices.feature_command = 0x02; //0x02 Connection State register
get_connected_devices.data[0] = 0x02; //Writting 0x02 to the connection state register will ask the receiver to fake a reconnect of paired devices
result = hid_write(dev_use1, get_connected_devices.buffer, get_connected_devices.size());
for(size_t i = 0; i < device_count; i++)
{
blankFAPmessage devices;
devices.init();
hid_read_timeout(dev_use1, devices.buffer, devices.size(), LOGITECH_PROTOCOL_TIMEOUT);
unsigned int wireless_PID = (devices.data[2] << 8) | devices.data[1];
LOG_NOTICE("Connected Device Index %i:\tVirtualID=%04X\t\t%02X %02X %02X %02X %02X %02X %02X", i, wireless_PID, devices.buffer[0], devices.buffer[1], devices.buffer[2], devices.buffer[3], devices.buffer[4], devices.buffer[5], devices.buffer[6]);
/*-----------------------------------------------------------------*\
| We need to read the receiver from the HID device queue but |
| there is no need to add it as it's own device |
\*-----------------------------------------------------------------*/
if(devices.device_index != 0xFF)
{
wireless_devices->emplace(wireless_PID, devices.device_index);
}
}
}
else
{
LOG_WARNING("No devices were found connected to receiver!");
}
}
return wireless_devices->size();
}
logitech_device::logitech_device(char *path, usages _usages, uint8_t _device_index, bool _wireless)
{
device_index = _device_index;
location = path;
device_usages = _usages;
wireless = _wireless;
RGB_feature_index = 0;
LED_count = 0;
mutex = nullptr;
initialiseDevice();
}
logitech_device::logitech_device(char *path, usages _usages, uint8_t _device_index, bool _wireless, std::shared_ptr<std::mutex> mutex_ptr)
{
device_index = _device_index;
location = path;
device_usages = _usages;
wireless = _wireless;
RGB_feature_index = 0;
LED_count = 0;
mutex = mutex_ptr;
initialiseDevice();
}
logitech_device::~logitech_device()
{
for(usages::iterator dev = device_usages.begin(); dev != device_usages.end(); dev++)
{
hid_close(dev->second);
}
}
void logitech_device::initialiseDevice()
{
flushReadQueue();
getDeviceName(); //This will get the name of the device if it exists
for(std::vector<uint16_t>::iterator page = logitech_RGB_pages.begin(); page != logitech_RGB_pages.end(); page++)
{
int feature_index = getFeatureIndex(*page);
if(feature_index > 0)
{
feature_list.emplace(*page, feature_index);
RGB_feature_index = feature_index;
}
}
if (RGB_feature_index == 0)
{
/*-----------------------------------------------------------------*\
| If there was no RGB Effect Feature page found |
| dump the entire Feature list to log |
\*-----------------------------------------------------------------*/
getDeviceFeatureList(); //This will populate the feature list
LOG_NOTICE("Unable add this device due to missing RGB Effects Feature");
for(features::iterator feature = feature_list.begin(); feature != feature_list.end(); feature++)
{
LOG_NOTICE("Feature Index: %02X\tFeature Page: %04X", feature->second, feature->first);
}
}
else
{
getRGBconfig();
}
}
bool logitech_device::connected()
{
bool test = false;
hid_device* dev_use1 = getDevice(1);
if(dev_use1)
{
blankFAPmessage response;
response.init(); //zero out the response
shortFAPrequest get_connected_devices;
get_connected_devices.init(device_index, LOGITECH_GET_REGISTER_REQUEST);
get_connected_devices.feature_command = 0x02; //0x02 Connection State register. Essentially asking for count of paired devices
hid_write(dev_use1, get_connected_devices.buffer, get_connected_devices.size());
hid_read_timeout(dev_use1, response.buffer, response.size(), LOGITECH_PROTOCOL_TIMEOUT);
test = (response.data[1] != 0x09); //ERR_RESOURCE_ERROR i.e. not currently connected
}
return test;
}
uint8_t logitech_device::getLEDinfo()
{
/*-----------------------------------------------------------------*\
| Get all info about the LEDs and Zones |
\*-----------------------------------------------------------------*/
return LED_count;
}
void logitech_device::flushReadQueue()
{
/*-----------------------------------------------------------------*\
| Create a buffer for reads |
\*-----------------------------------------------------------------*/
blankFAPmessage response;
response.init();
for(usages::iterator dev = device_usages.begin(); dev != device_usages.end(); dev++)
{
//Flush the buffer
int result = 1;
while( result > 0 )
{
result = hid_read_timeout(dev->second, response.buffer, response.size(), LOGITECH_PROTOCOL_TIMEOUT);
}
}
}
hid_device* logitech_device::getDevice(uint8_t usage_index)
{
/*-----------------------------------------------------------------*\
| Check the usage map for usage_index |
| Return the associated device if found otherwise a nullptr |
\*-----------------------------------------------------------------*/
#ifdef WIN32
usages::iterator find_usage = device_usages.find(usage_index);
#else
usages::iterator find_usage = device_usages.begin();
#endif //WIN32
if (find_usage == device_usages.end())
{
LOG_NOTICE("Unable add this device due to missing FAP Message usage %i", usage_index);
return nullptr;
}
else
{
return find_usage->second;
}
}
uint8_t logitech_device::getFeatureIndex(uint16_t feature_page)
{
/*-----------------------------------------------------------------*\
| Get the feature index from the Root Index |
| Return the mapped feature_index of the given feature page |
| for this device or else return 0 |
\*-----------------------------------------------------------------*/
int result = 0;
uint8_t feature_index = 0;
hid_device* dev_use2 = getDevice(2);
if(dev_use2)
{
blankFAPmessage response;
longFAPrequest get_index;
get_index.init(device_index, LOGITECH_HIDPP_PAGE_ROOT_IDX, LOGITECH_CMD_ROOT_GET_FEATURE);
get_index.data[0] = feature_page >> 8;
get_index.data[1] = feature_page & 0xFF;
result = hid_write(dev_use2, get_index.buffer, get_index.size());
result = hid_read_timeout(dev_use2, response.buffer, response.size(), LOGITECH_PROTOCOL_TIMEOUT);
feature_index = response.data[0];
}
return feature_index;
}
int logitech_device::getDeviceFeatureList()
{
int result = 0;
/*-----------------------------------------------------------------*\
| Check the usage map for usage1 (0x10 Short FAP Message) & usage2 |
| (0x11 Long FAP Message) then list all features for device |
\*-----------------------------------------------------------------*/
hid_device* dev_use1 = getDevice(1);
hid_device* dev_use2 = getDevice(2);
if(dev_use1 && dev_use2)
{
/*-----------------------------------------------------------------*\
| Create a buffer for reads |
\*-----------------------------------------------------------------*/
blankFAPmessage response;
response.init();
/*-----------------------------------------------------------------*\
| Query the root index for the index of the feature list |
| This is done for safety as it is generaly at feature index 0x01 |
\*-----------------------------------------------------------------*/
shortFAPrequest get_index;
get_index.init(device_index, LOGITECH_HIDPP_PAGE_ROOT_IDX);
get_index.feature_command = LOGITECH_CMD_ROOT_GET_FEATURE;
get_index.data[0] = LOGITECH_HIDPP_PAGE_FEATURE_SET >> 8; //Get feature index of the Feature Set 0x0001
get_index.data[1] = LOGITECH_HIDPP_PAGE_FEATURE_SET & 0xFF;
result = hid_write(dev_use1, get_index.buffer, get_index.size());
result = hid_read_timeout(dev_use2, response.buffer, response.size(), LOGITECH_PROTOCOL_TIMEOUT);
uint8_t feature_index = response.data[0];
/*-----------------------------------------------------------------*\
| Get the count of Features |
\*-----------------------------------------------------------------*/
shortFAPrequest get_count;
get_count.init(device_index, feature_index);
get_count.feature_command = LOGITECH_CMD_FEATURE_SET_GET_COUNT;
result = hid_write(dev_use1, get_count.buffer, get_count.size());
result = hid_read_timeout(dev_use2, response.buffer, response.size(), LOGITECH_PROTOCOL_TIMEOUT);
unsigned int feature_count = response.data[0];
shortFAPrequest get_features;
get_features.init(device_index, feature_index);
get_features.feature_command = LOGITECH_CMD_FEATURE_SET_GET_ID;
for(std::size_t i = 1; feature_list.size() < feature_count; i++ )
{
get_features.data[0] = i;
result = hid_write(dev_use1, get_features.buffer, get_features.size());
result = hid_read_timeout(dev_use2, response.buffer, response.size(), LOGITECH_PROTOCOL_TIMEOUT);
LOG_DEBUG("Reading HID++ Feature %04X at index: %02X", (response.data[0] << 8) | response.data[1], i);
feature_list.emplace((response.data[0] << 8) | response.data[1], i);
}
}
else
{
if(!dev_use1)
{
LOG_NOTICE("Unable add this device due to missing FAP Short Message (0x10) usage");
}
if(!dev_use2)
{
LOG_NOTICE("Unable add this device due to missing FAP Long Message (0x11) usage");
}
}
return feature_list.size();
}
int logitech_device::getDeviceName()
{
/*-----------------------------------------------------------------*\
| Check the usage map for usage2 (0x11 Long FAP Message) |
| Then use it to get the name for this device |
\*-----------------------------------------------------------------*/
hid_device* dev_use2 = getDevice(2);
if(dev_use2)
{
/*-----------------------------------------------------------------*\
| Create a buffer for reads |
\*-----------------------------------------------------------------*/
blankFAPmessage response;
response.init();
int result;
/*-----------------------------------------------------------------*\
| Check if the feature_list contains an index for the Device_name |
| feature otherwise query the root index. If not found return 0 |
\*-----------------------------------------------------------------*/
uint8_t name_feature_index;
features::iterator find_feature = feature_list.find(LOGITECH_HIDPP_PAGE_DEVICE_NAME_TYPE);
if (find_feature == feature_list.end())
{
longFAPrequest get_index;
get_index.init(device_index, LOGITECH_HIDPP_PAGE_ROOT_IDX, LOGITECH_CMD_ROOT_GET_FEATURE);
get_index.data[0] = LOGITECH_HIDPP_PAGE_DEVICE_NAME_TYPE >> 8; //Get feature index of the Feature Set 0x0001
get_index.data[1] = LOGITECH_HIDPP_PAGE_DEVICE_NAME_TYPE & 0xFF;
result = hid_write(dev_use2, get_index.buffer, get_index.size());
result = hid_read_timeout(dev_use2, response.buffer, response.size(), LOGITECH_PROTOCOL_TIMEOUT);
name_feature_index = response.data[0];
}
else
{
name_feature_index = find_feature->second;
}
/*-----------------------------------------------------------------*\
| Get the device name length |
\*-----------------------------------------------------------------*/
longFAPrequest get_length;
get_length.init(device_index, name_feature_index, LOTITECH_CMD_DEVICE_NAME_TYPE_GET_COUNT);
result = hid_write(dev_use2, get_length.buffer, get_length.size());
result = hid_read_timeout(dev_use2, response.buffer, response.size(), LOGITECH_PROTOCOL_TIMEOUT);
unsigned int name_length = response.data[0];
longFAPrequest get_name;
get_name.init(device_index, name_feature_index, LOGITECH_CMD_DEVICE_NAME_TYPE_GET_DEVICE_NAME);
while(device_name.length() < name_length)
{
get_name.data[0] = device_name.length(); //This sets the character index to get from the device
result = hid_write(dev_use2, get_name.buffer, get_name.size());
result = hid_read_timeout(dev_use2, response.buffer, response.size(), LOGITECH_PROTOCOL_TIMEOUT);
std::string temp = (char *)&response.data;
device_name.append(temp);
}
get_name.init(device_index, name_feature_index, LOGITECH_CMD_DEVICE_NAME_TYPE_GET_TYPE);
result = hid_write(dev_use2, get_name.buffer, get_name.size());
result = hid_read_timeout(dev_use2, response.buffer, response.size(), LOGITECH_PROTOCOL_TIMEOUT);
logitech_device_type = response.data[0];
}
return device_name.length();
}
void logitech_device::getRGBconfig()
{
/*-----------------------------------------------------------------*\
| Check the usage map for usage2 (0x11 Long FAP Message) |
| Then use it to get the name for this device |
\*-----------------------------------------------------------------*/
hid_device* dev_use2 = getDevice(2);
if(dev_use2)
{
/*-----------------------------------------------------------------*\
| Create a buffer for reads |
\*-----------------------------------------------------------------*/
blankFAPmessage response;
response.init();
int result;
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());
result = hid_read_timeout(dev_use2, response.buffer, response.size(), LOGITECH_PROTOCOL_TIMEOUT);
LED_count = response.data[0];
get_count.feature_command = LOGITECH_CMD_RGB_EFFECTS_GET_INFO;
for(std::size_t i = 0; i < LED_count; i++ )
{
//TODO: Push this info into a vector for later enumeration by the RGBController
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);
}
/*get_count.feature_command = LOGITECH_CMD_RGB_EFFECTS_GET_STATE;
for(std::size_t i = 0; i < feature_count; 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);
}
get_count.feature_command = LOGITECH_CMD_RGB_EFFECTS_GET_CONFIG;
for(std::size_t i = 0; i < feature_count; 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);
}*/
}
}
uint8_t logitech_device::setDirectMode(bool direct)
{
int result = 0;
/*-----------------------------------------------------------------*\
| Check the usage map for usage1 (0x10 Short FAP Message) & usage2 |
| (0x11 Long FAP Message) then set the device into direct mode |
| via register 0x8A |
\*-----------------------------------------------------------------*/
hid_device* dev_use1 = getDevice(1);
hid_device* dev_use2 = getDevice(2);
if(dev_use1 && dev_use2)
{
/*-----------------------------------------------------------------*\
| Create a buffer for reads |
\*-----------------------------------------------------------------*/
blankFAPmessage response;
response.init();
/*-----------------------------------------------------------------*\
| Turn the direct mode on or off via the RGB_feature_index |
\*-----------------------------------------------------------------*/
shortFAPrequest set_direct;
set_direct.init(device_index, RGB_feature_index);
set_direct.feature_command = LOGITECH_CMD_RGB_EFFECTS_UNKNOWN;
set_direct.data[0] = (direct) ? 1 : 0;
set_direct.data[1] = set_direct.data[0];
/*-----------------------------------------------------*\
| Send packet |
| This code has to be protected to avoid crashes when |
| this is called at the same time to change a powerplay |
| mat and its paired wireless mouse leds. It will |
| happen when using effects engines with high framerate |
\*-----------------------------------------------------*/
if(mutex)
{
std::lock_guard<std::mutex> guard(*mutex);
result = hid_write(dev_use1, set_direct.buffer, set_direct.size());
result = hid_read_timeout(dev_use2, response.buffer, response.size(), LOGITECH_PROTOCOL_TIMEOUT);
}
else
{
result = hid_write(dev_use1, set_direct.buffer, set_direct.size());
result = hid_read_timeout(dev_use2, response.buffer, response.size(), LOGITECH_PROTOCOL_TIMEOUT);
}
}
return result;
}
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)
{
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);
if(dev_use2)
{
/*-----------------------------------------------------------------*\
| Create a buffer for reads |
\*-----------------------------------------------------------------*/
blankFAPmessage response;
response.init();
/*-----------------------------------------------------------------*\
| 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.data[0] = zone;
set_mode.data[1] = mode;
set_mode.data[2] = red;
set_mode.data[3] = green;
set_mode.data[4] = blue;
speed *= 100;
if(mode == 1) //Static
{
set_mode.data[5] = zone;
}
else if(mode == 2) //Spectrum Cycle
{
set_mode.data[7] = speed >> 8;
set_mode.data[8] = speed & 0xFF;
set_mode.data[9] = brightness;
}
else if(mode == 3) //Breathing
{
set_mode.data[5] = speed >> 8;
set_mode.data[6] = speed & 0xFF;
set_mode.data[8] = brightness;
}
/*-----------------------------------------------------*\
| Send packet |
| This code has to be protected to avoid crashes when |
| this is called at the same time to change a powerplay |
| mat and its paired wireless mouse leds. It will |
| happen when using effects engines with high framerate |
\*-----------------------------------------------------*/
if(mutex)
{
std::lock_guard<std::mutex> guard(*mutex);
result = hid_write(dev_use2, set_mode.buffer, set_mode.size());
result = hid_read_timeout(dev_use2, response.buffer, response.size(), LOGITECH_PROTOCOL_TIMEOUT);
}
else
{
result = hid_write(dev_use2, set_mode.buffer, set_mode.size());
result = hid_read_timeout(dev_use2, response.buffer, response.size(), LOGITECH_PROTOCOL_TIMEOUT);
}
}
return result;
}
@@ -0,0 +1,218 @@
/*-------------------------------------------------------------------*\
| LogitechProtocolCommon.h |
| |
| Common Logitech RAP and FAP protocol calls |
| |
| Chris M (Dr_No) 4th May 2021 |
| |
\*-------------------------------------------------------------------*/
#include <map>
#include <hidapi/hidapi.h>
#include "LogManager.h"
#pragma once
#define LOGITECH_PROTOCOL_TIMEOUT 300 //Timeout in ms
#define LOGITECH_HEADER_SIZE 3
#define LOGITECH_SHORT_MESSAGE 0x10
#define LOGITECH_SHORT_MESSAGE_LEN 7
#define LOGITECH_LONG_MESSAGE 0x11
#define LOGITECH_LONG_MESSAGE_LEN 20
#define LOGITECH_FAP_RESPONSE_LEN 64 //Define a universal response buffer and allow the hidapi to determine the size
#define LOGITECH_RECEIVER_ADDRESS 0xFF //The Unifying receiver uses RAP or register access protocol
#define LOGITECH_SET_REGISTER_REQUEST 0x80
#define LOGITECH_GET_REGISTER_REQUEST 0x81
#define LOGITECH_HIDPP_PAGE_ROOT_IDX 0x00 //Used for querying the feature index
#define LOGITECH_CMD_ROOT_GET_FEATURE 0x01
#define LOGITECH_CMD_ROOT_GET_PROTOCOL 0x11
#define LOGITECH_HIDPP_PAGE_FEATURE_SET 0x0001
#define LOGITECH_CMD_FEATURE_SET_GET_COUNT 0x01
#define LOGITECH_CMD_FEATURE_SET_GET_ID 0x11
#define LOGITECH_HIDPP_PAGE_DEVICE_NAME_TYPE 0x0005
#define LOTITECH_CMD_DEVICE_NAME_TYPE_GET_COUNT 0x01
#define LOGITECH_CMD_DEVICE_NAME_TYPE_GET_DEVICE_NAME 0x11
#define LOGITECH_CMD_DEVICE_NAME_TYPE_GET_TYPE 0x21
#define LOGITECH_HIDPP_PAGE_RGB_EFFECTS1 0x8070
#define LOGITECH_HIDPP_PAGE_RGB_EFFECTS2 0x8071
#define LOGITECH_CMD_RGB_EFFECTS_GET_COUNT 0x00
#define LOGITECH_CMD_RGB_EFFECTS_GET_INFO 0x10
#define LOGITECH_CMD_RGB_EFFECTS_GET_CONTROL 0x20
#define LOGITECH_CMD_RGB_EFFECTS_SET_CONTROL 0x30
#define LOGITECH_CMD_RGB_EFFECTS_GET_STATE 0x40
#define LOGITECH_CMD_RGB_EFFECTS_SET_STATE 0x50
#define LOGITECH_CMD_RGB_EFFECTS_GET_CONFIG 0x60
#define LOGITECH_CMD_RGB_EFFECTS_SET_CONFIG 0x70
#define LOGITECH_CMD_RGB_EFFECTS_UNKNOWN 0x80 //Used to set "direct" mode
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_TOUCHPAD = 4,
LOGITECH_DEVICE_TYPE_TRACKBALL = 5,
LOGITECH_DEVICE_TYPE_PRESENTER = 6,
LOGITECH_DEVICE_TYPE_RECEIVER = 7
};
// Used for: {GET,SET}_REGISTER_{REQ,RSP}, SET_LONG_REGISTER_RSP, GET_LONG_REGISTER_REQ
struct message_short
{
unsigned char address;
unsigned char data[3];
};
// Used for: SET_LONG_REGISTER_REQ, GET_LONG_REGISTER_RSP
struct message_long
{
unsigned char address;
unsigned char data[16];
};
// Used for: ERROR_MSG
struct message_error
{
unsigned char sub_id;
unsigned char address;
unsigned char error_code;
unsigned char padding; /* set to 0 */
};
union shortFAPrequest
{
uint8_t buffer[LOGITECH_SHORT_MESSAGE_LEN];
struct
{
uint8_t report_id;
uint8_t device_index;
uint8_t feature_index;
uint8_t feature_command;
uint8_t data[LOGITECH_SHORT_MESSAGE_LEN - 4];
};
void init(uint8_t device_index, uint8_t feature_index)
{
this->report_id = LOGITECH_SHORT_MESSAGE;
this->device_index = device_index;
this->feature_index = feature_index;
this->feature_command = 0;
for(size_t i = 0; i < sizeof(data); i++)
{
this->data[i] = 0;
}
};
int size()
{
return LOGITECH_SHORT_MESSAGE_LEN;
};
};
union longFAPrequest
{
uint8_t buffer[LOGITECH_LONG_MESSAGE_LEN];
struct
{
uint8_t report_id;
uint8_t device_index;
uint8_t feature_index;
uint8_t feature_command;
uint8_t data[LOGITECH_LONG_MESSAGE_LEN - 4];
};
void init(uint8_t device_index, uint8_t feature_index, uint8_t feature_command)
{
this->report_id = LOGITECH_LONG_MESSAGE;
this->device_index = device_index;
this->feature_index = feature_index;
this->feature_command = feature_command;
for(size_t i = 0; i < sizeof(data); i++)
{
this->data[i] = 0;
}
};
int size()
{
return LOGITECH_LONG_MESSAGE_LEN;
};
};
union blankFAPmessage
{
uint8_t buffer[LOGITECH_FAP_RESPONSE_LEN];
struct
{
uint8_t command;
uint8_t device_index;
uint8_t feature_index;
uint8_t feature_command;
uint8_t data[LOGITECH_FAP_RESPONSE_LEN - 4];
};
//blank this buffer entirely
void init()
{
for(size_t i = 0; i < sizeof(buffer); i++)
{
this->buffer[i] = 0;
}
};
int size()
{
return LOGITECH_FAP_RESPONSE_LEN;
};
};
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;
int getWirelessDevice(usages _usages, uint16_t pid, wireless_map *wireless_devices); //Helper function needed outside of class
class logitech_device
{
public:
logitech_device(char *path, usages _usages, uint8_t _device_index, bool _wireless);
logitech_device(char *path, usages _usages, uint8_t _device_index, bool _wireless, std::shared_ptr<std::mutex> mutex_ptr);
~logitech_device();
/*-----------------------------------------------------------------*\
| usages is a std::map that stores all the devices HID usages |
| This is to ensure that we can communicate to all windows usages |
\*-----------------------------------------------------------------*/
usages device_usages;
features feature_list;
uint8_t device_index;
uint8_t RGB_feature_index; //Stored for quick use
uint8_t logitech_device_type;
bool wireless;
std::string device_name;
std::string location;
std::string protocol_version;
bool connected();
void flushReadQueue();
uint8_t getFeatureIndex(uint16_t feature_page);
uint8_t getLEDinfo();
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);
int getDeviceName();
private:
uint8_t LED_count;
std::shared_ptr<std::mutex> mutex;
hid_device* getDevice(uint8_t usage_index);
int getDeviceFeatureList();
void getRGBconfig();
void initialiseDevice();
};
@@ -1,117 +0,0 @@
/*-----------------------------------------*\
| RGBController_LogitechG203.cpp |
| |
| Generic RGB Interface for Logitech G203 |
| Prodigy RGB Mouse |
| |
| Adam Honse (CalcProgrammer1) 5/17/2020 |
\*-----------------------------------------*/
#include "RGBController_LogitechG203.h"
RGBController_LogitechG203::RGBController_LogitechG203(LogitechG203Controller* logitech_ptr)
{
logitech = logitech_ptr;
name = "Logitech Mouse Device";
vendor = "Logitech";
type = DEVICE_TYPE_MOUSE;
description = "Logitech Mouse Device";
location = logitech->GetDeviceLocation();
serial = logitech->GetSerialString();
mode Static;
Static.name = "Static";
Static.value = LOGITECH_G203_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Off;
Off.name = "Off";
Off.value = LOGITECH_G203_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Cycle;
Cycle.name = "Cycle";
Cycle.value = LOGITECH_G203_MODE_CYCLE;
Cycle.flags = MODE_FLAG_HAS_SPEED;
Cycle.color_mode = MODE_COLORS_NONE;
Cycle.speed_min = LOGITECH_G203_SPEED_SLOWEST;
Cycle.speed_max = LOGITECH_G203_SPEED_FASTEST;
Cycle.speed = LOGITECH_G203_SPEED_NORMAL;
modes.push_back(Cycle);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = LOGITECH_G203_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED;
Breathing.color_mode = MODE_COLORS_PER_LED;
Breathing.speed_min = LOGITECH_G203_SPEED_SLOWEST;
Breathing.speed_max = LOGITECH_G203_SPEED_FASTEST;
Breathing.speed = LOGITECH_G203_SPEED_NORMAL;
modes.push_back(Breathing);
SetupZones();
}
RGBController_LogitechG203::~RGBController_LogitechG203()
{
delete logitech;
}
void RGBController_LogitechG203::SetupZones()
{
zone g203_zone;
g203_zone.name = "Mouse";
g203_zone.type = ZONE_TYPE_SINGLE;
g203_zone.leds_min = 1;
g203_zone.leds_max = 1;
g203_zone.leds_count = 1;
g203_zone.matrix_map = NULL;
zones.push_back(g203_zone);
led g203_led;
g203_led.name = "Mouse";
leds.push_back(g203_led);
SetupColors();
}
void RGBController_LogitechG203::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_LogitechG203::DeviceUpdateLEDs()
{
unsigned char red = RGBGetRValue(colors[0]);
unsigned char grn = RGBGetGValue(colors[0]);
unsigned char blu = RGBGetBValue(colors[0]);
logitech->SendMouseMode(modes[active_mode].value, modes[active_mode].speed, red, grn, blu);
}
void RGBController_LogitechG203::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_LogitechG203::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_LogitechG203::SetCustomMode()
{
}
void RGBController_LogitechG203::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}
@@ -1,129 +0,0 @@
/*-----------------------------------------*\
| RGBController_LogitechG303.cpp |
| |
| Generic RGB Interface for Logitech G303 |
| Daedalus Apex Mouse |
| |
| TheRogueZeta 02/14/2021 |
\*-----------------------------------------*/
#include "RGBController_LogitechG303.h"
RGBController_LogitechG303::RGBController_LogitechG303(LogitechG303Controller* logitech_ptr)
{
logitech = logitech_ptr;
name = "Logitech Mouse Device";
type = DEVICE_TYPE_MOUSE;
description = "Logitech Mouse Device";
location = logitech->GetDeviceLocation();
mode Off;
Off.name = "Off";
Off.value = LOGITECH_G303_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Static;
Static.name = "Static";
Static.value = LOGITECH_G303_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Cycle;
Cycle.name = "Cycle";
Cycle.value = LOGITECH_G303_MODE_CYCLE;
Cycle.flags = MODE_FLAG_HAS_SPEED;
Cycle.color_mode = MODE_COLORS_NONE;
Cycle.speed_min = LOGITECH_G303_SPEED_SLOWEST;
Cycle.speed_max = LOGITECH_G303_SPEED_FASTEST;
Cycle.speed = LOGITECH_G303_SPEED_NORMAL;
modes.push_back(Cycle);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = LOGITECH_G303_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED;
Breathing.color_mode = MODE_COLORS_PER_LED;
Breathing.speed_min = LOGITECH_G303_SPEED_SLOWEST;
Breathing.speed_max = LOGITECH_G303_SPEED_FASTEST;
Breathing.speed = LOGITECH_G303_SPEED_NORMAL;
modes.push_back(Breathing);
SetupZones();
}
RGBController_LogitechG303::~RGBController_LogitechG303()
{
delete logitech;
}
void RGBController_LogitechG303::SetupZones()
{
zone G303_primary_zone;
G303_primary_zone.name = "Primary";
G303_primary_zone.type = ZONE_TYPE_SINGLE;
G303_primary_zone.leds_min = 1;
G303_primary_zone.leds_max = 1;
G303_primary_zone.leds_count = 1;
G303_primary_zone.matrix_map = NULL;
zones.push_back(G303_primary_zone);
led G303_primary_led;
G303_primary_led.name = "Primary";
leds.push_back(G303_primary_led);
zone G303_logo_zone;
G303_logo_zone.name = "Logo";
G303_logo_zone.type = ZONE_TYPE_SINGLE;
G303_logo_zone.leds_min = 1;
G303_logo_zone.leds_max = 1;
G303_logo_zone.leds_count = 1;
G303_logo_zone.matrix_map = NULL;
zones.push_back(G303_logo_zone);
led G303_logo_led;
G303_logo_led.name = "Logo";
leds.push_back(G303_logo_led);
SetupColors();
}
void RGBController_LogitechG303::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_LogitechG303::DeviceUpdateLEDs()
{
UpdateZoneLEDs(0);
UpdateZoneLEDs(1);
}
void RGBController_LogitechG303::UpdateZoneLEDs(int zone)
{
unsigned char red = RGBGetRValue(colors[zone]);
unsigned char grn = RGBGetGValue(colors[zone]);
unsigned char blu = RGBGetBValue(colors[zone]);
logitech->SendMouseMode(modes[active_mode].value, modes[active_mode].speed, zone, red, grn, blu);
}
void RGBController_LogitechG303::UpdateSingleLED(int led)
{
UpdateZoneLEDs(led);
}
void RGBController_LogitechG303::SetCustomMode()
{
}
void RGBController_LogitechG303::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}
@@ -1,131 +0,0 @@
/*-----------------------------------------*\
| RGBController_LogitechG403.cpp |
| |
| Generic RGB Interface for Logitech G403 |
| Prodigy RGB Mouse |
| |
| Martin Hartl (inlar) 5/19/2020 |
\*-----------------------------------------*/
#include "RGBController_LogitechG403.h"
RGBController_LogitechG403::RGBController_LogitechG403(LogitechG403Controller* logitech_ptr)
{
logitech = logitech_ptr;
name = "Logitech Mouse Device";
vendor = "Logitech";
type = DEVICE_TYPE_MOUSE;
description = "Logitech Mouse Device";
location = logitech->GetDeviceLocation();
serial = logitech->GetSerialString();
mode Static;
Static.name = "Static";
Static.value = LOGITECH_G403_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
mode Off;
Off.name = "Off";
Off.value = LOGITECH_G403_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Cycle;
Cycle.name = "Cycle";
Cycle.value = LOGITECH_G403_MODE_CYCLE;
Cycle.flags = MODE_FLAG_HAS_SPEED;
Cycle.color_mode = MODE_COLORS_NONE;
Cycle.speed_min = LOGITECH_G403_SPEED_SLOWEST;
Cycle.speed_max = LOGITECH_G403_SPEED_FASTEST;
Cycle.speed = LOGITECH_G403_SPEED_NORMAL;
modes.push_back(Cycle);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = LOGITECH_G403_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED;
Breathing.color_mode = MODE_COLORS_PER_LED;
Breathing.speed_min = LOGITECH_G403_SPEED_SLOWEST;
Breathing.speed_max = LOGITECH_G403_SPEED_FASTEST;
Breathing.speed = LOGITECH_G403_SPEED_NORMAL;
modes.push_back(Breathing);
SetupZones();
}
RGBController_LogitechG403::~RGBController_LogitechG403()
{
delete logitech;
}
void RGBController_LogitechG403::SetupZones()
{
zone G403_wheel_zone;
G403_wheel_zone.name = "Scroll Wheel";
G403_wheel_zone.type = ZONE_TYPE_SINGLE;
G403_wheel_zone.leds_min = 1;
G403_wheel_zone.leds_max = 1;
G403_wheel_zone.leds_count = 1;
G403_wheel_zone.matrix_map = NULL;
zones.push_back(G403_wheel_zone);
led G403_wheel_led;
G403_wheel_led.name = "Scroll Wheel";
leds.push_back(G403_wheel_led);
zone G403_logo_zone;
G403_logo_zone.name = "Logo";
G403_logo_zone.type = ZONE_TYPE_SINGLE;
G403_logo_zone.leds_min = 1;
G403_logo_zone.leds_max = 1;
G403_logo_zone.leds_count = 1;
G403_logo_zone.matrix_map = NULL;
zones.push_back(G403_logo_zone);
led G403_logo_led;
G403_logo_led.name = "Logo";
leds.push_back(G403_logo_led);
SetupColors();
}
void RGBController_LogitechG403::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_LogitechG403::DeviceUpdateLEDs()
{
UpdateZoneLEDs(0);
UpdateZoneLEDs(1);
}
void RGBController_LogitechG403::UpdateZoneLEDs(int zone)
{
unsigned char red = RGBGetRValue(colors[zone]);
unsigned char grn = RGBGetGValue(colors[zone]);
unsigned char blu = RGBGetBValue(colors[zone]);
logitech->SendMouseMode(modes[active_mode].value, modes[active_mode].speed, zone, red, grn, blu);
}
void RGBController_LogitechG403::UpdateSingleLED(int led)
{
UpdateZoneLEDs(led);
}
void RGBController_LogitechG403::SetCustomMode()
{
}
void RGBController_LogitechG403::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}
@@ -1,131 +0,0 @@
/*-----------------------------------------*\
| RGBController_LogitechG403.h |
| |
| Generic RGB Interface for Logitech G502 |
| Proteus Sprectrum Mouse |
| |
| kernzerfall 07/28/2020 |
\*-----------------------------------------*/
#include "RGBController_LogitechG502PS.h"
RGBController_LogitechG502PS::RGBController_LogitechG502PS(LogitechG502PSController* logitech_ptr)
{
logitech = logitech_ptr;
name = "Logitech Mouse Device";
vendor = "Logitech";
type = DEVICE_TYPE_MOUSE;
description = "Logitech Mouse Device";
location = logitech->GetDeviceLocation();
serial = logitech->GetSerialString();
mode Direct;
Direct.name = "Direct";
Direct.value = LOGITECH_G502_PS_MODE_STATIC;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Off;
Off.name = "Off";
Off.value = LOGITECH_G502_PS_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Cycle;
Cycle.name = "Cycle";
Cycle.value = LOGITECH_G502_PS_MODE_CYCLE;
Cycle.flags = MODE_FLAG_HAS_SPEED;
Cycle.color_mode = MODE_COLORS_NONE;
Cycle.speed_min = LOGITECH_G502_PS_SPEED_SLOWEST;
Cycle.speed_max = LOGITECH_G502_PS_SPEED_FASTEST;
Cycle.speed = LOGITECH_G502_PS_SPEED_NORMAL;
modes.push_back(Cycle);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = LOGITECH_G502_PS_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED;
Breathing.color_mode = MODE_COLORS_PER_LED;
Breathing.speed_min = LOGITECH_G502_PS_SPEED_SLOWEST;
Breathing.speed_max = LOGITECH_G502_PS_SPEED_FASTEST;
Breathing.speed = LOGITECH_G502_PS_SPEED_NORMAL;
modes.push_back(Breathing);
SetupZones();
}
RGBController_LogitechG502PS::~RGBController_LogitechG502PS()
{
delete logitech;
}
void RGBController_LogitechG502PS::SetupZones()
{
zone G502_PS_side_zone;
G502_PS_side_zone.name = "DPI";
G502_PS_side_zone.type = ZONE_TYPE_SINGLE;
G502_PS_side_zone.leds_min = 1;
G502_PS_side_zone.leds_max = 1;
G502_PS_side_zone.leds_count = 1;
G502_PS_side_zone.matrix_map = NULL;
zones.push_back(G502_PS_side_zone);
led G502_PS_side_led;
G502_PS_side_led.name = "DPI";
leds.push_back(G502_PS_side_led);
zone G502_logo_zone;
G502_logo_zone.name = "Logo";
G502_logo_zone.type = ZONE_TYPE_SINGLE;
G502_logo_zone.leds_min = 1;
G502_logo_zone.leds_max = 1;
G502_logo_zone.leds_count = 1;
G502_logo_zone.matrix_map = NULL;
zones.push_back(G502_logo_zone);
led G502_logo_led;
G502_logo_led.name = "Logo";
leds.push_back(G502_logo_led);
SetupColors();
}
void RGBController_LogitechG502PS::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_LogitechG502PS::DeviceUpdateLEDs()
{
UpdateZoneLEDs(0);
UpdateZoneLEDs(1);
}
void RGBController_LogitechG502PS::UpdateZoneLEDs(int zone)
{
unsigned char red = RGBGetRValue(colors[zone]);
unsigned char grn = RGBGetGValue(colors[zone]);
unsigned char blu = RGBGetBValue(colors[zone]);
logitech->SendMouseMode(modes[active_mode].value, modes[active_mode].speed, zone, red, grn, blu);
}
void RGBController_LogitechG502PS::UpdateSingleLED(int led)
{
UpdateZoneLEDs(led);
}
void RGBController_LogitechG502PS::SetCustomMode()
{
}
void RGBController_LogitechG502PS::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}

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