Compare commits
100
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88464d1595 | ||
|
|
f41da638fa | ||
|
|
a2e74eb788 | ||
|
|
8a88573443 | ||
|
|
a90edce03b | ||
|
|
72070f95ad | ||
|
|
4b5d66ee12 | ||
|
|
2306b20bb3 | ||
|
|
d2de20425d | ||
|
|
b87691f051 | ||
|
|
5841b2c55d | ||
|
|
5286c27b25 | ||
|
|
9345682eb0 | ||
|
|
7d76d60db8 | ||
|
|
7e5546c1f2 | ||
|
|
10876054b3 | ||
|
|
7b4d24ac31 | ||
|
|
96dd92384d | ||
|
|
18aa3d35cb | ||
|
|
e7dc95313f | ||
|
|
f70c9cc63e | ||
|
|
61d4b8fa5d | ||
|
|
49fda962be | ||
|
|
a7acefb284 | ||
|
|
d19baf1365 | ||
|
|
92dc8411d6 | ||
|
|
f0468ff8d1 | ||
|
|
8cc371f9be | ||
|
|
c030157ffb | ||
|
|
3f7c981ba2 | ||
|
|
7a305b1440 | ||
|
|
9c2d186d7e | ||
|
|
f8f4dceb4a | ||
|
|
210591aa39 | ||
|
|
d3aefcfdf4 | ||
|
|
31e35884dd | ||
|
|
9bde1c282a | ||
|
|
ca3c2ad541 | ||
|
|
3345fe6562 | ||
|
|
ddfcd1caf9 | ||
|
|
72da8f362c | ||
|
|
b0de49a107 | ||
|
|
09a9a5c257 | ||
|
|
35fd4e2aae | ||
|
|
e4a819913a | ||
|
|
08718044d0 | ||
|
|
6ec7901038 | ||
|
|
43fccf259f | ||
|
|
a2f348a245 | ||
|
|
049441a4f5 | ||
|
|
081752c927 | ||
|
|
f64fe31daa | ||
|
|
195730e721 | ||
|
|
f2396b453f | ||
|
|
f1fd3e0191 | ||
|
|
fd4dcbd092 | ||
|
|
5b76b83433 | ||
|
|
fd3f2c50cb | ||
|
|
a414335334 | ||
|
|
23ed6955bf | ||
|
|
9ca2a28444 | ||
|
|
80c8b5f7e5 | ||
|
|
ec7ca4cca3 | ||
|
|
fca0f53e7a | ||
|
|
843dacb43e | ||
|
|
d9771f7b9b | ||
|
|
dc2b41a0e2 | ||
|
|
cae28f3ac6 | ||
|
|
0a458623e4 | ||
|
|
2850bd1a19 | ||
|
|
bcd49298cd | ||
|
|
5458692192 | ||
|
|
b35474d711 | ||
|
|
207e05ba27 | ||
|
|
3ea73ee80c | ||
|
|
7cfdaaa501 | ||
|
|
6347feb575 | ||
|
|
8dd0d85104 | ||
|
|
c1715f25f4 | ||
|
|
9b9ec69f57 | ||
|
|
3cae2bccb5 | ||
|
|
a2e21e606c | ||
|
|
c7a7eaf670 | ||
|
|
ca6c61d47f | ||
|
|
2346095994 | ||
|
|
7abd511306 | ||
|
|
f99aa4c4ff | ||
|
|
55af558e0e | ||
|
|
4f47e166dd | ||
|
|
6cf624e56b | ||
|
|
e98d43776a | ||
|
|
34d8edb629 | ||
|
|
8ffd302a57 | ||
|
|
dde857dfb4 | ||
|
|
9a53709db0 | ||
|
|
b495c7723f | ||
|
|
dd36a7362a | ||
|
|
a4d02d1c32 | ||
|
|
75bd29126e | ||
|
|
f106e83c94 |
@@ -4,5 +4,8 @@ ui_*
|
||||
moc_*
|
||||
qrc_*
|
||||
OpenRGB
|
||||
openrgb
|
||||
Makefile
|
||||
OpenRGB-x86_64.AppImage
|
||||
.qmake.stash
|
||||
.vscode
|
||||
|
||||
+58
-6
@@ -20,38 +20,90 @@ stages:
|
||||
before_script:
|
||||
- echo "started by ${GITLAB_USER_NAME}"
|
||||
|
||||
#reusable templates
|
||||
.ccache_init: &ccache_init
|
||||
before_script:
|
||||
- apt update
|
||||
- apt install -y build-essential qtcreator qt5-default libusb-1.0-0-dev libhidapi-dev pkgconf wget git
|
||||
|
||||
#-----------------------------------------------------------------------#
|
||||
# Linux (AppImage) 32-bit Build Target #
|
||||
#-----------------------------------------------------------------------#
|
||||
build_linux_32:
|
||||
<<: *ccache_init
|
||||
image: i386/ubuntu:bionic
|
||||
stage: build
|
||||
script:
|
||||
- apt update
|
||||
- apt install -y build-essential qtcreator qt5-default libusb-1.0-0-dev libhidapi-dev pkgconf wget git
|
||||
- ./scripts/build-appimage-32.sh
|
||||
- export $(dpkg-architecture)
|
||||
- ./scripts/build-appimage.sh
|
||||
|
||||
artifacts:
|
||||
paths:
|
||||
- OpenRGB-i386.AppImage
|
||||
- 60-openrgb.rules
|
||||
- README.md
|
||||
expire_in: 30 days
|
||||
|
||||
#-----------------------------------------------------------------------#
|
||||
# Linux (AppImage) 64-bit Build Target #
|
||||
#-----------------------------------------------------------------------#
|
||||
build_linux_64:
|
||||
<<: *ccache_init
|
||||
image: ubuntu:bionic
|
||||
stage: build
|
||||
script:
|
||||
- apt update
|
||||
- apt install -y build-essential qtcreator qt5-default libusb-1.0-0-dev libhidapi-dev pkgconf wget git
|
||||
- export $(dpkg-architecture)
|
||||
- ./scripts/build-appimage.sh
|
||||
|
||||
artifacts:
|
||||
paths:
|
||||
- OpenRGB-x86_64.AppImage
|
||||
- 60-openrgb.rules
|
||||
- README.md
|
||||
expire_in: 30 days
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------#
|
||||
# Linux (.deb) 32-bit Build Target #
|
||||
#-----------------------------------------------------------------------#
|
||||
build_linux_deb32:
|
||||
<<: *ccache_init
|
||||
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*.ddeb
|
||||
- mv -v ../openrgb*.deb ./
|
||||
|
||||
artifacts:
|
||||
paths:
|
||||
- openrgb*.deb
|
||||
exclude:
|
||||
- openrgb-dbgsym*.deb
|
||||
expire_in: 30 days
|
||||
|
||||
#-----------------------------------------------------------------------#
|
||||
# Linux (.deb) 64-bit Build Target #
|
||||
#-----------------------------------------------------------------------#
|
||||
build_linux_deb64:
|
||||
<<: *ccache_init
|
||||
image: ubuntu:bionic
|
||||
stage: build
|
||||
script:
|
||||
- apt install -y debhelper
|
||||
- dpkg-architecture -l
|
||||
- dpkg-buildpackage -us -B
|
||||
- rm -v ../openrgb-dbgsym*.ddeb
|
||||
- mv -v ../openrgb*.deb ./
|
||||
|
||||
artifacts:
|
||||
paths:
|
||||
- openrgb*.deb
|
||||
exclude:
|
||||
- openrgb-dbgsym*.deb
|
||||
expire_in: 30 days
|
||||
|
||||
#-----------------------------------------------------------------------#
|
||||
# Windows (32-bit) Build Target #
|
||||
#-----------------------------------------------------------------------#
|
||||
|
||||
@@ -4,7 +4,7 @@ Found a bug? Something isn't working as expected? To help us keep track of the
|
||||
|
||||
### Description of Bug
|
||||
<!--
|
||||
Please describe the bug. Explain steps taken to reproduct the bug and what you expect the correct behavior to be.
|
||||
Please describe the bug. Explain steps taken to reproduce the bug and what you expect the correct behavior to be.
|
||||
-->
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,9 @@ Please link us to the manufacturer's product page beneath this line
|
||||
|
||||
|
||||
### Please select what type of device/interface the device uses:
|
||||
|
||||
<!--
|
||||
Place an x between the brackets to check the box
|
||||
-->
|
||||
- [ ] Motherboard (SMBus)
|
||||
- [ ] Motherboard (USB)
|
||||
- [ ] RAM (SMBus)
|
||||
@@ -29,7 +31,7 @@ Please link us to the manufacturer's product page beneath this line
|
||||
### ID information:
|
||||
<!--
|
||||
For PCI (GPU) devices we will need the Vendor ID, Device ID, Sub-Vendor ID and Sub-Device IDs
|
||||
In Windows this can be found under the device manager and on Linux this can be found wit lspci -vv
|
||||
In Windows this can be found under the device manager and on Linux this can be found with lspci -vv
|
||||
For USB devices we will need the USB VID and PID
|
||||
-->
|
||||
|
||||
|
||||
+35
-10
@@ -68,6 +68,7 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c12", TAG+="uacces
|
||||
# Corsair LS100 #
|
||||
# Corsair 1000D Obsidian #
|
||||
# Corsair Spec Omega RGB #
|
||||
# Corsair LT100 #
|
||||
#---------------------------------------------------------------#
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c1a", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c0b", TAG+="uaccess"
|
||||
@@ -75,6 +76,7 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c10", TAG+="uacces
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0c1e", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1d00", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1d04", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0a32", TAG+="uaccess"
|
||||
|
||||
#---------------------------------------------------------------#
|
||||
# Corsair Peripheral Devices #
|
||||
@@ -134,12 +136,28 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0a34", TAG+="uacces
|
||||
# #
|
||||
# Keyboards: #
|
||||
# HyperX Alloy Elite #
|
||||
# #
|
||||
# Mice: #
|
||||
# HyperX Pulsefire Surge #
|
||||
# #
|
||||
# Mousemats: #
|
||||
# HyperX Fury Ultra #
|
||||
#---------------------------------------------------------------#
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="0951", ATTR{idProduct}=="16be", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="0951", ATTR{idProduct}=="16d3", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="0951", ATTR{idProduct}=="1705", TAG+="uaccess"
|
||||
|
||||
#---------------------------------------------------------------#
|
||||
# Logitech Peripheral Devices #
|
||||
# #
|
||||
# Keyboards: #
|
||||
# Logitech G213 #
|
||||
# Logitech G512 #
|
||||
# Logitech G512 RGB #
|
||||
# Logitech G610 #
|
||||
# Logitech G810 #1 #
|
||||
# Logitech G810 #2 #
|
||||
# #
|
||||
# Mice: #
|
||||
# Logitech G203 Prodigy #
|
||||
# Logitech G203 Lightsync #
|
||||
@@ -148,27 +166,28 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="0951", ATTR{idProduct}=="16be", TAG+="uacces
|
||||
# Logitech G502 Proteus Spectrum #
|
||||
# Logitech G Lightspeed Wireless Gaming Mouse #
|
||||
# Logitech G Pro Wireless Gaming Mouse (Wired) #
|
||||
# #
|
||||
# Mousemats: #
|
||||
# Logitech G Powerplay Mousepad with Lightspeed #
|
||||
# #
|
||||
# Keyboards: #
|
||||
# Logitech G512 #
|
||||
# Logitech G512 RGB #
|
||||
# Logitech G810 #1 #
|
||||
# Logitech G810 #2 #
|
||||
#---------------------------------------------------------------#
|
||||
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}=="c331", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c337", 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}=="c332", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c08b", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c539", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c088", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c53a", TAG+="uaccess"
|
||||
|
||||
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}=="c337", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c331", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c53a", TAG+="uaccess"
|
||||
|
||||
#---------------------------------------------------------------#
|
||||
# MSI Mysticlight #
|
||||
@@ -220,6 +239,11 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="905D", TAG+="uacces
|
||||
#---------------------------------------------------------------#
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1770", ATTR{idProduct}=="FF00", TAG+="uaccess"
|
||||
|
||||
#---------------------------------------------------------------#
|
||||
# NZXT Hue+ #
|
||||
#---------------------------------------------------------------#
|
||||
KERNEL=="ttyACM[0-9]*", ATTR{idVendor}=="04D8", ATTR{idProduct}=="00DF", TAG+="uaccess"
|
||||
|
||||
#---------------------------------------------------------------#
|
||||
# NZXT Hue 2 Devices #
|
||||
# #
|
||||
@@ -254,6 +278,7 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="0c45", ATTR{idProduct}=="652f", TAG+="uacces
|
||||
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="04d9", ATTR{idProduct}=="fc30", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="04d9", ATTR{idProduct}=="fc39", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="04d9", ATTR{idProduct}=="fc4d", TAG+="uaccess"
|
||||
|
||||
#---------------------------------------------------------------#
|
||||
# Gigabyte/Aorus RGB Fusion 2 USB #
|
||||
|
||||
@@ -41,7 +41,7 @@ AMDWraithPrismController::~AMDWraithPrismController()
|
||||
|
||||
std::string AMDWraithPrismController::GetLocationString()
|
||||
{
|
||||
return(location);
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
char* AMDWraithPrismController::GetDeviceName()
|
||||
@@ -49,6 +49,17 @@ char* AMDWraithPrismController::GetDeviceName()
|
||||
return device_name;
|
||||
}
|
||||
|
||||
std::string AMDWraithPrismController::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);
|
||||
}
|
||||
|
||||
std::string AMDWraithPrismController::GetEffectChannelString(unsigned char channel)
|
||||
{
|
||||
std::string ret_string = "";
|
||||
|
||||
@@ -117,6 +117,7 @@ public:
|
||||
std::string GetEffectChannelString(unsigned char channel);
|
||||
std::string GetFirmwareVersionString();
|
||||
std::string GetLocationString();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SetRingEffectChannel(unsigned char channel);
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
#include "AMDWraithPrismController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_AMDWraithPrism.h"
|
||||
#include <vector>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#define AMD_WRAITH_PRISM_VID 0x2516
|
||||
#define AMD_WRAITH_PRISM_PID 0x0051
|
||||
|
||||
@@ -15,40 +15,16 @@
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectAMDWraithPrismControllers(std::vector<RGBController*>& rgb_controllers)
|
||||
void DetectAMDWraithPrismControllers(hid_device_info* info, const std::string&)
|
||||
{
|
||||
hid_device_info* info;
|
||||
hid_device* dev = NULL;
|
||||
|
||||
hid_init();
|
||||
|
||||
info = hid_enumerate(AMD_WRAITH_PRISM_VID, AMD_WRAITH_PRISM_PID);
|
||||
|
||||
//Look for AMD Wraith Prism
|
||||
while(info)
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if( dev )
|
||||
{
|
||||
if((info->vendor_id == AMD_WRAITH_PRISM_VID)
|
||||
&&(info->product_id == AMD_WRAITH_PRISM_PID)
|
||||
#if USE_HID_USAGE
|
||||
&&(info->interface_number == 1)
|
||||
&&(info->usage_page == 0xFF00))
|
||||
#else
|
||||
&&(info->interface_number == 1))
|
||||
#endif
|
||||
{
|
||||
dev = hid_open_path(info->path);
|
||||
|
||||
if( dev )
|
||||
{
|
||||
AMDWraithPrismController* controller = new AMDWraithPrismController(dev, info->path);
|
||||
|
||||
RGBController_AMDWraithPrism* rgb_controller = new RGBController_AMDWraithPrism(controller);
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
info = info->next;
|
||||
AMDWraithPrismController* controller = new AMDWraithPrismController(dev, info->path);
|
||||
RGBController_AMDWraithPrism* rgb_controller = new RGBController_AMDWraithPrism(controller);
|
||||
// Constructor sets the name
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_DETECTOR("AMD Wraith Prism", DetectAMDWraithPrismControllers);
|
||||
REGISTER_HID_DETECTOR_IP("AMD Wraith Prism", DetectAMDWraithPrismControllers, AMD_WRAITH_PRISM_VID, AMD_WRAITH_PRISM_PID, 1, 0xFF00);
|
||||
|
||||
@@ -14,10 +14,16 @@ RGBController_AMDWraithPrism::RGBController_AMDWraithPrism(AMDWraithPrismControl
|
||||
wraith = wraith_ptr;
|
||||
|
||||
name = "AMD Wraith Prism";
|
||||
vendor = "Cooler Master";
|
||||
type = DEVICE_TYPE_COOLER;
|
||||
description = "AMD Wraith Prism Device";
|
||||
version = wraith->GetFirmwareVersionString();
|
||||
location = wraith->GetLocationString();
|
||||
/*-----------------------------------------------------*\
|
||||
| Don't use HID serial string, it is inconsistent on my |
|
||||
| Wraith Prism |
|
||||
\*-----------------------------------------------------*/
|
||||
serial = "";//wraith->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
|
||||
+8
-5
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| PolychromeController.cpp |
|
||||
| ASRockPolychromeSMBusController.cpp |
|
||||
| |
|
||||
| Driver for for ASRock ASR LED and |
|
||||
| Polychrome RGB lighting controller |
|
||||
@@ -7,8 +7,9 @@
|
||||
| Adam Honse (CalcProgrammer1) 12/14/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "PolychromeController.h"
|
||||
#include "ASRockPolychromeSMBusController.h"
|
||||
#include <cstring>
|
||||
#include "dependencies/dmiinfo.h"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
@@ -17,6 +18,8 @@ PolychromeController::PolychromeController(i2c_smbus_interface* bus, polychrome_
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
|
||||
DMIInfo dmi;
|
||||
|
||||
unsigned short fw_version = ReadFirmwareVersion();
|
||||
unsigned char major_version = fw_version >> 8;
|
||||
|
||||
@@ -29,19 +32,19 @@ PolychromeController::PolychromeController(i2c_smbus_interface* bus, polychrome_
|
||||
switch(major_version)
|
||||
{
|
||||
case ASROCK_TYPE_ASRLED:
|
||||
device_name = "ASRock ASR LED";
|
||||
device_name = "ASRock " + dmi.getMainboard();
|
||||
asrock_type = ASROCK_TYPE_ASRLED;
|
||||
memset(zone_led_count, 0, sizeof(zone_led_count));
|
||||
break;
|
||||
|
||||
case ASROCK_TYPE_POLYCHROME_V1:
|
||||
device_name = "ASRock Polychrome V1";
|
||||
device_name = "ASRock " + dmi.getMainboard();
|
||||
asrock_type = ASROCK_TYPE_POLYCHROME_V1;
|
||||
ReadLEDConfiguration();
|
||||
break;
|
||||
|
||||
case ASROCK_TYPE_POLYCHROME_V2:
|
||||
device_name = "ASRock Polychrome V2";
|
||||
device_name = "ASRock " + dmi.getMainboard();
|
||||
asrock_type = ASROCK_TYPE_POLYCHROME_V2;
|
||||
ReadLEDConfiguration();
|
||||
break;
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| PolychromeController.h |
|
||||
| ASRockPolychromeSMBusController.h |
|
||||
| |
|
||||
| Definitions and types for ASRock |
|
||||
| ASR LED and Polychrome RGB lighting |
|
||||
+10
-10
@@ -1,7 +1,7 @@
|
||||
#include "Detector.h"
|
||||
#include "PolychromeController.h"
|
||||
#include "ASRockPolychromeSMBusController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_Polychrome.h"
|
||||
#include "RGBController_ASRockPolychromeSMBus.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include "pci_ids.h"
|
||||
#include <vector>
|
||||
@@ -10,14 +10,14 @@
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* TestForPolychromeController *
|
||||
* TestForPolychromeSMBusController *
|
||||
* *
|
||||
* Tests the given address to see if an ASRock Polychrome RGB controller exists there.*
|
||||
* First does a quick write to test for a response *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
bool TestForPolychromeController(i2c_smbus_interface* bus, unsigned char address)
|
||||
bool TestForPolychromeSMBusController(i2c_smbus_interface* bus, unsigned char address)
|
||||
{
|
||||
bool pass = false;
|
||||
|
||||
@@ -36,15 +36,15 @@ bool TestForPolychromeController(i2c_smbus_interface* bus, unsigned char address
|
||||
* *
|
||||
* DetectPolychromeControllers *
|
||||
* *
|
||||
* Detect ASRock Polychrome RGB controllers on the enumerated I2C busses at address *
|
||||
* 0x6A. *
|
||||
* Detect ASRock Polychrome RGB SMBus controllers on the enumerated I2C busses at *
|
||||
* address 0x6A. *
|
||||
* *
|
||||
* bus - pointer to i2c_smbus_interface where Polychrome device is connected *
|
||||
* dev - I2C address of Polychrome device *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectPolychromeControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers)
|
||||
void DetectPolychromeSMBusControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers)
|
||||
{
|
||||
PolychromeController* new_polychrome;
|
||||
RGBController_Polychrome* new_controller;
|
||||
@@ -54,7 +54,7 @@ void DetectPolychromeControllers(std::vector<i2c_smbus_interface*>& busses, std:
|
||||
IF_MOBO_SMBUS(busses[bus]->pci_vendor, busses[bus]->pci_device)
|
||||
{
|
||||
// Check for Polychrome controller at 0x6A
|
||||
if (TestForPolychromeController(busses[bus], 0x6A))
|
||||
if (TestForPolychromeSMBusController(busses[bus], 0x6A))
|
||||
{
|
||||
new_polychrome = new PolychromeController(busses[bus], 0x6A);
|
||||
|
||||
@@ -71,6 +71,6 @@ void DetectPolychromeControllers(std::vector<i2c_smbus_interface*>& busses, std:
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectPolychromeControllers() */
|
||||
} /* DetectSMBusPolychromeControllers() */
|
||||
|
||||
REGISTER_I2C_DETECTOR("ASRock Polychrome", DetectPolychromeControllers);
|
||||
REGISTER_I2C_DETECTOR("ASRock Polychrome SMBus", DetectPolychromeSMBusControllers);
|
||||
+9
-3
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_Polychrome.cpp |
|
||||
| RGBController_ASRockPolychromeSMBus.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for OpenRGB |
|
||||
| ASRock ASR LED and Polychrome RGB Driver |
|
||||
@@ -7,7 +7,7 @@
|
||||
| Adam Honse (CalcProgrammer1) 12/15/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_Polychrome.h"
|
||||
#include "RGBController_ASRockPolychromeSMBus.h"
|
||||
|
||||
#define ASROCK_MAX_ZONES 4
|
||||
#define ASROCK_MAX_LEDS 22
|
||||
@@ -37,15 +37,17 @@ RGBController_Polychrome::RGBController_Polychrome(PolychromeController* polychr
|
||||
polychrome = polychrome_ptr;
|
||||
|
||||
name = polychrome->GetDeviceName();
|
||||
vendor = "ASRock";
|
||||
version = polychrome->GetFirmwareVersion();
|
||||
type = DEVICE_TYPE_MOTHERBOARD;
|
||||
description = "ASRock ASR LED/Polychrome Device";
|
||||
location = polychrome->GetDeviceLocation();
|
||||
|
||||
switch(polychrome->GetASRockType())
|
||||
{
|
||||
case ASROCK_TYPE_ASRLED:
|
||||
{
|
||||
description = "ASRock ASR LED Device";
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = ASRLED_MODE_OFF;
|
||||
@@ -121,6 +123,8 @@ RGBController_Polychrome::RGBController_Polychrome(PolychromeController* polychr
|
||||
|
||||
case ASROCK_TYPE_POLYCHROME_V1:
|
||||
{
|
||||
description = "ASRock Polychrome v1 Device";
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = POLYCHROME_V1_MODE_OFF;
|
||||
@@ -269,6 +273,8 @@ RGBController_Polychrome::RGBController_Polychrome(PolychromeController* polychr
|
||||
|
||||
case ASROCK_TYPE_POLYCHROME_V2:
|
||||
{
|
||||
description = "ASRock Polychrome v2 Device";
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = POLYCHROME_V2_MODE_OFF;
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_Polychrome.h |
|
||||
| RGBController_ASRockPolychromeSMBus.h |
|
||||
| |
|
||||
| Generic RGB Interface for OpenRGB |
|
||||
| ASRock ASR LED and Polychrome RGB Driver |
|
||||
@@ -10,7 +10,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "PolychromeController.h"
|
||||
#include "ASRockPolychromeSMBusController.h"
|
||||
|
||||
class RGBController_Polychrome : public RGBController
|
||||
{
|
||||
@@ -1,87 +0,0 @@
|
||||
#include "Detector.h"
|
||||
#include "RGBController.h"
|
||||
#include "ATC800Controller.h"
|
||||
#include "RGBController_AorusATC800.h"
|
||||
#include <vector>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Vendor ID |
|
||||
\*-----------------------------------------------------*/
|
||||
#define HOLTEK_VID 0x1044
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Controller product ids |
|
||||
\*-----------------------------------------------------*/
|
||||
#define ATC_800_CONTROLLER_PID 0x7A42
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short usb_vid;
|
||||
unsigned short usb_pid;
|
||||
char usb_interface;
|
||||
device_type type;
|
||||
const char * name;
|
||||
} device;
|
||||
|
||||
#define NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
|
||||
|
||||
static const device device_list[] =
|
||||
{
|
||||
{ HOLTEK_VID, ATC_800_CONTROLLER_PID, 0, DEVICE_TYPE_KEYBOARD, "Aorus ATC800 CPU Cooler" },
|
||||
};
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectAorusCPUCoolerControllers *
|
||||
* *
|
||||
* Tests the USB address to see if a Aorus RGB CPU Cooler exists there. *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectAorusCPUCoolerControllers(std::vector<RGBController*>& rgb_controllers)
|
||||
{
|
||||
hid_init();
|
||||
|
||||
for(unsigned int device_idx = 0; device_idx < NUM_DEVICES; device_idx++)
|
||||
{
|
||||
hid_device_info* info = hid_enumerate(device_list[device_idx].usb_vid, device_list[device_idx].usb_pid);
|
||||
|
||||
while(info)
|
||||
{
|
||||
if((info->vendor_id == device_list[device_idx].usb_vid)
|
||||
&&(info->product_id == device_list[device_idx].usb_pid)
|
||||
#ifdef USE_HID_USAGE
|
||||
&&(info->interface_number == device_list[device_idx].usb_interface)
|
||||
&&(info->usage_page == 0xFF01)
|
||||
&&(info->usage == 1))
|
||||
#else
|
||||
&&(info->interface_number == device_list[device_idx].usb_interface))
|
||||
#endif
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
switch(device_list[device_idx].usb_pid)
|
||||
{
|
||||
case ATC_800_CONTROLLER_PID:
|
||||
{
|
||||
ATC800Controller* controller = new ATC800Controller(dev, info->path);
|
||||
|
||||
RGBController_AorusATC800* rgb_controller = new RGBController_AorusATC800(controller);
|
||||
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
info = info->next;
|
||||
}
|
||||
hid_free_enumeration(info);
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_DETECTOR("Aorus CPU Coolers", DetectAorusCPUCoolerControllers);
|
||||
+21
-4
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| AuraCoreController.cpp |
|
||||
| AsusAuraCoreController.cpp |
|
||||
| |
|
||||
| Driver for ASUS ROG Aura Core RGB |
|
||||
| lighting controller |
|
||||
@@ -7,12 +7,13 @@
|
||||
| Adam Honse (CalcProgrammer1) 4/13/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "AuraCoreController.h"
|
||||
#include "AsusAuraCoreController.h"
|
||||
#include <cstring>
|
||||
|
||||
AuraCoreController::AuraCoreController(hid_device* dev_handle)
|
||||
AuraCoreController::AuraCoreController(hid_device* dev_handle, const char* path)
|
||||
{
|
||||
dev = dev_handle;
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
}
|
||||
|
||||
AuraCoreController::~AuraCoreController()
|
||||
@@ -20,6 +21,22 @@ AuraCoreController::~AuraCoreController()
|
||||
|
||||
}
|
||||
|
||||
std::string AuraCoreController::GetDeviceLocation()
|
||||
{
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string AuraCoreController::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 AuraCoreController::SendBrightness
|
||||
(
|
||||
unsigned char brightness
|
||||
+6
-2
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| AuraCoreController.h |
|
||||
| AsusAuraCoreController.h |
|
||||
| |
|
||||
| Definitions and types for ASUS ROG Aura |
|
||||
| Core RGB lighting controller |
|
||||
@@ -48,9 +48,12 @@ enum
|
||||
class AuraCoreController
|
||||
{
|
||||
public:
|
||||
AuraCoreController(hid_device* dev_handle);
|
||||
AuraCoreController(hid_device* dev_handle, const char* path);
|
||||
~AuraCoreController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SendBrightness
|
||||
(
|
||||
unsigned char brightness
|
||||
@@ -72,5 +75,6 @@ public:
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
#include "Detector.h"
|
||||
#include "AsusAuraCoreController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_AsusAuraCore.h"
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#define AURA_CORE_VID 0x0B05
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectAuraCoreControllers *
|
||||
* *
|
||||
* Tests the USB address to see if an Asus ROG Aura Core controller exists there *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectAsusAuraCoreControllers(hid_device_info* info, const std::string&)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if( dev )
|
||||
{
|
||||
AuraCoreController* controller = new AuraCoreController(dev, info->path);
|
||||
RGBController_AuraCore* rgb_controller = new RGBController_AuraCore(controller);
|
||||
// Constructor sets the name
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_HID_DETECTOR("ASUS Aura Core", DetectAsusAuraCoreControllers, AURA_CORE_VID, 0x1854);
|
||||
REGISTER_HID_DETECTOR("ASUS Aura Core", DetectAsusAuraCoreControllers, AURA_CORE_VID, 0x1866);
|
||||
REGISTER_HID_DETECTOR("ASUS Aura Core", DetectAsusAuraCoreControllers, AURA_CORE_VID, 0x1869);
|
||||
+5
-2
@@ -1,20 +1,23 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_AuraCore.cpp |
|
||||
| RGBController_AsusAuraCore.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for ROG Aura Core |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 4/17/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_AuraCore.h"
|
||||
#include "RGBController_AsusAuraCore.h"
|
||||
|
||||
RGBController_AuraCore::RGBController_AuraCore(AuraCoreController* aura_ptr)
|
||||
{
|
||||
aura = aura_ptr;
|
||||
|
||||
name = "ASUS Aura Core";
|
||||
vendor = "ASUS";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "ASUS Aura Core Device";
|
||||
location = aura->GetDeviceLocation();
|
||||
serial = aura->GetSerialString();
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_AuraCore.h |
|
||||
| RGBController_AsusAuraCore.h |
|
||||
| |
|
||||
| Generic RGB Interface for ROG Aura Core |
|
||||
| |
|
||||
@@ -9,7 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "AuraCoreController.h"
|
||||
#include "AsusAuraCoreController.h"
|
||||
|
||||
class RGBController_AuraCore : public RGBController
|
||||
{
|
||||
+2
-2
@@ -1,12 +1,12 @@
|
||||
/*-----------------------------------------*\
|
||||
| AuraGPUController.cpp |
|
||||
| AsusAuraGPUController.cpp |
|
||||
| |
|
||||
| Driver for ASUS Aura RGB on GPUs |
|
||||
| |
|
||||
| Jan Rettig (Klapstuhl) 14.02.2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "AuraGPUController.h"
|
||||
#include "AsusAuraGPUController.h"
|
||||
#include <cstring>
|
||||
|
||||
AuraGPUController::AuraGPUController(i2c_smbus_interface* bus, aura_gpu_dev_id dev)
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| AuraGPUController.h |
|
||||
| AsusAuraGPUController.h |
|
||||
| |
|
||||
| Definitions for ASUS Aura RGB on GPUs |
|
||||
| |
|
||||
+7
-7
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| AuraGPUControllerDetect.cpp |
|
||||
| AsusAuraGPUControllerDetect.cpp |
|
||||
| |
|
||||
| Driver for ASUS Aura RGB on GPUs |
|
||||
| |
|
||||
@@ -7,9 +7,9 @@
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "Detector.h"
|
||||
#include "AuraGPUController.h"
|
||||
#include "AsusAuraGPUController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_AuraGPU.h"
|
||||
#include "RGBController_AsusAuraGPU.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
@@ -38,7 +38,7 @@ static const unsigned char aura_gpu_addresses[] =
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
bool TestForAuraGPUController(i2c_smbus_interface* bus, unsigned char address)
|
||||
bool TestForAsusAuraGPUController(i2c_smbus_interface* bus, unsigned char address)
|
||||
{
|
||||
bool pass = false;
|
||||
|
||||
@@ -63,7 +63,7 @@ bool TestForAuraGPUController(i2c_smbus_interface* bus, unsigned char address)
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectAuraGPUControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers)
|
||||
void DetectAsusAuraGPUControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers)
|
||||
{
|
||||
AuraGPUController* new_aura_gpu;
|
||||
RGBController_AuraGPU* new_controller;
|
||||
@@ -73,7 +73,7 @@ void DetectAuraGPUControllers(std::vector<i2c_smbus_interface*> &busses, std::ve
|
||||
// Add Aura-enabled GPU controllers
|
||||
for (unsigned int address_list_idx = 0; address_list_idx < AURA_GPU_ADDRESS_COUNT; address_list_idx++)
|
||||
{
|
||||
if (TestForAuraGPUController(busses[bus], aura_gpu_addresses[address_list_idx]))
|
||||
if (TestForAsusAuraGPUController(busses[bus], aura_gpu_addresses[address_list_idx]))
|
||||
{
|
||||
new_aura_gpu = new AuraGPUController(busses[bus], aura_gpu_addresses[address_list_idx]);
|
||||
new_controller = new RGBController_AuraGPU(new_aura_gpu);
|
||||
@@ -85,4 +85,4 @@ void DetectAuraGPUControllers(std::vector<i2c_smbus_interface*> &busses, std::ve
|
||||
}
|
||||
} /* DetectAuraGPUControllers() */
|
||||
|
||||
REGISTER_I2C_DETECTOR("ASUS Aura GPU", DetectAuraGPUControllers);
|
||||
REGISTER_I2C_DETECTOR("ASUS Aura GPU", DetectAsusAuraGPUControllers);
|
||||
+3
-2
@@ -1,12 +1,12 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_AuraGPU.h |
|
||||
| RGBController_AsusAuraGPU.h |
|
||||
| |
|
||||
| Generic RGB Interface for Asus Aura GPU |
|
||||
| |
|
||||
| Jan Rettig (Klapstuhl) 14.02.2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_AuraGPU.h"
|
||||
#include "RGBController_AsusAuraGPU.h"
|
||||
|
||||
int RGBController_AuraGPU::GetDeviceMode()
|
||||
{
|
||||
@@ -47,6 +47,7 @@ RGBController_AuraGPU::RGBController_AuraGPU(AuraGPUController * aura_gpu_ptr)
|
||||
|
||||
|
||||
name = aura_gpu->GetDeviceName();
|
||||
vendor = "ASUS";
|
||||
type = DEVICE_TYPE_GPU;
|
||||
description = "ASUS Aura GPU Device";
|
||||
version = "0.00.1";
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_AuraGPU.h |
|
||||
| RGBController_AsusAuraGPU.h |
|
||||
| |
|
||||
| Generic RGB Interface for Asus Aura GPU |
|
||||
| |
|
||||
@@ -9,7 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "AuraGPUController.h"
|
||||
#include "AsusAuraGPUController.h"
|
||||
|
||||
class RGBController_AuraGPU : public RGBController
|
||||
{
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| AuraSMBusController.cpp |
|
||||
| AsusAuraSMBusController.cpp |
|
||||
| |
|
||||
| Driver for ASUS Aura RGB lighting |
|
||||
| controller |
|
||||
@@ -7,7 +7,7 @@
|
||||
| Adam Honse (CalcProgrammer1) 8/19/2018 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "AuraSMBusController.h"
|
||||
#include "AsusAuraSMBusController.h"
|
||||
#include <cstring>
|
||||
|
||||
static const char* aura_channels[] = /* Aura channel strings */
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| AuraSMBusController.h |
|
||||
| AsusAuraSMBusController.h |
|
||||
| |
|
||||
| Definitions and types for ASUS Aura RGB |
|
||||
| lighting controller |
|
||||
+10
-10
@@ -1,7 +1,7 @@
|
||||
#include "Detector.h"
|
||||
#include "AuraSMBusController.h"
|
||||
#include "AsusAuraSMBusController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_AuraSMBus.h"
|
||||
#include "RGBController_AsusAuraSMBus.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include "pci_ids.h"
|
||||
#include <vector>
|
||||
@@ -64,7 +64,7 @@ static const unsigned char aura_mobo_addresses[] =
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void AuraRegisterWrite(i2c_smbus_interface* bus, aura_dev_id dev, aura_register reg, unsigned char val)
|
||||
void AsusAuraRegisterWrite(i2c_smbus_interface* bus, aura_dev_id dev, aura_register reg, unsigned char val)
|
||||
{
|
||||
//Write Aura register
|
||||
bus->i2c_smbus_write_word_data(dev, 0x00, ((reg << 8) & 0xFF00) | ((reg >> 8) & 0x00FF));
|
||||
@@ -83,7 +83,7 @@ void AuraRegisterWrite(i2c_smbus_interface* bus, aura_dev_id dev, aura_register
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
bool TestForAuraSMBusController(i2c_smbus_interface* bus, unsigned char address)
|
||||
bool TestForAsusAuraSMBusController(i2c_smbus_interface* bus, unsigned char address)
|
||||
{
|
||||
bool pass = false;
|
||||
|
||||
@@ -122,7 +122,7 @@ bool TestForAuraSMBusController(i2c_smbus_interface* bus, unsigned char address)
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectAuraSMBusControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers)
|
||||
void DetectAsusAuraSMBusControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers)
|
||||
{
|
||||
AuraSMBusController* new_aura;
|
||||
RGBController_AuraSMBus* new_controller;
|
||||
@@ -159,15 +159,15 @@ void DetectAuraSMBusControllers(std::vector<i2c_smbus_interface*> &busses, std::
|
||||
|
||||
if(address_list_idx < AURA_RAM_ADDRESS_COUNT)
|
||||
{
|
||||
AuraRegisterWrite(busses[bus], 0x77, AURA_REG_SLOT_INDEX, slot);
|
||||
AuraRegisterWrite(busses[bus], 0x77, AURA_REG_I2C_ADDRESS, (aura_ram_addresses[address_list_idx] << 1));
|
||||
AsusAuraRegisterWrite(busses[bus], 0x77, AURA_REG_SLOT_INDEX, slot);
|
||||
AsusAuraRegisterWrite(busses[bus], 0x77, AURA_REG_I2C_ADDRESS, (aura_ram_addresses[address_list_idx] << 1));
|
||||
}
|
||||
}
|
||||
|
||||
// Add Aura-enabled controllers at their remapped addresses
|
||||
for (unsigned int address_list_idx = 0; address_list_idx < AURA_RAM_ADDRESS_COUNT; address_list_idx++)
|
||||
{
|
||||
if (TestForAuraSMBusController(busses[bus], aura_ram_addresses[address_list_idx]))
|
||||
if (TestForAsusAuraSMBusController(busses[bus], aura_ram_addresses[address_list_idx]))
|
||||
{
|
||||
new_aura = new AuraSMBusController(busses[bus], aura_ram_addresses[address_list_idx]);
|
||||
new_controller = new RGBController_AuraSMBus(new_aura);
|
||||
@@ -183,7 +183,7 @@ void DetectAuraSMBusControllers(std::vector<i2c_smbus_interface*> &busses, std::
|
||||
{
|
||||
for (unsigned int address_list_idx = 0; address_list_idx < AURA_MOBO_ADDRESS_COUNT; address_list_idx++)
|
||||
{
|
||||
if (TestForAuraSMBusController(busses[bus], aura_mobo_addresses[address_list_idx]))
|
||||
if (TestForAsusAuraSMBusController(busses[bus], aura_mobo_addresses[address_list_idx]))
|
||||
{
|
||||
new_aura = new AuraSMBusController(busses[bus], aura_mobo_addresses[address_list_idx]);
|
||||
new_controller = new RGBController_AuraSMBus(new_aura);
|
||||
@@ -197,4 +197,4 @@ void DetectAuraSMBusControllers(std::vector<i2c_smbus_interface*> &busses, std::
|
||||
|
||||
} /* DetectAuraSMBusControllers() */
|
||||
|
||||
REGISTER_I2C_DETECTOR("ASUS Aura SMBus", DetectAuraSMBusControllers);
|
||||
REGISTER_I2C_DETECTOR("ASUS Aura SMBus", DetectAsusAuraSMBusControllers);
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_AuraSMBus.cpp |
|
||||
| RGBController_AsusAuraSMBus.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| Asus Aura SMBus driver |
|
||||
@@ -7,7 +7,7 @@
|
||||
| Adam Honse (CalcProgrammer1) 6/13/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_AuraSMBus.h"
|
||||
#include "RGBController_AsusAuraSMBus.h"
|
||||
|
||||
int RGBController_AuraSMBus::GetDeviceMode()
|
||||
{
|
||||
@@ -129,6 +129,7 @@ RGBController_AuraSMBus::RGBController_AuraSMBus(AuraSMBusController * aura_ptr)
|
||||
type = DEVICE_TYPE_MOTHERBOARD;
|
||||
name = "ASUS Aura Motherboard";
|
||||
}
|
||||
vendor = "ASUS";
|
||||
description = "ASUS Aura SMBus Device";
|
||||
|
||||
mode Direct;
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_AuraSMBus.h |
|
||||
| RGBController_AsusAuraSMBus.h |
|
||||
| |
|
||||
| Generic RGB Interface for OpenAuraSDK |
|
||||
| Asus Aura SMBus driver |
|
||||
@@ -10,7 +10,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "AuraSMBusController.h"
|
||||
#include "AsusAuraSMBusController.h"
|
||||
|
||||
class RGBController_AuraSMBus : public RGBController
|
||||
{
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| AuraAddressableController.cpp |
|
||||
| AsusAuraAddressableController.cpp |
|
||||
| |
|
||||
| Driver for ASUS Aura RGB Addressable |
|
||||
| lighting controller |
|
||||
@@ -7,7 +7,7 @@
|
||||
| Adam Honse (CalcProgrammer1) 1/18/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "AuraAddressableController.h"
|
||||
#include "AsusAuraAddressableController.h"
|
||||
#include <cstring>
|
||||
|
||||
AuraAddressableController::AuraAddressableController(hid_device* dev_handle, const char* path) : AuraUSBController(dev_handle, path)
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| AuraAddressableController.h |
|
||||
| AsusAuraAddressableController.h |
|
||||
| |
|
||||
| Definitions and types for ASUS Aura |
|
||||
| Addressable RGB lighting controller |
|
||||
@@ -8,7 +8,7 @@
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "AuraUSBController.h"
|
||||
#include "AsusAuraUSBController.h"
|
||||
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| AuraMainboardController.cpp |
|
||||
| AsusAuraMainboardController.cpp |
|
||||
| |
|
||||
| Driver for ASUS Aura RGB USB mainboard |
|
||||
| lighting controller |
|
||||
@@ -7,7 +7,7 @@
|
||||
| Martin Hartl (inlart) 4/25/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "AuraMainboardController.h"
|
||||
#include "AsusAuraMainboardController.h"
|
||||
#include <cstring>
|
||||
|
||||
AuraMainboardController::AuraMainboardController(hid_device* dev_handle, const char* path) : AuraUSBController(dev_handle, path), mode(AURA_MODE_DIRECT)
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| AuraMainboardController.h |
|
||||
| AsusAuraMainboardController.h |
|
||||
| |
|
||||
| Definitions and types for ASUS Aura |
|
||||
| USB Mainboard RGB lighting controller |
|
||||
@@ -8,7 +8,7 @@
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "AuraUSBController.h"
|
||||
#include "AsusAuraUSBController.h"
|
||||
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
+14
-3
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| AuraMouseController.cpp |
|
||||
| AsusAuraMouseController.cpp |
|
||||
| |
|
||||
| Driver for ASUS Aura RGB USB |
|
||||
| lighting controller |
|
||||
@@ -7,7 +7,7 @@
|
||||
| Adam Honse (CalcProgrammer1) 10/23/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "AuraMouseController.h"
|
||||
#include "AsusAuraMouseController.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
@@ -24,7 +24,18 @@ AuraMouseController::~AuraMouseController()
|
||||
|
||||
std::string AuraMouseController::GetDeviceLocation()
|
||||
{
|
||||
return(location);
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string AuraMouseController::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 AuraMouseController::SendUpdate
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| AuraMouseController.h |
|
||||
| AsusAuraMouseController.h |
|
||||
| |
|
||||
| Definitions and types for ASUS Aura |
|
||||
| USB RGB lighting controller |
|
||||
@@ -38,6 +38,7 @@ public:
|
||||
virtual ~AuraMouseController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SendUpdate
|
||||
(
|
||||
+14
-3
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| AuraUSBController.cpp |
|
||||
| AsusAuraUSBController.cpp |
|
||||
| |
|
||||
| Driver for ASUS Aura RGB USB |
|
||||
| lighting controller |
|
||||
@@ -7,7 +7,7 @@
|
||||
| Martin Hartl (inlart) 4/25/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "AuraUSBController.h"
|
||||
#include "AsusAuraUSBController.h"
|
||||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
|
||||
@@ -32,7 +32,7 @@ unsigned int AuraUSBController::GetChannelCount()
|
||||
|
||||
std::string AuraUSBController::GetDeviceLocation()
|
||||
{
|
||||
return(location);
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string AuraUSBController::GetDeviceName()
|
||||
@@ -40,6 +40,17 @@ std::string AuraUSBController::GetDeviceName()
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
std::string AuraUSBController::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);
|
||||
}
|
||||
|
||||
const std::vector<AuraDeviceInfo>& AuraUSBController::GetAuraDevices() const
|
||||
{
|
||||
return(device_info);
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| AuraUSBController.h |
|
||||
| AsusAuraUSBController.h |
|
||||
| |
|
||||
| Definitions and types for ASUS Aura |
|
||||
| USB RGB lighting controller |
|
||||
@@ -66,6 +66,7 @@ public:
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetDeviceName();
|
||||
std::string GetSerialString();
|
||||
|
||||
const std::vector<AuraDeviceInfo>& GetAuraDevices() const;
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
#include "Detector.h"
|
||||
#include "AsusAuraAddressableController.h"
|
||||
#include "AsusAuraMainboardController.h"
|
||||
#include "AsusAuraMouseController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_AsusAuraUSB.h"
|
||||
#include "RGBController_AsusAuraMouse.h"
|
||||
#include <stdexcept>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#define AURA_USB_VID 0x0B05
|
||||
#define AURA_TERMINAL_PID 0x1889
|
||||
#define AURA_ADDRESSABLE_1_PID 0x1867
|
||||
#define AURA_ADDRESSABLE_2_PID 0x1872
|
||||
#define AURA_ADDRESSABLE_3_PID 0x18A3
|
||||
#define AURA_ADDRESSABLE_4_PID 0x18A5
|
||||
#define AURA_MOTHERBOARD_1_PID 0x18F3
|
||||
#define AURA_MOTHERBOARD_2_PID 0x1939
|
||||
#define AURA_ROG_GLADIUS_II_CORE_PID 0x18DD
|
||||
#define AURA_ROG_GLADIUS_II_PID 0x1845
|
||||
#define AURA_ROG_GLADIUS_II_ORIGIN_PID 0x1877
|
||||
|
||||
void DetectAsusAuraUSBAddressable(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
AuraAddressableController* controller = new AuraAddressableController(dev, info->path);
|
||||
RGBController_AuraUSB* rgb_controller = new RGBController_AuraUSB(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
void DetectAsusAuraUSBMotherboards(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
try
|
||||
{
|
||||
AuraMainboardController* controller = new AuraMainboardController(dev, info->path);
|
||||
RGBController_AuraUSB* rgb_controller = new RGBController_AuraUSB(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
catch(std::runtime_error&)
|
||||
{
|
||||
// reading the config table failed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DetectAsusAuraUSBMice(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
AuraMouseController* controller = new AuraMouseController(dev, info->path);
|
||||
RGBController_AuraMouse* rgb_controller = new RGBController_AuraMouse(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
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_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);
|
||||
+4
-2
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_AuraMouse.cpp |
|
||||
| RGBController_AsusAuraMouse.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for Asus Aura |
|
||||
| USB controller driver |
|
||||
@@ -7,16 +7,18 @@
|
||||
| Adam Honse (CalcProgrammer1) 10/25/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_AuraMouse.h"
|
||||
#include "RGBController_AsusAuraMouse.h"
|
||||
|
||||
RGBController_AuraMouse::RGBController_AuraMouse(AuraMouseController* aura_ptr)
|
||||
{
|
||||
aura = aura_ptr;
|
||||
|
||||
name = "ASUS Aura Mouse";
|
||||
vendor = "ASUS";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = "ASUS Aura Mouse Device";
|
||||
location = aura->GetDeviceLocation();
|
||||
serial = aura->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_AuraMouse.h |
|
||||
| RGBController_AsusAuraMouse.h |
|
||||
| |
|
||||
| Generic RGB Interface for Asus Aura |
|
||||
| USB controller driver |
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "AuraMouseController.h"
|
||||
#include "AsusAuraMouseController.h"
|
||||
|
||||
class RGBController_AuraMouse : public RGBController
|
||||
{
|
||||
+19
-3
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_AuraUSB.cpp |
|
||||
| RGBController_AsusAuraUSB.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for Asus Aura |
|
||||
| USB controller driver |
|
||||
@@ -7,17 +7,20 @@
|
||||
| Adam Honse (CalcProgrammer1) 1/18/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_AuraUSB.h"
|
||||
#include "RGBController_AsusAuraUSB.h"
|
||||
|
||||
RGBController_AuraUSB::RGBController_AuraUSB(AuraUSBController* aura_ptr)
|
||||
RGBController_AuraUSB::RGBController_AuraUSB(AuraUSBController* aura_ptr) :
|
||||
initializedMode(false)
|
||||
{
|
||||
aura = aura_ptr;
|
||||
|
||||
name = "ASUS Aura USB";
|
||||
vendor = "ASUS";
|
||||
version = aura->GetDeviceName();
|
||||
type = DEVICE_TYPE_MOTHERBOARD;
|
||||
description = "ASUS Aura USB Device";
|
||||
location = aura->GetDeviceLocation();
|
||||
serial = aura->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
@@ -191,6 +194,10 @@ void RGBController_AuraUSB::ResizeZone(int zone, int new_size)
|
||||
|
||||
void RGBController_AuraUSB::DeviceUpdateLEDs()
|
||||
{
|
||||
if(!initializedMode)
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
}
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
aura->SetChannelLEDs(zone_idx, zones[zone_idx].colors, zones[zone_idx].leds_count);
|
||||
@@ -199,11 +206,19 @@ void RGBController_AuraUSB::DeviceUpdateLEDs()
|
||||
|
||||
void RGBController_AuraUSB::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
if(!initializedMode)
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
}
|
||||
aura->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count);
|
||||
}
|
||||
|
||||
void RGBController_AuraUSB::UpdateSingleLED(int led)
|
||||
{
|
||||
if(!initializedMode)
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
}
|
||||
unsigned int channel = leds[led].value;
|
||||
|
||||
aura->SetChannelLEDs(channel, zones[channel].colors, zones[channel].leds_count);
|
||||
@@ -216,6 +231,7 @@ void RGBController_AuraUSB::SetCustomMode()
|
||||
|
||||
void RGBController_AuraUSB::DeviceUpdateMode()
|
||||
{
|
||||
initializedMode = true;
|
||||
unsigned char red = 0;
|
||||
unsigned char grn = 0;
|
||||
unsigned char blu = 0;
|
||||
+4
-3
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_AuraUSB.h |
|
||||
| RGBController_AsusAuraUSB.h |
|
||||
| |
|
||||
| Generic RGB Interface for Asus Aura |
|
||||
| USB controller driver |
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "AuraUSBController.h"
|
||||
#include "AsusAuraUSBController.h"
|
||||
|
||||
#define AURA_ADDRESSABLE_MAX_LEDS 120
|
||||
|
||||
@@ -31,7 +31,8 @@ public:
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
AuraUSBController* aura;
|
||||
AuraUSBController* aura;
|
||||
std::vector<unsigned int> leds_channel;
|
||||
std::vector<unsigned int> zones_channel;
|
||||
bool initializedMode;
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
#ifdef _WIN32
|
||||
|
||||
#include "RGBController_AsusTUFLaptopWMI.h"
|
||||
|
||||
#include "acpiwmi.h"
|
||||
#include "Detector.h"
|
||||
#include "wmi.h"
|
||||
#include <string>
|
||||
|
||||
static void DetectAsusTUFLaptopWMIControllers(std::vector<RGBController*>&)
|
||||
{
|
||||
// Try to retrieve ProductID / Device name from WMI; Possibly can be rewritten to use wmi.cpp
|
||||
// IF you encounter false detection ( e.g. if your laptop keyboard backlight uses USB interface
|
||||
// instead of ACPI WMI) please add a WHITELIST by checking the
|
||||
// `name` variable for model substrings like "FX505DU"
|
||||
// For now, checking for "TUF Gaming" should suffice
|
||||
|
||||
Wmi wmi;
|
||||
wmi.init();
|
||||
|
||||
std::vector<QueryObj> systemProduct;
|
||||
if (wmi.query("SELECT * FROM Win32_ComputerSystemProduct", systemProduct))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// There should only be one, a cycle is a precaution
|
||||
if(systemProduct.size() != 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
std::string& name = systemProduct[0]["Name"];
|
||||
if(name.find("TUF Gaming") == name.npos)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(AsWMI_Open())
|
||||
{
|
||||
RGBController* new_controller = new RGBController_AsusTUFLaptopWMI();
|
||||
ResourceManager::get()->RegisterRGBController(new_controller);
|
||||
// Success! No more if's
|
||||
}
|
||||
} /* DetectFaustusControllers() */
|
||||
|
||||
REGISTER_DETECTOR("TUF Laptop WMI", DetectAsusTUFLaptopWMIControllers);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,143 @@
|
||||
#ifdef _WIN32
|
||||
|
||||
#include "RGBController_AsusTUFLaptopWMI.h"
|
||||
|
||||
#include "acpiwmi.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "Detector.h"
|
||||
#include "wmi.h"
|
||||
#include <string>
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
RGBController_AsusTUFLaptopWMI::RGBController_AsusTUFLaptopWMI()
|
||||
{
|
||||
name = "ASUS TUF Keyboard";
|
||||
vendor = "ASUS";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "WMI Device";
|
||||
location = "\\\\.\\ATKACPI";
|
||||
|
||||
modes.resize(5);
|
||||
modes[0].name = "Direct";
|
||||
modes[0].value = 4;
|
||||
modes[0].flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
modes[0].color_mode = MODE_COLORS_PER_LED;
|
||||
|
||||
modes[1].name = "Static";
|
||||
modes[1].value = 0;
|
||||
modes[1].flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
modes[1].color_mode = MODE_COLORS_PER_LED;
|
||||
|
||||
modes[2].name = "Breathing";
|
||||
modes[2].value = 1;
|
||||
modes[2].flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
modes[2].speed_min = 0;
|
||||
modes[2].speed_max = 2;
|
||||
modes[2].color_mode = MODE_COLORS_PER_LED;
|
||||
modes[2].speed = 1;
|
||||
|
||||
modes[3].name = "Color Cycle";
|
||||
modes[3].value = 2;
|
||||
modes[3].flags = MODE_FLAG_HAS_SPEED;
|
||||
modes[3].speed_min = 0;
|
||||
modes[3].speed_max = 2;
|
||||
modes[3].color_mode = MODE_COLORS_NONE;
|
||||
modes[3].speed = 1;
|
||||
|
||||
modes[4].name = "Strobe";
|
||||
modes[4].value = 0x0A;
|
||||
modes[4].flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
modes[4].color_mode = MODE_COLORS_PER_LED;
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_AsusTUFLaptopWMI::~RGBController_AsusTUFLaptopWMI()
|
||||
{
|
||||
AsWMI_Close();
|
||||
}
|
||||
|
||||
void RGBController_AsusTUFLaptopWMI::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zone |
|
||||
\*---------------------------------------------------------*/
|
||||
zones.resize(1);
|
||||
zones[0].type = ZONE_TYPE_SINGLE;
|
||||
zones[0].name = "Keyboard Backlight zone";
|
||||
zones[0].leds_min = 1;
|
||||
zones[0].leds_max = 1;
|
||||
zones[0].leds_count = 1;
|
||||
zones[0].matrix_map = NULL;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up LED |
|
||||
\*---------------------------------------------------------*/
|
||||
leds.resize(1);
|
||||
leds[0].name = "Keyboard Backlight LED";
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_AsusTUFLaptopWMI::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_AsusTUFLaptopWMI::DeviceUpdateLEDs()
|
||||
{
|
||||
uint8_t red = RGBGetRValue(colors[0]);
|
||||
uint8_t green = RGBGetGValue(colors[0]);
|
||||
uint8_t blue = RGBGetBValue(colors[0]);
|
||||
uint8_t speed_byte = 0;
|
||||
uint8_t mode = modes[active_mode].value;
|
||||
uint8_t inv = 0;
|
||||
if(mode == 4)
|
||||
{
|
||||
mode = 1;
|
||||
inv = 4; // Any invalid mode, i.e. anything other than 0, 1, 2 and 10
|
||||
}
|
||||
if(mode == 1 || mode == 2)
|
||||
{
|
||||
switch(modes[active_mode].speed)
|
||||
{
|
||||
case 0: speed_byte = 0xE1; break;
|
||||
case 1: speed_byte = 0xEB; break;
|
||||
case 2: speed_byte = 0xF5; break;
|
||||
}
|
||||
}
|
||||
int high = ((mode | ((red | (green << 8)) << 8)) << 8) | 0xB3;
|
||||
int low = blue | (speed_byte << 8);
|
||||
AsWMI_NB_DeviceControl_2arg(0x100056, high, low);
|
||||
if(inv)
|
||||
{
|
||||
//std::this_thread::sleep_for(10ms);
|
||||
high = ((inv | ((red | (green << 8)) << 8)) << 8) | 0xB3;
|
||||
AsWMI_NB_DeviceControl_2arg(0x100056, high, low);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_AsusTUFLaptopWMI::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_AsusTUFLaptopWMI::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_AsusTUFLaptopWMI::SetCustomMode()
|
||||
{
|
||||
SetMode(0);
|
||||
}
|
||||
|
||||
void RGBController_AsusTUFLaptopWMI::DeviceUpdateMode()
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef RGBCONTROLLER_ASUSTUFLAPTOPWMI_H
|
||||
#define RGBCONTROLLER_ASUSTUFLAPTOPWMI_H
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include "RGBController.h"
|
||||
|
||||
class RGBController_AsusTUFLaptopWMI : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_AsusTUFLaptopWMI();
|
||||
virtual ~RGBController_AsusTUFLaptopWMI();
|
||||
|
||||
void SetupZones() override;
|
||||
|
||||
void ResizeZone(int zone, int new_size) override;
|
||||
|
||||
void DeviceUpdateLEDs() override;
|
||||
void UpdateZoneLEDs(int zone) override;
|
||||
void UpdateSingleLED(int led) override;
|
||||
|
||||
void DeviceUpdateMode() override;
|
||||
|
||||
void SetCustomMode() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif // RGBCONTROLLER_ASUSTUFLAPTOPWMI_H
|
||||
@@ -1,48 +0,0 @@
|
||||
#include "Detector.h"
|
||||
#include "AuraCoreController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_AuraCore.h"
|
||||
#include <vector>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#define AURA_CORE_VID 0x0B05
|
||||
|
||||
#define NUM_PIDS 3
|
||||
static const unsigned short pid_table[] =
|
||||
{
|
||||
0x1854,
|
||||
0x1869,
|
||||
0x1866
|
||||
};
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectAuraCoreControllers *
|
||||
* *
|
||||
* Tests the USB address to see if an Asus ROG Aura Core controller exists there *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectAuraCoreControllers(std::vector<RGBController*>& rgb_controllers)
|
||||
{
|
||||
hid_device* dev;
|
||||
|
||||
//Look for Asus ROG Aura Core RGB controller
|
||||
hid_init();
|
||||
|
||||
for(int pid_idx = 0; pid_idx < NUM_PIDS; pid_idx++)
|
||||
{
|
||||
dev = hid_open(AURA_CORE_VID, pid_table[pid_idx], 0);
|
||||
|
||||
if( dev )
|
||||
{
|
||||
AuraCoreController* controller = new AuraCoreController(dev);
|
||||
|
||||
RGBController_AuraCore* rgb_controller = new RGBController_AuraCore(controller);
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_DETECTOR("ASUS Aura Core", DetectAuraCoreControllers);
|
||||
@@ -1,170 +0,0 @@
|
||||
#include "Detector.h"
|
||||
#include "AuraAddressableController.h"
|
||||
#include "AuraMainboardController.h"
|
||||
#include "AuraMouseController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_AuraUSB.h"
|
||||
#include "RGBController_AuraMouse.h"
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#define AURA_USB_VID 0x0B05
|
||||
#define AURA_TERMINAL_PID 0x1889
|
||||
#define AURA_ADDRESSABLE_1_PID 0x1867
|
||||
#define AURA_ADDRESSABLE_2_PID 0x1872
|
||||
#define AURA_ADDRESSABLE_3_PID 0x18A3
|
||||
#define AURA_ADDRESSABLE_4_PID 0x18A5
|
||||
#define AURA_MOTHERBOARD_1_PID 0x18F3
|
||||
#define AURA_MOTHERBOARD_2_PID 0x1939
|
||||
#define AURA_ROG_GLADIUS_II_CORE_PID 0x18DD
|
||||
#define AURA_ROG_GLADIUS_II_PID 0x1845
|
||||
#define AURA_ROG_GLADIUS_II_ORIGIN_PID 0x1877
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short usb_vid;
|
||||
unsigned short usb_pid;
|
||||
unsigned short usb_interface;
|
||||
const char * name;
|
||||
} aura_device;
|
||||
|
||||
#define ADDRESSABLE_NUM_DEVICES (sizeof(addressable_device_list) / sizeof(addressable_device_list[ 0 ]))
|
||||
|
||||
static const aura_device addressable_device_list[] =
|
||||
{
|
||||
/*---------------------------------------------------------------------------------*\
|
||||
| ASUS AURA Addressable |
|
||||
\*---------------------------------------------------------------------------------*/
|
||||
{ AURA_USB_VID, AURA_TERMINAL_PID, 0, "ASUS ROG AURA Terminal" },
|
||||
{ AURA_USB_VID, AURA_ADDRESSABLE_1_PID, 0, "ASUS Aura Addressable" },
|
||||
{ AURA_USB_VID, AURA_ADDRESSABLE_2_PID, 0, "ASUS Aura Addressable" },
|
||||
{ AURA_USB_VID, AURA_ADDRESSABLE_3_PID, 0, "ASUS Aura Addressable" },
|
||||
{ AURA_USB_VID, AURA_ADDRESSABLE_4_PID, 0, "ASUS Aura Addressable" },
|
||||
};
|
||||
|
||||
#define MOTHERBOARD_NUM_DEVICES (sizeof(motherboard_device_list) / sizeof(motherboard_device_list[ 0 ]))
|
||||
|
||||
static const aura_device motherboard_device_list[] =
|
||||
{
|
||||
/*---------------------------------------------------------------------------------*\
|
||||
| ASUS AURA Motherboard |
|
||||
\*---------------------------------------------------------------------------------*/
|
||||
{ AURA_USB_VID, AURA_MOTHERBOARD_1_PID, 0, "ASUS Aura Motherboard" },
|
||||
{ AURA_USB_VID, AURA_MOTHERBOARD_2_PID, 0, "ASUS Aura Motherboard" },
|
||||
};
|
||||
|
||||
#define MOUSE_NUM_DEVICES (sizeof(mouse_device_list) / sizeof(mouse_device_list[ 0 ]))
|
||||
|
||||
static const aura_device mouse_device_list[] =
|
||||
{
|
||||
{ AURA_USB_VID, AURA_ROG_GLADIUS_II_CORE_PID, 0, "ASUS ROG Gladius II Core" },
|
||||
{ AURA_USB_VID, AURA_ROG_GLADIUS_II_PID, 2, "ASUS ROG Gladius II" },
|
||||
{ AURA_USB_VID, AURA_ROG_GLADIUS_II_ORIGIN_PID, 2, "ASUS ROG Gladius II Origin" },
|
||||
};
|
||||
|
||||
void DetectAuraUSBControllers(std::vector<RGBController*>& rgb_controllers)
|
||||
{
|
||||
hid_device_info* info = NULL;
|
||||
|
||||
hid_init();
|
||||
|
||||
/*ASUS AURA Addressable*/
|
||||
for(unsigned int pid_idx = 0; pid_idx < ADDRESSABLE_NUM_DEVICES; pid_idx++)
|
||||
{
|
||||
info = hid_enumerate(addressable_device_list[pid_idx].usb_vid, addressable_device_list[pid_idx].usb_pid);
|
||||
|
||||
while(info)
|
||||
{
|
||||
hid_device* dev = NULL;
|
||||
|
||||
if((info->vendor_id == addressable_device_list[pid_idx].usb_vid)
|
||||
&&(info->product_id == addressable_device_list[pid_idx].usb_pid))
|
||||
{
|
||||
dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
AuraAddressableController* controller = new AuraAddressableController(dev, info->path);
|
||||
RGBController_AuraUSB* rgb_controller = new RGBController_AuraUSB(controller);
|
||||
rgb_controller->name = addressable_device_list[pid_idx].name;
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
info = info->next;
|
||||
}
|
||||
}
|
||||
|
||||
info = NULL;
|
||||
|
||||
/*ASUS AURA Motherboard*/
|
||||
for(unsigned int pid_idx = 0; pid_idx < MOTHERBOARD_NUM_DEVICES; pid_idx++)
|
||||
{
|
||||
info = hid_enumerate(motherboard_device_list[pid_idx].usb_vid, motherboard_device_list[pid_idx].usb_pid);
|
||||
|
||||
while(info)
|
||||
{
|
||||
hid_device* dev = NULL;
|
||||
|
||||
if((info->vendor_id == motherboard_device_list[pid_idx].usb_vid)
|
||||
&&(info->product_id == motherboard_device_list[pid_idx].usb_pid))
|
||||
{
|
||||
dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
try
|
||||
{
|
||||
AuraMainboardController* controller = new AuraMainboardController(dev, info->path);
|
||||
RGBController_AuraUSB* rgb_controller = new RGBController_AuraUSB(controller);
|
||||
rgb_controller->name = motherboard_device_list[pid_idx].name;
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
catch(std::runtime_error&)
|
||||
{
|
||||
// reading the config table failed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
info = info->next;
|
||||
}
|
||||
}
|
||||
|
||||
/*ASUS AURA Mouse*/
|
||||
for(unsigned int pid_idx = 0; pid_idx < MOUSE_NUM_DEVICES; pid_idx++)
|
||||
{
|
||||
info = hid_enumerate(mouse_device_list[pid_idx].usb_vid, mouse_device_list[pid_idx].usb_pid);
|
||||
|
||||
while(info)
|
||||
{
|
||||
hid_device* dev = NULL;
|
||||
|
||||
if((info->vendor_id == mouse_device_list[pid_idx].usb_vid)
|
||||
&&(info->product_id == mouse_device_list[pid_idx].usb_pid)
|
||||
#ifdef USE_HID_USAGE
|
||||
&&(info->interface_number == mouse_device_list[pid_idx].usb_interface )
|
||||
&&(info->usage_page == 0xFF01))
|
||||
#else
|
||||
&&(info->interface_number == mouse_device_list[pid_idx].usb_interface ))
|
||||
#endif
|
||||
{
|
||||
dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
AuraMouseController* controller = new AuraMouseController(dev, info->path);
|
||||
RGBController_AuraMouse* rgb_controller = new RGBController_AuraMouse(controller);
|
||||
rgb_controller->name = mouse_device_list[pid_idx].name;
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
info = info->next;
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectAuraUSBControllers() */
|
||||
|
||||
REGISTER_DETECTOR("ASUS Aura USB", DetectAuraUSBControllers);
|
||||
@@ -92,7 +92,7 @@ std::string CMARGBController::GetSerial()
|
||||
|
||||
std::string CMARGBController::GetLocation()
|
||||
{
|
||||
return location;
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
unsigned char CMARGBController::GetZoneIndex()
|
||||
|
||||
@@ -27,20 +27,25 @@ static unsigned char speed_mode_data[][9] =
|
||||
{ 0xFF, 0xE0, 0xC0, 0xA0, 0x80, 0x60, 0x40, 0x20, 0x00 } /* Colour Breath */
|
||||
};
|
||||
|
||||
CMMP750Controller::CMMP750Controller(hid_device* dev_handle, wchar_t *_vendor, wchar_t *_device_name, char *_path)
|
||||
CMMP750Controller::CMMP750Controller(hid_device* dev_handle, char *_path)
|
||||
{
|
||||
std::size_t tmp_size = wcslen(_vendor);
|
||||
dev = dev_handle;
|
||||
location = _path;
|
||||
dev = dev_handle;
|
||||
location = _path;
|
||||
|
||||
for(std::size_t i = 0; (i < tmp_size) && (i < CM_DEVICE_NAME_SIZE); i++)
|
||||
{
|
||||
device_name[i] = (char)_vendor[i];
|
||||
}
|
||||
for(std::size_t j = 0; (j < wcslen(_vendor)) && (tmp_size + j < CM_DEVICE_NAME_SIZE); j++)
|
||||
{
|
||||
device_name[tmp_size + j] = (char)_device_name[j];
|
||||
}
|
||||
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()));
|
||||
|
||||
hid_get_serial_number_string(dev, tmpName, szTemp);
|
||||
wName = std::wstring(tmpName);
|
||||
serial = std::string(wName.begin(), wName.end());
|
||||
|
||||
GetStatus(); //When setting up device get current status
|
||||
}
|
||||
@@ -82,19 +87,19 @@ void CMMP750Controller::GetStatus()
|
||||
}
|
||||
}
|
||||
|
||||
char* CMMP750Controller::GetDeviceName()
|
||||
std::string CMMP750Controller::GetDeviceName()
|
||||
{
|
||||
return device_name;
|
||||
}
|
||||
|
||||
char* CMMP750Controller::GetSerial()
|
||||
std::string CMMP750Controller::GetSerial()
|
||||
{
|
||||
return serial;
|
||||
}
|
||||
|
||||
std::string CMMP750Controller::GetLocation()
|
||||
{
|
||||
return location;
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
unsigned char CMMP750Controller::GetMode()
|
||||
|
||||
@@ -60,11 +60,11 @@ enum
|
||||
class CMMP750Controller
|
||||
{
|
||||
public:
|
||||
CMMP750Controller(hid_device* dev_handle, wchar_t *_vendor, wchar_t *_device_name, char *_path);
|
||||
CMMP750Controller(hid_device* dev_handle, char *_path);
|
||||
~CMMP750Controller();
|
||||
|
||||
char* GetDeviceName();
|
||||
char* GetSerial();
|
||||
std::string GetDeviceName();
|
||||
std::string GetSerial();
|
||||
std::string GetLocation();
|
||||
|
||||
unsigned char GetMode();
|
||||
@@ -76,8 +76,8 @@ public:
|
||||
void SetColor(unsigned char red, unsigned char green, unsigned char blue);
|
||||
|
||||
private:
|
||||
char device_name[32];
|
||||
char serial[32];
|
||||
std::string device_name;
|
||||
std::string serial;
|
||||
std::string location;
|
||||
hid_device* dev;
|
||||
|
||||
|
||||
@@ -12,24 +12,6 @@
|
||||
#define COOLERMASTER_MP750_MEDIUM_PID 0x0105
|
||||
#define COOLERMASTER_ARGB_PID 0x1011
|
||||
|
||||
#define COOLERMASTER_NUM_DEVICES (sizeof(cm_pids) / sizeof(cm_pids[ 0 ]))
|
||||
|
||||
struct coolermaster_device
|
||||
{
|
||||
unsigned int product_id;
|
||||
unsigned short interface;
|
||||
unsigned int usage_page;
|
||||
unsigned int usage;
|
||||
device_type type;
|
||||
};
|
||||
|
||||
static const coolermaster_device cm_pids[] =
|
||||
{ // PID, Interface, Usage_Page, Usage, Device_Type
|
||||
{ COOLERMASTER_MP750_XL_PID, 0x00, 0xFF00, 0x01, DEVICE_TYPE_MOUSEMAT }, //Coolermaster MP750 (Extra Large)
|
||||
{ COOLERMASTER_MP750_MEDIUM_PID, 0x00, 0xFF00, 0x01, DEVICE_TYPE_MOUSEMAT }, //Coolermaster MP750 (Medium)
|
||||
{ COOLERMASTER_ARGB_PID, 0x00, 0xFF00, 0x01, DEVICE_TYPE_LEDSTRIP } //Coolermaster ARGB Controller
|
||||
};
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectCoolerMasterControllers *
|
||||
@@ -38,60 +20,33 @@ static const coolermaster_device cm_pids[] =
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectCoolerMasterControllers(std::vector<RGBController*>& rgb_controllers)
|
||||
void DetectCoolerMasterMousemats(hid_device_info* info, const std::string&)
|
||||
{
|
||||
hid_device_info* info;
|
||||
|
||||
//Look for the passed in cm_pids
|
||||
hid_init();
|
||||
info = hid_enumerate(COOLERMASTER_VID, 0x0);
|
||||
|
||||
while(info)
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
hid_device* dev = NULL;
|
||||
device_type dev_type;
|
||||
|
||||
if(info->vendor_id == COOLERMASTER_VID)
|
||||
{
|
||||
for(unsigned int cm_pid_idx = 0; cm_pid_idx < COOLERMASTER_NUM_DEVICES; cm_pid_idx++)
|
||||
{
|
||||
if((info->product_id == cm_pids[cm_pid_idx].product_id)
|
||||
#ifdef USE_HID_USAGE
|
||||
&&(info->usage == cm_pids[cm_pid_idx].usage) //Usage and usage page required to get the correct interface
|
||||
&&(info->usage_page == cm_pids[cm_pid_idx].usage_page))
|
||||
#else
|
||||
&&(info->interface_number == cm_pids[cm_pid_idx].interface))
|
||||
#endif //USE_HID_USAGE
|
||||
{
|
||||
dev = hid_open_path(info->path);
|
||||
dev_type = cm_pids[cm_pid_idx].type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(dev)
|
||||
{
|
||||
if (dev_type == DEVICE_TYPE_MOUSEMAT)
|
||||
{
|
||||
CMMP750Controller* controller = new CMMP750Controller(dev, info->manufacturer_string, info->product_string, info->path);
|
||||
RGBController_CMMP750Controller* rgb_controller = new RGBController_CMMP750Controller(controller);
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
else if(dev_type == DEVICE_TYPE_LEDSTRIP)
|
||||
{
|
||||
for(std::size_t i = 0; i < CM_ARGB_HEADER_DATA_SIZE; i++)
|
||||
{
|
||||
CMARGBController* controller = new CMARGBController(dev, info->path, i);
|
||||
RGBController_CMARGBController* rgb_controller = new RGBController_CMARGBController(controller);
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
}
|
||||
info = info->next;
|
||||
CMMP750Controller* controller = new CMMP750Controller(dev, info->path);
|
||||
RGBController_CMMP750Controller* rgb_controller = new RGBController_CMMP750Controller(controller);
|
||||
// Constructor sets the name
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
hid_free_enumeration(info);
|
||||
}
|
||||
|
||||
} /* DetectCoolerMasterControllers() */
|
||||
void DetectCoolerMasterARGB(hid_device_info* info, const std::string&)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
for(std::size_t i = 0; i < CM_ARGB_HEADER_DATA_SIZE; i++)
|
||||
{
|
||||
CMARGBController* controller = new CMARGBController(dev, info->path, i);
|
||||
RGBController_CMARGBController* rgb_controller = new RGBController_CMARGBController(controller);
|
||||
// Constructor sets the name
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_DETECTOR("Cooler Master", DetectCoolerMasterControllers);
|
||||
REGISTER_HID_DETECTOR_IPU("Cooler Master MP750 XL", DetectCoolerMasterMousemats, COOLERMASTER_VID, COOLERMASTER_MP750_XL_PID, 0, 0xFF00, 1);
|
||||
REGISTER_HID_DETECTOR_IPU("Cooler Master MP750 Medium", DetectCoolerMasterMousemats, COOLERMASTER_VID, COOLERMASTER_MP750_MEDIUM_PID, 0, 0xFF00, 1);
|
||||
REGISTER_HID_DETECTOR_IPU("Cooler Master ARGB", DetectCoolerMasterARGB, COOLERMASTER_VID, COOLERMASTER_ARGB_PID, 0, 0xFF00, 1);
|
||||
|
||||
@@ -15,6 +15,7 @@ RGBController_CMARGBController::RGBController_CMARGBController(CMARGBController
|
||||
unsigned char speed = cmargb->GetLedSpeed();
|
||||
|
||||
name = argb_header_data[cmargb->GetZoneIndex()].name;
|
||||
vendor = "Cooler Master";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
description = cmargb->GetDeviceName();
|
||||
version = "1.0";
|
||||
|
||||
@@ -15,10 +15,11 @@ RGBController_CMMP750Controller::RGBController_CMMP750Controller(CMMP750Controll
|
||||
unsigned char speed = cmmp750->GetLedSpeed();
|
||||
|
||||
name = cmmp750->GetDeviceName();
|
||||
vendor = "Cooler Master";
|
||||
type = DEVICE_TYPE_MOUSEMAT;
|
||||
description = cmmp750->GetDeviceName();
|
||||
version = "1.0";
|
||||
serial = "";
|
||||
serial = cmmp750->GetSerial();
|
||||
location = cmmp750->GetLocation();
|
||||
|
||||
mode Static;
|
||||
@@ -143,25 +144,5 @@ void RGBController_CMMP750Controller::SetCustomMode()
|
||||
|
||||
void RGBController_CMMP750Controller::DeviceUpdateMode()
|
||||
{
|
||||
switch(modes[active_mode].value)
|
||||
{
|
||||
case MP750_MODE_STATIC:
|
||||
cmmp750->SetMode(MP750_MODE_STATIC, modes[active_mode].speed);
|
||||
break;
|
||||
case MP750_MODE_BLINK:
|
||||
cmmp750->SetMode(MP750_MODE_BLINK, modes[active_mode].speed);
|
||||
break;
|
||||
case MP750_MODE_BREATHING:
|
||||
cmmp750->SetMode(MP750_MODE_BREATHING, modes[active_mode].speed);
|
||||
break;
|
||||
case MP750_MODE_COLOR_CYCLE:
|
||||
cmmp750->SetMode(MP750_MODE_COLOR_CYCLE, modes[active_mode].speed);
|
||||
break;
|
||||
case MP750_MODE_BREATH_CYCLE:
|
||||
cmmp750->SetMode(MP750_MODE_BREATH_CYCLE, modes[active_mode].speed);
|
||||
break;
|
||||
default:
|
||||
cmmp750->SetMode(MP750_MODE_BREATHING, modes[active_mode].speed);
|
||||
break;
|
||||
}
|
||||
cmmp750->SetMode(modes[active_mode].value, modes[active_mode].speed);
|
||||
}
|
||||
|
||||
+1
@@ -13,6 +13,7 @@ RGBController_CorsairDominatorPlatinum::RGBController_CorsairDominatorPlatinum(C
|
||||
corsair = corsair_ptr;
|
||||
|
||||
name = corsair->GetDeviceName();
|
||||
vendor = "Corsair";
|
||||
type = DEVICE_TYPE_DRAM;
|
||||
description = "Corsair Dominator Platinum RGB Device";
|
||||
location = corsair->GetDeviceLocation();
|
||||
|
||||
@@ -7,10 +7,22 @@
|
||||
#include "CorsairHydroController.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
||||
CorsairHydroController::CorsairHydroController(libusb_device_handle* dev_handle)
|
||||
{
|
||||
dev = dev_handle;
|
||||
dev = dev_handle;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Fill in location string with USB ID |
|
||||
\*-----------------------------------------------------*/
|
||||
libusb_device_descriptor descriptor;
|
||||
libusb_get_device_descriptor(libusb_get_device(dev_handle), &descriptor);
|
||||
|
||||
std::stringstream location_stream;
|
||||
location_stream << std::hex << std::setfill('0') << std::setw(4) << descriptor.idVendor << ":" << std::hex << std::setfill('0') << std::setw(4) << descriptor.idProduct;
|
||||
location = location_stream.str();
|
||||
|
||||
SendInit();
|
||||
|
||||
@@ -22,6 +34,11 @@ std::string CorsairHydroController::GetFirmwareString()
|
||||
return(firmware_version);
|
||||
}
|
||||
|
||||
std::string CorsairHydroController::GetLocation()
|
||||
{
|
||||
return("USB: " + location);
|
||||
}
|
||||
|
||||
void CorsairHydroController::SetBlink
|
||||
(
|
||||
std::vector<RGBColor> & colors,
|
||||
@@ -248,4 +265,4 @@ void CorsairHydroController::SendSpeed
|
||||
\*-----------------------------------------------------*/
|
||||
libusb_bulk_transfer(dev, 0x01, usb_buf, 2, &actual, 1000);
|
||||
libusb_bulk_transfer(dev, 0x81, usb_buf, 3, &actual, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,8 @@ public:
|
||||
|
||||
std::string GetFirmwareString();
|
||||
|
||||
std::string GetLocation();
|
||||
|
||||
void SetBlink
|
||||
(
|
||||
std::vector<RGBColor> & colors,
|
||||
@@ -65,6 +67,7 @@ public:
|
||||
private:
|
||||
libusb_device_handle* dev;
|
||||
std::string firmware_version;
|
||||
std::string location;
|
||||
|
||||
void SendApplyBlink();
|
||||
void SendApplyPulse();
|
||||
|
||||
@@ -50,6 +50,10 @@ void DetectCorsairHydroControllers(std::vector<RGBController*>& rgb_controllers)
|
||||
libusb_context * ctx;
|
||||
libusb_init(&ctx);
|
||||
|
||||
#ifdef _WIN32
|
||||
libusb_set_option(ctx, LIBUSB_OPTION_USE_USBDK);
|
||||
#endif
|
||||
|
||||
for(std::size_t device_idx = 0; device_idx < CORSAIR_NUM_DEVICES; device_idx++)
|
||||
{
|
||||
libusb_device_handle * dev = libusb_open_device_with_vid_pid(ctx, device_list[device_idx].usb_vid, device_list[device_idx].usb_pid);
|
||||
|
||||
@@ -13,9 +13,11 @@ RGBController_CorsairHydro::RGBController_CorsairHydro(CorsairHydroController* c
|
||||
{
|
||||
corsair = corsair_ptr;
|
||||
|
||||
vendor = "Corsair";
|
||||
description = "Corsair Hydro Series Device";
|
||||
version = corsair->GetFirmwareString();
|
||||
type = DEVICE_TYPE_COOLER;
|
||||
location = corsair->GetLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
|
||||
@@ -11,32 +11,8 @@
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
|
||||
//Include thread libraries for Windows or Linux
|
||||
#ifdef WIN32
|
||||
#include <process.h>
|
||||
#else
|
||||
#include "pthread.h"
|
||||
#include "unistd.h"
|
||||
#endif
|
||||
|
||||
//Thread functions have different types in Windows and Linux
|
||||
#ifdef WIN32
|
||||
#define THREAD static void
|
||||
#define THREADRETURN
|
||||
#else
|
||||
#define THREAD static void*
|
||||
#define THREADRETURN return(NULL);
|
||||
#endif
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
THREAD keepalive_thread(void *param)
|
||||
{
|
||||
CorsairLightingNodeController* corsair = static_cast<CorsairLightingNodeController*>(param);
|
||||
corsair->KeepaliveThread();
|
||||
THREADRETURN
|
||||
}
|
||||
|
||||
CorsairLightingNodeController::CorsairLightingNodeController(hid_device* dev_handle, const char* path)
|
||||
{
|
||||
dev = dev_handle;
|
||||
@@ -50,21 +26,20 @@ CorsairLightingNodeController::CorsairLightingNodeController(hid_device* dev_han
|
||||
| to not revert back into rainbow mode. Start a thread |
|
||||
| to continuously send a keepalive packet every 5s |
|
||||
\*-----------------------------------------------------*/
|
||||
#ifdef WIN32
|
||||
_beginthread(keepalive_thread, 0, this);
|
||||
#else
|
||||
pthread_t thread;
|
||||
pthread_create(&thread, NULL, &keepalive_thread, this);
|
||||
#endif
|
||||
keepalive_thread_run = 1;
|
||||
keepalive_thread = new std::thread(&CorsairLightingNodeController::KeepaliveThread, this);
|
||||
}
|
||||
|
||||
CorsairLightingNodeController::~CorsairLightingNodeController()
|
||||
{
|
||||
keepalive_thread_run = 0;
|
||||
keepalive_thread->join();
|
||||
delete keepalive_thread;
|
||||
}
|
||||
|
||||
void CorsairLightingNodeController::KeepaliveThread()
|
||||
{
|
||||
while(1)
|
||||
while(keepalive_thread_run.load())
|
||||
{
|
||||
if((std::chrono::steady_clock::now() - last_commit_time) > std::chrono::seconds(5))
|
||||
{
|
||||
@@ -81,7 +56,18 @@ std::string CorsairLightingNodeController::GetFirmwareString()
|
||||
|
||||
std::string CorsairLightingNodeController::GetLocationString()
|
||||
{
|
||||
return(location);
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string CorsairLightingNodeController::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 CorsairLightingNodeController::SetChannelEffect(unsigned char channel,
|
||||
|
||||
@@ -84,6 +84,7 @@ public:
|
||||
|
||||
std::string GetFirmwareString();
|
||||
std::string GetLocationString();
|
||||
std::string GetSerialString();
|
||||
|
||||
unsigned int GetStripsOnChannel(unsigned int channel);
|
||||
|
||||
@@ -112,6 +113,8 @@ private:
|
||||
hid_device* dev;
|
||||
std::string firmware_version;
|
||||
std::string location;
|
||||
std::thread* keepalive_thread;
|
||||
std::atomic<bool> keepalive_thread_run;
|
||||
std::chrono::time_point<std::chrono::steady_clock> last_commit_time;
|
||||
|
||||
void SendFirmwareRequest();
|
||||
|
||||
@@ -12,26 +12,7 @@
|
||||
#define CORSAIR_LS100_PID 0x0C1E
|
||||
#define CORSAIR_1000D_OBSIDIAN_PID 0x1D00
|
||||
#define CORSAIR_SPEC_OMEGA_RGB_PID 0x1D04
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short usb_vid;
|
||||
unsigned short usb_pid;
|
||||
unsigned char channel_count;
|
||||
const char * name;
|
||||
} corsair_node_device;
|
||||
|
||||
#define CORSAIR_NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
|
||||
|
||||
static const corsair_node_device device_list[] =
|
||||
{
|
||||
{ CORSAIR_VID, CORSAIR_LIGHTING_NODE_CORE_PID, 1, "Corsair Lighting Node Core" },
|
||||
{ CORSAIR_VID, CORSAIR_LIGHTING_NODE_PRO_PID, 2, "Corsair Lighting Node Pro" },
|
||||
{ CORSAIR_VID, CORSAIR_COMMANDER_PRO_PID, 2, "Corsair Commander Pro" },
|
||||
{ CORSAIR_VID, CORSAIR_LS100_PID, 1, "Corsair LS100 Lighting Kit" },
|
||||
{ CORSAIR_VID, CORSAIR_1000D_OBSIDIAN_PID, 2, "Corsair 1000D Obsidian" },
|
||||
{ CORSAIR_VID, CORSAIR_SPEC_OMEGA_RGB_PID, 2, "Corsair SPEC OMEGA RGB" }
|
||||
};
|
||||
#define CORSAIR_LT100_PID 0x0C23
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
@@ -41,42 +22,22 @@ static const corsair_node_device device_list[] =
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectCorsairLightingNodeControllers(std::vector<RGBController*> &rgb_controllers)
|
||||
void DetectCorsairLightingNodeControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device_info* info;
|
||||
hid_device* dev;
|
||||
|
||||
hid_init();
|
||||
|
||||
for(std::size_t device_idx = 0; device_idx < CORSAIR_NUM_DEVICES; device_idx++)
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if( dev )
|
||||
{
|
||||
dev = NULL;
|
||||
|
||||
info = hid_enumerate(device_list[device_idx].usb_vid, device_list[device_idx].usb_pid);
|
||||
|
||||
//Look for Corsair Lighting Node Devices
|
||||
while(info)
|
||||
{
|
||||
if((info->vendor_id == device_list[device_idx].usb_vid)
|
||||
&&(info->product_id == device_list[device_idx].usb_pid))
|
||||
{
|
||||
dev = hid_open_path(info->path);
|
||||
|
||||
if( dev )
|
||||
{
|
||||
CorsairLightingNodeController* controller = new CorsairLightingNodeController(dev, info->path);
|
||||
|
||||
RGBController_CorsairLightingNode* rgb_controller = new RGBController_CorsairLightingNode(controller);
|
||||
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
info = info->next;
|
||||
}
|
||||
CorsairLightingNodeController* controller = new CorsairLightingNodeController(dev, info->path);
|
||||
RGBController_CorsairLightingNode* rgb_controller = new RGBController_CorsairLightingNode(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
} /* DetectCorsairLightingNodeControllers() */
|
||||
|
||||
REGISTER_DETECTOR("Corsair Lighting Node", DetectCorsairLightingNodeControllers);
|
||||
REGISTER_HID_DETECTOR("Corsair Lighting Node Core", DetectCorsairLightingNodeControllers, CORSAIR_VID, CORSAIR_LIGHTING_NODE_CORE_PID); // 1 channel
|
||||
REGISTER_HID_DETECTOR("Corsair Lighting Node Pro", DetectCorsairLightingNodeControllers, CORSAIR_VID, CORSAIR_LIGHTING_NODE_PRO_PID); // 2 channels
|
||||
REGISTER_HID_DETECTOR("Corsair Commander Pro", DetectCorsairLightingNodeControllers, CORSAIR_VID, CORSAIR_COMMANDER_PRO_PID); // 2 channels
|
||||
REGISTER_HID_DETECTOR("Corsair LS100 Lighting Kit", DetectCorsairLightingNodeControllers, CORSAIR_VID, CORSAIR_LS100_PID); // 1 channel
|
||||
REGISTER_HID_DETECTOR("Corsair 1000D Obsidian", DetectCorsairLightingNodeControllers, CORSAIR_VID, CORSAIR_1000D_OBSIDIAN_PID); // 2 channels
|
||||
REGISTER_HID_DETECTOR("Corsair SPEC OMEGA RGB", DetectCorsairLightingNodeControllers, CORSAIR_VID, CORSAIR_SPEC_OMEGA_RGB_PID); // 2 channels
|
||||
REGISTER_HID_DETECTOR("Corsair LT100", DetectCorsairLightingNodeControllers, CORSAIR_VID, CORSAIR_LT100_PID); // 2 channels
|
||||
@@ -15,10 +15,12 @@ RGBController_CorsairLightingNode::RGBController_CorsairLightingNode(CorsairLigh
|
||||
corsair = corsair_ptr;
|
||||
|
||||
name = "Corsair Lighting Node Device";
|
||||
vendor = "Corsair";
|
||||
description = "Corsair Lighting Node Device";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
version = corsair->GetFirmwareString();
|
||||
location = corsair->GetLocationString();
|
||||
serial = corsair->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
|
||||
@@ -60,7 +60,10 @@ CorsairPeripheralController::CorsairPeripheralController(hid_device* dev_handle,
|
||||
|
||||
CorsairPeripheralController::~CorsairPeripheralController()
|
||||
{
|
||||
|
||||
if(dev)
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
}
|
||||
|
||||
device_type CorsairPeripheralController::GetDeviceType()
|
||||
@@ -70,7 +73,7 @@ device_type CorsairPeripheralController::GetDeviceType()
|
||||
|
||||
std::string CorsairPeripheralController::GetDeviceLocation()
|
||||
{
|
||||
return(location);
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
int CorsairPeripheralController::GetPhysicalLayout()
|
||||
@@ -88,6 +91,22 @@ std::string CorsairPeripheralController::GetFirmwareString()
|
||||
return firmware_version;
|
||||
}
|
||||
|
||||
std::string CorsairPeripheralController::GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
std::string CorsairPeripheralController::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 CorsairPeripheralController::SetLEDs(std::vector<RGBColor>colors)
|
||||
{
|
||||
switch(type)
|
||||
@@ -267,6 +286,11 @@ void CorsairPeripheralController::SetLEDsKeyboardLimited(std::vector<RGBColor> c
|
||||
SubmitKeyboardLimitedColors(216);
|
||||
}
|
||||
|
||||
void CorsairPeripheralController::SetName(std::string device_name)
|
||||
{
|
||||
name = device_name;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------*\
|
||||
| Private packet sending functions. |
|
||||
\*-------------------------------------------------------------------------------------------------*/
|
||||
|
||||
@@ -74,18 +74,22 @@ public:
|
||||
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 SetLEDsKeyboardLimited(std::vector<RGBColor> colors);
|
||||
void SetLEDsMouse(std::vector<RGBColor> colors);
|
||||
void SetLEDsMousemat(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;
|
||||
int physical_layout; //ANSI, ISO, etc.
|
||||
int logical_layout; //Normal, K95 or K95 Platinum
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include "CorsairPeripheralController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_CorsairPeripheral.h"
|
||||
#include <vector>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
@@ -60,56 +59,6 @@
|
||||
\*-----------------------------------------------------*/
|
||||
#define CORSAIR_ST100_PID 0x0A34
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short usb_vid;
|
||||
unsigned short usb_pid;
|
||||
unsigned char usb_interface;
|
||||
const char * name;
|
||||
} corsair_node_device;
|
||||
|
||||
#define CORSAIR_NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
|
||||
|
||||
static const corsair_node_device device_list[] =
|
||||
{
|
||||
/*-----------------------------------------------------------------------------------------------------*\
|
||||
| Keyboards |
|
||||
\*-----------------------------------------------------------------------------------------------------*/
|
||||
// { CORSAIR_VID, CORSAIR_K55_RGB_PID, 1, "Corsair K55 RGB" }, //Not per-key, disabled for now
|
||||
{ CORSAIR_VID, CORSAIR_K65_RGB_PID, 1, "Corsair K65 RGB" },
|
||||
{ CORSAIR_VID, CORSAIR_K65_LUX_RGB_PID, 1, "Corsair K65 LUX RGB" },
|
||||
{ CORSAIR_VID, CORSAIR_K65_RGB_RAPIDFIRE_PID, 1, "Corsair K65 RGB RAPIDFIRE" },
|
||||
{ CORSAIR_VID, CORSAIR_K68_RGB, 1, "Corsair K68 RGB" },
|
||||
{ CORSAIR_VID, CORSAIR_K70_RGB_PID, 1, "Corsair K70 RGB" },
|
||||
{ CORSAIR_VID, CORSAIR_K70_LUX_RGB_PID, 1, "Corsair K70 LUX RGB" },
|
||||
{ CORSAIR_VID, CORSAIR_K70_RGB_RAPIDFIRE_PID, 1, "Corsair K70 RGB RAPIDFIRE" },
|
||||
{ CORSAIR_VID, CORSAIR_K70_RGB_MK2_PID, 1, "Corsair K70 RGB MK.2" },
|
||||
{ CORSAIR_VID, CORSAIR_K70_RGB_MK2_SE_PID, 1, "Corsair K70 RGB MK.2 SE" },
|
||||
{ CORSAIR_VID, CORSAIR_K70_RGB_MK2_LP_PID, 1, "Corsair K70 RGB MK.2 Low Profile" },
|
||||
{ CORSAIR_VID, CORSAIR_K95_RGB_PID, 1, "Corsair K95 RGB" },
|
||||
{ CORSAIR_VID, CORSAIR_K95_PLATINUM_PID, 1, "Corsair K95 RGB PLATINUM" },
|
||||
{ CORSAIR_VID, CORSAIR_STRAFE_PID, 1, "Corsair Strafe" },
|
||||
{ CORSAIR_VID, CORSAIR_STRAFE_MK2_PID, 1, "Corsair Strafe MK.2" },
|
||||
/*-----------------------------------------------------------------------------------------------------*\
|
||||
| Mice |
|
||||
\*-----------------------------------------------------------------------------------------------------*/
|
||||
{ CORSAIR_VID, CORSAIR_GLAIVE_RGB_PRO_PID, 1, "Corsair Glaive RGB PRO" },
|
||||
{ CORSAIR_VID, CORSAIR_HARPOON_RGB_PID, 1, "Corsair Harpoon RGB" },
|
||||
{ CORSAIR_VID, CORSAIR_HARPOON_RGB_PRO_PID, 1, "Corsair Harpoon RGB PRO" },
|
||||
{ CORSAIR_VID, CORSAIR_M65_PRO_PID, 1, "Corsair M65 PRO" },
|
||||
{ CORSAIR_VID, CORSAIR_M65_RGB_ELITE_PID, 1, "Corsair M65 RGB Elite" },
|
||||
{ CORSAIR_VID, CORSAIR_SCIMITAR_PRO_RGB_PID, 1, "Corsair Scimitar PRO RGB" },
|
||||
{ CORSAIR_VID, CORSAIR_SABRE_RGB_PID, 1, "Corsair Sabre RGB" },
|
||||
/*-----------------------------------------------------------------------------------------------------*\
|
||||
| Mousemats |
|
||||
\*-----------------------------------------------------------------------------------------------------*/
|
||||
{ CORSAIR_VID, CORSAIR_MM800_RGB_POLARIS_PID, 0, "Corsair MM800 RGB Polaris" },
|
||||
/*-----------------------------------------------------------------------------------------------------*\
|
||||
| Headset Stands |
|
||||
\*-----------------------------------------------------------------------------------------------------*/
|
||||
{ CORSAIR_VID, CORSAIR_ST100_PID, 0, "Corsair ST100 RGB" }
|
||||
};
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectCorsairPeripheralControllers *
|
||||
@@ -118,50 +67,68 @@ static const corsair_node_device device_list[] =
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectCorsairPeripheralControllers(std::vector<RGBController*>& rgb_controllers)
|
||||
void DetectCorsairPeripheralControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device_info* info;
|
||||
hid_device* dev;
|
||||
|
||||
hid_init();
|
||||
|
||||
for(std::size_t device_idx = 0; device_idx < CORSAIR_NUM_DEVICES; device_idx++)
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if( dev )
|
||||
{
|
||||
dev = NULL;
|
||||
CorsairPeripheralController* controller = new CorsairPeripheralController(dev, info->path);
|
||||
controller->SetName(name);
|
||||
|
||||
info = hid_enumerate(device_list[device_idx].usb_vid, device_list[device_idx].usb_pid);
|
||||
|
||||
//Look for Corsair RGB Peripheral
|
||||
while(info)
|
||||
if(controller->GetDeviceType() != DEVICE_TYPE_UNKNOWN)
|
||||
{
|
||||
if((info->vendor_id == device_list[device_idx].usb_vid)
|
||||
#ifdef USE_HID_USAGE
|
||||
&&(info->product_id == device_list[device_idx].usb_pid)
|
||||
&&(info->usage_page == 0xFFC2))
|
||||
#else
|
||||
&&(info->product_id == device_list[device_idx].usb_pid)
|
||||
&&(info->interface_number == device_list[device_idx].usb_interface))
|
||||
#endif
|
||||
{
|
||||
dev = hid_open_path(info->path);
|
||||
|
||||
if( dev )
|
||||
{
|
||||
CorsairPeripheralController* controller = new CorsairPeripheralController(dev, info->path);
|
||||
|
||||
if(controller->GetDeviceType() != DEVICE_TYPE_UNKNOWN)
|
||||
{
|
||||
RGBController_CorsairPeripheral* rgb_controller = new RGBController_CorsairPeripheral(controller);
|
||||
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
}
|
||||
info = info->next;
|
||||
RGBController_CorsairPeripheral* rgb_controller = new RGBController_CorsairPeripheral(controller);
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
}
|
||||
} /* DetectCorsairPeripheralControllers() */
|
||||
|
||||
REGISTER_DETECTOR("Corsair Peripheral", DetectCorsairPeripheralControllers);
|
||||
/*-----------------------------------------------------------------------------------------------------*\
|
||||
| Keyboards |
|
||||
\*-----------------------------------------------------------------------------------------------------*/
|
||||
//REGISTER_HID_DETECTOR_IP("Corsair K55 RGB", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_K55_RGB_PID, 1, 0xFFC2); // Not per-key, disabled for now
|
||||
REGISTER_HID_DETECTOR_IP("Corsair K65 RGB", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_K65_RGB_PID, 1, 0xFFC2);
|
||||
REGISTER_HID_DETECTOR_IP("Corsair K65 LUX RGB", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_K65_LUX_RGB_PID, 1, 0xFFC2);
|
||||
REGISTER_HID_DETECTOR_IP("Corsair K65 RGB RAPIDFIRE", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_K65_RGB_RAPIDFIRE_PID, 1, 0xFFC2);
|
||||
REGISTER_HID_DETECTOR_IP("Corsair K68 RGB", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_K68_RGB, 1, 0xFFC2);
|
||||
REGISTER_HID_DETECTOR_IP("Corsair K70 RGB", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_K70_RGB_PID, 1, 0xFFC2);
|
||||
REGISTER_HID_DETECTOR_IP("Corsair K70 LUX RGB", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_K70_LUX_RGB_PID, 1, 0xFFC2);
|
||||
REGISTER_HID_DETECTOR_IP("Corsair K70 RGB RAPIDFIRE", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_K70_RGB_RAPIDFIRE_PID, 1, 0xFFC2);
|
||||
REGISTER_HID_DETECTOR_IP("Corsair K70 RGB MK.2", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_K70_RGB_MK2_PID, 1, 0xFFC2);
|
||||
REGISTER_HID_DETECTOR_IP("Corsair K70 RGB MK.2 SE", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_K70_RGB_MK2_SE_PID, 1, 0xFFC2);
|
||||
REGISTER_HID_DETECTOR_IP("Corsair K70 RGB MK.2 Low Profile", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_K70_RGB_MK2_LP_PID, 1, 0xFFC2);
|
||||
REGISTER_HID_DETECTOR_IP("Corsair K95 RGB", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_K95_RGB_PID, 1, 0xFFC2);
|
||||
REGISTER_HID_DETECTOR_IP("Corsair K95 RGB PLATINUM", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_K95_PLATINUM_PID, 1, 0xFFC2);
|
||||
REGISTER_HID_DETECTOR_IP("Corsair Strafe", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_STRAFE_PID, 1, 0xFFC2);
|
||||
REGISTER_HID_DETECTOR_IP("Corsair Strafe MK.2", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_STRAFE_MK2_PID, 1, 0xFFC2);
|
||||
/*-----------------------------------------------------------------------------------------------------*\
|
||||
| Mice |
|
||||
\*-----------------------------------------------------------------------------------------------------*/
|
||||
REGISTER_HID_DETECTOR_IP("Corsair Glaive RGB PRO", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_GLAIVE_RGB_PRO_PID, 1, 0xFFC2);
|
||||
REGISTER_HID_DETECTOR_IP("Corsair Harpoon RGB", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_HARPOON_RGB_PID, 1, 0xFFC2);
|
||||
REGISTER_HID_DETECTOR_IP("Corsair Harpoon RGB PRO", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_HARPOON_RGB_PRO_PID, 1, 0xFFC2);
|
||||
REGISTER_HID_DETECTOR_IP("Corsair M65 PRO", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_M65_PRO_PID, 1, 0xFFC2);
|
||||
REGISTER_HID_DETECTOR_IP("Corsair M65 RGB Elite" , DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_M65_RGB_ELITE_PID, 1, 0xFFC2);
|
||||
REGISTER_HID_DETECTOR_IP("Corsair Scimitar PRO RGB", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_SCIMITAR_PRO_RGB_PID, 1, 0xFFC2);
|
||||
REGISTER_HID_DETECTOR_IP("Corsair Sabre RGB", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_SABRE_RGB_PID, 1, 0xFFC2);
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------------*\
|
||||
| Mousemats |
|
||||
\*-----------------------------------------------------------------------------------------------------*/
|
||||
#ifdef USE_HID_USAGE
|
||||
REGISTER_HID_DETECTOR_P("Corsair MM800 RGB Polaris", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_MM800_RGB_POLARIS_PID, 0xFFC2);
|
||||
#else
|
||||
REGISTER_HID_DETECTOR_I("Corsair MM800 RGB Polaris", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_MM800_RGB_POLARIS_PID, 0);
|
||||
#endif
|
||||
/*-----------------------------------------------------------------------------------------------------*\
|
||||
| Headset Stands |
|
||||
\*-----------------------------------------------------------------------------------------------------*/
|
||||
#ifdef USE_HID_USAGE
|
||||
REGISTER_HID_DETECTOR_P("Corsair ST100 RGB", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_ST100_PID, 0xFFC2);
|
||||
#else
|
||||
REGISTER_HID_DETECTOR_I("Corsair ST100 RGB", DetectCorsairPeripheralControllers, CORSAIR_VID, CORSAIR_ST100_PID, 0);
|
||||
#endif
|
||||
|
||||
@@ -513,6 +513,25 @@ static const char* corsair_mouse_leds[] =
|
||||
"Mouse LED 15",
|
||||
};
|
||||
|
||||
static const char* corsair_m65_elite_leds[] =
|
||||
{
|
||||
"",
|
||||
"",
|
||||
"Logo",
|
||||
"DPI",
|
||||
"Scroll Wheel",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
};
|
||||
|
||||
static const char* corsair_sabre_rgb_leds[] =
|
||||
{
|
||||
"",
|
||||
@@ -555,11 +574,13 @@ RGBController_CorsairPeripheral::RGBController_CorsairPeripheral(CorsairPeripher
|
||||
{
|
||||
corsair = corsair_ptr;
|
||||
|
||||
name = "Corsair RGB Peripheral Device";
|
||||
name = corsair->GetName();
|
||||
vendor = "Corsair";
|
||||
description = "Corsair RGB Peripheral Device";
|
||||
type = corsair->GetDeviceType();
|
||||
version = corsair->GetFirmwareString();
|
||||
location = corsair->GetDeviceLocation();
|
||||
serial = corsair->GetSerialString();
|
||||
|
||||
physical_layout = corsair->GetPhysicalLayout();
|
||||
logical_layout = corsair->GetLogicalLayout();
|
||||
@@ -757,7 +778,22 @@ void RGBController_CorsairPeripheral::SetupZones()
|
||||
break;
|
||||
|
||||
case DEVICE_TYPE_MOUSE:
|
||||
new_led.name = corsair_mouse_leds[led_idx];
|
||||
if(name == "Corsair M65 RGB Elite")
|
||||
{
|
||||
new_led.name = corsair_m65_elite_leds[led_idx];
|
||||
}
|
||||
else if(name == "Corsair Harpoon RGB PRO")
|
||||
{
|
||||
new_led.name = corsair_harpoon_pro_leds[led_idx];
|
||||
}
|
||||
else if(name == "Corsair Sabre RGB")
|
||||
{
|
||||
new_led.name = corsair_sabre_rgb_leds[led_idx];
|
||||
}
|
||||
else
|
||||
{
|
||||
new_led.name = corsair_mouse_leds[led_idx];
|
||||
}
|
||||
break;
|
||||
|
||||
case DEVICE_TYPE_MOUSEMAT:
|
||||
|
||||
@@ -14,6 +14,7 @@ RGBController_CorsairVengeance::RGBController_CorsairVengeance(CorsairVengeanceC
|
||||
corsair = corsair_ptr;
|
||||
|
||||
name = corsair->GetDeviceName();
|
||||
vendor = "Corsair";
|
||||
type = DEVICE_TYPE_DRAM;
|
||||
description = "Corsair Vengeance RGB Device";
|
||||
location = corsair->GetDeviceLocation();
|
||||
|
||||
@@ -14,6 +14,7 @@ RGBController_CorsairVengeancePro::RGBController_CorsairVengeancePro(CorsairVeng
|
||||
corsair = corsair_ptr;
|
||||
|
||||
name = corsair->GetDeviceName();
|
||||
vendor = "Corsair";
|
||||
type = DEVICE_TYPE_DRAM;
|
||||
description = "Corsair Vengeance Pro RGB Device";
|
||||
location = corsair->GetDeviceLocation();
|
||||
|
||||
@@ -15,6 +15,9 @@ CrucialController::CrucialController(i2c_smbus_interface* bus, crucial_dev_id de
|
||||
{
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
|
||||
// We don't know what mode the sticks are in until we set one.
|
||||
this->last_mode = CRUCIAL_MODE_UNKNOWN;
|
||||
}
|
||||
|
||||
CrucialController::~CrucialController()
|
||||
@@ -44,7 +47,11 @@ unsigned int CrucialController::GetLEDCount()
|
||||
|
||||
void CrucialController::SetMode(unsigned char mode)
|
||||
{
|
||||
// Don't set a mode if we've already set the same one before.
|
||||
// This is mostly useful for direct mode and updating colors often.
|
||||
if (mode == last_mode) return;
|
||||
SendEffectMode(mode, 0x10);
|
||||
last_mode = mode;
|
||||
}
|
||||
|
||||
void CrucialController::SetAllColorsDirect(RGBColor* colors)
|
||||
@@ -80,6 +87,8 @@ void CrucialController::SendEffectMode(unsigned char mode, unsigned char speed)
|
||||
|
||||
void CrucialController::SendDirectColors(RGBColor* color_buf)
|
||||
{
|
||||
SetMode(CRUCIAL_MODE_STATIC);
|
||||
|
||||
//Red Channels
|
||||
CrucialRegisterWrite(0x8300, RGBGetRValue(color_buf[0]));
|
||||
CrucialRegisterWrite(0x8301, RGBGetRValue(color_buf[1]));
|
||||
|
||||
@@ -18,6 +18,7 @@ typedef unsigned short crucial_register;
|
||||
|
||||
enum
|
||||
{
|
||||
CRUCIAL_MODE_UNKNOWN = 0x00, /* We don't know what the mode is */
|
||||
CRUCIAL_MODE_SHIFT = 0x1F, /* Shift effect mode */
|
||||
CRUCIAL_MODE_GRADIENT_SHIFT = 0x2F, /* Gradient shift mode */
|
||||
CRUCIAL_MODE_FILL = 0x3F, /* Fill effect mode */
|
||||
@@ -53,6 +54,7 @@ private:
|
||||
unsigned char config_table[64];
|
||||
unsigned int led_count;
|
||||
unsigned char channel_cfg;
|
||||
unsigned char last_mode;
|
||||
i2c_smbus_interface * bus;
|
||||
crucial_dev_id dev;
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ RGBController_Crucial::RGBController_Crucial(CrucialController * crucial_ptr)
|
||||
crucial = crucial_ptr;
|
||||
|
||||
name = "Crucial DRAM";
|
||||
vendor = "Crucial";
|
||||
type = DEVICE_TYPE_DRAM;
|
||||
description = "Crucial DRAM Device";
|
||||
location = crucial->GetDeviceLocation();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "Detector.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_Debug.h"
|
||||
#include "RGBController_Dummy.h"
|
||||
#include "SettingsManager.h"
|
||||
#include <vector>
|
||||
@@ -161,7 +162,7 @@ static const char *led_names[] =
|
||||
* *
|
||||
* DetectDebugControllers *
|
||||
* *
|
||||
* Add dummy controllers based on debug.txt *
|
||||
* Add dummy controllers based on the DebugDevices key in the settings json *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
@@ -172,7 +173,7 @@ void DetectDebugControllers(std::vector<RGBController*> &rgb_controllers)
|
||||
/*-------------------------------------------------*\
|
||||
| Get Debug Device settings from settings manager |
|
||||
\*-------------------------------------------------*/
|
||||
debug_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("Setting_DebugDevices");
|
||||
debug_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("DebugDevices");
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| If the Debug settings contains devices, process |
|
||||
@@ -487,6 +488,54 @@ void DetectDebugControllers(std::vector<RGBController*> &rgb_controllers)
|
||||
\*---------------------------------------------------------*/
|
||||
rgb_controllers.push_back(dummy_keyboard);
|
||||
}
|
||||
else if(type == "argb")
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Create a dummy ARGB |
|
||||
\*---------------------------------------------------------*/
|
||||
RGBController_Debug* dummy_argb = new RGBController_Debug();
|
||||
|
||||
dummy_argb->name = "Debug ARGB";
|
||||
dummy_argb->type = DEVICE_TYPE_LEDSTRIP;
|
||||
dummy_argb->description = "Debug ARGB Device";
|
||||
dummy_argb->location = "Debug ARGB Location";
|
||||
dummy_argb->version = "Debug ARGB Version";
|
||||
dummy_argb->serial = "Debug ARGB Serial";
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Create a direct mode for the dummy ARGB |
|
||||
\*---------------------------------------------------------*/
|
||||
mode dummy_argb_direct_mode;
|
||||
|
||||
dummy_argb_direct_mode.name = "Direct";
|
||||
dummy_argb_direct_mode.value = 0;
|
||||
dummy_argb_direct_mode.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
dummy_argb_direct_mode.color_mode = MODE_COLORS_PER_LED;
|
||||
|
||||
dummy_argb->modes.push_back(dummy_argb_direct_mode);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Create a linear zone for the dummy ARGB |
|
||||
\*---------------------------------------------------------*/
|
||||
zone dummy_argb_linear_zone;
|
||||
|
||||
dummy_argb_linear_zone.name = "Resizable zone";
|
||||
dummy_argb_linear_zone.type = ZONE_TYPE_LINEAR;
|
||||
dummy_argb_linear_zone.leds_min = 1;
|
||||
dummy_argb_linear_zone.leds_max = 100;
|
||||
dummy_argb_linear_zone.leds_count = 0;
|
||||
dummy_argb_linear_zone.matrix_map = NULL;
|
||||
|
||||
dummy_argb->zones.push_back(dummy_argb_linear_zone);
|
||||
|
||||
dummy_argb->SetupColors();
|
||||
dummy_argb->ResizeZone(0, 60);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Push the dummy ARGB onto the controller list |
|
||||
\*---------------------------------------------------------*/
|
||||
rgb_controllers.push_back(dummy_argb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
#include "RGBController_Debug.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
RGBController_Debug::RGBController_Debug()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_Debug::ResizeZone(int index, int new_size)
|
||||
{
|
||||
//Make sure that it isn't out of bounds (negative numbers)
|
||||
if(new_size < int(zones[index].leds_min))
|
||||
{
|
||||
new_size = zones[index].leds_min;
|
||||
}
|
||||
|
||||
// Same thing as the above line except for over 100
|
||||
if(new_size > int(zones[index].leds_max))
|
||||
{
|
||||
new_size = zones[index].leds_max;
|
||||
}
|
||||
|
||||
// Store the previous amount of LEDs
|
||||
int old_size = zones[index].leds_count;
|
||||
|
||||
// Set the LED count in the zone to the new ammount
|
||||
zones[index].leds_count = new_size;
|
||||
|
||||
// Set the new ammount of LEDs for to the new size
|
||||
size_t old_leds_size = leds.size();
|
||||
|
||||
// Add the new ammount of LEDs to the old ammount
|
||||
size_t new_leds_size = leds.size() - old_size + new_size;
|
||||
|
||||
leds.resize(std::max(old_leds_size, new_leds_size));
|
||||
|
||||
memmove(&leds[zones[index].start_idx] + old_leds_size, &leds[zones[index].start_idx] + new_leds_size, (old_leds_size - zones[index].start_idx - old_size) * sizeof(led));
|
||||
|
||||
leds.resize(new_leds_size);
|
||||
|
||||
for(int i = 0; i < new_size; ++i)
|
||||
{
|
||||
leds[zones[index].start_idx + i].name = "Linear LED " + std::to_string(i);
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
#ifndef RGBCONTROLLER_DEBUG_H
|
||||
#define RGBCONTROLLER_DEBUG_H
|
||||
|
||||
#include "RGBController_Dummy.h"
|
||||
|
||||
// A variation of Dummy controller that allows the zones to be resized
|
||||
|
||||
class RGBController_Debug : public RGBController_Dummy
|
||||
{
|
||||
public:
|
||||
RGBController_Debug();
|
||||
void ResizeZone(int zone, int newSize) override;
|
||||
};
|
||||
|
||||
#endif // RGBCONTROLLER_DEBUG_H
|
||||
@@ -25,7 +25,18 @@ DuckyKeyboardController::~DuckyKeyboardController()
|
||||
|
||||
std::string DuckyKeyboardController::GetDeviceLocation()
|
||||
{
|
||||
return(location);
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string DuckyKeyboardController::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 DuckyKeyboardController::SendColors
|
||||
|
||||
@@ -21,6 +21,7 @@ public:
|
||||
~DuckyKeyboardController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SendColors
|
||||
(
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include "DuckyKeyboardController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_DuckyKeyboard.h"
|
||||
#include <vector>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
@@ -16,25 +15,6 @@
|
||||
#define DUCKY_SHINE_7_ONE_2_RGB_PID 0x0348
|
||||
#define DUCKY_ONE_2_RGB_TKL_PID 0x0356
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short usb_vid;
|
||||
unsigned short usb_pid;
|
||||
unsigned char usb_interface;
|
||||
const char * name;
|
||||
} ducky_device;
|
||||
|
||||
#define DUCKY_NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
|
||||
|
||||
static const ducky_device device_list[] =
|
||||
{
|
||||
/*-----------------------------------------------------------------------------------------------------*\
|
||||
| Keyboards |
|
||||
\*-----------------------------------------------------------------------------------------------------*/
|
||||
{ DUCKY_VID, DUCKY_SHINE_7_ONE_2_RGB_PID, 1, "Ducky Shine 7/Ducky One 2 RGB" },
|
||||
{ DUCKY_VID, DUCKY_ONE_2_RGB_TKL_PID, 1, "Ducky One 2 RGB TKL" },
|
||||
};
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectDuckyKeyboardControllers *
|
||||
@@ -43,42 +23,17 @@ static const ducky_device device_list[] =
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectDuckyKeyboardControllers(std::vector<RGBController*>& rgb_controllers)
|
||||
void DetectDuckyKeyboardControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device_info* info;
|
||||
hid_device* dev;
|
||||
|
||||
hid_init();
|
||||
|
||||
for(std::size_t device_idx = 0; device_idx < DUCKY_NUM_DEVICES; device_idx++)
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if( dev )
|
||||
{
|
||||
dev = NULL;
|
||||
|
||||
info = hid_enumerate(device_list[device_idx].usb_vid, device_list[device_idx].usb_pid);
|
||||
|
||||
//Look for Ducky RGB Peripheral
|
||||
while(info)
|
||||
{
|
||||
if((info->vendor_id == device_list[device_idx].usb_vid)
|
||||
&&(info->product_id == device_list[device_idx].usb_pid)
|
||||
&&(info->interface_number == device_list[device_idx].usb_interface))
|
||||
{
|
||||
dev = hid_open_path(info->path);
|
||||
|
||||
if( dev )
|
||||
{
|
||||
DuckyKeyboardController* controller = new DuckyKeyboardController(dev, info->path);
|
||||
|
||||
RGBController_DuckyKeyboard* rgb_controller = new RGBController_DuckyKeyboard(controller);
|
||||
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
info = info->next;
|
||||
}
|
||||
DuckyKeyboardController* controller = new DuckyKeyboardController(dev, info->path);
|
||||
RGBController_DuckyKeyboard* rgb_controller = new RGBController_DuckyKeyboard(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
} /* DetectDuckyKeyboardControllers() */
|
||||
|
||||
REGISTER_DETECTOR("Ducky Keyboard", DetectDuckyKeyboardControllers);
|
||||
REGISTER_HID_DETECTOR_I("Ducky Shine 7/Ducky One 2 RGB", DetectDuckyKeyboardControllers, DUCKY_VID, DUCKY_SHINE_7_ONE_2_RGB_PID, 1);
|
||||
REGISTER_HID_DETECTOR_I("Ducky One 2 RGB TKL", DetectDuckyKeyboardControllers, DUCKY_VID, DUCKY_ONE_2_RGB_TKL_PID, 1);
|
||||
|
||||
@@ -176,9 +176,11 @@ RGBController_DuckyKeyboard::RGBController_DuckyKeyboard(DuckyKeyboardController
|
||||
ducky = ducky_ptr;
|
||||
|
||||
name = "Ducky Keyboard Device";
|
||||
vendor = "Ducky";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "Ducky Keyboard Device";
|
||||
location = ducky->GetDeviceLocation();
|
||||
serial = ducky->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
|
||||
@@ -30,7 +30,7 @@ void DetectE131Controllers(std::vector<RGBController*> &rgb_controllers)
|
||||
/*-------------------------------------------------*\
|
||||
| Get E1.31 settings from settings manager |
|
||||
\*-------------------------------------------------*/
|
||||
e131_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("Setting_E131Devices");
|
||||
e131_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("E131Devices");
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| If the E1.31 settings contains devices, process |
|
||||
@@ -43,6 +43,7 @@ void DetectE131Controllers(std::vector<RGBController*> &rgb_controllers)
|
||||
| Clear E1.31 device data |
|
||||
\*-------------------------------------------------*/
|
||||
dev.name = "";
|
||||
dev.ip = "";
|
||||
dev.type = ZONE_TYPE_SINGLE;
|
||||
dev.num_leds = 0;
|
||||
dev.rgb_order = E131_RGB_ORDER_RBG;
|
||||
@@ -57,6 +58,11 @@ void DetectE131Controllers(std::vector<RGBController*> &rgb_controllers)
|
||||
dev.name = e131_settings["devices"][device_idx]["name"];
|
||||
}
|
||||
|
||||
if(e131_settings["devices"][device_idx].contains("ip"))
|
||||
{
|
||||
dev.ip = e131_settings["devices"][device_idx]["ip"];
|
||||
}
|
||||
|
||||
if(e131_settings["devices"][device_idx].contains("num_leds"))
|
||||
{
|
||||
dev.num_leds = e131_settings["devices"][device_idx]["num_leds"];
|
||||
@@ -188,40 +194,70 @@ void DetectE131Controllers(std::vector<RGBController*> &rgb_controllers)
|
||||
\*---------------------------------------------------------*/
|
||||
bool device_added_to_existing_list = false;
|
||||
|
||||
for(unsigned int list_idx = 0; list_idx < device_lists.size(); list_idx++)
|
||||
/*---------------------------------------------------------*\
|
||||
| Only track grouping for multicast controllers. Unicast |
|
||||
| controllers are currently not grouped. |
|
||||
\*---------------------------------------------------------*/
|
||||
if(dev.ip == "")
|
||||
{
|
||||
for(unsigned int device_idx = 0; device_idx < device_lists[list_idx].size(); device_idx++)
|
||||
for(unsigned int list_idx = 0; list_idx < device_lists.size(); list_idx++)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Check if any universes used by this new device exist in |
|
||||
| the existing device. If so, add the new device to the |
|
||||
| existing list. |
|
||||
\*---------------------------------------------------------*/
|
||||
if(dev.start_universe == device_lists[list_idx][device_idx].start_universe)
|
||||
for(unsigned int device_idx = 0; device_idx < device_lists[list_idx].size(); device_idx++)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Determine if there is any overlap between this device and |
|
||||
| any existing device list |
|
||||
| Offset the end by two - one because the range is 1-512 |
|
||||
| rather than 0-511, and one because the start channel is |
|
||||
| included in the first set of 3 channels. |
|
||||
\*---------------------------------------------------------*/
|
||||
unsigned int dev_start = dev.start_universe;
|
||||
unsigned int list_start = device_lists[list_idx][device_idx].start_universe;
|
||||
unsigned int dev_end = dev.start_universe + ((dev.start_channel + (3 * dev.num_leds) - 2) / 512);
|
||||
unsigned int list_end = device_lists[list_idx][device_idx].start_universe + ((device_lists[list_idx][device_idx].start_channel + (3 * device_lists[list_idx][device_idx].num_leds) - 2) / 512);
|
||||
|
||||
bool overlap = !(dev_end < list_start || list_end < dev_start);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Check if any universes used by this new device exist in |
|
||||
| the existing device. If so, add the new device to the |
|
||||
| existing list. |
|
||||
\*---------------------------------------------------------*/
|
||||
if(overlap)
|
||||
{
|
||||
device_lists[list_idx].push_back(dev);
|
||||
device_added_to_existing_list = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(device_added_to_existing_list)
|
||||
{
|
||||
device_lists[list_idx].push_back(dev);
|
||||
device_added_to_existing_list = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(device_added_to_existing_list)
|
||||
/*---------------------------------------------------------*\
|
||||
| If the device did not overlap with existing devices, |
|
||||
| create a new list for it |
|
||||
\*---------------------------------------------------------*/
|
||||
if(!device_added_to_existing_list)
|
||||
{
|
||||
break;
|
||||
std::vector<E131Device> new_list;
|
||||
|
||||
new_list.push_back(dev);
|
||||
|
||||
device_lists.push_back(new_list);
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| If the device did not overlap with existing devices, |
|
||||
| create a new list for it |
|
||||
\*---------------------------------------------------------*/
|
||||
if(!device_added_to_existing_list)
|
||||
else
|
||||
{
|
||||
std::vector<E131Device> new_list;
|
||||
std::vector<E131Device> tmp_device_list;
|
||||
tmp_device_list.push_back(dev);
|
||||
|
||||
new_list.push_back(dev);
|
||||
|
||||
device_lists.push_back(new_list);
|
||||
RGBController_E131* rgb_controller;
|
||||
rgb_controller = new RGBController_E131(tmp_device_list);
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@ using namespace std::chrono_literals;
|
||||
|
||||
RGBController_E131::RGBController_E131(std::vector<E131Device> device_list)
|
||||
{
|
||||
bool multicast = false;
|
||||
|
||||
devices = device_list;
|
||||
|
||||
name = "E1.31 Device Group";
|
||||
@@ -34,9 +36,17 @@ RGBController_E131::RGBController_E131(std::vector<E131Device> device_list)
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Append the destination address to the |
|
||||
| location field (multicast only for now) |
|
||||
| location field |
|
||||
\*-----------------------------------------*/
|
||||
location += "Multicast, ";
|
||||
if((devices.size() == 1) && (devices[0].ip != ""))
|
||||
{
|
||||
location += "Unicast " + devices[0].ip + ", ";
|
||||
}
|
||||
else
|
||||
{
|
||||
location += "Multicast, ";
|
||||
multicast = true;
|
||||
}
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Calculate universe list |
|
||||
@@ -152,7 +162,15 @@ RGBController_E131::RGBController_E131(std::vector<E131Device> device_list)
|
||||
e131_addr_t dest_addr;
|
||||
|
||||
e131_pkt_init(&packet, universe, 512);
|
||||
e131_multicast_dest(&dest_addr, universe, E131_DEFAULT_PORT);
|
||||
|
||||
if(multicast)
|
||||
{
|
||||
e131_multicast_dest(&dest_addr, universe, E131_DEFAULT_PORT);
|
||||
}
|
||||
else
|
||||
{
|
||||
e131_unicast_dest(&dest_addr, devices[0].ip.c_str(), E131_DEFAULT_PORT);
|
||||
}
|
||||
|
||||
packets.push_back(packet);
|
||||
universes.push_back(universe);
|
||||
@@ -261,12 +279,21 @@ RGBController_E131::RGBController_E131(std::vector<E131Device> device_list)
|
||||
|
||||
if(keepalive_delay.count() > 0)
|
||||
{
|
||||
KeepaliveThread = new std::thread(&RGBController_E131::KeepaliveThreadFunction, this);
|
||||
keepalive_thread_run = 1;
|
||||
keepalive_thread = new std::thread(&RGBController_E131::KeepaliveThreadFunction, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
keepalive_thread_run = 0;
|
||||
keepalive_thread = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
RGBController_E131::~RGBController_E131()
|
||||
{
|
||||
keepalive_thread_run = 0;
|
||||
keepalive_thread->join();
|
||||
delete keepalive_thread;
|
||||
/*---------------------------------------------------------*\
|
||||
| Delete the matrix map |
|
||||
\*---------------------------------------------------------*/
|
||||
@@ -413,7 +440,7 @@ void RGBController_E131::DeviceUpdateMode()
|
||||
|
||||
void RGBController_E131::KeepaliveThreadFunction()
|
||||
{
|
||||
while(1)
|
||||
while(keepalive_thread_run.load())
|
||||
{
|
||||
if((std::chrono::steady_clock::now() - last_update_time) > ( keepalive_delay * 0.95f ) )
|
||||
{
|
||||
|
||||
@@ -42,6 +42,7 @@ typedef unsigned int e131_matrix_order;
|
||||
struct E131Device
|
||||
{
|
||||
std::string name;
|
||||
std::string ip;
|
||||
unsigned int num_leds;
|
||||
unsigned int start_universe;
|
||||
unsigned int start_channel;
|
||||
@@ -78,7 +79,8 @@ private:
|
||||
std::vector<e131_addr_t> dest_addrs;
|
||||
std::vector<unsigned int> universes;
|
||||
int sockfd;
|
||||
std::thread * KeepaliveThread;
|
||||
std::thread * keepalive_thread;
|
||||
std::atomic<bool> keepalive_thread_run;
|
||||
std::chrono::milliseconds keepalive_delay;
|
||||
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "EKController.h"
|
||||
|
||||
static unsigned char colour_mode_data[][16] =
|
||||
static unsigned char ek_colour_mode_data[][16] =
|
||||
{
|
||||
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
|
||||
0x00, 0x10, 0x20, 0x01, 0x01, 0x00, 0xFF, 0x64}, // Static
|
||||
@@ -31,7 +31,7 @@ static unsigned char colour_mode_data[][16] =
|
||||
0x00, 0x10, 0x20, 0x01, 0x09, 0x00, 0xFF, 0x64}, // Candle
|
||||
};
|
||||
|
||||
static unsigned char speed_mode_data[][9] =
|
||||
static unsigned char ek_speed_mode_data[][9] =
|
||||
{
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // Static
|
||||
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Breathing
|
||||
@@ -44,21 +44,24 @@ static unsigned char speed_mode_data[][9] =
|
||||
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 } // Candle
|
||||
};
|
||||
|
||||
EKController::EKController(hid_device* dev_handle, wchar_t *_vendor, wchar_t *_device_name, char *_path)
|
||||
EKController::EKController(hid_device* dev_handle, char *_path)
|
||||
{
|
||||
std::size_t tmp_size = wcslen(_vendor);
|
||||
const int szTemp = 256;
|
||||
wchar_t tmpName[szTemp];
|
||||
|
||||
dev = dev_handle;
|
||||
|
||||
for(std::size_t i = 0; (i < tmp_size) && (i < EK_DEVICE_NAME_SIZE); i++)
|
||||
{
|
||||
device_name[i] = (char)_vendor[i];
|
||||
}
|
||||
hid_get_manufacturer_string(dev, tmpName, szTemp);
|
||||
std::wstring wName = std::wstring(tmpName);
|
||||
device_name = std::string(wName.begin(), wName.end());
|
||||
|
||||
for(std::size_t j = 0; (j < wcslen(_vendor)) && ((tmp_size + j) < EK_DEVICE_NAME_SIZE); j++)
|
||||
{
|
||||
device_name[tmp_size + j] = (char)_device_name[j];
|
||||
}
|
||||
hid_get_product_string(dev, tmpName, szTemp);
|
||||
wName = std::wstring(tmpName);
|
||||
device_name.append(" ").append(std::string(wName.begin(), wName.end()));
|
||||
|
||||
hid_get_serial_number_string(dev, tmpName, szTemp);
|
||||
wName = std::wstring(tmpName);
|
||||
serial = std::string(wName.begin(), wName.end());
|
||||
|
||||
location = _path;
|
||||
|
||||
@@ -68,25 +71,22 @@ EKController::EKController(hid_device* dev_handle, wchar_t *_vendor, wchar_t *_d
|
||||
|
||||
EKController::~EKController()
|
||||
{
|
||||
if(dev)
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
char* EKController::GetDeviceName()
|
||||
std::string EKController::GetDeviceName()
|
||||
{
|
||||
return device_name;
|
||||
}
|
||||
|
||||
char* EKController::GetSerial()
|
||||
std::string EKController::GetSerial()
|
||||
{
|
||||
return serial;
|
||||
}
|
||||
|
||||
std::string EKController::GetLocation()
|
||||
{
|
||||
return location;
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
void EKController::SetMode(unsigned char mode, unsigned char speed)
|
||||
@@ -113,14 +113,14 @@ void EKController::SendUpdate()
|
||||
|
||||
for(std::size_t i = 0; i < EK_COLOUR_MODE_DATA_SIZE; i++)
|
||||
{
|
||||
buffer[i] = colour_mode_data[current_mode][i];
|
||||
buffer[i] = ek_colour_mode_data[current_mode][i];
|
||||
}
|
||||
|
||||
//Set the relevant colour info
|
||||
buffer[EK_RED_BYTE] = current_red;
|
||||
buffer[EK_GREEN_BYTE] = current_green;
|
||||
buffer[EK_BLUE_BYTE] = current_blue;
|
||||
buffer[EK_SPEED_BYTE] = speed_mode_data[current_mode][current_speed];
|
||||
buffer[EK_SPEED_BYTE] = ek_speed_mode_data[current_mode][current_speed];
|
||||
|
||||
buffer[10] = 0x10;
|
||||
buffer[47] = 0xFF;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#define EK_COLOUR_MODE_DATA_SIZE (sizeof(colour_mode_data[0]) / sizeof(colour_mode_data[0][0]))
|
||||
#define EK_COLOUR_MODE_DATA_SIZE (sizeof(ek_colour_mode_data[0]) / sizeof(ek_colour_mode_data[0][0]))
|
||||
#define EK_DEVICE_NAME_SIZE (sizeof(device_name) / sizeof(device_name[ 0 ]))
|
||||
#define EK_PACKET_LENGTH 0x3F
|
||||
|
||||
@@ -55,19 +55,19 @@ enum
|
||||
class EKController
|
||||
{
|
||||
public:
|
||||
EKController(hid_device* dev_handle, wchar_t *_vendor, wchar_t *_device_name, char *_path);
|
||||
EKController(hid_device* dev_handle, char *_path);
|
||||
~EKController();
|
||||
|
||||
char* GetDeviceName();
|
||||
char* GetSerial();
|
||||
std::string GetDeviceName();
|
||||
std::string GetSerial();
|
||||
std::string GetLocation();
|
||||
|
||||
void SetMode(unsigned char mode, unsigned char speed);
|
||||
void SetColor(unsigned char red, unsigned char green, unsigned char blue);
|
||||
|
||||
private:
|
||||
char device_name[32];
|
||||
char serial[32];
|
||||
std::string device_name;
|
||||
std::string serial;
|
||||
std::string location;
|
||||
hid_device* dev;
|
||||
|
||||
|
||||
@@ -5,22 +5,8 @@
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#define EK_VID 0x0483
|
||||
|
||||
#define EK_LOOP_CONNECT 0x5750
|
||||
|
||||
#define EK_NUM_DEVICES (sizeof(ek_pids) / sizeof(ek_pids[ 0 ]))
|
||||
|
||||
enum
|
||||
{
|
||||
EK_PID = 0,
|
||||
EK_INTERFACE = 1
|
||||
};
|
||||
|
||||
static const unsigned int ek_pids[][2] =
|
||||
{ // PID, Interface
|
||||
{ EK_LOOP_CONNECT, 0x00 } //EK Loop Connect
|
||||
};
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectEKControllers *
|
||||
@@ -29,39 +15,17 @@ static const unsigned int ek_pids[][2] =
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectEKControllers(std::vector<RGBController*>& rgb_controllers)
|
||||
void DetectEKControllers(hid_device_info* info, const std::string&)
|
||||
{
|
||||
hid_device_info* info = NULL;
|
||||
|
||||
//Look for the passed in cm_pids
|
||||
hid_init();
|
||||
info = hid_enumerate(EK_VID, 0x0);
|
||||
|
||||
while(info)
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
hid_device* dev = NULL;
|
||||
if(info->vendor_id == EK_VID)
|
||||
{
|
||||
for(unsigned int ek_pid_idx = 0; ek_pid_idx < EK_NUM_DEVICES; ek_pid_idx++)
|
||||
{
|
||||
if((info->product_id == ek_pids[ek_pid_idx][EK_PID])
|
||||
&&(info->interface_number == ek_pids[ek_pid_idx][EK_INTERFACE]))
|
||||
{
|
||||
dev = hid_open_path(info->path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(dev)
|
||||
{
|
||||
EKController* controller = new EKController(dev, info->manufacturer_string, info->product_string, info->path);
|
||||
RGBController_EKController* rgb_controller = new RGBController_EKController(controller);
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
info = info->next;
|
||||
EKController* controller = new EKController(dev, info->path);
|
||||
RGBController_EKController* rgb_controller = new RGBController_EKController(controller);
|
||||
// Constructor sets the name
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
hid_free_enumeration(info);
|
||||
info = info->next;
|
||||
} /* DetectEKControllers() */
|
||||
|
||||
REGISTER_DETECTOR("EK", DetectEKControllers);
|
||||
REGISTER_HID_DETECTOR_IPU("EK Loop Connect", DetectEKControllers, EK_VID, EK_LOOP_CONNECT, 0, 0xFFA0, 1);
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include "RGBController_EKController.h"
|
||||
|
||||
RGBController_EKController::RGBController_EKController(EKController* _dev)
|
||||
@@ -15,6 +14,7 @@ RGBController_EKController::RGBController_EKController(EKController* _dev)
|
||||
EK_dev = _dev;
|
||||
|
||||
name = EK_dev->GetDeviceName();
|
||||
vendor = "EK";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
description = EK_dev->GetDeviceName();
|
||||
version = "1.0";
|
||||
|
||||
@@ -31,6 +31,7 @@ typedef struct
|
||||
static const gpu_pci_device device_list[] =
|
||||
{
|
||||
{ NVIDIA_VEN, NVIDIA_GTX1070_DEV, EVGA_SUB_VEN, EVGA_GTX1070_FTW_SUB_DEV, EVGA_RGB_V1, "EVGA GeForce GTX 1070 FTW" },
|
||||
{ NVIDIA_VEN, NVIDIA_GTX1080_DEV, EVGA_SUB_VEN, EVGA_GTX1080_FTW_SUB_DEV, EVGA_RGB_V1, "EVGA GeForce GTX 1080 FTW" },
|
||||
{ NVIDIA_VEN, NVIDIA_RTX2070_OC_DEV, EVGA_SUB_VEN, EVGA_RTX2070_XC_OC_SUB_DEV, EVGA_RGB_V2, "EVGA GeForce RTX 2070 XC OC" },
|
||||
{ NVIDIA_VEN, NVIDIA_RTX2070S_DEV, EVGA_SUB_VEN, EVGA_RTX2070S_XC_ULTRA_SUB_DEV, EVGA_RGB_V2, "EVGA GeForce RTX 2070 SUPER XC ULTRA" },
|
||||
{ NVIDIA_VEN, NVIDIA_RTX2080_DEV, EVGA_SUB_VEN, EVGA_RTX2080_XC_GAMING_SUB_DEV, EVGA_RGB_V2, "EVGA GeForce RTX 2080 XC GAMING" },
|
||||
|
||||
@@ -30,6 +30,11 @@ std::string EVGAGPUv1Controller::GetDeviceLocation()
|
||||
return("I2C: " + return_string);
|
||||
}
|
||||
|
||||
unsigned char EVGAGPUv1Controller::GetMode()
|
||||
{
|
||||
return(bus->i2c_smbus_read_byte_data(dev, EVGA_GPU_V1_REG_MODE));
|
||||
}
|
||||
|
||||
unsigned char EVGAGPUv1Controller::GetRed()
|
||||
{
|
||||
return(bus->i2c_smbus_read_byte_data(dev, EVGA_GPU_V1_REG_RED));
|
||||
|
||||
@@ -38,6 +38,7 @@ public:
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
|
||||
unsigned char GetMode();
|
||||
unsigned char GetRed();
|
||||
unsigned char GetGreen();
|
||||
unsigned char GetBlue();
|
||||
|
||||
@@ -14,6 +14,7 @@ RGBController_EVGAGPUv1::RGBController_EVGAGPUv1(EVGAGPUv1Controller* evga_ptr)
|
||||
evga = evga_ptr;
|
||||
|
||||
name = "EVGA GPU";
|
||||
vendor = "EVGA";
|
||||
description = "EVGA RGB v1 GPU Device";
|
||||
location = evga->GetDeviceLocation();
|
||||
|
||||
@@ -49,8 +50,26 @@ RGBController_EVGAGPUv1::RGBController_EVGAGPUv1(EVGAGPUv1Controller* evga_ptr)
|
||||
|
||||
SetupZones();
|
||||
|
||||
// Initialize active mode
|
||||
// Initialize active mode and stored color
|
||||
|
||||
unsigned char raw_active_mode = evga->GetMode();
|
||||
|
||||
active_mode = 0;
|
||||
for(unsigned int i = 0; i < modes.size(); i++)
|
||||
{
|
||||
if (modes[i].value == raw_active_mode)
|
||||
{
|
||||
active_mode = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char r = evga->GetRed();
|
||||
unsigned char g = evga->GetGreen();
|
||||
unsigned char b = evga->GetBlue();
|
||||
|
||||
RGBColor color = ToRGBColor(r, g, b);
|
||||
colors[0] = color;
|
||||
}
|
||||
|
||||
void RGBController_EVGAGPUv1::SetupZones()
|
||||
|
||||
@@ -14,6 +14,7 @@ RGBController_EVGAGPUv2::RGBController_EVGAGPUv2(EVGAGPUv2Controller* evga_ptr)
|
||||
evga = evga_ptr;
|
||||
|
||||
name = "EVGA GPU";
|
||||
vendor = "EVGA";
|
||||
description = "EVGA RGB v2 GPU Device";
|
||||
location = evga->GetDeviceLocation();
|
||||
|
||||
|
||||
@@ -46,11 +46,17 @@ void EspurnaController::Initialize(char* ledstring)
|
||||
|
||||
void EspurnaController::InitializeEspurna(char * clientname, char * port, char * apikey)
|
||||
{
|
||||
strcpy(client_name, clientname);
|
||||
strcpy(port_name, port);
|
||||
client_name = clientname;
|
||||
port_name = port;
|
||||
|
||||
strcpy(espurna_apikey, apikey);
|
||||
tcpport = new net_port;
|
||||
tcpport->tcp_client(client_name, port_name);
|
||||
tcpport->tcp_client(client_name.c_str(), port_name.c_str());
|
||||
}
|
||||
|
||||
std::string EspurnaController::GetLocation()
|
||||
{
|
||||
return("TCP: " + client_name + ":" + port_name);
|
||||
}
|
||||
|
||||
void EspurnaController::SetLEDs(std::vector<RGBColor> colors)
|
||||
@@ -60,7 +66,7 @@ void EspurnaController::SetLEDs(std::vector<RGBColor> colors)
|
||||
RGBColor color = colors[0];
|
||||
|
||||
char get_request[1024];
|
||||
snprintf(get_request, 1024, "GET /api/rgb?apikey=%s&value=%%23%02X%02X%02X HTTP/1.1\r\nHost: %s\r\n\r\n", espurna_apikey, RGBGetRValue(color), RGBGetGValue(color), RGBGetBValue(color), client_name);
|
||||
snprintf(get_request, 1024, "GET /api/rgb?apikey=%s&value=%%23%02X%02X%02X HTTP/1.1\r\nHost: %s\r\n\r\n", espurna_apikey, RGBGetRValue(color), RGBGetGValue(color), RGBGetBValue(color), client_name.c_str());
|
||||
tcpport->tcp_client_connect();
|
||||
tcpport->tcp_client_write(get_request, strlen(get_request));
|
||||
tcpport->tcp_close();
|
||||
|
||||
@@ -28,16 +28,19 @@ public:
|
||||
EspurnaController();
|
||||
~EspurnaController();
|
||||
|
||||
void Initialize(char* ledstring);
|
||||
void InitializeEspurna(char* clientname, char* port, char * apikey);
|
||||
void SetLEDs(std::vector<RGBColor> colors);
|
||||
void Initialize(char* ledstring);
|
||||
void InitializeEspurna(char* clientname, char* port, char * apikey);
|
||||
|
||||
std::string GetLocation();
|
||||
|
||||
void SetLEDs(std::vector<RGBColor> colors);
|
||||
|
||||
private:
|
||||
int baud_rate;
|
||||
|
||||
char led_string[1024];
|
||||
char port_name[128];
|
||||
char client_name[1024];
|
||||
std::string port_name;
|
||||
std::string client_name;
|
||||
char espurna_apikey[128];
|
||||
|
||||
net_port *tcpport;
|
||||
|
||||
@@ -24,7 +24,7 @@ void DetectEspurnaControllers(std::vector<RGBController*> &rgb_controllers)
|
||||
/*-------------------------------------------------*\
|
||||
| Get Espurna settings from settings manager |
|
||||
\*-------------------------------------------------*/
|
||||
espurna_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("Setting_EspurnaDevices");
|
||||
espurna_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("EspurnaDevices");
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| If the Espurna settings contains devices, process |
|
||||
|
||||
@@ -15,6 +15,7 @@ RGBController_Espurna::RGBController_Espurna(EspurnaController* espurna_ptr)
|
||||
name = "Espurna";
|
||||
type = DEVICE_TYPE_LIGHT;
|
||||
description = "Espurna Device";
|
||||
location = espurna->GetLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
RGBController_Faustus::RGBController_Faustus(const std::string& dev_path)
|
||||
{
|
||||
name = "ASUS TUF Keyboard";
|
||||
vendor = "ASUS";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "Faustus Device";
|
||||
|
||||
@@ -33,11 +34,8 @@ RGBController_Faustus::RGBController_Faustus(const std::string& dev_path)
|
||||
|
||||
modes[3].name = "Strobe";
|
||||
modes[3].value = FAUSTUS_MODE_STROBE;
|
||||
modes[3].flags = MODE_FLAG_HAS_SPEED;
|
||||
modes[3].speed_min = FAUSTUS_SPEED_SLOWEST;
|
||||
modes[3].speed_max = FAUSTUS_SPEED_FASTEST;
|
||||
modes[3].color_mode = MODE_COLORS_NONE;
|
||||
modes[3].speed = FAUSTUS_SPEED_NORMAL;
|
||||
modes[3].flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
modes[3].color_mode = MODE_COLORS_PER_LED;
|
||||
|
||||
SetupZones();
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ RGBController_GalaxGPU::RGBController_GalaxGPU(GalaxGPUController * galax_gpu_pt
|
||||
galax_gpu = galax_gpu_ptr;
|
||||
|
||||
name = galax_gpu->GetDeviceName();
|
||||
vendor = "GALAX";
|
||||
type = DEVICE_TYPE_GPU;
|
||||
description = "GALAX / KFA2 RTX GPU";
|
||||
version = "1.0";
|
||||
|
||||
+12
-1
@@ -24,7 +24,18 @@ ATC800Controller::~ATC800Controller()
|
||||
|
||||
std::string ATC800Controller::GetDeviceLocation()
|
||||
{
|
||||
return(location);
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string ATC800Controller::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 ATC800Controller::SendCoolerMode
|
||||
+1
@@ -45,6 +45,7 @@ public:
|
||||
~ATC800Controller();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SendCoolerMode
|
||||
(
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
#include "Detector.h"
|
||||
#include "RGBController.h"
|
||||
#include "ATC800Controller.h"
|
||||
#include "RGBController_AorusATC800.h"
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Vendor ID |
|
||||
\*-----------------------------------------------------*/
|
||||
#define HOLTEK_VID 0x1044
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Controller product ids |
|
||||
\*-----------------------------------------------------*/
|
||||
#define ATC_800_CONTROLLER_PID 0x7A42
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectAorusCPUCoolerControllers *
|
||||
* *
|
||||
* Tests the USB address to see if a Aorus RGB CPU Cooler exists there. *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectGigabyteAorusCPUCoolerControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
ATC800Controller* controller = new ATC800Controller(dev, info->path);
|
||||
RGBController_AorusATC800* rgb_controller = new RGBController_AorusATC800(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_HID_DETECTOR_IPU("Aorus CPU Coolers", DetectGigabyteAorusCPUCoolerControllers, HOLTEK_VID, ATC_800_CONTROLLER_PID, 0, 0xFF01, 1);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user