Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dbdf5eab0b |
+7
-34
@@ -24,14 +24,14 @@ before_script:
|
||||
.ccache_init: &ccache_init
|
||||
before_script:
|
||||
- apt update
|
||||
- apt install -y build-essential qtcreator qtbase5-dev libusb-1.0-0-dev libhidapi-dev pkgconf wget git file
|
||||
- apt install -y build-essential qtcreator qt5-default libusb-1.0-0-dev libhidapi-dev pkgconf wget git
|
||||
|
||||
#-----------------------------------------------------------------------#
|
||||
# Linux (AppImage) 32-bit Build Target #
|
||||
#-----------------------------------------------------------------------#
|
||||
"Linux 32 AppImage":
|
||||
<<: *ccache_init
|
||||
image: i386/debian:bullseye
|
||||
image: i386/ubuntu:bionic
|
||||
stage: build
|
||||
script:
|
||||
- export $(dpkg-architecture)
|
||||
@@ -50,7 +50,7 @@ before_script:
|
||||
#-----------------------------------------------------------------------#
|
||||
"Linux 64 AppImage":
|
||||
<<: *ccache_init
|
||||
image: debian:bullseye
|
||||
image: ubuntu:bionic
|
||||
stage: build
|
||||
script:
|
||||
- export $(dpkg-architecture)
|
||||
@@ -69,13 +69,13 @@ before_script:
|
||||
#-----------------------------------------------------------------------#
|
||||
"Linux 32 deb":
|
||||
<<: *ccache_init
|
||||
image: i386/debian:bullseye
|
||||
image: i386/ubuntu:bionic
|
||||
stage: build
|
||||
script:
|
||||
- apt install -y debhelper
|
||||
- dpkg-architecture -l
|
||||
- dpkg-buildpackage --target-arch i386 -us -B
|
||||
- rm -v ../openrgb-dbgsym*.deb
|
||||
- rm -v ../openrgb-dbgsym*.ddeb
|
||||
- mv -v ../openrgb*.deb ./
|
||||
|
||||
artifacts:
|
||||
@@ -91,13 +91,13 @@ before_script:
|
||||
#-----------------------------------------------------------------------#
|
||||
"Linux 64 deb":
|
||||
<<: *ccache_init
|
||||
image: debian:bullseye
|
||||
image: ubuntu:bionic
|
||||
stage: build
|
||||
script:
|
||||
- apt install -y debhelper
|
||||
- dpkg-architecture -l
|
||||
- dpkg-buildpackage -us -B
|
||||
- rm -v ../openrgb-dbgsym*.deb
|
||||
- rm -v ../openrgb-dbgsym*.ddeb
|
||||
- mv -v ../openrgb*.deb ./
|
||||
|
||||
artifacts:
|
||||
@@ -108,33 +108,6 @@ 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
|
||||
|
||||
#-----------------------------------------------------------------------#
|
||||
# Windows (32-bit) Build Target #
|
||||
#-----------------------------------------------------------------------#
|
||||
|
||||
+5
-371
@@ -53,18 +53,6 @@ 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) #
|
||||
@@ -82,29 +70,8 @@ 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 #
|
||||
@@ -117,23 +84,6 @@ 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 #
|
||||
# #
|
||||
@@ -151,7 +101,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}=="0c23", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0a32", TAG+="uaccess"
|
||||
|
||||
#---------------------------------------------------------------#
|
||||
# Corsair Peripheral Devices #
|
||||
@@ -176,12 +126,6 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c23", 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 #
|
||||
@@ -205,96 +149,27 @@ 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"
|
||||
|
||||
#---------------------------------------------------------------#
|
||||
@@ -309,87 +184,53 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="0cf2", ATTR{idProduct}=="7750", TAG+="uacces
|
||||
# Logitech G213 #
|
||||
# Logitech G512 #
|
||||
# Logitech G512 RGB #
|
||||
# Logitech G610 #1 #
|
||||
# Logitech G610 #2 #
|
||||
# Logitech G610 #
|
||||
# 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}=="2020", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="24f0", ATTR{idProduct}=="202b", TAG+="uaccess"
|
||||
|
||||
#---------------------------------------------------------------#
|
||||
# MSI Mysticlight #
|
||||
#---------------------------------------------------------------#
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="3EA4", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="4459", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="4559", 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"
|
||||
@@ -427,7 +268,6 @@ 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"
|
||||
|
||||
#---------------------------------------------------------------#
|
||||
@@ -444,163 +284,15 @@ 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 #
|
||||
@@ -640,13 +332,6 @@ 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 #
|
||||
# #
|
||||
@@ -662,62 +347,22 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0ba0", 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}=="1710", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1384", 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 #
|
||||
@@ -731,14 +376,3 @@ 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"
|
||||
|
||||
@@ -179,8 +179,7 @@ void PolychromeUSBController::WriteRGSwap
|
||||
void PolychromeUSBController::WriteHeader
|
||||
(
|
||||
unsigned char cfg,
|
||||
unsigned char* configstring,
|
||||
unsigned int configsize
|
||||
unsigned char configstring[]
|
||||
)
|
||||
{
|
||||
unsigned char usb_buf[65];
|
||||
@@ -195,7 +194,7 @@ void PolychromeUSBController::WriteHeader
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x01] = POLYCHROME_USB_WRITE_HEADER;
|
||||
usb_buf[0x03] = cfg;
|
||||
memcpy(&usb_buf[4], configstring, configsize);
|
||||
memcpy(&usb_buf[4], configstring, sizeof(configstring));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
@@ -208,7 +207,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;
|
||||
@@ -243,7 +242,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,9 +128,8 @@ public:
|
||||
|
||||
void WriteHeader
|
||||
(
|
||||
unsigned char cfg,
|
||||
unsigned char* configstring,
|
||||
unsigned int configsize
|
||||
unsigned char cfg,
|
||||
unsigned char configstring []
|
||||
);
|
||||
|
||||
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& /*
|
||||
}
|
||||
|
||||
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,6 +171,16 @@ 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 |
|
||||
\*-------------------------------------------------*/
|
||||
@@ -181,6 +191,7 @@ 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];
|
||||
@@ -258,8 +269,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, sizeof(zonecfg));
|
||||
unsigned char zonecmd = POLYCHROME_USB_LEDCOUNT_CFG;
|
||||
// WriteHeader(zonecmd, zonecfg);
|
||||
}
|
||||
|
||||
void RGBController_PolychromeUSB::DeviceUpdateLEDs()
|
||||
@@ -305,6 +316,7 @@ 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;
|
||||
|
||||
@@ -32,20 +32,14 @@ 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_GTX1070_DEV, ASUS_SUB_VEN, ASUS_GTX1070_STRIX, 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_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_RTX2070S_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX2070S_A8G_GAMING, 0x2A, "ASUS ROG STRIX RTX 2070S A8G 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" }
|
||||
};
|
||||
{ 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" }
|
||||
};
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
|
||||
@@ -194,38 +194,38 @@ unsigned char AuraSMBusController::GetLEDBlue(unsigned int led)
|
||||
return(AuraRegisterRead(direct_reg + ( 3 * led ) + 1));
|
||||
}
|
||||
|
||||
void AuraSMBusController::SetAllColorsDirect(RGBColor* colors)
|
||||
void AuraSMBusController::SetAllColorsDirect(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
unsigned char* color_buf = new unsigned char[led_count * 3];
|
||||
unsigned char* colors = new unsigned char[led_count * 3];
|
||||
|
||||
for (unsigned int i = 0; i < (led_count * 3); i += 3)
|
||||
{
|
||||
color_buf[i + 0] = RGBGetRValue(colors[i / 3]);
|
||||
color_buf[i + 1] = RGBGetBValue(colors[i / 3]);
|
||||
color_buf[i + 2] = RGBGetGValue(colors[i / 3]);
|
||||
colors[i + 0] = red;
|
||||
colors[i + 1] = blue;
|
||||
colors[i + 2] = green;
|
||||
}
|
||||
|
||||
AuraRegisterWriteBlock(direct_reg, color_buf, led_count * 3);
|
||||
AuraRegisterWriteBlock(direct_reg, colors, led_count * 3);
|
||||
|
||||
delete color_buf;
|
||||
delete colors;
|
||||
}
|
||||
|
||||
void AuraSMBusController::SetAllColorsEffect(RGBColor* colors)
|
||||
void AuraSMBusController::SetAllColorsEffect(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
unsigned char* color_buf = new unsigned char[led_count * 3];
|
||||
unsigned char* colors = new unsigned char[led_count * 3];
|
||||
|
||||
for (unsigned int i = 0; i < (led_count * 3); i += 3)
|
||||
{
|
||||
color_buf[i + 0] = RGBGetRValue(colors[i / 3]);
|
||||
color_buf[i + 1] = RGBGetBValue(colors[i / 3]);
|
||||
color_buf[i + 2] = RGBGetGValue(colors[i / 3]);
|
||||
colors[i + 0] = red;
|
||||
colors[i + 1] = blue;
|
||||
colors[i + 2] = green;
|
||||
}
|
||||
|
||||
AuraRegisterWriteBlock(effect_reg, color_buf, led_count * 3);
|
||||
|
||||
AuraRegisterWriteBlock(effect_reg, colors, led_count * 3);
|
||||
|
||||
AuraRegisterWrite(AURA_REG_APPLY, AURA_APPLY_VAL);
|
||||
|
||||
delete[] color_buf;
|
||||
delete[] colors;
|
||||
}
|
||||
|
||||
void AuraSMBusController::SetDirect(unsigned char direct)
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
| Adam Honse (CalcProgrammer1) 8/19/2018 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController.h"
|
||||
|
||||
#include <string>
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
@@ -89,8 +87,8 @@ public:
|
||||
unsigned char GetLEDRed(unsigned int led);
|
||||
unsigned char GetLEDGreen(unsigned int led);
|
||||
unsigned char GetLEDBlue(unsigned int led);
|
||||
void SetAllColorsDirect(RGBColor* colors);
|
||||
void SetAllColorsEffect(RGBColor* colors);
|
||||
void SetAllColorsDirect(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetAllColorsEffect(unsigned char red, unsigned char green, unsigned char blue);
|
||||
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,6 +1,5 @@
|
||||
#include "Detector.h"
|
||||
#include "AsusAuraSMBusController.h"
|
||||
#include "LogManager.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_AsusAuraSMBus.h"
|
||||
#include "i2c_smbus.h"
|
||||
@@ -8,7 +7,6 @@
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "dependencies/dmiinfo.h"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
@@ -89,32 +87,21 @@ 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);
|
||||
@@ -135,24 +122,24 @@ bool TestForAsusAuraSMBusController(i2c_smbus_interface* bus, unsigned char addr
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectAsusAuraSMBusDRAMControllers(std::vector<i2c_smbus_interface*> &busses)
|
||||
void DetectAsusAuraSMBusControllers(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)
|
||||
{
|
||||
LOG_DEBUG("Remapping Aura SMBus RAM modules on 0x77");
|
||||
|
||||
// Remap Aura-enabled 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;
|
||||
}
|
||||
|
||||
@@ -162,8 +149,6 @@ void DetectAsusAuraSMBusDRAMControllers(std::vector<i2c_smbus_interface*> &busse
|
||||
|
||||
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
|
||||
@@ -174,8 +159,6 @@ void DetectAsusAuraSMBusDRAMControllers(std::vector<i2c_smbus_interface*> &busse
|
||||
|
||||
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));
|
||||
}
|
||||
@@ -186,25 +169,14 @@ void DetectAsusAuraSMBusDRAMControllers(std::vector<i2c_smbus_interface*> &busse
|
||||
{
|
||||
if (TestForAsusAuraSMBusController(busses[bus], aura_ram_addresses[address_list_idx]))
|
||||
{
|
||||
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);
|
||||
new_aura = new AuraSMBusController(busses[bus], aura_ram_addresses[address_list_idx]);
|
||||
new_controller = new RGBController_AuraSMBus(new_aura);
|
||||
ResourceManager::get()->RegisterRGBController(new_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)
|
||||
@@ -213,11 +185,9 @@ void DetectAsusAuraSMBusMotherboardControllers(std::vector<i2c_smbus_interface*>
|
||||
{
|
||||
if (TestForAsusAuraSMBusController(busses[bus], aura_mobo_addresses[address_list_idx]))
|
||||
{
|
||||
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);
|
||||
new_aura = new AuraSMBusController(busses[bus], aura_mobo_addresses[address_list_idx]);
|
||||
new_controller = new RGBController_AuraSMBus(new_aura);
|
||||
ResourceManager::get()->RegisterRGBController(new_controller);
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(1ms);
|
||||
@@ -225,7 +195,6 @@ void DetectAsusAuraSMBusMotherboardControllers(std::vector<i2c_smbus_interface*>
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectAuraSMBusMotherboardControllers() */
|
||||
} /* DetectAuraSMBusControllers() */
|
||||
|
||||
REGISTER_I2C_DETECTOR("ASUS Aura SMBus DRAM", DetectAsusAuraSMBusDRAMControllers);
|
||||
REGISTER_I2C_DETECTOR("ASUS Aura SMBus Motherboard", DetectAsusAuraSMBusMotherboardControllers);
|
||||
REGISTER_I2C_DETECTOR("ASUS Aura SMBus", DetectAsusAuraSMBusControllers);
|
||||
|
||||
@@ -58,13 +58,20 @@ int RGBController_AuraSMBus::GetDeviceMode()
|
||||
|
||||
void RGBController_AuraSMBus::DeviceUpdateLEDs()
|
||||
{
|
||||
if(GetMode() == 0)
|
||||
for(std::size_t led = 0; led < colors.size(); led++)
|
||||
{
|
||||
aura->SetAllColorsDirect(&colors[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
aura->SetAllColorsEffect(&colors[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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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, 0, AuraDeviceType::ADDRESSABLE});
|
||||
device_info.push_back({0x01, (unsigned char)i, 0x01, AuraDeviceType::ADDRESSABLE});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,26 +12,17 @@
|
||||
|
||||
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, num_total_mainboard_leds, num_rgb_headers, AuraDeviceType::FIXED});
|
||||
device_info.push_back({0x00, 0x04, config_table[0x1B], AuraDeviceType::FIXED});
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Add addressable devices |
|
||||
\*-----------------------------------------------------*/
|
||||
for(int i = 0; i < num_addressable_headers; i++)
|
||||
for(int i = 0; i < config_table[0x02]; ++i)
|
||||
{
|
||||
device_info.push_back({0x01, (unsigned char)i, 0x01, 0, AuraDeviceType::ADDRESSABLE});
|
||||
device_info.push_back({0x01, (unsigned char)i, 0x01, AuraDeviceType::ADDRESSABLE});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +142,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
|
||||
@@ -205,4 +196,4 @@ void AuraMainboardController::SendCommit()
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 65);
|
||||
}
|
||||
}
|
||||
@@ -53,7 +53,6 @@ struct AuraDeviceInfo
|
||||
unsigned char effect_channel;
|
||||
unsigned char direct_channel;
|
||||
unsigned char num_leds;
|
||||
unsigned char num_headers;
|
||||
AuraDeviceType device_type;
|
||||
};
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "RGBController_AsusAuraMouse.h"
|
||||
#include <stdexcept>
|
||||
#include <hidapi/hidapi.h>
|
||||
#include "dependencies/dmiinfo.h"
|
||||
|
||||
#define AURA_USB_VID 0x0B05
|
||||
#define AURA_TERMINAL_PID 0x1889
|
||||
@@ -19,7 +18,6 @@
|
||||
#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
|
||||
@@ -30,7 +28,7 @@
|
||||
#define AURA_ROG_CHAKRAM_WIRED_1_PID 0x18E3
|
||||
#define AURA_ROG_CHAKRAM_WIRED_2_PID 0x1958
|
||||
|
||||
void DetectAsusAuraUSBTerminal(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);
|
||||
|
||||
@@ -43,20 +41,6 @@ void DetectAsusAuraUSBTerminal(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);
|
||||
@@ -64,10 +48,9 @@ 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 = "ASUS " + dmi.getMainboard();
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
catch(std::runtime_error&)
|
||||
@@ -101,14 +84,13 @@ void DetectAsusAuraUSBMice(hid_device_info* info, const std::string& name)
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_HID_DETECTOR ("ASUS ROG AURA Terminal", DetectAsusAuraUSBTerminal, AURA_USB_VID, AURA_TERMINAL_PID);
|
||||
REGISTER_HID_DETECTOR ("ASUS ROG AURA Terminal", DetectAsusAuraUSBAddressable, 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);
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
#define NA 0xFFFFFFFF
|
||||
|
||||
static unsigned int matrix_map[6][22] =
|
||||
{ { 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 } };
|
||||
{ { 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 } };
|
||||
|
||||
static const char* zone_names[] =
|
||||
{
|
||||
@@ -36,7 +36,7 @@ static zone_type zone_types[] =
|
||||
|
||||
static const unsigned int zone_sizes[] =
|
||||
{
|
||||
106,
|
||||
104,
|
||||
1,
|
||||
2,
|
||||
};
|
||||
@@ -56,7 +56,6 @@ 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 },
|
||||
@@ -118,7 +117,6 @@ static const led_type led_names[] =
|
||||
{ "Key: F10", 0x68 },
|
||||
{ "Key: =", 0x69 },
|
||||
{ "Key: ]", 0x6A },
|
||||
{ "Key: #", 0x6B },
|
||||
{ "Key: F11", 0x70 },
|
||||
{ "Key: F12", 0x78 },
|
||||
{ "Key: Backspace", 0x79 },
|
||||
@@ -239,7 +237,7 @@ void RGBController_AuraKeyboard::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
|
||||
void RGBController_AuraKeyboard::DeviceUpdateLEDs()
|
||||
{
|
||||
unsigned char frame_buf[109 * 4];
|
||||
unsigned char frame_buf[107 * 4];
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| TODO: Send packets with multiple LED frames |
|
||||
@@ -252,7 +250,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(109, frame_buf);
|
||||
aura->SendDirect(107, frame_buf);
|
||||
}
|
||||
|
||||
void RGBController_AuraKeyboard::UpdateZoneLEDs(int /*zone*/)
|
||||
|
||||
@@ -159,24 +159,13 @@ 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;
|
||||
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.name.append(", LED ");
|
||||
new_led.name.append(std::to_string(led_ch_idx + 1));
|
||||
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(unsigned int i = 0; i < led_count; i++)
|
||||
for(int i = 0; i < led_count; i++)
|
||||
{
|
||||
RGBColor colour = led_colours[i];
|
||||
|
||||
|
||||
@@ -1,167 +0,0 @@
|
||||
/*-------------------------------------------------------------------*\
|
||||
| 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;
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/*-------------------------------------------------------------------*\
|
||||
| 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,28 +3,20 @@
|
||||
#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_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
|
||||
#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
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
@@ -85,27 +77,8 @@ void DetectCoolerMasterGPU(hid_device_info* info, const std::string&)
|
||||
}
|
||||
}
|
||||
|
||||
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 );
|
||||
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);
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -1,467 +0,0 @@
|
||||
/*-------------------------------------------------------------------*\
|
||||
| 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;
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
/*-------------------------------------------------------------------*\
|
||||
| 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(unsigned int i = 0; i < modes.size(); i++)
|
||||
for( 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 );
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#define CORSAIR_HYDRO_PLATINUM_PACKET_SIZE 65
|
||||
#define CORSAIR_HYDRO_PLATINUM_PACKET_DELAY 5
|
||||
#define CORSAIR_HYDRO_PLATINUM_PACKET_DELAY 3
|
||||
|
||||
enum
|
||||
{
|
||||
|
||||
@@ -48,9 +48,6 @@ 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;
|
||||
@@ -394,16 +391,7 @@ void CorsairPeripheralController::SetupK95LightingControl()
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, (unsigned char *)usb_buf, 65);
|
||||
|
||||
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;
|
||||
int identifier = 0;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
@@ -421,12 +409,11 @@ void CorsairPeripheralController::SetupK95LightingControl()
|
||||
|
||||
for (int j = 0; j < 30; j++)
|
||||
{
|
||||
for (int j = 0; j < skipped_identifiers_count; 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)
|
||||
{
|
||||
if (identifier == skipped_identifiers[j])
|
||||
{
|
||||
identifier++;
|
||||
}
|
||||
identifier++;
|
||||
}
|
||||
|
||||
usb_buf[5 + 2 * j] = identifier++;
|
||||
|
||||
@@ -1,217 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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];
|
||||
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 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);
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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);
|
||||
};
|
||||
@@ -1,50 +0,0 @@
|
||||
#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);
|
||||
@@ -1,326 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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);
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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;
|
||||
};
|
||||
@@ -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, 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 },
|
||||
{ 3, NA, 9, 15, 21, 27, NA, 33, 39, 45, 51, 57, 63, 69, 87, NA, NA, NA, NA, 111, 117, 123, NA },
|
||||
{ 4, NA, 16, 22, 28, 34, NA, 40, NA, 46, 52, 58, 64, 70, 82, NA, NA, 100, NA, 112, 118, 124, 131 },
|
||||
{ 5, 11, 17, NA, NA, NA, NA, 41, NA, NA, NA, NA, 65, 77, 83, 89, 95, 101, 107, 113, NA, 125, NA } };
|
||||
|
||||
static const char* zone_names[] =
|
||||
@@ -47,7 +47,7 @@ static const char *led_names[] =
|
||||
"Key: 1",
|
||||
"Key: Q",
|
||||
"Key: A",
|
||||
"Key: \\ (ISO)",
|
||||
"Unused",
|
||||
"Key: Left Windows",
|
||||
"Key: F1",
|
||||
"Key: 2",
|
||||
@@ -112,7 +112,7 @@ static const char *led_names[] =
|
||||
"Key: F10",
|
||||
"Key: =",
|
||||
"Key: ]",
|
||||
"Key: #",
|
||||
"Unused",
|
||||
"Unused",
|
||||
"Key: Right Windows",
|
||||
"Key: F11",
|
||||
|
||||
@@ -293,13 +293,9 @@ RGBController_E131::RGBController_E131(std::vector<E131Device> device_list)
|
||||
|
||||
RGBController_E131::~RGBController_E131()
|
||||
{
|
||||
if(keepalive_thread != nullptr)
|
||||
{
|
||||
keepalive_thread_run = 0;
|
||||
keepalive_thread->join();
|
||||
delete keepalive_thread;
|
||||
}
|
||||
|
||||
keepalive_thread_run = 0;
|
||||
keepalive_thread->join();
|
||||
delete keepalive_thread;
|
||||
/*---------------------------------------------------------*\
|
||||
| Delete the matrix map |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
@@ -124,8 +124,6 @@ int RGBController_EVGAGPUv2::getModeIndex(unsigned char mode_value)
|
||||
return mode_index;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RGBController_EVGAGPUv2::SetupZones()
|
||||
|
||||
@@ -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(unsigned int i = 0; i < sizeof(fanbus_msg); i++)
|
||||
for(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(unsigned int led_idx = 0; led_idx < led_zone.leds_count; led_idx++)
|
||||
for(int led_idx = 0; led_idx < led_zone.leds_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = "LED ";
|
||||
|
||||
@@ -41,7 +41,6 @@ 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" },
|
||||
};
|
||||
|
||||
|
||||
@@ -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(unsigned int i = 0; i < modes[active_mode].colors_max; i++)
|
||||
for ( int i = 0; i < modes[active_mode].colors_max; i++)
|
||||
{
|
||||
modes[active_mode].colors[i] = modes[previous_mode].colors[i];
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ void LEDStripController::SetLEDsKeyboardVisualizer(std::vector<RGBColor> colors)
|
||||
\*-------------------------------------------------------------*/
|
||||
unsigned short sum = 0;
|
||||
|
||||
for(unsigned int i = 0; i < (payload_size + 1); i++)
|
||||
for (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,30 +1,34 @@
|
||||
#include "Detector.h"
|
||||
#include "LogitechG203Controller.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 "LogitechGLightsyncController.h"
|
||||
#include "LogitechGProWirelessController.h"
|
||||
#include "LogitechGPowerPlayController.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_LogitechGLightsync.h"
|
||||
#include "RGBController_LogitechGLightsync1zone.h"
|
||||
#include "RGBController_LogitechGProWireless.h"
|
||||
#include "RGBController_LogitechGPowerPlay.h"
|
||||
#include <vector>
|
||||
#include <hidapi/hidapi.h>
|
||||
#include <LogManager.h>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Logitech vendor ID |
|
||||
\*-----------------------------------------------------*/
|
||||
#define LOGITECH_VID 0x046D
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Keyboard product IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
@@ -37,9 +41,6 @@
|
||||
#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 |
|
||||
\*-----------------------------------------------------*/
|
||||
@@ -48,50 +49,21 @@
|
||||
#define LOGITECH_G303_PID 0xC080
|
||||
#define LOGITECH_G403_PID 0xC083
|
||||
#define LOGITECH_G403H_PID 0xC08F
|
||||
#define LOGITECH_G403_WIRELESS_PID 0xC082
|
||||
#define LOGITECH_G403_WIRELESS_VIRTUAL_PID 0x405D
|
||||
#define LOGITECH_G502_PS_PID 0xC332
|
||||
#define LOGITECH_G502H_PID 0xC08B
|
||||
#define LOGITECH_G502_WIRELESS_PID 0xC08D
|
||||
#define LOGITECH_G502_WIRELESS_VIRTUAL_PID 0x407F
|
||||
#define LOGITECH_G703_WIRELESS_PID 0xC087
|
||||
#define LOGITECH_G703_WIRELESS_VIRTUAL_PID 0x4070
|
||||
#define LOGITECH_G900_WIRELESS_PID 0xC081
|
||||
#define LOGITECH_G900_WIRELESS_VIRTUAL_PID 0x4053
|
||||
#define LOGITECH_G903_WIRELESS_PID 0xC086
|
||||
#define LOGITECH_G903_WIRELESS_VIRTUAL_PID 0x4067
|
||||
#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_GPRO_WIRELESS_VIRTUAL_PID 0x4079
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Mousemat product IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define LOGITECH_G_LIGHTSPEED_POWERPLAY_PID 0xC53A
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Speaker product IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define LOGITECH_G560_PID 0x0A78
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| 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)
|
||||
{
|
||||
/*-------------------------------------------------------------------------------------------------*\
|
||||
@@ -99,51 +71,49 @@ 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);
|
||||
@@ -151,63 +121,120 @@ void DetectLogitechKeyboardG810(hid_device_info* info, const std::string& name)
|
||||
#endif
|
||||
}
|
||||
|
||||
void DetectLogitechKeyboardG910(hid_device_info* info, const std::string& name)
|
||||
void DetectLogitechKeyboardG213(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
/*-------------------------------------------------------------------------------------------------*\
|
||||
| Logitech keyboards use two different usages, one for 20-byte packets and one for 64-byte packets |
|
||||
| Usage 0x0602 for 20 byte, usage 0x0604 for 64 byte, both are on usage page 0xFF43 |
|
||||
\*-------------------------------------------------------------------------------------------------*/
|
||||
#ifdef USE_HID_USAGE
|
||||
hid_device* dev_usage_0x0602 = nullptr;
|
||||
hid_device* dev_usage_0x0604 = nullptr;
|
||||
hid_device_info* info_temp = info;
|
||||
|
||||
while(info_temp)
|
||||
{
|
||||
if(info_temp->vendor_id == info->vendor_id // constant LOGITECH_VID
|
||||
&& info_temp->product_id == info->product_id // NON-constant
|
||||
&& info_temp->interface_number == info->interface_number // constant 1
|
||||
&& info_temp->usage_page == info->usage_page) // constant 0xFF43
|
||||
{
|
||||
if(info_temp->usage == 0x0602)
|
||||
{
|
||||
dev_usage_0x0602 = hid_open_path(info_temp->path);
|
||||
}
|
||||
else if(info_temp->usage == 0x0604)
|
||||
{
|
||||
dev_usage_0x0604 = hid_open_path(info_temp->path);
|
||||
}
|
||||
}
|
||||
if(dev_usage_0x0602 && dev_usage_0x0604)
|
||||
{
|
||||
break;
|
||||
}
|
||||
info_temp = info_temp->next;
|
||||
}
|
||||
if(dev_usage_0x0602 && dev_usage_0x0604)
|
||||
{
|
||||
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);
|
||||
}
|
||||
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)
|
||||
{
|
||||
LogitechG910Controller* controller = new LogitechG910Controller(dev, dev);
|
||||
RGBController_LogitechG910* rgb_controller = new RGBController_LogitechG910(controller);
|
||||
LogitechG213Controller* controller = new LogitechG213Controller(dev, info->path);
|
||||
RGBController_LogitechG213* rgb_controller = new RGBController_LogitechG213(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void DetectLogitechMouseG203(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void DetectLogitechKeyboardG815(hid_device_info* info, const std::string& name)
|
||||
@@ -216,60 +243,56 @@ 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 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);
|
||||
}
|
||||
}
|
||||
#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);
|
||||
}
|
||||
}
|
||||
#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);
|
||||
@@ -277,279 +300,38 @@ 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 DetectLogitechMouseG403WW(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
addLogitechLightsyncMouse2zone(info, name, 0xFF, 0x18, 0x3A);
|
||||
}
|
||||
|
||||
void DetectLogitechMouseG502PS(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
addLogitechLightsyncMouse2zone(info, name, 0xFF, 0x02, 0x3A);
|
||||
}
|
||||
|
||||
void DetectLogitechMouseG502WW(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
addLogitechLightsyncMouse2zone(info, name, 0xFF, 0x07, 0x3A);
|
||||
}
|
||||
|
||||
void DetectLogitechMouseG703WW(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
addLogitechLightsyncMouse2zone(info, name, 0x01, 0x18, 0x3C);
|
||||
}
|
||||
|
||||
void DetectLogitechMouseG900WW(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
addLogitechLightsyncMouse2zone(info, name, 0x01, 0x17, 0x3A);
|
||||
}
|
||||
|
||||
void DetectLogitechMouseG903WW(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
addLogitechLightsyncMouse2zone(info, name, 0x01, 0x17, 0x3A);
|
||||
}
|
||||
|
||||
void DetectLogitechMouseGPRO(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
addLogitechLightsyncMouse2zone(info, name, 0x01, 0x07, 0x3C);
|
||||
}
|
||||
|
||||
void DetectLogitechMouseGLS(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
/*---------------------------------------------*\
|
||||
| Create mutex to prevent the two controllers |
|
||||
| from interfering with each other |
|
||||
\*---------------------------------------------*/
|
||||
std::shared_ptr<std::mutex> logitech_mutex = std::make_shared<std::mutex>();
|
||||
|
||||
/*---------------------------------------------*\
|
||||
| Add mouse |
|
||||
\*---------------------------------------------*/
|
||||
LogitechGLightsyncController* controller = new LogitechGLightsyncController(dev, dev, info->path, 0x01, 0x07, 0x3C, logitech_mutex);
|
||||
RGBController_LogitechGLightsync* rgb_controller = new RGBController_LogitechGLightsync(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
|
||||
/*---------------------------------------------*\
|
||||
| Add Powerplay mousemat |
|
||||
\*---------------------------------------------*/
|
||||
LogitechGLightsyncController* mousemat_controller = new LogitechGLightsyncController(dev, dev, info->path, 0x07, 0x0B, 0x3C, logitech_mutex);
|
||||
RGBController_LogitechGPowerPlay* mousemat_rgb_controller = new RGBController_LogitechGPowerPlay(mousemat_controller);
|
||||
mousemat_rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(mousemat_rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| 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_IP ("Logitech G910 Orion Spark", DetectLogitechKeyboardG910, LOGITECH_VID, LOGITECH_G910_ORION_SPARK_PID, 1, 0xFF43);
|
||||
REGISTER_HID_DETECTOR_IP ("Logitech G910 Orion Spectrum", DetectLogitechKeyboardG910, LOGITECH_VID, LOGITECH_G910_PID, 1, 0xFF43);
|
||||
REGISTER_HID_DETECTOR_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);
|
||||
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
|
||||
| Mice |
|
||||
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
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_G203L_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 Prodigy", DetectLogitechMouseG403, LOGITECH_VID, LOGITECH_G403_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("Logitech G403 Hero", DetectLogitechMouseG403, LOGITECH_VID, LOGITECH_G403H_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("Logitech G403 Prodigy Wireless (wired)", DetectLogitechMouseG403WW, LOGITECH_VID, LOGITECH_G403_WIRELESS_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("Logitech G502 Proteus Spectrum", DetectLogitechMouseG502PS, LOGITECH_VID, LOGITECH_G502_PS_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("Logitech G502 Hero", DetectLogitechMouseG502PS, LOGITECH_VID, LOGITECH_G502H_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("Logitech G502 LIGHTSPEED Wireless (wired)", DetectLogitechMouseG502WW, LOGITECH_VID, LOGITECH_G502_WIRELESS_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("Logitech G703 Wireless (wired)", DetectLogitechMouseG703WW, LOGITECH_VID, LOGITECH_G703_WIRELESS_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("Logitech G900 Chaos Spectrum Wireless (wired)", DetectLogitechMouseG900WW, LOGITECH_VID, LOGITECH_G900_WIRELESS_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("Logitech G903 LIGHTSPEED Wireless (wired)", DetectLogitechMouseG903WW, LOGITECH_VID, LOGITECH_G903_WIRELESS_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("Logitech G Pro Gaming Mouse", DetectLogitechMouseG203, LOGITECH_VID, LOGITECH_GPRO_WIRED_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("Logitech G Pro (HERO) Gaming Mouse", DetectLogitechMouseG203, LOGITECH_VID, LOGITECH_GPRO_HERO_WIRED_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("Logitech G Lightspeed Wireless Gaming Mouse", DetectLogitechMouseGPRO, LOGITECH_VID, LOGITECH_G_LIGHTSPEED_WIRELESS_PID, 2, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("Logitech G Pro Wireless Gaming Mouse (Wired)", DetectLogitechMouseGPRO, LOGITECH_VID, LOGITECH_GPRO_WIRELESS_PID, 2, 0xFF00);
|
||||
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_IPU("Logitech G Powerplay Mousepad with Lightspeed", DetectLogitechMouseGLS, LOGITECH_VID, LOGITECH_G_LIGHTSPEED_POWERPLAY_PID, 2, 0xFF00, 2);
|
||||
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
|
||||
| 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);
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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);
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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;
|
||||
};
|
||||
@@ -0,0 +1,81 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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);
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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;
|
||||
};
|
||||
@@ -0,0 +1,92 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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);
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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;
|
||||
};
|
||||
@@ -0,0 +1,94 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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);
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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, 20);
|
||||
hid_read_timeout(dev, usb_buf_out, LOGI_G560_LED_PACKET_SIZE, 200);
|
||||
break;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,181 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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];
|
||||
hid_get_serial_number_string(dev_pkt_0x11, serial_string, 128);
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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();
|
||||
};
|
||||
@@ -1,176 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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];
|
||||
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 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);
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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;
|
||||
};
|
||||
@@ -0,0 +1,99 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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);
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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;
|
||||
};
|
||||
@@ -0,0 +1,99 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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,59 @@
|
||||
/*-----------------------------------------*\
|
||||
| LogitechGProWirelessController.h |
|
||||
| |
|
||||
| Definitions and types for Logitech G Pro |
|
||||
| Wireless Gaming Mouse lighting controller|
|
||||
| |
|
||||
| TheRogueZeta 8/5/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController.h"
|
||||
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
enum
|
||||
{
|
||||
LOGITECH_G_PRO_WIRELESS_MODE_OFF = 0x00,
|
||||
LOGITECH_G_PRO_WIRELESS_MODE_STATIC = 0x01,
|
||||
LOGITECH_G_PRO_WIRELESS_MODE_CYCLE = 0x02,
|
||||
LOGITECH_G_PRO_WIRELESS_MODE_BREATHING = 0x03,
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------------------------*\
|
||||
| Speed is 1000 for fast and 20000 for slow. |
|
||||
| Values are multiplied by 100 later to give lots of GUI steps. |
|
||||
\*---------------------------------------------------------------------------------------------*/
|
||||
enum
|
||||
{
|
||||
LOGITECH_G_PRO_WIRELESS_SPEED_SLOWEST = 0xC8, /* Slowest speed */
|
||||
LOGITECH_G_PRO_WIRELESS_SPEED_NORMAL = 0x32, /* Normal speed */
|
||||
LOGITECH_G_PRO_WIRELESS_SPEED_FASTEST = 0x0A, /* Fastest speed */
|
||||
};
|
||||
|
||||
class LogitechGProWirelessController
|
||||
{
|
||||
public:
|
||||
LogitechGProWirelessController(hid_device* dev_handle, const char* path);
|
||||
~LogitechGProWirelessController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SendMouseMode
|
||||
(
|
||||
unsigned char mode,
|
||||
unsigned short speed,
|
||||
unsigned char zone,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
// unsigned char brightness
|
||||
);
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
};
|
||||
@@ -0,0 +1,117 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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();
|
||||
}
|
||||
+9
-9
@@ -1,21 +1,21 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_LogitechG910.h |
|
||||
| RGBController_LogitechG203.h |
|
||||
| |
|
||||
| Generic RGB Interface for Logitech G910 |
|
||||
| Orion Spectrum keyboard |
|
||||
| Generic RGB Interface for Logitech G203 |
|
||||
| Prodigy RGB Mouse |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/12/2020 |
|
||||
| Adam Honse (CalcProgrammer1) 5/17/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "LogitechG910Controller.h"
|
||||
#include "LogitechG203Controller.h"
|
||||
|
||||
class RGBController_LogitechG910 : public RGBController
|
||||
class RGBController_LogitechG203 : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_LogitechG910(LogitechG910Controller* logitech_ptr);
|
||||
~RGBController_LogitechG910();
|
||||
RGBController_LogitechG203(LogitechG203Controller* logitech_ptr);
|
||||
~RGBController_LogitechG203();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
@@ -29,5 +29,5 @@ public:
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
LogitechG910Controller* logitech;
|
||||
LogitechG203Controller* logitech;
|
||||
};
|
||||
@@ -0,0 +1,129 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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();
|
||||
}
|
||||
+9
-10
@@ -1,22 +1,21 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_SteelSeriesQCKMat.h |
|
||||
| RGBController_LogitechG303.h |
|
||||
| |
|
||||
| Generic RGB Interface SteelSeriesQCK |
|
||||
| Class |
|
||||
| Generic RGB Interface for Logitech G303 |
|
||||
| Daedalus Apex Mouse |
|
||||
| |
|
||||
| Edbgon 22/05/2021 |
|
||||
| TheRogueZeta 02/14/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "SteelSeriesQCKMatController.h"
|
||||
#include "LogitechG303Controller.h"
|
||||
|
||||
class RGBController_SteelSeriesQCKMat : public RGBController
|
||||
class RGBController_LogitechG303 : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_SteelSeriesQCKMat(SteelSeriesQCKMatController* qck_ptr);
|
||||
~RGBController_SteelSeriesQCKMat();
|
||||
RGBController_LogitechG303(LogitechG303Controller* logitech_ptr);
|
||||
~RGBController_LogitechG303();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
@@ -30,5 +29,5 @@ public:
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
SteelSeriesQCKMatController* qck;
|
||||
LogitechG303Controller* logitech;
|
||||
};
|
||||
@@ -0,0 +1,131 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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();
|
||||
}
|
||||
+9
-9
@@ -1,21 +1,21 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_LogitechGLightsync1zone.h |
|
||||
| RGBController_LogitechG403.h |
|
||||
| |
|
||||
| Generic RGB Interface for single zone |
|
||||
| Logitech G Lightsync Devices |
|
||||
| Generic RGB Interface for Logitech G403 |
|
||||
| Prodigy RGB Mouse |
|
||||
| |
|
||||
| TheRogueZeta 04/21/2021 |
|
||||
| Martin Hartl (inlar) 5/19/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "LogitechGLightsyncController.h"
|
||||
#include "LogitechG403Controller.h"
|
||||
|
||||
class RGBController_LogitechGLightsync1zone : public RGBController
|
||||
class RGBController_LogitechG403 : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_LogitechGLightsync1zone(LogitechGLightsyncController* logitech_ptr);
|
||||
~RGBController_LogitechGLightsync1zone();
|
||||
RGBController_LogitechG403(LogitechG403Controller* logitech_ptr);
|
||||
~RGBController_LogitechG403();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
@@ -29,5 +29,5 @@ public:
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
LogitechGLightsyncController* logitech;
|
||||
LogitechG403Controller* logitech;
|
||||
};
|
||||
@@ -0,0 +1,131 @@
|
||||
/*-----------------------------------------*\
|
||||
| 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();
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_LogitechG403.h |
|
||||
| |
|
||||
| Generic RGB Interface for Logitech G502 |
|
||||
| Proteus Sprectrum Mouse |
|
||||
| |
|
||||
| kernzerfall 07/28/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "LogitechG502PSController.h"
|
||||
|
||||
class RGBController_LogitechG502PS : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_LogitechG502PS(LogitechG502PSController* logitech_ptr);
|
||||
~RGBController_LogitechG502PS();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
LogitechG502PSController* logitech;
|
||||
};
|
||||
@@ -118,12 +118,12 @@ void RGBController_LogitechG560::DeviceUpdateLEDs()
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_LogitechG560::UpdateZoneLEDs(int /*zone*/)
|
||||
void RGBController_LogitechG560::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_LogitechG560::UpdateSingleLED(int /*led*/)
|
||||
void RGBController_LogitechG560::UpdateSingleLED(int led)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ void RGBController_LogitechG815::DeviceUpdateLEDs()
|
||||
if (current_colors[led_idx]==new_colors[led_idx])
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Don't send if key color is not changed |
|
||||
| Not ready for prime. |
|
||||
\*-------------------------------------------------*/
|
||||
continue;
|
||||
}
|
||||
@@ -363,6 +363,16 @@ void RGBController_LogitechG815::DeviceUpdateLEDs()
|
||||
size_t frame_pos = 3;
|
||||
uint8_t li = 0;
|
||||
|
||||
memset(frame_buffer_big_mode, 0x00, sizeof(frame_buffer_big_mode));
|
||||
memset(frame_buffer_little_mode, 0x00, sizeof(frame_buffer_little_mode));
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Don't ask why but the keyboard needs one 6F |
|
||||
| packet in order to handle a 1F packet with one single led |
|
||||
| color. |
|
||||
\*---------------------------------------------------------*/
|
||||
//logitech->SetDummyBigPacket();
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Create frame_buffers of type 1F (Little, up to 4 leds |
|
||||
| per packet) and 6F (big, up to 13 leds per packet). |
|
||||
@@ -392,24 +402,19 @@ void RGBController_LogitechG815::DeviceUpdateLEDs()
|
||||
frame_pos++;
|
||||
}
|
||||
}
|
||||
|
||||
if (frame_pos < data_size)
|
||||
{
|
||||
/*-----------------------------------------*\
|
||||
| Zeroing just what is needed and if needed |
|
||||
\*-----------------------------------------*/
|
||||
memset(frame_buffer_big_mode + frame_pos, 0x00, sizeof(frame_buffer_big_mode) - frame_pos);
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| End of Data byte |
|
||||
\*-----------------------------------------*/
|
||||
frame_buffer_big_mode[frame_pos] = 0xFF;
|
||||
frame_pos++;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zeroing just what is needed |
|
||||
\*-----------------------------------------------------*/
|
||||
logitech->SetDirect(LOGITECH_G815_ZONE_FRAME_TYPE_BIG, frame_buffer_big_mode);
|
||||
|
||||
memset(frame_buffer_big_mode, 0x00, sizeof(frame_buffer_big_mode));
|
||||
|
||||
bi = bi + max_key_per_color;
|
||||
}
|
||||
}
|
||||
@@ -436,6 +441,7 @@ void RGBController_LogitechG815::DeviceUpdateLEDs()
|
||||
| No End of Data byte if the packet is full |
|
||||
\*-----------------------------------------*/
|
||||
logitech->SetDirect(LOGITECH_G815_ZONE_FRAME_TYPE_LITTLE, frame_buffer_little_mode);
|
||||
memset(frame_buffer_little_mode, 0x00, sizeof(frame_buffer_little_mode));
|
||||
led_in_little_frame=0;
|
||||
}
|
||||
}
|
||||
@@ -449,12 +455,7 @@ void RGBController_LogitechG815::DeviceUpdateLEDs()
|
||||
if(led_in_little_frame > 0)
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Zeroing just what is needed |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(frame_buffer_little_mode + (led_in_little_frame * 4 + 1), 0x00, sizeof(frame_buffer_little_mode) - led_in_little_frame * 4);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Data byte |
|
||||
| End of Data byte |
|
||||
\*-----------------------------------------------------*/
|
||||
frame_buffer_little_mode[led_in_little_frame*4 + 0] = 0xFF;
|
||||
|
||||
@@ -462,6 +463,7 @@ void RGBController_LogitechG815::DeviceUpdateLEDs()
|
||||
| Send little frame and clear little frame buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
logitech->SetDirect(LOGITECH_G815_ZONE_FRAME_TYPE_LITTLE, frame_buffer_little_mode);
|
||||
memset(frame_buffer_little_mode, 0x00, sizeof(frame_buffer_little_mode));
|
||||
}
|
||||
if(ledsByColors.size() > 0)
|
||||
{
|
||||
|
||||
@@ -1,394 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_LogitechG910.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for Logitech G910 |
|
||||
| Orion Spectrum Keyboard |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/12/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_LogitechG910.h"
|
||||
|
||||
//0xFFFFFFFF indicates an unused entry in matrix
|
||||
#define NA 0xFFFFFFFF
|
||||
|
||||
static unsigned int matrix_map[8][24] =
|
||||
{ { NA, 111, 112, 113, 114, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA },
|
||||
{ 115, 37, NA, 54, 55, 56, 57, NA, 58, 59, 60, 61, NA, 62, 63, 64, 65, 66, 67, 68, NA, NA, NA, NA },
|
||||
{ 106, 49, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, NA, 41, 42, 38, NA, 69, 70, 71, 79, 80, 81, 82 },
|
||||
{ 107, 39, NA, 16, 22, 4, 17, NA, 19, 24, 20, 8, 14, 15, 43, 44, 45, 72, 73, 74, 91, 92, 93, 83 },
|
||||
{ 108, 53, NA, 0, 18, 3, 5, NA, 6, 7, 9, 10, 11, 47, 48, 46, 36, NA, NA, NA, 88, 89, 90, NA },
|
||||
{ 109, 99, 96, 25, 23, 2, 21, NA, 1, NA, 13, 12, 50, 51, 52, 103, NA, NA, 78, NA, 85, 86, 87, 84 },
|
||||
{ 110, 98, 101, 100, NA, NA, NA, NA, 40, NA, NA, NA, NA, 104, 105, 97, 102, 76, 77, 75, 94, NA, 95, NA },
|
||||
{ NA, NA, NA, 116, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA } };
|
||||
|
||||
static const char* zone_names[] =
|
||||
{
|
||||
"Keyboard",
|
||||
};
|
||||
|
||||
static zone_type zone_types[] =
|
||||
{
|
||||
ZONE_TYPE_MATRIX,
|
||||
};
|
||||
|
||||
static const unsigned int zone_sizes[] =
|
||||
{
|
||||
117,
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char * name;
|
||||
const unsigned char zone;
|
||||
const unsigned char idx;
|
||||
} led_type;
|
||||
|
||||
static const led_type led_names[] =
|
||||
{
|
||||
/* Key Label Zone, Index */
|
||||
{ "Key: A", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x04 },
|
||||
{ "Key: B", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x05 },
|
||||
{ "Key: C", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x06 },
|
||||
{ "Key: D", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x07 },
|
||||
{ "Key: E", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x08 },
|
||||
{ "Key: F", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x09 },
|
||||
{ "Key: G", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x0A },
|
||||
{ "Key: H", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x0B },
|
||||
{ "Key: I", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x0C },
|
||||
{ "Key: J", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x0D },
|
||||
{ "Key: K", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x0E },
|
||||
{ "Key: L", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x0F },
|
||||
{ "Key: M", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x10 },
|
||||
{ "Key: N", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x11 },
|
||||
{ "Key: O", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x12 },
|
||||
{ "Key: P", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x13 },
|
||||
{ "Key: Q", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x14 },
|
||||
{ "Key: R", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x15 },
|
||||
{ "Key: S", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x16 },
|
||||
{ "Key: T", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x17 },
|
||||
{ "Key: U", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x18 },
|
||||
{ "Key: V", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x19 },
|
||||
{ "Key: W", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x1A },
|
||||
{ "Key: X", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x1B },
|
||||
{ "Key: Y", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x1C },
|
||||
{ "Key: Z", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x1D },
|
||||
{ "Key: 1", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x1E },
|
||||
{ "Key: 2", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x1F },
|
||||
{ "Key: 3", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x20 },
|
||||
{ "Key: 4", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x21 },
|
||||
{ "Key: 5", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x22 },
|
||||
{ "Key: 6", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x23 },
|
||||
{ "Key: 7", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x24 },
|
||||
{ "Key: 8", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x25 },
|
||||
{ "Key: 9", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x26 },
|
||||
{ "Key: 0", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x27 },
|
||||
{ "Key: Enter", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x28 },
|
||||
{ "Key: Escape", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x29 },
|
||||
{ "Key: Backspace", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x2A },
|
||||
{ "Key: Tab", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x2B },
|
||||
{ "Key: Space", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x2C },
|
||||
{ "Key: -", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x2D },
|
||||
{ "Key: =", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x2E },
|
||||
{ "Key: [", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x2F },
|
||||
{ "Key: ]", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x30 },
|
||||
{ "Key: \\ (ANSI)", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x31 },//ANSI only
|
||||
{ "Key: #", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x32 },//ISO only
|
||||
{ "Key: ;", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x33 },
|
||||
{ "Key: '", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x34 },
|
||||
{ "Key: `", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x35 },
|
||||
{ "Key: ,", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x36 },
|
||||
{ "Key: .", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x37 },
|
||||
{ "Key: /", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x38 },
|
||||
{ "Key: Caps Lock", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x39 },
|
||||
{ "Key: F1", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x3A },
|
||||
{ "Key: F2", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x3B },
|
||||
{ "Key: F3", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x3C },
|
||||
{ "Key: F4", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x3D },
|
||||
{ "Key: F5", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x3E },
|
||||
{ "Key: F6", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x3F },
|
||||
{ "Key: F7", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x40 },
|
||||
{ "Key: F8", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x41 },
|
||||
{ "Key: F9", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x42 },
|
||||
{ "Key: F10", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x43 },
|
||||
{ "Key: F11", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x44 },
|
||||
{ "Key: F12", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x45 },
|
||||
{ "Key: Print Screen", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x46 },
|
||||
{ "Key: Scroll Lock", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x47 },
|
||||
{ "Key: Pause/Break", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x48 },
|
||||
{ "Key: Insert", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x49 },
|
||||
{ "Key: Home", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x4A },
|
||||
{ "Key: Page Up", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x4B },
|
||||
{ "Key: Delete", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x4C },
|
||||
{ "Key: End", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x4D },
|
||||
{ "Key: Page Down", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x4E },
|
||||
{ "Key: Right Arrow", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x4F },
|
||||
{ "Key: Left Arrow", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x50 },
|
||||
{ "Key: Down Arrow", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x51 },
|
||||
{ "Key: Up Arrow", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x52 },
|
||||
{ "Key: Num Lock", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x53 },
|
||||
{ "Key: Number Pad /", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x54 },
|
||||
{ "Key: Number Pad *", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x55 },
|
||||
{ "Key: Number Pad -", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x56 },
|
||||
{ "Key: Number Pad +", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x57 },
|
||||
{ "Key: Number Pad Enter", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x58 },
|
||||
{ "Key: Number Pad 1", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x59 },
|
||||
{ "Key: Number Pad 2", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x5A },
|
||||
{ "Key: Number Pad 3", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x5B },
|
||||
{ "Key: Number Pad 4", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x5C },
|
||||
{ "Key: Number Pad 5", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x5D },
|
||||
{ "Key: Number Pad 6", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x5E },
|
||||
{ "Key: Number Pad 7", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x5F },
|
||||
{ "Key: Number Pad 8", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x60 },
|
||||
{ "Key: Number Pad 9", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x61 },
|
||||
{ "Key: Number Pad 0", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x62 },
|
||||
{ "Key: Number Pad .", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x63 },
|
||||
{ "Key: \\ (ISO)", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x64 },//ISO only
|
||||
{ "Key: Menu", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0x65 },
|
||||
{ "Key: Left Control", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0xE0 },
|
||||
{ "Key: Left Shift", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0xE1 },
|
||||
{ "Key: Left Alt", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0xE2 },
|
||||
{ "Key: Left Windows", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0xE3 },
|
||||
{ "Key: Right Control", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0xE4 },
|
||||
{ "Key: Right Shift", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0xE5 },
|
||||
{ "Key: Right Alt", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0xE6 },
|
||||
{ "Key: Right Windows", LOGITECH_G910_ZONE_DIRECT_KEYBOARD, 0xE7 },
|
||||
{ "Key: G1", LOGITECH_G910_ZONE_DIRECT_GKEYS, 0x01 },
|
||||
{ "Key: G2", LOGITECH_G910_ZONE_DIRECT_GKEYS, 0x02 },
|
||||
{ "Key: G3", LOGITECH_G910_ZONE_DIRECT_GKEYS, 0x03 },
|
||||
{ "Key: G4", LOGITECH_G910_ZONE_DIRECT_GKEYS, 0x04 },
|
||||
{ "Key: G5", LOGITECH_G910_ZONE_DIRECT_GKEYS, 0x05 },
|
||||
{ "Key: G6", LOGITECH_G910_ZONE_DIRECT_GKEYS, 0x06 },
|
||||
{ "Key: G7", LOGITECH_G910_ZONE_DIRECT_GKEYS, 0x07 },
|
||||
{ "Key: G8", LOGITECH_G910_ZONE_DIRECT_GKEYS, 0x08 },
|
||||
{ "Key: G9", LOGITECH_G910_ZONE_DIRECT_GKEYS, 0x09 },
|
||||
{ "Logo", LOGITECH_G910_ZONE_DIRECT_LOGO, 0x01 },
|
||||
{ "Nameplate", LOGITECH_G910_ZONE_DIRECT_LOGO, 0x02 },
|
||||
};
|
||||
|
||||
RGBController_LogitechG910::RGBController_LogitechG910(LogitechG910Controller* logitech_ptr)
|
||||
{
|
||||
logitech = logitech_ptr;
|
||||
|
||||
name = "Logitech Keyboard Device";
|
||||
vendor = "Logitech";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "Logitech Keyboard Device";
|
||||
serial = logitech->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0xFFFF;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = LOGITECH_G910_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Static.colors_min = 1;
|
||||
Static.colors_max = 1;
|
||||
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Static.colors.resize(1);
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = LOGITECH_G910_MODE_OFF;
|
||||
Off.flags = 0;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
mode Cycle;
|
||||
Cycle.name = "Cycle";
|
||||
Cycle.value = LOGITECH_G910_MODE_CYCLE;
|
||||
Cycle.flags = MODE_FLAG_HAS_SPEED;
|
||||
Cycle.color_mode = MODE_COLORS_NONE;
|
||||
Cycle.speed_min = LOGITECH_G910_SPEED_SLOWEST;
|
||||
Cycle.speed_max = LOGITECH_G910_SPEED_FASTEST;
|
||||
Cycle.speed = LOGITECH_G910_SPEED_NORMAL;
|
||||
modes.push_back(Cycle);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = LOGITECH_G910_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED;
|
||||
Breathing.colors_min = 1;
|
||||
Breathing.colors_max = 1;
|
||||
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Breathing.colors.resize(1);
|
||||
Breathing.speed_min = LOGITECH_G910_SPEED_SLOWEST;
|
||||
Breathing.speed_max = LOGITECH_G910_SPEED_FASTEST;
|
||||
Breathing.speed = LOGITECH_G910_SPEED_NORMAL;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_LogitechG910::~RGBController_LogitechG910()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Delete the matrix map |
|
||||
\*---------------------------------------------------------*/
|
||||
for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++)
|
||||
{
|
||||
if(zones[zone_index].matrix_map != NULL)
|
||||
{
|
||||
delete zones[zone_index].matrix_map;
|
||||
}
|
||||
}
|
||||
|
||||
delete logitech;
|
||||
}
|
||||
|
||||
void RGBController_LogitechG910::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zones |
|
||||
\*---------------------------------------------------------*/
|
||||
unsigned int total_led_count = 0;
|
||||
for(unsigned int zone_idx = 0; zone_idx < 1; zone_idx++)
|
||||
{
|
||||
zone new_zone;
|
||||
new_zone.name = zone_names[zone_idx];
|
||||
new_zone.type = zone_types[zone_idx];
|
||||
new_zone.leds_min = zone_sizes[zone_idx];
|
||||
new_zone.leds_max = zone_sizes[zone_idx];
|
||||
new_zone.leds_count = zone_sizes[zone_idx];
|
||||
|
||||
if(zone_types[zone_idx] == ZONE_TYPE_MATRIX)
|
||||
{
|
||||
new_zone.matrix_map = new matrix_map_type;
|
||||
new_zone.matrix_map->height = 8;
|
||||
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 += zone_sizes[zone_idx];
|
||||
}
|
||||
|
||||
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = led_names[led_idx].name;
|
||||
new_led.value = ( led_names[led_idx].zone << 8 ) + led_names[led_idx].idx;
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_LogitechG910::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_LogitechG910::DeviceUpdateLEDs()
|
||||
{
|
||||
#define MAX_FRAMES_PER_PACKET 0x0E
|
||||
|
||||
unsigned char frame_buf[MAX_FRAMES_PER_PACKET * 4];
|
||||
unsigned char frame_cnt = 0;
|
||||
unsigned char prev_zone = 0;
|
||||
unsigned char zone = 0;
|
||||
unsigned char idx = 0;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| TODO: Send packets with multiple LED frames |
|
||||
\*---------------------------------------------------------*/
|
||||
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
||||
{
|
||||
zone = ( leds[led_idx].value >> 8 );
|
||||
idx = ( leds[led_idx].value & 0xFF );
|
||||
|
||||
if((zone != prev_zone) && (frame_cnt != 0))
|
||||
{
|
||||
logitech->SetDirect(prev_zone, frame_cnt, frame_buf);
|
||||
frame_cnt = 0;
|
||||
}
|
||||
|
||||
frame_buf[(frame_cnt * 4) + 0] = idx;
|
||||
frame_buf[(frame_cnt * 4) + 1] = RGBGetRValue(colors[led_idx]);
|
||||
frame_buf[(frame_cnt * 4) + 2] = RGBGetGValue(colors[led_idx]);
|
||||
frame_buf[(frame_cnt * 4) + 3] = RGBGetBValue(colors[led_idx]);
|
||||
|
||||
frame_cnt++;
|
||||
prev_zone = zone;
|
||||
|
||||
if(frame_cnt == MAX_FRAMES_PER_PACKET)
|
||||
{
|
||||
logitech->SetDirect(prev_zone, frame_cnt, frame_buf);
|
||||
frame_cnt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(frame_cnt != 0)
|
||||
{
|
||||
logitech->SetDirect(prev_zone, frame_cnt, frame_buf);
|
||||
}
|
||||
|
||||
logitech->Commit();
|
||||
}
|
||||
|
||||
void RGBController_LogitechG910::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_LogitechG910::UpdateSingleLED(int led)
|
||||
{
|
||||
unsigned char frame[4];
|
||||
unsigned char zone;
|
||||
unsigned char idx;
|
||||
|
||||
zone = ( leds[led].value >> 8 );
|
||||
idx = ( leds[led].value & 0xFF );
|
||||
|
||||
frame[0] = idx;
|
||||
frame[1] = RGBGetRValue(colors[led]);
|
||||
frame[2] = RGBGetGValue(colors[led]);
|
||||
frame[3] = RGBGetBValue(colors[led]);
|
||||
|
||||
logitech->SetDirect(zone, 1, frame);
|
||||
logitech->Commit();
|
||||
}
|
||||
|
||||
void RGBController_LogitechG910::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_LogitechG910::DeviceUpdateMode()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Direct mode does not send a mode packet |
|
||||
| Call UpdateLEDs to send direct packet |
|
||||
\*---------------------------------------------------------*/
|
||||
if(active_mode == 0xFFFF)
|
||||
{
|
||||
UpdateLEDs();
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned char red = 0;
|
||||
unsigned char grn = 0;
|
||||
unsigned char blu = 0;
|
||||
|
||||
if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
|
||||
{
|
||||
red = RGBGetRValue(modes[active_mode].colors[0]);
|
||||
grn = RGBGetGValue(modes[active_mode].colors[0]);
|
||||
blu = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
}
|
||||
|
||||
logitech->SetMode(modes[active_mode].value, modes[active_mode].speed, red, grn, blu);
|
||||
}
|
||||
@@ -1,149 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_LogitechGLightsync.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for |
|
||||
| Logitech G Lightsync Devices |
|
||||
| |
|
||||
| TheRogueZeta 04/21/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_LogitechGLightsync.h"
|
||||
|
||||
RGBController_LogitechGLightsync::RGBController_LogitechGLightsync(LogitechGLightsyncController* logitech_ptr)
|
||||
{
|
||||
logitech = logitech_ptr;
|
||||
|
||||
name = "Logitech G Lightsync Mouse";
|
||||
vendor = "Logitech";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = "Logitech G Lightsync Mouse";
|
||||
location = logitech->GetDeviceLocation();
|
||||
serial = logitech->GetSerialString();
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = LOGITECH_G_LIGHTSYNC_MODE_OFF;
|
||||
Off.flags = 0;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0xFF;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = LOGITECH_G_LIGHTSYNC_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 = "Spectrum Cycle";
|
||||
Cycle.value = LOGITECH_G_LIGHTSYNC_MODE_CYCLE;
|
||||
Cycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Cycle.color_mode = MODE_COLORS_NONE;
|
||||
Cycle.speed_min = LOGITECH_G_LIGHTSYNC_SPEED_SLOWEST;
|
||||
Cycle.speed_max = LOGITECH_G_LIGHTSYNC_SPEED_FASTEST;
|
||||
Cycle.speed = LOGITECH_G_LIGHTSYNC_SPEED_NORMAL;
|
||||
modes.push_back(Cycle);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = LOGITECH_G_LIGHTSYNC_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.speed_min = LOGITECH_G_LIGHTSYNC_SPEED_SLOWEST;
|
||||
Breathing.speed_max = LOGITECH_G_LIGHTSYNC_SPEED_FASTEST;
|
||||
Breathing.speed = LOGITECH_G_LIGHTSYNC_SPEED_NORMAL;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_LogitechGLightsync::~RGBController_LogitechGLightsync()
|
||||
{
|
||||
delete logitech;
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync::SetupZones()
|
||||
{
|
||||
zone GLightsync_primary_zone;
|
||||
GLightsync_primary_zone.name = "DPI";
|
||||
GLightsync_primary_zone.type = ZONE_TYPE_SINGLE;
|
||||
GLightsync_primary_zone.leds_min = 1;
|
||||
GLightsync_primary_zone.leds_max = 1;
|
||||
GLightsync_primary_zone.leds_count = 1;
|
||||
GLightsync_primary_zone.matrix_map = NULL;
|
||||
zones.push_back(GLightsync_primary_zone);
|
||||
|
||||
led GLightsync_primary_led;
|
||||
GLightsync_primary_led.name = "DPI";
|
||||
leds.push_back(GLightsync_primary_led);
|
||||
|
||||
zone GLightsync_logo_zone;
|
||||
GLightsync_logo_zone.name = "Logo";
|
||||
GLightsync_logo_zone.type = ZONE_TYPE_SINGLE;
|
||||
GLightsync_logo_zone.leds_min = 1;
|
||||
GLightsync_logo_zone.leds_max = 1;
|
||||
GLightsync_logo_zone.leds_count = 1;
|
||||
GLightsync_logo_zone.matrix_map = NULL;
|
||||
zones.push_back(GLightsync_logo_zone);
|
||||
|
||||
led GLightsync_logo_led;
|
||||
GLightsync_logo_led.name = "Logo";
|
||||
leds.push_back(GLightsync_logo_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync::DeviceUpdateLEDs()
|
||||
{
|
||||
UpdateZoneLEDs(0);
|
||||
UpdateZoneLEDs(1);
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[zone]);
|
||||
unsigned char grn = RGBGetGValue(colors[zone]);
|
||||
unsigned char blu = RGBGetBValue(colors[zone]);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Replace direct mode with static when sending to controller|
|
||||
\*---------------------------------------------------------*/
|
||||
unsigned char temp_mode = (modes[active_mode].value != 0xFF) ? modes[active_mode].value : LOGITECH_G_LIGHTSYNC_MODE_STATIC;
|
||||
|
||||
logitech->UpdateMouseLED(temp_mode, modes[active_mode].speed, zone, red, grn, blu, /* Brightness */ 0x64);
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync::UpdateSingleLED(int led)
|
||||
{
|
||||
UpdateZoneLEDs(led);
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync::SetCustomMode()
|
||||
{
|
||||
active_mode = 1;
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync::DeviceUpdateMode()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| If direct mode is true, then sent the packet to put the |
|
||||
| mouse in direct mode. This code will only be called when |
|
||||
| we change modes as to not spam the device. |
|
||||
\*---------------------------------------------------------*/
|
||||
logitech->SetDirectMode(modes[active_mode].value == 0xFF);
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_LogitechGLightsync1zone.cpp|
|
||||
| |
|
||||
| Generic RGB Interface for single zone |
|
||||
| Logitech G Lightsync Devices |
|
||||
| |
|
||||
| TheRogueZeta 04/21/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_LogitechGLightsync1zone.h"
|
||||
|
||||
RGBController_LogitechGLightsync1zone::RGBController_LogitechGLightsync1zone(LogitechGLightsyncController* logitech_ptr)
|
||||
{
|
||||
logitech = logitech_ptr;
|
||||
|
||||
name = "Logitech G Lightsync Mouse Single Zone";
|
||||
vendor = "Logitech";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = "Logitech G Lightsync Mouse Single Zone";
|
||||
location = logitech->GetDeviceLocation();
|
||||
serial = logitech->GetSerialString();
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = LOGITECH_G_LIGHTSYNC_MODE_OFF;
|
||||
Off.flags = 0;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0xFF;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = LOGITECH_G_LIGHTSYNC_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 = "Spectrum Cycle";
|
||||
Cycle.value = LOGITECH_G_LIGHTSYNC_MODE_CYCLE;
|
||||
Cycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Cycle.color_mode = MODE_COLORS_NONE;
|
||||
Cycle.speed_min = LOGITECH_G_LIGHTSYNC_SPEED_SLOWEST;
|
||||
Cycle.speed_max = LOGITECH_G_LIGHTSYNC_SPEED_FASTEST;
|
||||
Cycle.speed = LOGITECH_G_LIGHTSYNC_SPEED_NORMAL;
|
||||
modes.push_back(Cycle);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = LOGITECH_G_LIGHTSYNC_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.speed_min = LOGITECH_G_LIGHTSYNC_SPEED_SLOWEST;
|
||||
Breathing.speed_max = LOGITECH_G_LIGHTSYNC_SPEED_FASTEST;
|
||||
Breathing.speed = LOGITECH_G_LIGHTSYNC_SPEED_NORMAL;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_LogitechGLightsync1zone::~RGBController_LogitechGLightsync1zone()
|
||||
{
|
||||
delete logitech;
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync1zone::SetupZones()
|
||||
{
|
||||
zone GLightsync_logo_zone;
|
||||
GLightsync_logo_zone.name = "Logo";
|
||||
GLightsync_logo_zone.type = ZONE_TYPE_SINGLE;
|
||||
GLightsync_logo_zone.leds_min = 1;
|
||||
GLightsync_logo_zone.leds_max = 1;
|
||||
GLightsync_logo_zone.leds_count = 1;
|
||||
GLightsync_logo_zone.matrix_map = NULL;
|
||||
zones.push_back(GLightsync_logo_zone);
|
||||
|
||||
led GLightsync_logo_led;
|
||||
GLightsync_logo_led.name = "Logo";
|
||||
leds.push_back(GLightsync_logo_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync1zone::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync1zone::DeviceUpdateLEDs()
|
||||
{
|
||||
UpdateZoneLEDs(0);
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync1zone::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[zone]);
|
||||
unsigned char grn = RGBGetGValue(colors[zone]);
|
||||
unsigned char blu = RGBGetBValue(colors[zone]);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Replace direct mode with static when sending to controller|
|
||||
\*---------------------------------------------------------*/
|
||||
unsigned char temp_mode = (modes[active_mode].value != 0xFF) ? modes[active_mode].value : LOGITECH_G_LIGHTSYNC_MODE_STATIC;
|
||||
|
||||
logitech->UpdateMouseLED(temp_mode, modes[active_mode].speed, zone, red, grn, blu, /* Brightness */ 0x64);
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync1zone::UpdateSingleLED(int led)
|
||||
{
|
||||
UpdateZoneLEDs(led);
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync1zone::SetCustomMode()
|
||||
{
|
||||
active_mode = 1;
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync1zone::DeviceUpdateMode()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| If direct mode is true, then sent the packet to put the |
|
||||
| mouse in direct mode. This code will only be called when |
|
||||
| we change modes as to not spam the device. |
|
||||
\*---------------------------------------------------------*/
|
||||
logitech->SetDirectMode(modes[active_mode].value == 0xFF);
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
@@ -9,56 +9,49 @@
|
||||
|
||||
#include "RGBController_LogitechGPowerPlay.h"
|
||||
|
||||
RGBController_LogitechGPowerPlay::RGBController_LogitechGPowerPlay(LogitechGLightsyncController* logitech_ptr)
|
||||
RGBController_LogitechGPowerPlay::RGBController_LogitechGPowerPlay(LogitechGPowerPlayController* logitech_ptr)
|
||||
{
|
||||
logitech = logitech_ptr;
|
||||
logitech = logitech_ptr;
|
||||
|
||||
name = "Logitech G PowerPlay Wireless Charging System";
|
||||
vendor = "Logitech";
|
||||
type = DEVICE_TYPE_MOUSEMAT;
|
||||
description = "Logitech G PowerPlay Wireless Charging System";
|
||||
location = logitech->GetDeviceLocation();
|
||||
serial = logitech->GetSerialString();
|
||||
name = "Logitech G PowerPlay Wireless Charging System";
|
||||
vendor = "Logitech";
|
||||
type = DEVICE_TYPE_MOUSEMAT;
|
||||
description = "Logitech G PowerPlay Wireless Charging System";
|
||||
location = logitech->GetDeviceLocation();
|
||||
serial = logitech->GetSerialString();
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = LOGITECH_G_LIGHTSYNC_MODE_OFF;
|
||||
Off.flags = 0;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
Off.name = "Off";
|
||||
Off.value = LOGITECH_G_POWERPLAY_MODE_OFF;
|
||||
Off.flags = 0;
|
||||
Off.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Off);
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0xFF;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = LOGITECH_G_LIGHTSYNC_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
Static.name = "Static";
|
||||
Static.value = LOGITECH_G_POWERPLAY_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 = "Spectrum Cycle";
|
||||
Cycle.value = LOGITECH_G_LIGHTSYNC_MODE_CYCLE;
|
||||
Cycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Cycle.color_mode = MODE_COLORS_NONE;
|
||||
Cycle.speed_min = LOGITECH_G_LIGHTSYNC_SPEED_SLOWEST;
|
||||
Cycle.speed_max = LOGITECH_G_LIGHTSYNC_SPEED_FASTEST;
|
||||
Cycle.speed = LOGITECH_G_LIGHTSYNC_SPEED_NORMAL;
|
||||
Cycle.name = "Cycle";
|
||||
Cycle.value = LOGITECH_G_POWERPLAY_MODE_CYCLE;
|
||||
Cycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Cycle.color_mode = MODE_COLORS_PER_LED;
|
||||
Cycle.speed_min = LOGITECH_G_POWERPLAY_SPEED_SLOWEST;
|
||||
Cycle.speed_max = LOGITECH_G_POWERPLAY_SPEED_FASTEST;
|
||||
Cycle.speed = LOGITECH_G_POWERPLAY_SPEED_NORMAL;
|
||||
modes.push_back(Cycle);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = LOGITECH_G_LIGHTSYNC_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.speed_min = LOGITECH_G_LIGHTSYNC_SPEED_SLOWEST;
|
||||
Breathing.speed_max = LOGITECH_G_LIGHTSYNC_SPEED_FASTEST;
|
||||
Breathing.speed = LOGITECH_G_LIGHTSYNC_SPEED_NORMAL;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = LOGITECH_G_POWERPLAY_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.speed_min = LOGITECH_G_POWERPLAY_SPEED_SLOWEST;
|
||||
Breathing.speed_max = LOGITECH_G_POWERPLAY_SPEED_FASTEST;
|
||||
Breathing.speed = LOGITECH_G_POWERPLAY_SPEED_NORMAL;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
SetupZones();
|
||||
@@ -105,12 +98,7 @@ void RGBController_LogitechGPowerPlay::UpdateZoneLEDs(int zone)
|
||||
unsigned char grn = RGBGetGValue(colors[zone]);
|
||||
unsigned char blu = RGBGetBValue(colors[zone]);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Replace direct mode with static when sending to controller|
|
||||
\*---------------------------------------------------------*/
|
||||
unsigned char temp_mode = (modes[active_mode].value != 0xFF) ? modes[active_mode].value : LOGITECH_G_LIGHTSYNC_MODE_STATIC;
|
||||
|
||||
logitech->UpdateMouseLED(temp_mode, modes[active_mode].speed, zone, red, grn, blu, /* Brightness */ 0x64);
|
||||
logitech->SendMouseMatMode(modes[active_mode].value, modes[active_mode].speed, zone, red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_LogitechGPowerPlay::UpdateSingleLED(int led)
|
||||
@@ -120,16 +108,10 @@ void RGBController_LogitechGPowerPlay::UpdateSingleLED(int led)
|
||||
|
||||
void RGBController_LogitechGPowerPlay::SetCustomMode()
|
||||
{
|
||||
active_mode = 1;
|
||||
|
||||
}
|
||||
|
||||
void RGBController_LogitechGPowerPlay::DeviceUpdateMode()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| If direct mode is true, then sent the packet to put the |
|
||||
| mouse in direct mode. This code will only be called when |
|
||||
| we change modes as to not spam the device. |
|
||||
\*---------------------------------------------------------*/
|
||||
logitech->SetDirectMode(modes[active_mode].value == 0xFF);
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "LogitechGLightsyncController.h"
|
||||
#include "LogitechGPowerPlayController.h"
|
||||
|
||||
class RGBController_LogitechGPowerPlay : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_LogitechGPowerPlay(LogitechGLightsyncController* logitech_ptr);
|
||||
RGBController_LogitechGPowerPlay(LogitechGPowerPlayController* logitech_ptr);
|
||||
~RGBController_LogitechGPowerPlay();
|
||||
|
||||
void SetupZones();
|
||||
@@ -29,5 +29,5 @@ public:
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
LogitechGLightsyncController* logitech;
|
||||
LogitechGPowerPlayController* logitech;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_LogitechGProWireless.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for |
|
||||
| Logitech G Pro Wireless Gaming Mouse |
|
||||
| |
|
||||
| TheRogueZeta 8/5/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_LogitechGProWireless.h"
|
||||
|
||||
RGBController_LogitechGProWireless::RGBController_LogitechGProWireless(LogitechGProWirelessController* logitech_ptr)
|
||||
{
|
||||
logitech = logitech_ptr;
|
||||
|
||||
name = "Logitech G Pro Wireless Gaming Mouse";
|
||||
vendor = "Logitech";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = "Logitech G Pro Wireless Gaming Mouse";
|
||||
location = logitech->GetDeviceLocation();
|
||||
serial = logitech->GetSerialString();
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = LOGITECH_G_PRO_WIRELESS_MODE_OFF;
|
||||
Off.flags = 0;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = LOGITECH_G_PRO_WIRELESS_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_G_PRO_WIRELESS_MODE_CYCLE;
|
||||
Cycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Cycle.color_mode = MODE_COLORS_NONE;
|
||||
Cycle.speed_min = LOGITECH_G_PRO_WIRELESS_SPEED_SLOWEST;
|
||||
Cycle.speed_max = LOGITECH_G_PRO_WIRELESS_SPEED_FASTEST;
|
||||
Cycle.speed = LOGITECH_G_PRO_WIRELESS_SPEED_NORMAL;
|
||||
modes.push_back(Cycle);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = LOGITECH_G_PRO_WIRELESS_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.speed_min = LOGITECH_G_PRO_WIRELESS_SPEED_SLOWEST;
|
||||
Breathing.speed_max = LOGITECH_G_PRO_WIRELESS_SPEED_FASTEST;
|
||||
Breathing.speed = LOGITECH_G_PRO_WIRELESS_SPEED_NORMAL;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_LogitechGProWireless::~RGBController_LogitechGProWireless()
|
||||
{
|
||||
delete logitech;
|
||||
}
|
||||
|
||||
void RGBController_LogitechGProWireless::SetupZones()
|
||||
{
|
||||
zone GProWireless_primary_zone;
|
||||
GProWireless_primary_zone.name = "DPI";
|
||||
GProWireless_primary_zone.type = ZONE_TYPE_SINGLE;
|
||||
GProWireless_primary_zone.leds_min = 1;
|
||||
GProWireless_primary_zone.leds_max = 1;
|
||||
GProWireless_primary_zone.leds_count = 1;
|
||||
GProWireless_primary_zone.matrix_map = NULL;
|
||||
zones.push_back(GProWireless_primary_zone);
|
||||
|
||||
led GProWireless_primary_led;
|
||||
GProWireless_primary_led.name = "DPI";
|
||||
leds.push_back(GProWireless_primary_led);
|
||||
|
||||
zone GProWireless_logo_zone;
|
||||
GProWireless_logo_zone.name = "Logo";
|
||||
GProWireless_logo_zone.type = ZONE_TYPE_SINGLE;
|
||||
GProWireless_logo_zone.leds_min = 1;
|
||||
GProWireless_logo_zone.leds_max = 1;
|
||||
GProWireless_logo_zone.leds_count = 1;
|
||||
GProWireless_logo_zone.matrix_map = NULL;
|
||||
zones.push_back(GProWireless_logo_zone);
|
||||
|
||||
led GProWireless_logo_led;
|
||||
GProWireless_logo_led.name = "Logo";
|
||||
leds.push_back(GProWireless_logo_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_LogitechGProWireless::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_LogitechGProWireless::DeviceUpdateLEDs()
|
||||
{
|
||||
UpdateZoneLEDs(0);
|
||||
UpdateZoneLEDs(1);
|
||||
}
|
||||
|
||||
void RGBController_LogitechGProWireless::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_LogitechGProWireless::UpdateSingleLED(int led)
|
||||
{
|
||||
UpdateZoneLEDs(led);
|
||||
}
|
||||
|
||||
void RGBController_LogitechGProWireless::SetCustomMode()
|
||||
{
|
||||
active_mode = 1;
|
||||
}
|
||||
|
||||
void RGBController_LogitechGProWireless::DeviceUpdateMode()
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
+8
-8
@@ -1,21 +1,21 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_LogitechGLightsync.h |
|
||||
| RGBController_LogitechGProWireless.h |
|
||||
| |
|
||||
| Generic RGB Interface for |
|
||||
| Logitech G Lightsync Devices |
|
||||
| Logitech G Pro Wireless Gaming Mouse |
|
||||
| |
|
||||
| TheRogueZeta 04/21/2021 |
|
||||
| TheRogueZeta 8/5/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "LogitechGLightsyncController.h"
|
||||
#include "LogitechGProWirelessController.h"
|
||||
|
||||
class RGBController_LogitechGLightsync : public RGBController
|
||||
class RGBController_LogitechGProWireless : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_LogitechGLightsync(LogitechGLightsyncController* logitech_ptr);
|
||||
~RGBController_LogitechGLightsync();
|
||||
RGBController_LogitechGProWireless(LogitechGProWirelessController* logitech_ptr);
|
||||
~RGBController_LogitechGProWireless();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
@@ -29,5 +29,5 @@ public:
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
LogitechGLightsyncController* logitech;
|
||||
LogitechGProWirelessController* logitech;
|
||||
};
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "MSIMysticLight185Controller.h"
|
||||
#include "RGBController_MSIMysticLight162.h"
|
||||
#include "RGBController_MSIMysticLight185.h"
|
||||
#include "dependencies/dmiinfo.h"
|
||||
|
||||
#define MSI_USB_VID 0x1462
|
||||
|
||||
@@ -24,16 +23,15 @@
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectMSIMysticLight162Controllers(hid_device_info* info, const std::string& /*name*/)
|
||||
void DetectMSIMysticLight162Controllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if( dev )
|
||||
{
|
||||
DMIInfo dmi;
|
||||
MSIMysticLight162Controller* controller = new MSIMysticLight162Controller(dev, info->path);
|
||||
RGBController_MSIMysticLight162* rgb_controller = new RGBController_MSIMysticLight162(controller);
|
||||
rgb_controller->name = "MSI " + dmi.getMainboard();
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
} /* DetectMSIMysticLight162Controllers() */
|
||||
@@ -46,16 +44,15 @@ void DetectMSIMysticLight162Controllers(hid_device_info* info, const std::string
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectMSIMysticLight185Controllers(hid_device_info* info, const std::string& /*name*/)
|
||||
void DetectMSIMysticLight185Controllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if( dev )
|
||||
{
|
||||
DMIInfo dmi;
|
||||
MSIMysticLight185Controller* controller = new MSIMysticLight185Controller(dev, info->path);
|
||||
RGBController_MSIMysticLight185* rgb_controller = new RGBController_MSIMysticLight185(controller);
|
||||
rgb_controller->name = "MSI " + dmi.getMainboard();
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
} /* DetectMSIMysticLight185Controllers() */
|
||||
@@ -85,8 +82,6 @@ REGISTER_HID_DETECTOR_PU("MSI Mystic Light MS_7C90", DetectMSIMysticLight185C
|
||||
REGISTER_HID_DETECTOR_PU("MSI Mystic Light MS_7C91", DetectMSIMysticLight185Controllers, MSI_USB_VID, 0x7C91, 0x0001, 0x00);
|
||||
REGISTER_HID_DETECTOR_PU("MSI Mystic Light MS_7C92", DetectMSIMysticLight185Controllers, MSI_USB_VID, 0x7C92, 0x0001, 0x00);
|
||||
REGISTER_HID_DETECTOR_PU("MSI Mystic Light MS_7C94", DetectMSIMysticLight185Controllers, MSI_USB_VID, 0x7C94, 0x0001, 0x00);
|
||||
REGISTER_HID_DETECTOR_PU("MSI Mystic Light MS_7D09", DetectMSIMysticLight185Controllers, MSI_USB_VID, 0x7D09, 0x0001, 0x00);
|
||||
REGISTER_HID_DETECTOR_PU("MSI Mystic Light MS_7D13", DetectMSIMysticLight185Controllers, MSI_USB_VID, 0x7D13, 0x0001, 0x00);
|
||||
|
||||
#ifdef ENABLE_UNTESTED_MYSTIC_LIGHT
|
||||
/*-------------------------------------------------------------*\
|
||||
|
||||
@@ -106,7 +106,7 @@ void DetectMSIRGBControllers(std::vector<RGBController*> &rgb_controllers)
|
||||
{
|
||||
MSIRGBController* new_msi = new MSIRGBController(sioaddr, compatible_devices[i].invert);
|
||||
RGBController_MSIRGB* new_rgb = new RGBController_MSIRGB(new_msi);
|
||||
new_rgb->name = "MSI " + board_dmi;
|
||||
|
||||
rgb_controllers.push_back(new_rgb);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3114,11 +3114,11 @@ static const razer_device diamondback_chroma_device =
|
||||
| |
|
||||
| Zone "Right" |
|
||||
| Linear |
|
||||
| 7 LEDs |
|
||||
| 8 LEDs |
|
||||
| |
|
||||
| Zone "Left" |
|
||||
| Linear |
|
||||
| 7 LEDs |
|
||||
| 8 LEDs |
|
||||
| |
|
||||
| Zone "Logo" |
|
||||
| Single |
|
||||
@@ -3133,7 +3133,7 @@ static const razer_zone lancehead_te_right_zone =
|
||||
"Right LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
7
|
||||
8
|
||||
};
|
||||
|
||||
static const razer_zone lancehead_te_left_zone =
|
||||
@@ -3141,7 +3141,7 @@ static const razer_zone lancehead_te_left_zone =
|
||||
"Left LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
7
|
||||
8
|
||||
};
|
||||
|
||||
static const razer_zone lancehead_te_logo_zone =
|
||||
@@ -3166,7 +3166,7 @@ static const razer_device lancehead_te_device =
|
||||
DEVICE_TYPE_MOUSE,
|
||||
true,
|
||||
1,
|
||||
16,
|
||||
18,
|
||||
{
|
||||
&lancehead_te_right_zone,
|
||||
&lancehead_te_left_zone,
|
||||
@@ -3184,11 +3184,11 @@ static const razer_device lancehead_te_device =
|
||||
| |
|
||||
| Zone "Right" |
|
||||
| Linear |
|
||||
| 7 LEDs |
|
||||
| 8 LEDs |
|
||||
| |
|
||||
| Zone "Left" |
|
||||
| Linear |
|
||||
| 7 LEDs |
|
||||
| 8 LEDs |
|
||||
| |
|
||||
| Zone "Logo" |
|
||||
| Single |
|
||||
@@ -3203,7 +3203,7 @@ static const razer_zone lancehead_v2_wired_right_zone =
|
||||
"Right LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
7
|
||||
8
|
||||
};
|
||||
|
||||
static const razer_zone lancehead_v2_wired_left_zone =
|
||||
@@ -3211,7 +3211,7 @@ static const razer_zone lancehead_v2_wired_left_zone =
|
||||
"Left LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
7
|
||||
8
|
||||
};
|
||||
|
||||
static const razer_zone lancehead_v2_wired_logo_zone =
|
||||
@@ -3236,7 +3236,7 @@ static const razer_device lancehead_v2_wired_device =
|
||||
DEVICE_TYPE_MOUSE,
|
||||
true,
|
||||
1,
|
||||
16,
|
||||
18,
|
||||
{
|
||||
&lancehead_v2_wired_right_zone,
|
||||
&lancehead_v2_wired_left_zone,
|
||||
@@ -3254,11 +3254,11 @@ static const razer_device lancehead_v2_wired_device =
|
||||
| |
|
||||
| Zone "Right" |
|
||||
| Linear |
|
||||
| 7 LEDs |
|
||||
| 8 LEDs |
|
||||
| |
|
||||
| Zone "Left" |
|
||||
| Linear |
|
||||
| 7 LEDs |
|
||||
| 8 LEDs |
|
||||
| |
|
||||
| Zone "Logo" |
|
||||
| Single |
|
||||
@@ -3273,7 +3273,7 @@ static const razer_zone lancehead_v2_wireless_right_zone =
|
||||
"Right LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
7
|
||||
8
|
||||
};
|
||||
|
||||
static const razer_zone lancehead_v2_wireless_left_zone =
|
||||
@@ -3281,7 +3281,7 @@ static const razer_zone lancehead_v2_wireless_left_zone =
|
||||
"Left LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
7
|
||||
8
|
||||
};
|
||||
|
||||
static const razer_zone lancehead_v2_wireless_logo_zone =
|
||||
@@ -3306,7 +3306,7 @@ static const razer_device lancehead_v2_wireless_device =
|
||||
DEVICE_TYPE_MOUSE,
|
||||
true,
|
||||
1,
|
||||
16,
|
||||
18,
|
||||
{
|
||||
&lancehead_v2_wireless_right_zone,
|
||||
&lancehead_v2_wireless_left_zone,
|
||||
|
||||
@@ -1,557 +0,0 @@
|
||||
/*-------------------------------------------------------------------*\
|
||||
| QMKRGBMatrixController.cpp |
|
||||
| |
|
||||
| Driver for QMK keybaords using RGB Matrix |
|
||||
| |
|
||||
| Kasper 10th Octobber 2020 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "QMKRGBMatrixController.h"
|
||||
#include <cstring>
|
||||
|
||||
QMKRGBMatrixController::QMKRGBMatrixController
|
||||
(
|
||||
hid_device* dev_handle,
|
||||
const char* path,
|
||||
unsigned short vendor_id
|
||||
)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
|
||||
unsigned int massdrop_vid = 0x04D8;
|
||||
// ATSAM (MD) boards will crash eventually if this is higher than 2
|
||||
}
|
||||
|
||||
QMKRGBMatrixController::~QMKRGBMatrixController()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string QMKRGBMatrixController::GetLocation()
|
||||
{
|
||||
return location;
|
||||
}
|
||||
|
||||
void QMKRGBMatrixController::DirectModeSetSingleLED(unsigned int led, unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
unsigned char usb_buf[33];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up config table request packet |
|
||||
\*-----------------------------------------------------*/
|
||||
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = QMK_RGBMATRIX_DIRECT_MODE_SET_SINGLE_LED;
|
||||
usb_buf[0x02] = led;
|
||||
usb_buf[0x03] = red;
|
||||
usb_buf[0x04] = green;
|
||||
usb_buf[0x05] = blue;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 33);
|
||||
hid_read(dev, usb_buf, 33);
|
||||
}
|
||||
|
||||
void QMKRGBMatrixController::DirectModeSetLEDs(std::vector<RGBColor> colors, unsigned int leds_count)
|
||||
{
|
||||
unsigned int leds_sent = 0;
|
||||
unsigned int leds_per_update = 20;
|
||||
|
||||
while(leds_sent < leds_count)
|
||||
{
|
||||
if((leds_count - leds_sent) < leds_per_update)
|
||||
{
|
||||
leds_per_update = leds_count - leds_sent;
|
||||
}
|
||||
|
||||
unsigned char usb_buf[65];
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up config table request packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = QMK_RGBMATRIX_DIRECT_MODE_SET_LEDS;
|
||||
usb_buf[0x02] = leds_sent;
|
||||
usb_buf[0x03] = leds_per_update;
|
||||
|
||||
for(unsigned int led_idx = 0; led_idx < leds_per_update; led_idx++)
|
||||
{
|
||||
usb_buf[(led_idx * 3) + 4] = RGBGetRValue(colors[led_idx + leds_sent]);
|
||||
usb_buf[(led_idx * 3) + 5] = RGBGetGValue(colors[led_idx + leds_sent]);
|
||||
usb_buf[(led_idx * 3) + 6] = RGBGetBValue(colors[led_idx + leds_sent]);
|
||||
}
|
||||
|
||||
hid_write(dev, usb_buf, 65);
|
||||
hid_read_timeout(dev, usb_buf, 65, 3);
|
||||
|
||||
leds_sent += leds_per_update;
|
||||
}
|
||||
}
|
||||
|
||||
RGBColor QMKRGBMatrixController::DirectModeGetLEDColor(unsigned int led)
|
||||
{
|
||||
unsigned char usb_buf[33];
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up config table request packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = QMK_RGBMATRIX_DIRECT_MODE_GET_LED_COLOR;
|
||||
usb_buf[0x02] = led;
|
||||
|
||||
do
|
||||
{
|
||||
hid_write(dev, (unsigned char*)usb_buf, 33);
|
||||
hid_read_timeout(dev, (unsigned char*)usb_buf, 33, 20);
|
||||
}
|
||||
while(usb_buf[0x00] != QMK_RGBMATRIX_DIRECT_MODE_GET_LED_COLOR);
|
||||
|
||||
return ToRGBColor(usb_buf[1], usb_buf[2], usb_buf[3]);
|
||||
}
|
||||
|
||||
void QMKRGBMatrixController::QMKModeSetModeAndSpeed(unsigned char mode, unsigned char speed)
|
||||
{
|
||||
unsigned char usb_buf[33];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up config table request packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = QMK_RGBMATRIX_QMK_MODE_SET_MODE_AND_SPEED;
|
||||
usb_buf[0x02] = mode;
|
||||
usb_buf[0x03] = speed;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 33);
|
||||
hid_read(dev, usb_buf, 33);
|
||||
}
|
||||
|
||||
void QMKRGBMatrixController::QMKModeSetColorModeAndSpeed(hsv_t hsv_color, unsigned char mode, unsigned char speed)
|
||||
{
|
||||
unsigned char usb_buf[33];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up config table request packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = QMK_RGBMATRIX_QMK_MODE_SET_COLOR_MODE_AND_SPEED;
|
||||
// qmk hue range is between 0-255, instead of the regular 0-359, so hue needs to be converted
|
||||
usb_buf[0x02] = hsv_color.hue * 255 / 359;
|
||||
usb_buf[0x03] = hsv_color.saturation;
|
||||
usb_buf[0x04] = hsv_color.value;
|
||||
usb_buf[0x05] = mode;
|
||||
usb_buf[0x06] = speed;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 33);
|
||||
hid_read(dev, usb_buf, 33);
|
||||
}
|
||||
|
||||
unsigned int QMKRGBMatrixController::QMKModeGetColor()
|
||||
{
|
||||
unsigned char usb_buf[33];
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up config table request packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = QMK_RGBMATRIX_QMK_MODE_GET_COLOR;
|
||||
|
||||
do
|
||||
{
|
||||
hid_write(dev, (unsigned char*)usb_buf, 33);
|
||||
hid_read_timeout(dev, (unsigned char*)usb_buf, 33, 20);
|
||||
}
|
||||
while(usb_buf[0x00] != QMK_RGBMATRIX_QMK_MODE_GET_COLOR);
|
||||
|
||||
// qmk hue range is between 0-255, instead of the regular 0-359, so hue needs to be converted
|
||||
unsigned int oldRange = 255;
|
||||
unsigned int newRange = 359;
|
||||
unsigned int convertedHue = (usb_buf[1] * newRange / oldRange);
|
||||
|
||||
hsv_t hsv;
|
||||
hsv.hue = convertedHue;
|
||||
hsv.saturation = usb_buf[2];
|
||||
hsv.value = usb_buf[3];
|
||||
|
||||
return hsv2rgb(&hsv);
|
||||
}
|
||||
|
||||
unsigned int QMKRGBMatrixController::GetProtocolVersion()
|
||||
{
|
||||
unsigned char usb_buf[33];
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up config table request packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = QMK_RGBMATRIX_GET_PROTOCOL_VERSION;
|
||||
|
||||
do
|
||||
{
|
||||
hid_write(dev, (unsigned char*)usb_buf, 33);
|
||||
hid_read_timeout(dev, (unsigned char*)usb_buf, 33, 20);
|
||||
}
|
||||
while(usb_buf[0x00] != QMK_RGBMATRIX_GET_PROTOCOL_VERSION);
|
||||
|
||||
return usb_buf[1];
|
||||
}
|
||||
|
||||
std::string QMKRGBMatrixController::GetDeviceName()
|
||||
{
|
||||
unsigned char usb_buf[33];
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up config table request packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = QMK_RGBMATRIX_GET_DEVICE_NAME;
|
||||
|
||||
do
|
||||
{
|
||||
hid_write(dev, (unsigned char*)usb_buf, 33);
|
||||
hid_read_timeout(dev, (unsigned char*)usb_buf, 33, 20);
|
||||
}
|
||||
while(usb_buf[0x00] != QMK_RGBMATRIX_GET_DEVICE_NAME);
|
||||
|
||||
int i = 1;
|
||||
std::string name;
|
||||
while(usb_buf[i] != 0)
|
||||
{
|
||||
name.push_back(usb_buf[i]);
|
||||
i++;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
std::string QMKRGBMatrixController::GetDeviceVendor()
|
||||
{
|
||||
unsigned char usb_buf[33];
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up config table request packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = QMK_RGBMATRIX_GET_DEVICE_VENDOR;
|
||||
|
||||
do
|
||||
{
|
||||
hid_write(dev, (unsigned char*)usb_buf, 33);
|
||||
hid_read_timeout(dev, (unsigned char*)usb_buf, 33, 20);
|
||||
}
|
||||
while(usb_buf[0x00] != QMK_RGBMATRIX_GET_DEVICE_VENDOR);
|
||||
|
||||
int i = 1;
|
||||
std::string vendor;
|
||||
while(usb_buf[i] != 0)
|
||||
{
|
||||
vendor.push_back(usb_buf[i]);
|
||||
i++;
|
||||
}
|
||||
|
||||
return vendor;
|
||||
}
|
||||
|
||||
bool QMKRGBMatrixController::GetEnabledModes(int mode)
|
||||
{
|
||||
unsigned char usb_buf[33];
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up config table request packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = QMK_RGBMATRIX_GET_ENABLED_MODES;
|
||||
usb_buf[0x02] = mode;
|
||||
|
||||
do
|
||||
{
|
||||
hid_write(dev, (unsigned char*)usb_buf, 33);
|
||||
hid_read_timeout(dev, (unsigned char*)usb_buf, 33, 20);
|
||||
}
|
||||
while(usb_buf[0x00] != QMK_RGBMATRIX_GET_ENABLED_MODES);
|
||||
|
||||
return usb_buf[1] == QMK_RGBMATRIX_SUCCESS ? true : false;
|
||||
}
|
||||
|
||||
unsigned int QMKRGBMatrixController::GetActiveMode()
|
||||
{
|
||||
unsigned char usb_buf[33];
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up config table request packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = QMK_RGBMATRIX_GET_ACTIVE_MODE;
|
||||
|
||||
do
|
||||
{
|
||||
hid_write(dev, (unsigned char*)usb_buf, 33);
|
||||
hid_read_timeout(dev, (unsigned char*)usb_buf, 33, 20);
|
||||
}
|
||||
while(usb_buf[0x00] != QMK_RGBMATRIX_GET_ACTIVE_MODE);
|
||||
|
||||
return usb_buf[1];
|
||||
}
|
||||
|
||||
unsigned int QMKRGBMatrixController::GetZonesCount()
|
||||
{
|
||||
unsigned char usb_buf[33];
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up config table request packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = QMK_RGBMATRIX_GET_ZONES_COUNT;
|
||||
|
||||
do
|
||||
{
|
||||
hid_write(dev, (unsigned char*)usb_buf, 33);
|
||||
hid_read_timeout(dev, (unsigned char*)usb_buf, 33, 20);
|
||||
}
|
||||
while(usb_buf[0x00] != QMK_RGBMATRIX_GET_ZONES_COUNT);
|
||||
|
||||
return usb_buf[1];
|
||||
}
|
||||
|
||||
std::string QMKRGBMatrixController::GetZoneName(int zone)
|
||||
{
|
||||
unsigned char usb_buf[33];
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up config table request packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = QMK_RGBMATRIX_GET_ZONE_NAME;
|
||||
usb_buf[0x02] = zone;
|
||||
|
||||
do
|
||||
{
|
||||
hid_write(dev, (unsigned char*)usb_buf, 33);
|
||||
hid_read_timeout(dev, (unsigned char*)usb_buf, 33, 20);
|
||||
}
|
||||
while(usb_buf[0x00] != QMK_RGBMATRIX_GET_ZONE_NAME);
|
||||
|
||||
int i = 1;
|
||||
std::string name;
|
||||
while(usb_buf[i] != 0)
|
||||
{
|
||||
name.push_back(usb_buf[i]);
|
||||
i++;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
unsigned int QMKRGBMatrixController::GetZoneType(int zone)
|
||||
{
|
||||
unsigned char usb_buf[33];
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up config table request packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = QMK_RGBMATRIX_GET_ZONE_TYPE;
|
||||
usb_buf[0x02] = zone;
|
||||
|
||||
do
|
||||
{
|
||||
hid_write(dev, (unsigned char*)usb_buf, 33);
|
||||
hid_read_timeout(dev, (unsigned char*)usb_buf, 33, 20);
|
||||
}
|
||||
while(usb_buf[0x00] != QMK_RGBMATRIX_GET_ZONE_TYPE);
|
||||
|
||||
return usb_buf[1];
|
||||
}
|
||||
|
||||
unsigned int QMKRGBMatrixController::GetZoneSize(int zone)
|
||||
{
|
||||
unsigned char usb_buf[33];
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up config table request packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = QMK_RGBMATRIX_GET_ZONE_SIZE;
|
||||
usb_buf[0x02] = zone;
|
||||
|
||||
do
|
||||
{
|
||||
hid_write(dev, (unsigned char*)usb_buf, 33);
|
||||
hid_read_timeout(dev, (unsigned char*)usb_buf, 33, 20);
|
||||
}
|
||||
while(usb_buf[0x00] != QMK_RGBMATRIX_GET_ZONE_SIZE);
|
||||
|
||||
return usb_buf[1];
|
||||
}
|
||||
|
||||
unsigned int QMKRGBMatrixController::GetLEDMatirxRows()
|
||||
{
|
||||
unsigned char usb_buf[33];
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up config table request packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = QMK_RGBMATRIX_GET_LED_MATRIX_ROWS;
|
||||
|
||||
do
|
||||
{
|
||||
hid_write(dev, (unsigned char*)usb_buf, 33);
|
||||
hid_read_timeout(dev, (unsigned char*)usb_buf, 33, 1000);
|
||||
}
|
||||
while(usb_buf[0x00] != QMK_RGBMATRIX_GET_LED_MATRIX_ROWS);
|
||||
|
||||
return usb_buf[1];
|
||||
}
|
||||
|
||||
unsigned int QMKRGBMatrixController::GetLEDMatirxColumns()
|
||||
{
|
||||
unsigned char usb_buf[33];
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up config table request packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = QMK_RGBMATRIX_GET_LED_MATRIX_COLUMNS;
|
||||
|
||||
do
|
||||
{
|
||||
hid_write(dev, (unsigned char*)usb_buf, 33);
|
||||
hid_read_timeout(dev, (unsigned char*)usb_buf, 33, 20);
|
||||
}
|
||||
while(usb_buf[0x00] != QMK_RGBMATRIX_GET_LED_MATRIX_COLUMNS);
|
||||
|
||||
return usb_buf[1];
|
||||
}
|
||||
|
||||
unsigned int QMKRGBMatrixController::GetLEDValueInMatrix(int column, int row)
|
||||
{
|
||||
unsigned char usb_buf[33];
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up config table request packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = QMK_RGBMATRIX_GET_LED_VALUE_IN_MATRIX;
|
||||
usb_buf[0x02] = column;
|
||||
usb_buf[0x03] = row;
|
||||
|
||||
do
|
||||
{
|
||||
hid_write(dev, (unsigned char*)usb_buf, 33);
|
||||
hid_read_timeout(dev, (unsigned char*)usb_buf, 33, 20);
|
||||
}
|
||||
while(usb_buf[0x00] != QMK_RGBMATRIX_GET_LED_VALUE_IN_MATRIX);
|
||||
|
||||
return usb_buf[1];
|
||||
}
|
||||
|
||||
std::string QMKRGBMatrixController::GetLEDName(int led_column, int led_row)
|
||||
{
|
||||
unsigned char usb_buf[33];
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up config table request packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = QMK_RGBMATRIX_GET_LED_NAME;
|
||||
usb_buf[0x02] = led_column;
|
||||
usb_buf[0x03] = led_row;
|
||||
|
||||
do
|
||||
{
|
||||
hid_write(dev, (unsigned char*)usb_buf, 33);
|
||||
hid_read_timeout(dev, (unsigned char*)usb_buf, 33, 20);
|
||||
}
|
||||
while(usb_buf[0x00] != QMK_RGBMATRIX_GET_LED_NAME);
|
||||
|
||||
return QMKKeycodeToKeyNameMap[usb_buf[1]];
|
||||
}
|
||||
@@ -1,319 +0,0 @@
|
||||
/*-------------------------------------------------------------------*\
|
||||
| QMKRGBMatrixController.h |
|
||||
| |
|
||||
| Driver for QMK keybaords using RGB Matrix |
|
||||
| |
|
||||
| Kasper 10th Octobber 2020 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#include <array>
|
||||
#include <map>
|
||||
#include <hidapi/hidapi.h>
|
||||
#include "RGBController.h"
|
||||
#include "hsv.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
enum CommandsId {
|
||||
QMK_RGBMATRIX_EOM,
|
||||
QMK_RGBMATRIX_SUCCESS,
|
||||
QMK_RGBMATRIX_FAILURE,
|
||||
|
||||
QMK_RGBMATRIX_DIRECT_MODE_SET_SINGLE_LED,
|
||||
QMK_RGBMATRIX_DIRECT_MODE_SET_LEDS,
|
||||
QMK_RGBMATRIX_DIRECT_MODE_GET_LED_COLOR,
|
||||
|
||||
QMK_RGBMATRIX_QMK_MODE_SET_MODE_AND_SPEED,
|
||||
QMK_RGBMATRIX_QMK_MODE_SET_COLOR_MODE_AND_SPEED,
|
||||
QMK_RGBMATRIX_QMK_MODE_GET_COLOR,
|
||||
|
||||
QMK_RGBMATRIX_GET_PROTOCOL_VERSION,
|
||||
QMK_RGBMATRIX_GET_DEVICE_NAME,
|
||||
QMK_RGBMATRIX_GET_DEVICE_VENDOR,
|
||||
|
||||
QMK_RGBMATRIX_GET_ENABLED_MODES,
|
||||
QMK_RGBMATRIX_GET_ACTIVE_MODE,
|
||||
|
||||
QMK_RGBMATRIX_GET_ZONES_COUNT,
|
||||
QMK_RGBMATRIX_GET_ZONE_NAME,
|
||||
QMK_RGBMATRIX_GET_ZONE_TYPE,
|
||||
QMK_RGBMATRIX_GET_ZONE_SIZE,
|
||||
|
||||
QMK_RGBMATRIX_GET_LED_MATRIX_COLUMNS,
|
||||
QMK_RGBMATRIX_GET_LED_MATRIX_ROWS,
|
||||
QMK_RGBMATRIX_GET_LED_VALUE_IN_MATRIX,
|
||||
QMK_RGBMATRIX_GET_LED_NAME
|
||||
};
|
||||
|
||||
enum ModeCommands
|
||||
{
|
||||
QMK_RGBMATRIX_MODE_OPENRGB_DIRECT = 1,
|
||||
QMK_RGBMATRIX_MODE_SOLID_COLOR,
|
||||
QMK_RGBMATRIX_MODE_ALPHA_MOD,
|
||||
QMK_RGBMATRIX_MODE_GRADIENT_UP_DOWN,
|
||||
QMK_RGBMATRIX_MODE_GRADIENT_LEFT_RIGHT,
|
||||
QMK_RGBMATRIX_MODE_BREATHING,
|
||||
QMK_RGBMATRIX_MODE_BAND_SAT,
|
||||
QMK_RGBMATRIX_MODE_BAND_VAL,
|
||||
QMK_RGBMATRIX_MODE_BAND_PINWHEEL_SAT,
|
||||
QMK_RGBMATRIX_MODE_BAND_PINWHEEL_VAL,
|
||||
QMK_RGBMATRIX_MODE_BAND_SPIRAL_SAT,
|
||||
QMK_RGBMATRIX_MODE_BAND_SPIRAL_VAL,
|
||||
QMK_RGBMATRIX_MODE_CYCLE_ALL,
|
||||
QMK_RGBMATRIX_MODE_CYCLE_LEFT_RIGHT,
|
||||
QMK_RGBMATRIX_MODE_CYCLE_UP_DOWN,
|
||||
QMK_RGBMATRIX_MODE_CYCLE_OUT_IN,
|
||||
QMK_RGBMATRIX_MODE_CYCLE_OUT_IN_DUAL,
|
||||
QMK_RGBMATRIX_MODE_RAINBOW_MOVING_CHEVRON,
|
||||
QMK_RGBMATRIX_MODE_CYCLE_PINWHEEL,
|
||||
QMK_RGBMATRIX_MODE_CYCLE_SPIRAL,
|
||||
QMK_RGBMATRIX_MODE_DUAL_BEACON,
|
||||
QMK_RGBMATRIX_MODE_RAINBOW_BEACON,
|
||||
QMK_RGBMATRIX_MODE_RAINBOW_PINWHEELS,
|
||||
QMK_RGBMATRIX_MODE_RAINDROPS,
|
||||
QMK_RGBMATRIX_MODE_JELLYBEAN_RAINDROPS,
|
||||
QMK_RGBMATRIX_MODE_TYPING_HEATMAP,
|
||||
QMK_RGBMATRIX_MODE_DIGITAL_RAIN,
|
||||
QMK_RGBMATRIX_MODE_SOLID_REACTIVE_SIMPLE,
|
||||
QMK_RGBMATRIX_MODE_SOLID_REACTIVE,
|
||||
QMK_RGBMATRIX_MODE_SOLID_REACTIVE_WIDE,
|
||||
QMK_RGBMATRIX_MODE_SOLID_REACTIVE_MULTIWIDE,
|
||||
QMK_RGBMATRIX_MODE_SOLID_REACTIVE_CROSS,
|
||||
QMK_RGBMATRIX_MODE_SOLID_REACTIVE_MULTICROSS,
|
||||
QMK_RGBMATRIX_MODE_SOLID_REACTIVE_NEXUS,
|
||||
QMK_RGBMATRIX_MODE_SOLID_REACTIVE_MULTINEXUS,
|
||||
QMK_RGBMATRIX_MODE_SPLASH,
|
||||
QMK_RGBMATRIX_MODE_MULTISPLASH,
|
||||
QMK_RGBMATRIX_MODE_SOLID_SPLASH,
|
||||
QMK_RGBMATRIX_MODE_SOLID_MULTISPLASH,
|
||||
};
|
||||
|
||||
enum SpeedCommands
|
||||
{
|
||||
QMK_RGBMATRIX_SPEED_SLOWEST = 0x00, /* Slowest speed */
|
||||
QMK_RGBMATRIX_SPEED_NORMAL = 0x7F, /* Normal speed */
|
||||
QMK_RGBMATRIX_SPEED_FASTEST = 0xFF, /* Fastest speed */
|
||||
};
|
||||
|
||||
class QMKRGBMatrixController
|
||||
{
|
||||
public:
|
||||
QMKRGBMatrixController
|
||||
(
|
||||
hid_device* dev_handle,
|
||||
const char* path,
|
||||
unsigned short vendor_id
|
||||
);
|
||||
|
||||
~QMKRGBMatrixController();
|
||||
std::string GetLocation();
|
||||
|
||||
void DirectModeSetSingleLED(unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
|
||||
void DirectModeSetLEDs(std::vector<RGBColor> colors, unsigned int num_colors);
|
||||
RGBColor DirectModeGetLEDColor(unsigned int led);
|
||||
|
||||
void QMKModeSetModeAndSpeed(unsigned char mode, unsigned char speed);
|
||||
void QMKModeSetColorModeAndSpeed(hsv_t hsv_color, unsigned char mode, unsigned char speed);
|
||||
unsigned int QMKModeGetColor();
|
||||
|
||||
unsigned int GetProtocolVersion();
|
||||
std::string GetDeviceName();
|
||||
std::string GetDeviceVendor();
|
||||
|
||||
bool GetEnabledModes(int mode);
|
||||
unsigned int GetActiveMode();
|
||||
|
||||
unsigned int GetZonesCount();
|
||||
std::string GetZoneName(int zone);
|
||||
unsigned int GetZoneType(int zone);
|
||||
unsigned int GetZoneSize(int zone);
|
||||
unsigned int GetLEDMatirxRows();
|
||||
unsigned int GetLEDMatirxColumns();
|
||||
unsigned int GetLEDValueInMatrix(int column, int row);
|
||||
std::string GetLEDName(int led_column, int led_row);
|
||||
protected:
|
||||
hid_device* dev;
|
||||
private:
|
||||
std::string location;
|
||||
|
||||
std::map<uint8_t, std::string> QMKKeycodeToKeyNameMap
|
||||
{
|
||||
{ 0, "" },
|
||||
{ 1, "Right Fn" },
|
||||
{ 2, "Right Fn" },
|
||||
{ 3, "" },
|
||||
{ 4, "A" },
|
||||
{ 5, "B" },
|
||||
{ 6, "C" },
|
||||
{ 7, "D" },
|
||||
{ 8, "E" },
|
||||
{ 9, "F" },
|
||||
{ 10, "G" },
|
||||
{ 11, "H" },
|
||||
{ 12, "I" },
|
||||
{ 13, "J" },
|
||||
{ 14, "K" },
|
||||
{ 15, "L" },
|
||||
{ 16, "M" },
|
||||
{ 17, "N" },
|
||||
{ 18, "O" },
|
||||
{ 19, "P" },
|
||||
{ 20, "Q" },
|
||||
{ 21, "R" },
|
||||
{ 22, "S" },
|
||||
{ 23, "T" },
|
||||
{ 24, "U" },
|
||||
{ 25, "V" },
|
||||
{ 26, "W" },
|
||||
{ 27, "X" },
|
||||
{ 28, "Y" },
|
||||
{ 29, "Z" },
|
||||
{ 30, "1" },
|
||||
{ 31, "2" },
|
||||
{ 32, "3" },
|
||||
{ 33, "4" },
|
||||
{ 34, "5" },
|
||||
{ 35, "6" },
|
||||
{ 36, "7" },
|
||||
{ 37, "8" },
|
||||
{ 38, "9" },
|
||||
{ 39, "0" },
|
||||
{ 40, "Enter" },
|
||||
{ 41, "Escape" },
|
||||
{ 42, "Backspace" },
|
||||
{ 43, "Tab" },
|
||||
{ 44, "Space" },
|
||||
{ 45, "-" },
|
||||
{ 46, "=" },
|
||||
{ 47, "[" },
|
||||
{ 48, "]" },
|
||||
{ 49, "\\ (ANSI)" },
|
||||
{ 50, "#" },
|
||||
{ 51, ";" },
|
||||
{ 52, "'" },
|
||||
{ 53, "`" },
|
||||
{ 54, "," },
|
||||
{ 55, "." },
|
||||
{ 56, "/" },
|
||||
{ 57, "Caps Lock" },
|
||||
{ 58, "F1" },
|
||||
{ 59, "F2" },
|
||||
{ 60, "F3" },
|
||||
{ 61, "F4" },
|
||||
{ 62, "F5" },
|
||||
{ 63, "F6" },
|
||||
{ 64, "F7" },
|
||||
{ 65, "F8" },
|
||||
{ 66, "F9" },
|
||||
{ 67, "F10" },
|
||||
{ 68, "F11" },
|
||||
{ 69, "F12" },
|
||||
{ 70, "Print Screen" },
|
||||
{ 71, "Scroll Lock" },
|
||||
{ 72, "Pause/Break" },
|
||||
{ 73, "Insert" },
|
||||
{ 74, "Home" },
|
||||
{ 75, "Page Up" },
|
||||
{ 76, "Delete" },
|
||||
{ 77, "End" },
|
||||
{ 78, "Page Down" },
|
||||
{ 79, "Right Arrow" },
|
||||
{ 80, "Left Arrow" },
|
||||
{ 81, "Down Arrow" },
|
||||
{ 82, "Up Arrow" },
|
||||
{ 83, "Num Lock" },
|
||||
{ 84, "Number Pad /" },
|
||||
{ 85, "Number Pad *" },
|
||||
{ 86, "Number Pad -" },
|
||||
{ 87, "Number Pad +" },
|
||||
{ 88, "Number Pad Enter" },
|
||||
{ 89, "Number Pad 1" },
|
||||
{ 90, "Number Pad 2" },
|
||||
{ 91, "Number Pad 3" },
|
||||
{ 92, "Number Pad 4" },
|
||||
{ 93, "Number Pad 5" },
|
||||
{ 94, "Number Pad 6" },
|
||||
{ 95, "Number Pad 7" },
|
||||
{ 96, "Number Pad 8" },
|
||||
{ 97, "Number Pad 9" },
|
||||
{ 98, "Number Pad 0" },
|
||||
{ 99, "Number Pad ." },
|
||||
{ 100, "\\ (ISO)" },
|
||||
{ 101, "Menu" },
|
||||
{ 102, "" },
|
||||
{ 103, "" },
|
||||
{ 104, "" },
|
||||
{ 105, "" },
|
||||
{ 106, "" },
|
||||
{ 107, "" },
|
||||
{ 108, "" },
|
||||
{ 109, "" },
|
||||
{ 110, "" },
|
||||
{ 111, "" },
|
||||
{ 112, "" },
|
||||
{ 113, "" },
|
||||
{ 114, "" },
|
||||
{ 115, "" },
|
||||
{ 116, "" },
|
||||
{ 117, "" },
|
||||
{ 118, "" },
|
||||
{ 119, "" },
|
||||
{ 120, "" },
|
||||
{ 121, "" },
|
||||
{ 122, "" },
|
||||
{ 123, "" },
|
||||
{ 124, "" },
|
||||
{ 125, "" },
|
||||
{ 126, "" },
|
||||
{ 127, "" },
|
||||
{ 128, "" },
|
||||
{ 129, "" },
|
||||
{ 130, "" },
|
||||
{ 131, "" },
|
||||
{ 132, "" },
|
||||
{ 133, "" },
|
||||
{ 134, "" },
|
||||
{ 135, "\\ (INT1)" },
|
||||
{ 136, "" },
|
||||
{ 137, "" },
|
||||
{ 138, "" },
|
||||
{ 139, "" },
|
||||
{ 140, "" },
|
||||
{ 141, "" },
|
||||
{ 142, "" },
|
||||
{ 143, "" },
|
||||
{ 144, "" },
|
||||
{ 145, "" },
|
||||
{ 146, "" },
|
||||
{ 147, "" },
|
||||
{ 148, "" },
|
||||
{ 149, "" },
|
||||
{ 150, "" },
|
||||
{ 151, "" },
|
||||
{ 152, "" },
|
||||
{ 153, "" },
|
||||
{ 154, "" },
|
||||
{ 155, "" },
|
||||
{ 156, "" },
|
||||
{ 157, "" },
|
||||
{ 158, "" },
|
||||
{ 159, "" },
|
||||
{ 160, "" },
|
||||
{ 161, "" },
|
||||
{ 162, "" },
|
||||
{ 163, "" },
|
||||
{ 164, "" },
|
||||
{ 216, "Left Shift"}, // Space Cadet Left Shift
|
||||
{ 217, "Right Shift"}, // Space Cadet Right Shift
|
||||
{ 224, "Left Control" },
|
||||
{ 225, "Left Shift" },
|
||||
{ 226, "Left Alt" },
|
||||
{ 227, "Left Windows" },
|
||||
{ 228, "Right Control" },
|
||||
{ 229, "Right Shift" },
|
||||
{ 230, "Right Alt" },
|
||||
{ 231, "Right Windows" },
|
||||
};
|
||||
};
|
||||
@@ -1,57 +0,0 @@
|
||||
/*-------------------------------------------------------------------*\
|
||||
| QMKRGBMatrixControllerDetect.cpp |
|
||||
| |
|
||||
| Driver for QMK keybaords using RGB Matrix |
|
||||
| |
|
||||
| Kasper24 11th November 2020 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "Detector.h"
|
||||
#include "QMKRGBMatrixController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_QMKRGBMatrix.h"
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Protocol version |
|
||||
\*-----------------------------------------------------*/
|
||||
#define QMK_RGB_MATRIX_PROTOCOL_VERSION 0x01
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Usage and Usage Page |
|
||||
\*-----------------------------------------------------*/
|
||||
#define QMK_USAGE_PAGE 0xFF60
|
||||
#define QMK_USAGE 0x61
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Massdrop |
|
||||
\*-----------------------------------------------------*/
|
||||
#define MASSDROP_VID 0x04D8
|
||||
#define MASSDROP_ALT_PID 0xEED3
|
||||
#define MASSDROP_CTRL_PID 0xEED2
|
||||
|
||||
void DetectQMKRGBMatrixControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
QMKRGBMatrixController* controller = new QMKRGBMatrixController(dev, info->path, info->vendor_id);
|
||||
|
||||
unsigned int version = controller->GetProtocolVersion();
|
||||
if(version == QMK_RGB_MATRIX_PROTOCOL_VERSION)
|
||||
{
|
||||
RGBController_QMKRGBMatrix* rgb_controller = new RGBController_QMKRGBMatrix(controller, version);
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_HID_DETECTOR_IPU("Massdrop Alt", DetectQMKRGBMatrixControllers, MASSDROP_VID, MASSDROP_ALT_PID, 1, QMK_USAGE_PAGE, QMK_USAGE);
|
||||
REGISTER_HID_DETECTOR_IPU("Massdrop Ctrl", DetectQMKRGBMatrixControllers, MASSDROP_VID, MASSDROP_CTRL_PID, 1, QMK_USAGE_PAGE, QMK_USAGE);
|
||||
REGISTER_HID_DETECTOR_IPU("SonixQMK 0C45:5004", DetectQMKRGBMatrixControllers, 0x0C45, 0x5004, 1, QMK_USAGE_PAGE, QMK_USAGE);
|
||||
REGISTER_HID_DETECTOR_IPU("SonixQMK 0C45:5104", DetectQMKRGBMatrixControllers, 0x0C45, 0x5104, 1, QMK_USAGE_PAGE, QMK_USAGE);
|
||||
@@ -1,342 +0,0 @@
|
||||
/*-------------------------------------------------------------------*\
|
||||
| RGBController_QMKRGBMatrix.cpp |
|
||||
| |
|
||||
| Driver for QMK keybaords using RGB Matrix |
|
||||
| |
|
||||
| Kasper24 11th November 2020 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "hsv.h"
|
||||
#include "RGBController_QMKRGBMatrix.h"
|
||||
|
||||
RGBController_QMKRGBMatrix::RGBController_QMKRGBMatrix(QMKRGBMatrixController* qmk_rgb_matrix_ptr, unsigned int protocol_version)
|
||||
{
|
||||
qmk_rgb_matrix = qmk_rgb_matrix_ptr;
|
||||
|
||||
name = qmk_rgb_matrix_ptr->GetDeviceName();
|
||||
vendor = qmk_rgb_matrix_ptr->GetDeviceVendor();
|
||||
description = "QMK RGB Matrix Device";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
location = qmk_rgb_matrix_ptr->GetLocation();
|
||||
version = std::to_string(protocol_version);
|
||||
|
||||
unsigned int current_mode = 1;
|
||||
unsigned int hsv = 0;
|
||||
//unsigned int hsv = qmk_rgb_matrix_ptr->QMKModeGetColor();
|
||||
|
||||
//if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_OPENRGB_DIRECT))
|
||||
InitializeMode("Direct", current_mode, MODE_FLAG_HAS_PER_LED_COLOR, MODE_COLORS_PER_LED, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_SOLID_COLOR))
|
||||
// InitializeMode("Static", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR, MODE_COLORS_MODE_SPECIFIC, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_ALPHA_MOD))
|
||||
// InitializeMode("Alpha Mod", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED,
|
||||
// MODE_COLORS_MODE_SPECIFIC, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_GRADIENT_UP_DOWN))
|
||||
// InitializeMode("Gradient Up Down", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_GRADIENT_LEFT_RIGHT))
|
||||
// InitializeMode("Gradient Left Right", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_BREATHING))
|
||||
// InitializeMode("Breathing", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED,
|
||||
// MODE_COLORS_MODE_SPECIFIC, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_BAND_SAT))
|
||||
// InitializeMode("Band Saturation", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED,
|
||||
// MODE_COLORS_MODE_SPECIFIC, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_BAND_VAL))
|
||||
// InitializeMode("Band Value", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED,
|
||||
// MODE_COLORS_MODE_SPECIFIC, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_BAND_PINWHEEL_SAT))
|
||||
// InitializeMode("Band Pinwheel Saturation", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED,
|
||||
// MODE_COLORS_MODE_SPECIFIC, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_BAND_PINWHEEL_VAL))
|
||||
// InitializeMode("Band Pinwheel Value", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED,
|
||||
// MODE_COLORS_MODE_SPECIFIC, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_BAND_SPIRAL_SAT))
|
||||
// InitializeMode("Band Spiral Saturation", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED,
|
||||
// MODE_COLORS_MODE_SPECIFIC, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_BAND_SPIRAL_VAL))
|
||||
// InitializeMode("Band Spiral Value", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED,
|
||||
// MODE_COLORS_MODE_SPECIFIC, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_CYCLE_ALL))
|
||||
// InitializeMode("Cycle All", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_CYCLE_LEFT_RIGHT))
|
||||
// InitializeMode("Cycle Left Right", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_CYCLE_UP_DOWN))
|
||||
// InitializeMode("Cycle Up Down", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_CYCLE_OUT_IN))
|
||||
// InitializeMode("Cycle Out In", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_CYCLE_OUT_IN_DUAL))
|
||||
// InitializeMode("Cycle Out In Dual", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_RAINBOW_MOVING_CHEVRON))
|
||||
// InitializeMode("Rainbow Moving Chevron", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_CYCLE_PINWHEEL))
|
||||
// InitializeMode("Cycle Pinwheel", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_CYCLE_SPIRAL))
|
||||
// InitializeMode("Cycle Spiral", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_DUAL_BEACON))
|
||||
// InitializeMode("Dual Beacon", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_RAINBOW_BEACON))
|
||||
// InitializeMode("Rainbow Beacon", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_RAINBOW_PINWHEELS))
|
||||
// InitializeMode("Rainbow Pinwheels", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_RAINDROPS))
|
||||
// InitializeMode("Raindrops", current_mode, 0, MODE_COLORS_NONE, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_JELLYBEAN_RAINDROPS))
|
||||
// InitializeMode("Jellybean Raindrops", current_mode, 0, MODE_COLORS_NONE, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_TYPING_HEATMAP))
|
||||
// InitializeMode("Typing Heatmap", current_mode, 0, MODE_COLORS_NONE, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_DIGITAL_RAIN))
|
||||
// InitializeMode("Digital Rain", current_mode, 0, MODE_COLORS_NONE, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_SOLID_REACTIVE_SIMPLE))
|
||||
// InitializeMode("Solid Reactive Simple", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED,
|
||||
// MODE_COLORS_MODE_SPECIFIC, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_SOLID_REACTIVE))
|
||||
// InitializeMode("Solid Reactive", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED,
|
||||
// MODE_COLORS_MODE_SPECIFIC, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_SOLID_REACTIVE_WIDE))
|
||||
// InitializeMode("Solid Reactive Wide", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED,
|
||||
// MODE_COLORS_MODE_SPECIFIC, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_SOLID_REACTIVE_MULTIWIDE))
|
||||
// InitializeMode("Solid Reactive Multi Wide", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED,
|
||||
// MODE_COLORS_MODE_SPECIFIC, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_SOLID_REACTIVE_CROSS))
|
||||
// InitializeMode("Solid Reactive Cross", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED,
|
||||
// MODE_COLORS_MODE_SPECIFIC, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_SOLID_REACTIVE_MULTICROSS))
|
||||
// InitializeMode("Solid Reactive Multi Cross", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED,
|
||||
// MODE_COLORS_MODE_SPECIFIC, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_SOLID_REACTIVE_NEXUS))
|
||||
// InitializeMode("Solid Reactive Nexus", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED,
|
||||
// MODE_COLORS_MODE_SPECIFIC, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_SOLID_REACTIVE_MULTINEXUS))
|
||||
// InitializeMode("Solid Reactive Multi Nexus", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED,
|
||||
// MODE_COLORS_MODE_SPECIFIC, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_SPLASH))
|
||||
// InitializeMode("Rainbow Reactive Splash", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_MULTISPLASH))
|
||||
// InitializeMode("Rainbow Reactive Multi Splash", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_SOLID_SPLASH))
|
||||
// InitializeMode("Solid Reactive Splash", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED,
|
||||
// MODE_COLORS_MODE_SPECIFIC, hsv);
|
||||
|
||||
// if (qmk_rgb_matrix_ptr->GetEnabledModes(QMK_RGBMATRIX_MODE_SOLID_MULTISPLASH))
|
||||
// InitializeMode("Solid Reactive Multi Splash", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED,
|
||||
// MODE_COLORS_MODE_SPECIFIC, hsv);
|
||||
|
||||
active_mode = qmk_rgb_matrix_ptr->GetActiveMode() - 1;
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_QMKRGBMatrix::~RGBController_QMKRGBMatrix()
|
||||
{
|
||||
for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++)
|
||||
{
|
||||
if(zones[zone_index].matrix_map != NULL)
|
||||
{
|
||||
delete zones[zone_index].matrix_map;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_QMKRGBMatrix::SetupZones()
|
||||
{
|
||||
for(unsigned int i = 0; i < qmk_rgb_matrix->GetZonesCount(); i++)
|
||||
{
|
||||
zone keyboard_zone;
|
||||
keyboard_zone.name = qmk_rgb_matrix->GetZoneName(i);
|
||||
keyboard_zone.type = qmk_rgb_matrix->GetZoneType(i);
|
||||
keyboard_zone.leds_min = qmk_rgb_matrix->GetZoneSize(i);
|
||||
keyboard_zone.leds_max = keyboard_zone.leds_min;
|
||||
keyboard_zone.leds_count = keyboard_zone.leds_min;
|
||||
|
||||
std::vector<std::string> led_names;
|
||||
for (int i=0;i<keyboard_zone.leds_min;i++)
|
||||
{
|
||||
led_names.push_back("Unused");
|
||||
}
|
||||
if(keyboard_zone.type == ZONE_TYPE_MATRIX)
|
||||
{
|
||||
unsigned int led_matrix_columns = qmk_rgb_matrix->GetLEDMatirxColumns();
|
||||
unsigned int led_matrix_rows = qmk_rgb_matrix->GetLEDMatirxRows();
|
||||
|
||||
keyboard_zone.matrix_map = new matrix_map_type;
|
||||
keyboard_zone.matrix_map->height = led_matrix_rows;
|
||||
keyboard_zone.matrix_map->width = led_matrix_columns;
|
||||
|
||||
unsigned int* matrix_map = new unsigned int[led_matrix_rows * led_matrix_columns];
|
||||
for(unsigned int x = 0; x < led_matrix_rows; x++)
|
||||
{
|
||||
for(unsigned int y = 0; y < led_matrix_columns; y++)
|
||||
{
|
||||
unsigned int led_value = qmk_rgb_matrix->GetLEDValueInMatrix(y, x);
|
||||
|
||||
if(led_value != 255)
|
||||
{
|
||||
std::string led_name = qmk_rgb_matrix->GetLEDName(y, x);
|
||||
led_names[led_value] = led_name;
|
||||
}
|
||||
else
|
||||
{
|
||||
led_value = 0xFFFFFFFF;
|
||||
}
|
||||
matrix_map[led_matrix_columns * x + y] = led_value;
|
||||
}
|
||||
}
|
||||
|
||||
keyboard_zone.matrix_map->map = matrix_map;
|
||||
}
|
||||
else
|
||||
{
|
||||
keyboard_zone.matrix_map = NULL;
|
||||
}
|
||||
|
||||
zones.push_back(keyboard_zone);
|
||||
|
||||
for(unsigned int led_idx = 0; led_idx < keyboard_zone.leds_count; led_idx++)
|
||||
{
|
||||
led keyboard_led;
|
||||
|
||||
if(leds.size() < zones[0].leds_count)
|
||||
{
|
||||
if(led_idx < led_names.size()) keyboard_led.name = "Key: " + led_names[led_idx];
|
||||
}
|
||||
else
|
||||
{
|
||||
keyboard_led.name = zones[i].name + ": " + std::to_string(led_idx);
|
||||
}
|
||||
|
||||
leds.push_back(keyboard_led);
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
|
||||
for(unsigned int i = 0; i < leds.size(); i++)
|
||||
{
|
||||
colors[i] = qmk_rgb_matrix->DirectModeGetLEDColor(i);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_QMKRGBMatrix::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_QMKRGBMatrix::DeviceUpdateLEDs()
|
||||
{
|
||||
qmk_rgb_matrix->DirectModeSetLEDs(colors, leds.size());
|
||||
}
|
||||
|
||||
void RGBController_QMKRGBMatrix::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_QMKRGBMatrix::UpdateSingleLED(int led)
|
||||
{
|
||||
RGBColor color = colors[led];
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
qmk_rgb_matrix->DirectModeSetSingleLED(led, red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_QMKRGBMatrix::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_QMKRGBMatrix::DeviceUpdateMode()
|
||||
{
|
||||
if(modes[active_mode].color_mode == MODE_COLORS_PER_LED)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
else if(modes[active_mode].color_mode == MODE_COLORS_NONE)
|
||||
{
|
||||
qmk_rgb_matrix->QMKModeSetModeAndSpeed(modes[active_mode].value, modes[active_mode].speed);
|
||||
}
|
||||
else if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
|
||||
{
|
||||
RGBColor color = modes[active_mode].colors[0];
|
||||
hsv_t hsv_color;
|
||||
rgb2hsv(color, &hsv_color);
|
||||
|
||||
if(modes[active_mode].flags & MODE_FLAG_HAS_SPEED)
|
||||
qmk_rgb_matrix->QMKModeSetColorModeAndSpeed(hsv_color, modes[active_mode].value, modes[active_mode].speed);
|
||||
else
|
||||
qmk_rgb_matrix->QMKModeSetColorModeAndSpeed(hsv_color, modes[active_mode].value, 127);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_QMKRGBMatrix::InitializeMode
|
||||
(
|
||||
std::string name,
|
||||
unsigned int ¤t_mode,
|
||||
unsigned int flags,
|
||||
unsigned int color_mode,
|
||||
unsigned int hsv
|
||||
)
|
||||
{
|
||||
mode qmk_mode;
|
||||
qmk_mode.name = name;
|
||||
qmk_mode.value = current_mode++;
|
||||
qmk_mode.flags = flags;
|
||||
qmk_mode.color_mode = color_mode;
|
||||
|
||||
if(flags & MODE_FLAG_HAS_SPEED)
|
||||
{
|
||||
qmk_mode.speed_min = QMK_RGBMATRIX_SPEED_SLOWEST;
|
||||
qmk_mode.speed_max = QMK_RGBMATRIX_SPEED_FASTEST;
|
||||
qmk_mode.speed = QMK_RGBMATRIX_SPEED_NORMAL;
|
||||
}
|
||||
if(flags & MODE_FLAG_HAS_MODE_SPECIFIC_COLOR)
|
||||
{
|
||||
qmk_mode.colors_min = 1;
|
||||
qmk_mode.colors_max = 1;
|
||||
qmk_mode.colors.resize(1);
|
||||
qmk_mode.colors[0] = hsv;
|
||||
}
|
||||
|
||||
modes.push_back(qmk_mode);
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*-------------------------------------------------------------------*\
|
||||
| RGBController_QMKRGBMatrix.h |
|
||||
| |
|
||||
| Driver for QMK keybaords using RGB Matrix |
|
||||
| |
|
||||
| Kasper24 11th November 2020 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "QMKRGBMatrixController.h"
|
||||
|
||||
class RGBController_QMKRGBMatrix : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_QMKRGBMatrix(QMKRGBMatrixController* qmk_rgb_matrix_ptr, unsigned int protocol_version);
|
||||
~RGBController_QMKRGBMatrix();
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
private:
|
||||
QMKRGBMatrixController* qmk_rgb_matrix;
|
||||
|
||||
void InitializeMode
|
||||
(
|
||||
std::string name,
|
||||
unsigned int ¤t_mode,
|
||||
unsigned int flags,
|
||||
unsigned int color_mode,
|
||||
unsigned int hsv
|
||||
);
|
||||
};
|
||||
@@ -182,12 +182,12 @@ void RGBController_Razer::DeviceUpdateLEDs()
|
||||
controller->SetLEDs(&colors[0]);
|
||||
}
|
||||
|
||||
void RGBController_Razer::UpdateZoneLEDs(int /*zone*/)
|
||||
void RGBController_Razer::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_Razer::UpdateSingleLED(int /*led*/)
|
||||
void RGBController_Razer::UpdateSingleLED(int led)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
@@ -224,12 +224,12 @@ void RGBController_RazerAddressable::DeviceUpdateLEDs()
|
||||
controller->SetLEDs(&colors_buf[0]);
|
||||
}
|
||||
|
||||
void RGBController_RazerAddressable::UpdateZoneLEDs(int /*zone*/)
|
||||
void RGBController_RazerAddressable::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_RazerAddressable::UpdateSingleLED(int /*led*/)
|
||||
void RGBController_RazerAddressable::UpdateSingleLED(int led)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
@@ -172,12 +172,12 @@ void RGBController_RazerKraken::DeviceUpdateLEDs()
|
||||
controller->SetModeCustom(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_RazerKraken::UpdateZoneLEDs(int /*zone*/)
|
||||
void RGBController_RazerKraken::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_RazerKraken::UpdateSingleLED(int /*led*/)
|
||||
void RGBController_RazerKraken::UpdateSingleLED(int led)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
@@ -735,7 +735,7 @@ razer_report RazerController::razer_create_mode_breathing_one_color_extended_mat
|
||||
return report;
|
||||
}
|
||||
|
||||
razer_report RazerController::razer_create_mode_breathing_one_color_standard_matrix_report(unsigned char /*variable_storage*/, unsigned char /*led_id*/, unsigned char red, unsigned char grn, unsigned char blu)
|
||||
razer_report RazerController::razer_create_mode_breathing_one_color_standard_matrix_report(unsigned char variable_storage, unsigned char led_id, unsigned char red, unsigned char grn, unsigned char blu)
|
||||
{
|
||||
razer_report report = razer_create_report(0x03, 0x0A, 0x08);
|
||||
|
||||
@@ -790,7 +790,7 @@ razer_report RazerController::razer_create_mode_breathing_two_colors_extended_ma
|
||||
return report;
|
||||
}
|
||||
|
||||
razer_report RazerController::razer_create_mode_breathing_two_colors_standard_matrix_report(unsigned char /*variable_storage*/, unsigned char /*led_id*/, unsigned char r1, unsigned char g1, unsigned char b1, unsigned char r2, unsigned char g2, unsigned char b2)
|
||||
razer_report RazerController::razer_create_mode_breathing_two_colors_standard_matrix_report(unsigned char variable_storage, unsigned char led_id, unsigned char r1, unsigned char g1, unsigned char b1, unsigned char r2, unsigned char g2, unsigned char b2)
|
||||
{
|
||||
razer_report report = razer_create_report(0x03, 0x0A, 0x08);
|
||||
|
||||
@@ -838,7 +838,7 @@ razer_report RazerController::razer_create_mode_none_extended_matrix_report(unsi
|
||||
return report;
|
||||
}
|
||||
|
||||
razer_report RazerController::razer_create_mode_none_standard_matrix_report(unsigned char /*variable_storage*/, unsigned char /*led_id*/)
|
||||
razer_report RazerController::razer_create_mode_none_standard_matrix_report(unsigned char variable_storage, unsigned char led_id)
|
||||
{
|
||||
struct razer_report report = razer_create_report(0x03, 0x0A, 0x01);
|
||||
|
||||
@@ -858,7 +858,7 @@ razer_report RazerController::razer_create_mode_spectrum_cycle_extended_matrix_r
|
||||
return report;
|
||||
}
|
||||
|
||||
razer_report RazerController::razer_create_mode_spectrum_cycle_standard_matrix_report(unsigned char /*variable_storage*/, unsigned char /*led_id*/)
|
||||
razer_report RazerController::razer_create_mode_spectrum_cycle_standard_matrix_report(unsigned char variable_storage, unsigned char led_id)
|
||||
{
|
||||
razer_report report = razer_create_report(0x03, 0x0A, 0x01);
|
||||
|
||||
@@ -883,7 +883,7 @@ razer_report RazerController::razer_create_mode_static_extended_matrix_report(un
|
||||
return report;
|
||||
}
|
||||
|
||||
razer_report RazerController::razer_create_mode_static_standard_matrix_report(unsigned char /*variable_storage*/, unsigned char /*led_id*/, unsigned char red, unsigned char grn, unsigned char blu)
|
||||
razer_report RazerController::razer_create_mode_static_standard_matrix_report(unsigned char variable_storage, unsigned char led_id, unsigned char red, unsigned char grn, unsigned char blu)
|
||||
{
|
||||
razer_report report = razer_create_report(0x03, 0x0A, 0x04);
|
||||
|
||||
@@ -909,7 +909,7 @@ razer_report RazerController::razer_create_mode_wave_extended_matrix_report(unsi
|
||||
return report;
|
||||
}
|
||||
|
||||
razer_report RazerController::razer_create_mode_wave_standard_matrix_report(unsigned char /*variable_storage*/, unsigned char /*led_id*/, unsigned char direction)
|
||||
razer_report RazerController::razer_create_mode_wave_standard_matrix_report(unsigned char variable_storage, unsigned char led_id, unsigned char direction)
|
||||
{
|
||||
razer_report report = razer_create_report(0x03, 0x0A, 0x02);
|
||||
|
||||
@@ -1095,8 +1095,6 @@ void RazerController::razer_set_custom_frame(unsigned char row_index, unsigned c
|
||||
report = razer_create_set_led_rgb_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_SCROLL_WHEEL, rgb_data);
|
||||
razer_usb_send(&report);
|
||||
|
||||
std::this_thread::sleep_for(1ms);
|
||||
|
||||
report = razer_create_set_led_rgb_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_BACKLIGHT, &rgb_data[3]);
|
||||
razer_usb_send(&report);
|
||||
break;
|
||||
@@ -1162,58 +1160,8 @@ void RazerController::razer_set_mode_breathing_one_color(unsigned char red, unsi
|
||||
break;
|
||||
|
||||
case RAZER_MATRIX_TYPE_CUSTOM:
|
||||
unsigned char rgb_data[6];
|
||||
rgb_data[0] = red;
|
||||
rgb_data[1] = grn;
|
||||
rgb_data[2] = blu;
|
||||
rgb_data[3] = red;
|
||||
rgb_data[4] = grn;
|
||||
rgb_data[5] = blu;
|
||||
|
||||
switch(dev_pid)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| These devices use individual LED effect reports |
|
||||
\*-------------------------------------------------*/
|
||||
case RAZER_TARTARUS_CHROMA_PID:
|
||||
report = razer_create_set_led_rgb_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_BACKLIGHT, rgb_data);
|
||||
razer_usb_send(&report);
|
||||
report = razer_create_set_led_effect_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_BACKLIGHT, 2);
|
||||
razer_usb_send(&report);
|
||||
break;
|
||||
|
||||
case RAZER_DEATHADDER_CHROMA_PID:
|
||||
report = razer_create_set_led_rgb_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_SCROLL_WHEEL, rgb_data);
|
||||
razer_usb_send(&report);
|
||||
report = razer_create_set_led_effect_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_SCROLL_WHEEL, 2);
|
||||
razer_usb_send(&report);
|
||||
|
||||
report = razer_create_set_led_rgb_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_LOGO, &rgb_data[3]);
|
||||
razer_usb_send(&report);
|
||||
report = razer_create_set_led_effect_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_LOGO, 2);
|
||||
razer_usb_send(&report);
|
||||
break;
|
||||
|
||||
case RAZER_NAGA_EPIC_CHROMA_PID:
|
||||
report = razer_create_set_led_rgb_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_SCROLL_WHEEL, rgb_data);
|
||||
razer_usb_send(&report);
|
||||
|
||||
std::this_thread::sleep_for(1ms);
|
||||
|
||||
report = razer_create_set_led_effect_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_SCROLL_WHEEL, 2);
|
||||
razer_usb_send(&report);
|
||||
|
||||
std::this_thread::sleep_for(1ms);
|
||||
|
||||
report = razer_create_set_led_rgb_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_BACKLIGHT, &rgb_data[3]);
|
||||
razer_usb_send(&report);
|
||||
|
||||
std::this_thread::sleep_for(1ms);
|
||||
|
||||
report = razer_create_set_led_effect_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_BACKLIGHT, 2);
|
||||
razer_usb_send(&report);
|
||||
break;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| These devices use standard matrix reports |
|
||||
\*-------------------------------------------------*/
|
||||
@@ -1335,8 +1283,6 @@ void RazerController::razer_set_mode_custom()
|
||||
report = razer_create_set_led_effect_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_SCROLL_WHEEL, 0);
|
||||
razer_usb_send(&report);
|
||||
|
||||
std::this_thread::sleep_for(1ms);
|
||||
|
||||
report = razer_create_set_led_effect_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_BACKLIGHT, 0);
|
||||
razer_usb_send(&report);
|
||||
break;
|
||||
@@ -1372,58 +1318,8 @@ void RazerController::razer_set_mode_none()
|
||||
break;
|
||||
|
||||
case RAZER_MATRIX_TYPE_CUSTOM:
|
||||
unsigned char rgb_data[6];
|
||||
rgb_data[0] = 0x00;
|
||||
rgb_data[1] = 0x00;
|
||||
rgb_data[2] = 0x00;
|
||||
rgb_data[3] = 0x00;
|
||||
rgb_data[4] = 0x00;
|
||||
rgb_data[5] = 0x00;
|
||||
|
||||
switch(dev_pid)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| These devices use individual LED effect reports |
|
||||
\*-------------------------------------------------*/
|
||||
case RAZER_TARTARUS_CHROMA_PID:
|
||||
report = razer_create_set_led_rgb_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_BACKLIGHT, rgb_data);
|
||||
razer_usb_send(&report);
|
||||
report = razer_create_set_led_effect_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_BACKLIGHT, 0);
|
||||
razer_usb_send(&report);
|
||||
break;
|
||||
|
||||
case RAZER_DEATHADDER_CHROMA_PID:
|
||||
report = razer_create_set_led_rgb_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_SCROLL_WHEEL, rgb_data);
|
||||
razer_usb_send(&report);
|
||||
report = razer_create_set_led_effect_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_SCROLL_WHEEL, 0);
|
||||
razer_usb_send(&report);
|
||||
|
||||
report = razer_create_set_led_rgb_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_LOGO, &rgb_data[3]);
|
||||
razer_usb_send(&report);
|
||||
report = razer_create_set_led_effect_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_LOGO, 0);
|
||||
razer_usb_send(&report);
|
||||
break;
|
||||
|
||||
case RAZER_NAGA_EPIC_CHROMA_PID:
|
||||
report = razer_create_set_led_rgb_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_SCROLL_WHEEL, rgb_data);
|
||||
razer_usb_send(&report);
|
||||
|
||||
std::this_thread::sleep_for(1ms);
|
||||
|
||||
report = razer_create_set_led_effect_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_SCROLL_WHEEL, 0);
|
||||
razer_usb_send(&report);
|
||||
|
||||
std::this_thread::sleep_for(1ms);
|
||||
|
||||
report = razer_create_set_led_rgb_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_BACKLIGHT, &rgb_data[3]);
|
||||
razer_usb_send(&report);
|
||||
|
||||
std::this_thread::sleep_for(1ms);
|
||||
|
||||
report = razer_create_set_led_effect_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_BACKLIGHT, 0);
|
||||
razer_usb_send(&report);
|
||||
break;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| These devices use standard matrix reports |
|
||||
\*-------------------------------------------------*/
|
||||
@@ -1457,32 +1353,6 @@ void RazerController::razer_set_mode_spectrum_cycle()
|
||||
case RAZER_MATRIX_TYPE_CUSTOM:
|
||||
switch(dev_pid)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| These devices use individual LED effect reports |
|
||||
\*-------------------------------------------------*/
|
||||
case RAZER_TARTARUS_CHROMA_PID:
|
||||
report = razer_create_set_led_effect_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_BACKLIGHT, 4);
|
||||
razer_usb_send(&report);
|
||||
break;
|
||||
|
||||
case RAZER_DEATHADDER_CHROMA_PID:
|
||||
report = razer_create_set_led_effect_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_SCROLL_WHEEL, 4);
|
||||
razer_usb_send(&report);
|
||||
|
||||
report = razer_create_set_led_effect_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_LOGO, 4);
|
||||
razer_usb_send(&report);
|
||||
break;
|
||||
|
||||
case RAZER_NAGA_EPIC_CHROMA_PID:
|
||||
report = razer_create_set_led_effect_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_SCROLL_WHEEL, 4);
|
||||
razer_usb_send(&report);
|
||||
|
||||
std::this_thread::sleep_for(1ms);
|
||||
|
||||
report = razer_create_set_led_effect_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_BACKLIGHT, 4);
|
||||
razer_usb_send(&report);
|
||||
break;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| These devices use standard matrix reports |
|
||||
\*-------------------------------------------------*/
|
||||
@@ -1514,58 +1384,8 @@ void RazerController::razer_set_mode_static(unsigned char red, unsigned char grn
|
||||
break;
|
||||
|
||||
case RAZER_MATRIX_TYPE_CUSTOM:
|
||||
unsigned char rgb_data[6];
|
||||
rgb_data[0] = red;
|
||||
rgb_data[1] = grn;
|
||||
rgb_data[2] = blu;
|
||||
rgb_data[3] = red;
|
||||
rgb_data[4] = grn;
|
||||
rgb_data[5] = blu;
|
||||
|
||||
switch(dev_pid)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| These devices use individual LED effect reports |
|
||||
\*-------------------------------------------------*/
|
||||
case RAZER_TARTARUS_CHROMA_PID:
|
||||
report = razer_create_set_led_rgb_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_BACKLIGHT, rgb_data);
|
||||
razer_usb_send(&report);
|
||||
report = razer_create_set_led_effect_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_BACKLIGHT, 0);
|
||||
razer_usb_send(&report);
|
||||
break;
|
||||
|
||||
case RAZER_DEATHADDER_CHROMA_PID:
|
||||
report = razer_create_set_led_rgb_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_SCROLL_WHEEL, rgb_data);
|
||||
razer_usb_send(&report);
|
||||
report = razer_create_set_led_effect_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_SCROLL_WHEEL, 0);
|
||||
razer_usb_send(&report);
|
||||
|
||||
report = razer_create_set_led_rgb_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_LOGO, &rgb_data[3]);
|
||||
razer_usb_send(&report);
|
||||
report = razer_create_set_led_effect_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_LOGO, 0);
|
||||
razer_usb_send(&report);
|
||||
break;
|
||||
|
||||
case RAZER_NAGA_EPIC_CHROMA_PID:
|
||||
report = razer_create_set_led_rgb_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_SCROLL_WHEEL, rgb_data);
|
||||
razer_usb_send(&report);
|
||||
|
||||
std::this_thread::sleep_for(1ms);
|
||||
|
||||
report = razer_create_set_led_effect_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_SCROLL_WHEEL, 0);
|
||||
razer_usb_send(&report);
|
||||
|
||||
std::this_thread::sleep_for(1ms);
|
||||
|
||||
report = razer_create_set_led_rgb_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_BACKLIGHT, &rgb_data[3]);
|
||||
razer_usb_send(&report);
|
||||
|
||||
std::this_thread::sleep_for(1ms);
|
||||
|
||||
report = razer_create_set_led_effect_report(RAZER_STORAGE_NO_SAVE, RAZER_LED_ID_BACKLIGHT, 0);
|
||||
razer_usb_send(&report);
|
||||
break;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| These devices use standard matrix reports |
|
||||
\*-------------------------------------------------*/
|
||||
|
||||
@@ -127,7 +127,7 @@ union command_id_union
|
||||
} parts;
|
||||
};
|
||||
|
||||
PACK(struct razer_report
|
||||
PACK(typedef struct razer_report
|
||||
{
|
||||
unsigned char report_id;
|
||||
unsigned char status;
|
||||
@@ -145,7 +145,7 @@ PACK(struct razer_report
|
||||
/*---------------------------------------------------------*\
|
||||
| Razer ARGB Report Type (taken from OpenRazer) |
|
||||
\*---------------------------------------------------------*/
|
||||
PACK(struct razer_argb_report
|
||||
PACK(typedef struct razer_argb_report
|
||||
{
|
||||
unsigned char hid_id;
|
||||
unsigned char report_id;
|
||||
|
||||
@@ -3423,11 +3423,11 @@ static const razer_device diamondback_chroma_device =
|
||||
| |
|
||||
| Zone "Right" |
|
||||
| Linear |
|
||||
| 7 LEDs |
|
||||
| 8 LEDs |
|
||||
| |
|
||||
| Zone "Left" |
|
||||
| Linear |
|
||||
| 7 LEDs |
|
||||
| 8 LEDs |
|
||||
| |
|
||||
| Zone "Logo" |
|
||||
| Single |
|
||||
@@ -3442,7 +3442,7 @@ static const razer_zone lancehead_2017_wired_right_zone =
|
||||
"Right LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
7
|
||||
8
|
||||
};
|
||||
|
||||
static const razer_zone lancehead_2017_wired_left_zone =
|
||||
@@ -3450,7 +3450,7 @@ static const razer_zone lancehead_2017_wired_left_zone =
|
||||
"Left LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
7
|
||||
8
|
||||
};
|
||||
|
||||
static const razer_zone lancehead_2017_wired_logo_zone =
|
||||
@@ -3476,7 +3476,7 @@ static const razer_device lancehead_2017_wired_device =
|
||||
DEVICE_TYPE_MOUSE,
|
||||
true,
|
||||
1,
|
||||
16,
|
||||
18,
|
||||
{
|
||||
&lancehead_2017_wired_right_zone,
|
||||
&lancehead_2017_wired_left_zone,
|
||||
@@ -3494,11 +3494,11 @@ static const razer_device lancehead_2017_wired_device =
|
||||
| |
|
||||
| Zone "Right" |
|
||||
| Linear |
|
||||
| 7 LEDs |
|
||||
| 8 LEDs |
|
||||
| |
|
||||
| Zone "Left" |
|
||||
| Linear |
|
||||
| 7 LEDs |
|
||||
| 8 LEDs |
|
||||
| |
|
||||
| Zone "Logo" |
|
||||
| Single |
|
||||
@@ -3513,7 +3513,7 @@ static const razer_zone lancehead_2017_wireless_right_zone =
|
||||
"Right LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
7
|
||||
8
|
||||
};
|
||||
|
||||
static const razer_zone lancehead_2017_wireless_left_zone =
|
||||
@@ -3521,7 +3521,7 @@ static const razer_zone lancehead_2017_wireless_left_zone =
|
||||
"Left LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
7
|
||||
8
|
||||
};
|
||||
|
||||
static const razer_zone lancehead_2017_wireless_logo_zone =
|
||||
@@ -3547,7 +3547,7 @@ static const razer_device lancehead_2017_wireless_device =
|
||||
DEVICE_TYPE_MOUSE,
|
||||
true,
|
||||
1,
|
||||
16,
|
||||
18,
|
||||
{
|
||||
&lancehead_2017_wireless_right_zone,
|
||||
&lancehead_2017_wireless_left_zone,
|
||||
@@ -3565,11 +3565,11 @@ static const razer_device lancehead_2017_wireless_device =
|
||||
| |
|
||||
| Zone "Right" |
|
||||
| Linear |
|
||||
| 7 LEDs |
|
||||
| 8 LEDs |
|
||||
| |
|
||||
| Zone "Left" |
|
||||
| Linear |
|
||||
| 7 LEDs |
|
||||
| 8 LEDs |
|
||||
| |
|
||||
| Zone "Logo" |
|
||||
| Single |
|
||||
@@ -3584,7 +3584,7 @@ static const razer_zone lancehead_2019_wired_right_zone =
|
||||
"Right LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
7
|
||||
8
|
||||
};
|
||||
|
||||
static const razer_zone lancehead_2019_wired_left_zone =
|
||||
@@ -3592,7 +3592,7 @@ static const razer_zone lancehead_2019_wired_left_zone =
|
||||
"Left LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
7
|
||||
8
|
||||
};
|
||||
|
||||
static const razer_zone lancehead_2019_wired_logo_zone =
|
||||
@@ -3618,7 +3618,7 @@ static const razer_device lancehead_2019_wired_device =
|
||||
DEVICE_TYPE_MOUSE,
|
||||
true,
|
||||
1,
|
||||
16,
|
||||
18,
|
||||
{
|
||||
&lancehead_2019_wired_right_zone,
|
||||
&lancehead_2019_wired_left_zone,
|
||||
@@ -3636,11 +3636,11 @@ static const razer_device lancehead_2019_wired_device =
|
||||
| |
|
||||
| Zone "Right" |
|
||||
| Linear |
|
||||
| 7 LEDs |
|
||||
| 8 LEDs |
|
||||
| |
|
||||
| Zone "Left" |
|
||||
| Linear |
|
||||
| 7 LEDs |
|
||||
| 8 LEDs |
|
||||
| |
|
||||
| Zone "Logo" |
|
||||
| Single |
|
||||
@@ -3655,7 +3655,7 @@ static const razer_zone lancehead_2019_wireless_right_zone =
|
||||
"Right LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
7
|
||||
8
|
||||
};
|
||||
|
||||
static const razer_zone lancehead_2019_wireless_left_zone =
|
||||
@@ -3663,7 +3663,7 @@ static const razer_zone lancehead_2019_wireless_left_zone =
|
||||
"Left LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
7
|
||||
8
|
||||
};
|
||||
|
||||
static const razer_zone lancehead_2019_wireless_logo_zone =
|
||||
@@ -3689,7 +3689,7 @@ static const razer_device lancehead_2019_wireless_device =
|
||||
DEVICE_TYPE_MOUSE,
|
||||
true,
|
||||
1,
|
||||
16,
|
||||
18,
|
||||
{
|
||||
&lancehead_2019_wireless_right_zone,
|
||||
&lancehead_2019_wireless_left_zone,
|
||||
@@ -3707,11 +3707,11 @@ static const razer_device lancehead_2019_wireless_device =
|
||||
| |
|
||||
| Zone "Right" |
|
||||
| Linear |
|
||||
| 7 LEDs |
|
||||
| 8 LEDs |
|
||||
| |
|
||||
| Zone "Left" |
|
||||
| Linear |
|
||||
| 7 LEDs |
|
||||
| 8 LEDs |
|
||||
| |
|
||||
| Zone "Logo" |
|
||||
| Single |
|
||||
@@ -3726,7 +3726,7 @@ static const razer_zone lancehead_te_right_zone =
|
||||
"Right LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
7
|
||||
8
|
||||
};
|
||||
|
||||
static const razer_zone lancehead_te_left_zone =
|
||||
@@ -3734,7 +3734,7 @@ static const razer_zone lancehead_te_left_zone =
|
||||
"Left LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
7
|
||||
8
|
||||
};
|
||||
|
||||
static const razer_zone lancehead_te_logo_zone =
|
||||
@@ -3760,7 +3760,7 @@ static const razer_device lancehead_te_device =
|
||||
DEVICE_TYPE_MOUSE,
|
||||
true,
|
||||
1,
|
||||
16,
|
||||
18,
|
||||
{
|
||||
&lancehead_te_right_zone,
|
||||
&lancehead_te_left_zone,
|
||||
|
||||
@@ -43,7 +43,7 @@ union razer_kraken_effect_byte
|
||||
/*---------------------------------------------------------*\
|
||||
| Razer Kraken Report Types (taken from OpenRazer) |
|
||||
\*---------------------------------------------------------*/
|
||||
PACK(struct razer_kraken_request_report
|
||||
PACK(typedef struct razer_kraken_request_report
|
||||
{
|
||||
unsigned char report_id;
|
||||
unsigned char destination;
|
||||
@@ -53,7 +53,7 @@ PACK(struct razer_kraken_request_report
|
||||
unsigned char arguments[32];
|
||||
});
|
||||
|
||||
PACK(struct razer_kraken_response_report
|
||||
PACK(typedef struct razer_kraken_response_report
|
||||
{
|
||||
unsigned char report_id;
|
||||
unsigned char arguments[36];
|
||||
|
||||
@@ -29,12 +29,61 @@ RGBController_SteelSeriesOldApex::RGBController_SteelSeriesOldApex(SteelSeriesOl
|
||||
location = OldApex->GetDeviceLocation();
|
||||
serial = OldApex->GetSerialString();
|
||||
|
||||
mode direct;
|
||||
direct.name = "Direct";
|
||||
direct.value = STEELSERIES_OLDAPEX_DIRECT;
|
||||
direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(direct);
|
||||
mode Brightness8;
|
||||
Brightness8.name = "Brightness 8";
|
||||
Brightness8.value = STEELSERIES_OLDAPEX_BRIGHTNESS_8;
|
||||
Brightness8.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Brightness8.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Brightness8);
|
||||
|
||||
mode Brightness7;
|
||||
Brightness7.name = "Brightness 7";
|
||||
Brightness7.value = STEELSERIES_OLDAPEX_BRIGHTNESS_7;
|
||||
Brightness7.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Brightness7.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Brightness7);
|
||||
|
||||
mode Brightness6;
|
||||
Brightness6.name = "Brightness 6";
|
||||
Brightness6.value = STEELSERIES_OLDAPEX_BRIGHTNESS_6;
|
||||
Brightness6.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Brightness6.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Brightness6);
|
||||
|
||||
mode Brightness5;
|
||||
Brightness5.name = "Brightness 5";
|
||||
Brightness5.value = STEELSERIES_OLDAPEX_BRIGHTNESS_5;
|
||||
Brightness5.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Brightness5.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Brightness5);
|
||||
|
||||
mode Brightness4;
|
||||
Brightness4.name = "Brightness 4";
|
||||
Brightness4.value = STEELSERIES_OLDAPEX_BRIGHTNESS_4;
|
||||
Brightness4.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Brightness4.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Brightness4);
|
||||
|
||||
mode Brightness3;
|
||||
Brightness3.name = "Brightness 3";
|
||||
Brightness3.value = STEELSERIES_OLDAPEX_BRIGHTNESS_3;
|
||||
Brightness3.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Brightness3.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Brightness3);
|
||||
|
||||
mode Brightness2;
|
||||
Brightness2.name = "Brightness 2";
|
||||
Brightness2.value = STEELSERIES_OLDAPEX_BRIGHTNESS_2;
|
||||
Brightness2.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Brightness2.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Brightness2);
|
||||
|
||||
mode Brightness1;
|
||||
Brightness1.name = "Brightness 1";
|
||||
Brightness1.value = STEELSERIES_OLDAPEX_BRIGHTNESS_1;
|
||||
Brightness1.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Brightness1.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Brightness1);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
@@ -160,7 +209,7 @@ void RGBController_SteelSeriesOldApex::DeviceUpdateLEDs()
|
||||
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesOldApex::UpdateZoneLEDs(int /*zone*/)
|
||||
void RGBController_SteelSeriesOldApex::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
// updating for one zone is pointless,
|
||||
// all zones have to be blasted anyway
|
||||
@@ -169,7 +218,7 @@ void RGBController_SteelSeriesOldApex::UpdateZoneLEDs(int /*zone*/)
|
||||
}
|
||||
|
||||
|
||||
void RGBController_SteelSeriesOldApex::UpdateSingleLED(int /*led*/)
|
||||
void RGBController_SteelSeriesOldApex::UpdateSingleLED(int led)
|
||||
{
|
||||
// Each zone is one LED, however
|
||||
// updating for one zone is pointless,
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_SteelSeriesQCKMat.cpp |
|
||||
| |
|
||||
| Generic RGB Interface SteelSeriesQCK |
|
||||
| Class |
|
||||
| |
|
||||
| Edbgon 22/05/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_SteelSeriesQCKMat.h"
|
||||
|
||||
RGBController_SteelSeriesQCKMat::RGBController_SteelSeriesQCKMat(SteelSeriesQCKMatController* qck_ptr)
|
||||
{
|
||||
qck = qck_ptr;
|
||||
|
||||
name = qck->GetDeviceName();
|
||||
vendor = "SteelSeries";
|
||||
type = DEVICE_TYPE_MOUSEMAT;
|
||||
description = "SteelSeries QCK Mat Device";
|
||||
location = qck->GetDeviceLocation();
|
||||
serial = qck->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_SteelSeriesQCKMat::~RGBController_SteelSeriesQCKMat()
|
||||
{
|
||||
delete qck;
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesQCKMat::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| QCK has two zones |
|
||||
\*---------------------------------------------------------*/
|
||||
zone mousemat_zone;
|
||||
mousemat_zone.name = "Mousemat";
|
||||
mousemat_zone.type = ZONE_TYPE_SINGLE;
|
||||
mousemat_zone.leds_min = 2;
|
||||
mousemat_zone.leds_max = 2;
|
||||
mousemat_zone.leds_count = 2;
|
||||
mousemat_zone.matrix_map = NULL;
|
||||
zones.push_back(mousemat_zone);
|
||||
|
||||
led bot_led;
|
||||
bot_led.name = "Mat Bottom LED";
|
||||
leds.push_back(bot_led);
|
||||
|
||||
led top_led;
|
||||
top_led.name = "Mat Top LED";
|
||||
leds.push_back(top_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesQCKMat::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesQCKMat::DeviceUpdateLEDs()
|
||||
{
|
||||
qck->SetColors(colors);
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesQCKMat::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Packet expects both LEDs |
|
||||
\*---------------------------------------------------------*/
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesQCKMat::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Packet expects both LEDs |
|
||||
\*---------------------------------------------------------*/
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesQCKMat::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesQCKMat::DeviceUpdateMode()
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
@@ -62,7 +62,7 @@ void SteelSeriesApexMController::EnableLEDControl()
|
||||
hid_send_feature_report(dev, buf, 513);
|
||||
}
|
||||
|
||||
void SteelSeriesApexMController::SetMode(unsigned char /*mode*/, std::vector<RGBColor> /*colors*/)
|
||||
void SteelSeriesApexMController::SetMode(unsigned char mode, std::vector<RGBColor> colors)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "Detector.h"
|
||||
#include "SteelSeriesRivalController.h"
|
||||
#include "SteelSeriesSiberiaController.h"
|
||||
#include "SteelSeriesQCKMatController.h"
|
||||
#include "SteelSeriesApexController.h"
|
||||
#include "SteelSeriesOldApexController.h"
|
||||
#include "SteelSeriesApexMController.h"
|
||||
@@ -10,7 +9,6 @@
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_SteelSeriesRival.h"
|
||||
#include "RGBController_SteelSeriesSiberia.h"
|
||||
#include "RGBController_SteelSeriesQCKMat.h"
|
||||
#include "RGBController_SteelSeriesApex.h"
|
||||
#include "RGBController_SteelSeriesOldApex.h"
|
||||
#include "RGBController_SteelSeriesSensei.h"
|
||||
@@ -46,10 +44,6 @@
|
||||
\*-----------------------------------------------------*/
|
||||
#define STEELSERIES_SIBERIA_350_PID 0x1229
|
||||
/*-----------------------------------------------------*\
|
||||
| Mousemat product IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define STEELSERIES_QCK_PRISM_CLOTH 0x150D
|
||||
/*-----------------------------------------------------*\
|
||||
| Keyboard product IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define STEELSERIES_APEX_5_PID 0x161C
|
||||
@@ -59,7 +53,6 @@
|
||||
#define STEELSERIES_APEX_PRO_TKL_PID 0x1614
|
||||
#define STEELSERIES_APEX_M750_PID 0x0616
|
||||
#define STEELSERIES_APEX_OG_PID 0x1202
|
||||
#define STEELSERIES_APEX_350_PID 0x1206
|
||||
|
||||
void DetectSteelSeriesApex(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
@@ -121,18 +114,6 @@ void DetectSteelSeriesHeadset(hid_device_info* info, const std::string& name)
|
||||
}
|
||||
}
|
||||
|
||||
void DetectSteelSeriesMousemat(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
SteelSeriesQCKMatController* controller = new SteelSeriesQCKMatController(dev, info->path);
|
||||
RGBController_SteelSeriesQCKMat* rgb_controller = new RGBController_SteelSeriesQCKMat(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
void DetectSteelSeriesRival100(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
@@ -195,10 +176,6 @@ REGISTER_HID_DETECTOR_I("SteelSeries Sensei 310", Dete
|
||||
\*---------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
REGISTER_HID_DETECTOR_I("SteelSeries Siberia 350", DetectSteelSeriesHeadset, STEELSERIES_VID, STEELSERIES_SIBERIA_350_PID, 3 );
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------*\
|
||||
| Mousemats |
|
||||
\*---------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
REGISTER_HID_DETECTOR_I("SteelSeries QCK Prism Cloth", DetectSteelSeriesMousemat, STEELSERIES_VID, STEELSERIES_QCK_PRISM_CLOTH, 0 );
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------*\
|
||||
| Keyboards |
|
||||
\*---------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
REGISTER_HID_DETECTOR_I("SteelSeries Apex 5", DetectSteelSeriesApex, STEELSERIES_VID, STEELSERIES_APEX_5_PID, 1 );
|
||||
@@ -207,5 +184,4 @@ REGISTER_HID_DETECTOR_I("SteelSeries Apex 7 TKL", Dete
|
||||
REGISTER_HID_DETECTOR_I("SteelSeries Apex Pro", DetectSteelSeriesApex, STEELSERIES_VID, STEELSERIES_APEX_PRO_PID, 1 );
|
||||
REGISTER_HID_DETECTOR_I("SteelSeries Apex Pro TKL", DetectSteelSeriesApexTKL, STEELSERIES_VID, STEELSERIES_APEX_PRO_TKL_PID, 1 );
|
||||
REGISTER_HID_DETECTOR_I("SteelSeries Apex M750", DetectSteelSeriesApexM, STEELSERIES_VID, STEELSERIES_APEX_M750_PID, 2 );
|
||||
REGISTER_HID_DETECTOR_I("SteelSeries Apex (OG)/Apex Fnatic", DetectSteelSeriesApexOld, STEELSERIES_VID, STEELSERIES_APEX_OG_PID, 0 );
|
||||
REGISTER_HID_DETECTOR_I("SteelSeries Apex 350", DetectSteelSeriesApexOld, STEELSERIES_VID, STEELSERIES_APEX_350_PID, 0 );
|
||||
REGISTER_HID_DETECTOR_I("Steelseries Apex (OG)/Apex Fnatic/Apex 350", DetectSteelSeriesApexOld, STEELSERIES_VID, STEELSERIES_APEX_OG_PID, 0 );
|
||||
|
||||
@@ -66,12 +66,7 @@ char* SteelSeriesOldApexController::GetDeviceName()
|
||||
std::string SteelSeriesOldApexController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
int ret = hid_get_serial_number_string(dev, serial_string, 128);
|
||||
|
||||
if (ret != 0)
|
||||
{
|
||||
return("");
|
||||
}
|
||||
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());
|
||||
|
||||
@@ -26,13 +26,27 @@
|
||||
/* Mode, we then use these to set actual effect based on speed. */
|
||||
enum
|
||||
{
|
||||
STEELSERIES_OLDAPEX_DIRECT = 0x08,
|
||||
STEELSERIES_OLDAPEX_BRIGHTNESS_1 = 0x01,
|
||||
STEELSERIES_OLDAPEX_BRIGHTNESS_2 = 0x02,
|
||||
STEELSERIES_OLDAPEX_BRIGHTNESS_3 = 0x03,
|
||||
STEELSERIES_OLDAPEX_BRIGHTNESS_4 = 0x04,
|
||||
STEELSERIES_OLDAPEX_BRIGHTNESS_5 = 0x05,
|
||||
STEELSERIES_OLDAPEX_BRIGHTNESS_6 = 0x06,
|
||||
STEELSERIES_OLDAPEX_BRIGHTNESS_7 = 0x07,
|
||||
STEELSERIES_OLDAPEX_BRIGHTNESS_8 = 0x08,
|
||||
};
|
||||
|
||||
/* Effects */
|
||||
enum
|
||||
{
|
||||
STEELSERIES_OLDAPEX_EFFECT_DIRECT = 0x08,
|
||||
STEELSERIES_OLDAPEX_EFFECT_BRIGHTNESS_1 = 0x01,
|
||||
STEELSERIES_OLDAPEX_EFFECT_BRIGHTNESS_2 = 0x02,
|
||||
STEELSERIES_OLDAPEX_EFFECT_BRIGHTNESS_3 = 0x03,
|
||||
STEELSERIES_OLDAPEX_EFFECT_BRIGHTNESS_4 = 0x04,
|
||||
STEELSERIES_OLDAPEX_EFFECT_BRIGHTNESS_5 = 0x05,
|
||||
STEELSERIES_OLDAPEX_EFFECT_BRIGHTNESS_6 = 0x06,
|
||||
STEELSERIES_OLDAPEX_EFFECT_BRIGHTNESS_7 = 0x07,
|
||||
STEELSERIES_OLDAPEX_EFFECT_BRIGHTNESS_8 = 0x08,
|
||||
};
|
||||
|
||||
class SteelSeriesOldApexController
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| SteelSeriesQCKControllerMat.cpp |
|
||||
| |
|
||||
| Generic RGB Interface SteelSeriesQCK |
|
||||
| Class |
|
||||
| |
|
||||
| Edbgon 22/05/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "SteelSeriesQCKMatController.h"
|
||||
#include <cstring>
|
||||
|
||||
SteelSeriesQCKMatController::SteelSeriesQCKMatController(hid_device* dev_handle, const char* path)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
}
|
||||
|
||||
SteelSeriesQCKMatController::~SteelSeriesQCKMatController()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string SteelSeriesQCKMatController::GetDeviceLocation()
|
||||
{
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
char* SteelSeriesQCKMatController::GetDeviceName()
|
||||
{
|
||||
return device_name;
|
||||
}
|
||||
|
||||
std::string SteelSeriesQCKMatController::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 SteelSeriesQCKMatController::SetColors(std::vector<RGBColor> colors)
|
||||
{
|
||||
unsigned char buf[525];
|
||||
unsigned char cbuf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(buf, 0x00, sizeof(buf));
|
||||
memset(cbuf, 0x00, sizeof(cbuf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Direct packet |
|
||||
\*-----------------------------------------------------*/
|
||||
buf[0x00] = 0x00;
|
||||
buf[0x01] = 0x0E;
|
||||
buf[0x03] = 0x02;
|
||||
|
||||
buf[0x08] = 0xFF;
|
||||
buf[0x09] = 0x32;
|
||||
buf[0x0A] = 0xC8;
|
||||
buf[0x0E] = 0x01;
|
||||
|
||||
buf[0x14] = 0xFF;
|
||||
buf[0x15] = 0x32;
|
||||
buf[0x16] = 0xC8;
|
||||
buf[0x19] = 0x01;
|
||||
|
||||
buf[0x1A] = 0x01;
|
||||
buf[0x1C] = 0x01;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Fill in color data |
|
||||
\*-----------------------------------------------------*/
|
||||
buf[0x05] = RGBGetRValue(colors[0]);
|
||||
buf[0x06] = RGBGetGValue(colors[0]);
|
||||
buf[0x07] = RGBGetBValue(colors[0]);
|
||||
|
||||
buf[0x11] = RGBGetRValue(colors[1]);
|
||||
buf[0x12] = RGBGetGValue(colors[1]);
|
||||
buf[0x13] = RGBGetBValue(colors[1]);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_send_feature_report(dev, buf, 525);
|
||||
|
||||
cbuf[0x01] = 0x0D;
|
||||
hid_write(dev, cbuf, 65);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user