Compare commits

...
Author SHA1 Message Date
Kasper 90242dad0f QMK Improvements - make LEDs per update configurable
* Fix Windows include error that breaks std::min/max if a Windows header is included (tracked down to
net_port.h)

Commit amended by Adam Honse <[email protected]>
2021-06-25 20:52:19 -05:00
Dima-Kal 325169b16b Add support for Sinowealth keyboard
Commits squashed and amended for code style by Adam Honse <[email protected]>
2021-06-24 22:51:01 -05:00
edbgon 6b184f2b8c Initial G933 support 2021-06-22 17:19:47 +00:00
Adam Honse 742b477f6f Add keymap for Blade 14 2021 2021-06-21 20:27:58 -05:00
Adam Honse b4b22e2dce Add Razer Blade 14 2021 2021-06-21 12:31:10 -07:00
TheRogueZeta 6a134a1f75 Add logging to ASRock Polychome SMBus detection and fix stack smashing caused by Polychrome block read. 2021-06-21 04:45:48 +00:00
Chris 920542e8b6 Adding "random" to the acceptable inputs for the --color switch to align with GUI
* Allows for the selection of color_mode = MODE_COLORS_RANDOM from the CLI for devices that support it
* For all other implementations will return a random colour from the `human_colors` struct

* To avoid filtering in the profile manager and to ensure that color_mode is set to MODE_COLORS_RANDOM correctly
for HW that has the mode flags

MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_PER_LED_COLOR

The values for speed_min, speed_max, colors_min and colors_max NEED to be initialised to allow for a saved
profile to load correctly in `ProfileManager::LoadDeviceFromListWithOptions`

Commit amended by Adam Honse <[email protected]> to remove Aura SMBus change, will add as its own
commit.
2021-06-20 23:35:37 -05:00
David Lee 09db948f9f fixed typo in SteelSeriesControllerDetect.cpp 2021-06-21 04:12:05 +00:00
Alex fdfe6f764e Update Fedora build instructions in readme
git, make, gcc are pre-installed; qt-creator isn't necessary, qt5-qtbase-devel provides qmake-qt5; libusb is now libusbx; libmbedtls is actually mbedtls
2021-06-20 23:11:10 -05:00
Stefan Silviu 510ac44d27 Fix typo 2021-06-20 23:07:42 -05:00
Stefan Silviu 840aae45a4 Detect Redragon M716 Inquisitor mouse 2021-06-20 23:07:10 -05:00
Alex 9d36d6743a Add Asus Strix rx570 O4G pci id 2021-06-18 22:31:24 +02:00
Adam Honse 50f3c4c4b8 Add Womier K66 to EVision Keyboard controller 2021-06-18 11:01:57 -05:00
Adam Honse bec99489fb Add Womier K87 to EVision Keyboard controller 2021-06-17 21:13:02 -05:00
TheRogueZeta 90338354a6 Update PCI ID Macros to test against device ID 2021-06-17 10:48:06 -05:00
Alex 1053b83782 Fixing wmi issue when device detection thread run nth time 2021-06-17 10:47:59 -05:00
Mola19 b49edaafb0 Added support for ASUS TUF Gaming K7
* Always sends save command when changing modes, this should be reworked to be optional in a future commit

Commit amended for code style by Adam Honse <[email protected]>
2021-06-17 10:47:50 -05:00
Alex ba3aae8780 Fix Razer Ornata V2 Detection 2021-06-16 21:22:44 +02:00
Dave 518c05976e * Fix Smart Device V2 in H710i, bought in June 2021 - it uses a new PID 2021-06-16 13:20:36 -05:00
Alex 276895359a Add UK layout support for HyperX Alloy 2021-06-16 13:13:39 -05:00
mike 4a333e9b50 Fixed HyperX Alloy Origins Core HID communication on Windows
* Added serial number support
  * Amended to pass in HID device information for version number rather than enumerate a second time

Commits squashed and amended for code style by Adam Honse <[email protected]>
2021-06-13 16:00:05 -05:00
Vavooon a20a19e570 Add HyperX Origins Core support (direct mode)
Commits squashed and amended for code style by Adam Honse <[email protected]>
2021-06-13 00:02:32 -05:00
Roman Stingler c665c877fa Bad deallocator in AsusAuraSMBusController.cpp 2021-06-13 04:43:35 +00:00
Adam Honse 3ccab3d949 Fix Logitech common files out of order in project file 2021-06-12 00:18:00 -05:00
Mola19 fcb617ee47 Add support for ASUS ROG Throne Qi headset stand
Commits squashed and amended for code style by Adam Honse <[email protected]>
2021-06-12 00:16:40 -05:00
Alex ce7478737c Add Steelseries Rival 650 wireless support
* Also reworks the LED update functions to handle zones with more than one LED
  * Some other minor code style cleanup in the Rival code

Commits squashed and amended for code style by Adam Honse <[email protected]>
2021-06-11 18:12:40 -05:00
edbgon 8736f1b169 Initial support for Logitech X56 Rhino Hotas
Commit amended for code style by Adam Honse <[email protected]>
2021-06-11 17:01:42 -05:00
Alex 18939e6754 Add ASUS ROG Gladius II Wireless
Commit amended for code style by Adam Honse <[email protected]>
2021-06-10 23:13:26 -05:00
TheRogueZeta 806d77d2d6 Convert Polychrome read to i2c_smbus_read_block_data 2021-06-10 22:33:50 -05:00
TheRogueZeta b17b6340bd Test to see if Patriot Viper DRAM modules exist before performing writes
Amended to use read check as quick check doesn't work for SPD addresses by Adam Honse <[email protected]>
2021-06-10 21:09:26 -05:00
TheRogueZeta 46d353bc66 Fix missing % that got lost in transfer 2021-06-10 00:10:28 -05:00
TheRogueZeta b72de2fe5e Update README.md for Hue build requirements 2021-06-07 10:49:52 -07:00
TheRogueZeta 24d1c5f2ae Update HID device log prints to use caps 2021-06-06 16:44:05 -07:00
DrZlo13 bf99a5f250 New device: Obinslab Anne Pro 2
* Renamed "Obins Lab" to "Obinslab" as that is the name that I saw used most frequently in store listings.

Commit amended for code style and to update the name by Adam Honse <[email protected]>
2021-06-06 14:17:57 -05:00
Thomas greenwood 0755959741 Implement modes for Logitech G213 Keyboard 2021-06-06 02:41:56 +01:00
68 changed files with 4582 additions and 167 deletions
+19 -1
View File
@@ -65,6 +65,7 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="18cf", TAG+="uacces
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="18e5", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="18e3", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="1958", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="18a0", TAG+="uaccess"
#---------------------------------------------------------------#
# ASUS TUF Laptops (faustus) #
@@ -338,6 +339,12 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="0cf2", ATTR{idProduct}=="7750", TAG+="uacces
# Speakers: #
# Logitech G560 #
# #
# Headsets: #
# Logitech G933 #
# #
# Joysticks: #
# Logitech Rhino X56 Hotas (Throttle and Stick) #
# #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c336", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c342", TAG+="uaccess"
@@ -375,6 +382,11 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c53a", TAG+="uacces
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="0a78", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="0a5b", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0738", ATTR{idProduct}=="2221", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0738", ATTR{idProduct}=="A221", TAG+="uaccess"
#---------------------------------------------------------------#
# Metadot Das Keyboard 4Q + 5Q #
#---------------------------------------------------------------#
@@ -456,6 +468,7 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="1e71", ATTR{idProduct}=="2005", TAG+="uacces
SUBSYSTEMS=="usb", ATTR{idVendor}=="1e71", ATTR{idProduct}=="2006", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1e71", ATTR{idProduct}=="2007", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1e71", ATTR{idProduct}=="2009", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1e71", ATTR{idProduct}=="200D", TAG+="uaccess"
#---------------------------------------------------------------#
# NZXT Kraken #
@@ -614,6 +627,7 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="1e7d", ATTR{idProduct}=="2e27", TAG+="uacces
# Mice: #
# Redragon M711 Cobra #
# Redragon M715 Dagger #
# Redragon M716 Inquisitor #
#---------------------------------------------------------------#
SUBSYSTEMS=="usb", ATTR{idVendor}=="0c45", ATTR{idProduct}=="5204", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="0c45", ATTR{idProduct}=="5104", TAG+="uaccess"
@@ -622,6 +636,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}=="fc3a", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="04d9", ATTR{idProduct}=="fc4d", TAG+="uaccess"
#---------------------------------------------------------------#
@@ -665,7 +680,8 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="0ba0", TAG+="uacces
# SteelSeries Rival 300 Blackops Edition #
# SteelSeries Rival 310 #
# SteelSeries Rival 310 CS:GO Howl Edition #
# SteelSeries Rival 310 PubG Edition #
# SteelSeries Rival 310 PubG Edition #
# SteelSeries Rival 650 Wireless #
# SteelSeries Rival Sensei Ten #
# SteelSeries Rival Sensei Ten CS:GO Neon Rider #
# SteelSeries Rival Sensei 310 #
@@ -700,6 +716,8 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1736", TAG+="uacces
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1832", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1834", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1722", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1726", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="172B", TAG+="uaccess"
SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1229", TAG+="uaccess"
@@ -10,6 +10,7 @@
#include "ASRockPolychromeSMBusController.h"
#include <cstring>
#include "dependencies/dmiinfo.h"
#include "LogManager.h"
using namespace std::chrono_literals;
@@ -20,36 +21,39 @@ PolychromeController::PolychromeController(i2c_smbus_interface* bus, polychrome_
DMIInfo dmi;
unsigned short fw_version = ReadFirmwareVersion();
unsigned char major_version = fw_version >> 8;
device_name = "ASRock " + dmi.getMainboard();
fw_version = ReadFirmwareVersion();
unsigned char major_version = fw_version >> 8;
/*-----------------------------------------------------*\
| Determine whether the device uses ASR LED or |
| Polychrome protocol by checking firmware version. |
| Versions 1.xx and 2.xx use ASR LED, 3.xx uses |
| Polychrome |
| Versions: 1.xx are ASR RGB LED |
| 2.xx are Polychrome v1 |
| 3.xx are Polychrome v2 |
\*-----------------------------------------------------*/
switch(major_version)
{
case ASROCK_TYPE_ASRLED:
device_name = "ASRock " + dmi.getMainboard();
LOG_DEBUG("Device type is ASR RGB LED");
asrock_type = ASROCK_TYPE_ASRLED;
memset(zone_led_count, 0, sizeof(zone_led_count));
break;
case ASROCK_TYPE_POLYCHROME_V1:
device_name = "ASRock " + dmi.getMainboard();
LOG_DEBUG("Device type is Polychrome v1");
asrock_type = ASROCK_TYPE_POLYCHROME_V1;
ReadLEDConfiguration();
break;
case ASROCK_TYPE_POLYCHROME_V2:
device_name = "ASRock " + dmi.getMainboard();
LOG_DEBUG("Device type is Polychrome v2");
asrock_type = ASROCK_TYPE_POLYCHROME_V2;
ReadLEDConfiguration();
break;
default:
LOG_DEBUG("Got Unknown version!");
asrock_type = ASROCK_TYPE_UNKNOWN;
break;
}
@@ -82,7 +86,6 @@ std::string PolychromeController::GetDeviceName()
std::string PolychromeController::GetFirmwareVersion()
{
unsigned short fw_version = ReadFirmwareVersion();
unsigned char major_version = fw_version >> 8;
unsigned char minor_version = fw_version & 0xFF;
@@ -93,17 +96,20 @@ unsigned short PolychromeController::ReadFirmwareVersion()
{
// The firmware register holds two bytes, so the first read should return 2
// If not, report invalid firmware revision FFFF
if (bus->i2c_smbus_read_byte_data(dev, ASROCK_REG_FIRMWARE_VER) == 0x02)
LOG_DEBUG("Reading back device firmware version");
// Version response array needs to be 32 bytes to prevent non ASRock board from stack smashing
unsigned char asrock_version[I2C_SMBUS_BLOCK_MAX] = { 0x00, 0x00 };
if (bus->i2c_smbus_read_block_data(dev, ASROCK_REG_FIRMWARE_VER, asrock_version) == 0x02)
{
std::this_thread::sleep_for(1ms);
unsigned char major = bus->i2c_smbus_read_byte(dev);
std::this_thread::sleep_for(1ms);
unsigned char minor = bus->i2c_smbus_read_byte(dev);
unsigned char major = asrock_version[0];
unsigned char minor = asrock_version[1];
LOG_DEBUG("Device firmware version: v%02d.%02d", major, minor);
return((major << 8) | minor);
}
else
{
LOG_WARNING("Firmware readback failed; Returning 0xFFFF");
return(0xFFFF);
}
}
@@ -114,23 +120,26 @@ void PolychromeController::ReadLEDConfiguration()
| The LED configuration register holds 6 bytes, so the first read should return 6 |
| If not, set all zone sizes to zero |
\*---------------------------------------------------------------------------------*/
if (bus->i2c_smbus_read_byte_data(dev, POLYCHROME_REG_LED_CONFIG) == 0x06)
LOG_DEBUG("Reading back LED config");
unsigned char asrock_zone_count[I2C_SMBUS_BLOCK_MAX] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 };
if (bus->i2c_smbus_read_block_data(dev, POLYCHROME_REG_LED_CONFIG, asrock_zone_count) == 0x06)
{
std::this_thread::sleep_for(1ms);
zone_led_count[POLYCHROME_ZONE_1] = bus->i2c_smbus_read_byte(dev);
std::this_thread::sleep_for(1ms);
zone_led_count[POLYCHROME_ZONE_2] = bus->i2c_smbus_read_byte(dev);
std::this_thread::sleep_for(1ms);
zone_led_count[POLYCHROME_ZONE_3] = bus->i2c_smbus_read_byte(dev);
std::this_thread::sleep_for(1ms);
zone_led_count[POLYCHROME_ZONE_4] = bus->i2c_smbus_read_byte(dev);
std::this_thread::sleep_for(1ms);
zone_led_count[POLYCHROME_ZONE_5] = bus->i2c_smbus_read_byte(dev);
std::this_thread::sleep_for(1ms);
zone_led_count[POLYCHROME_ZONE_ADDRESSABLE] = bus->i2c_smbus_read_byte(dev);
zone_led_count[POLYCHROME_ZONE_1] = asrock_zone_count[0];
zone_led_count[POLYCHROME_ZONE_2] = asrock_zone_count[1];
zone_led_count[POLYCHROME_ZONE_3] = asrock_zone_count[2];
zone_led_count[POLYCHROME_ZONE_4] = asrock_zone_count[3];
zone_led_count[POLYCHROME_ZONE_5] = asrock_zone_count[4];
zone_led_count[POLYCHROME_ZONE_ADDRESSABLE] = asrock_zone_count[5];
LOG_DEBUG("Zone 1 LED count: %02d", zone_led_count[POLYCHROME_ZONE_1]);
LOG_DEBUG("Zone 2 LED count: %02d", zone_led_count[POLYCHROME_ZONE_2]);
LOG_DEBUG("Zone 3 LED count: %02d", zone_led_count[POLYCHROME_ZONE_3]);
LOG_DEBUG("Zone 4 LED count: %02d", zone_led_count[POLYCHROME_ZONE_4]);
LOG_DEBUG("Zone 5 LED count: %02d", zone_led_count[POLYCHROME_ZONE_5]);
LOG_DEBUG("Addressable Zone LED count: %02d", zone_led_count[POLYCHROME_ZONE_ADDRESSABLE]);
}
else
{
LOG_WARNING("LED config read failed");
memset(zone_led_count, 0, sizeof(zone_led_count));
}
}
@@ -209,6 +209,7 @@ public:
private:
unsigned int asrock_type;
unsigned short fw_version;
std::string device_name;
unsigned char active_zone;
unsigned char active_mode;
@@ -1,5 +1,6 @@
#include "Detector.h"
#include "ASRockPolychromeSMBusController.h"
#include "LogManager.h"
#include "RGBController.h"
#include "RGBController_ASRockPolychromeSMBus.h"
#include "i2c_smbus.h"
@@ -56,15 +57,18 @@ void DetectPolychromeSMBusControllers(std::vector<i2c_smbus_interface*>& busses)
// Check for Polychrome controller at 0x6A
if (TestForPolychromeSMBusController(busses[bus], 0x6A))
{
LOG_DEBUG("Detected a device at address 0x6A, Testing for a known controller");
new_polychrome = new PolychromeController(busses[bus], 0x6A);
if(new_polychrome->GetASRockType() != ASROCK_TYPE_UNKNOWN)
{
LOG_DEBUG("Found a known Polychrome device");
new_controller = new RGBController_Polychrome(new_polychrome);
ResourceManager::get()->RegisterRGBController(new_controller);
}
else
{
LOG_DEBUG("Not a Polychrome device or unknown type");
delete new_polychrome;
}
}
@@ -46,7 +46,7 @@ RGBController_Polychrome::RGBController_Polychrome(PolychromeController* polychr
{
case ASROCK_TYPE_ASRLED:
{
description = "ASRock ASR LED Device";
description = "ASRock ASR RGB LED Device";
mode Off;
Off.name = "Off";
@@ -0,0 +1,122 @@
/*-----------------------------------------*\
| AnnePro2Controller.cpp |
| |
| Driver for Obins Lab AnnePro2 keyboard |
| |
| Sergey Gavrilov (DrZlo13) 06/06/2021 |
\*-----------------------------------------*/
#include "AnnePro2Controller.h"
using namespace std::chrono_literals;
AnnePro2Controller::AnnePro2Controller(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
location = path;
}
AnnePro2Controller::~AnnePro2Controller()
{
hid_close(dev);
}
std::string AnnePro2Controller::GetDeviceLocation()
{
return("HID: " + location);
}
std::string AnnePro2Controller::GetSerialString()
{
wchar_t serial_string[128];
int ret = hid_get_serial_number_string(dev, serial_string, 128);
if(ret != 0)
{
return("");
}
std::wstring return_wstring = serial_string;
std::string return_string(return_wstring.begin(), return_wstring.end());
return(return_string);
}
void AnnePro2Controller::SendDirect(unsigned char frame_count, unsigned char * frame_data)
{
/*-------------------------------------------------------------*\
| Reverse engineered by https://github.com/manualmanul/Annemone |
\*-------------------------------------------------------------*/
const unsigned char hid_cmd_service_data_length = 4;
const unsigned char hid_cmd_service_data[hid_cmd_service_data_length] = {0, 123, 16, 65};
const unsigned char hid_cmd_static_message_length = 3;
const unsigned char hid_cmd_static_message[hid_cmd_static_message_length] = {0, 0, 125};
const unsigned char hid_cmd_command_info_length = 3;
const unsigned char hid_cmd_command_info[hid_cmd_command_info_length] = {32, 3, 255};
const unsigned char real_command_info_length = hid_cmd_command_info_length + 1;
const unsigned char max_hid_length = 64;
const unsigned char max_command_length = max_hid_length - hid_cmd_service_data_length - 2 - hid_cmd_static_message_length;
const unsigned char max_message_length = max_command_length - real_command_info_length;
const unsigned char messages_to_send_amount = frame_count / max_message_length + 1;
const unsigned char val_1 = frame_count % max_message_length;
const unsigned char val_2 = (0 == val_1) ? max_message_length : val_1;
unsigned char hid_command[max_hid_length];
unsigned char led_data = 0;
for(unsigned char p = 0; p < messages_to_send_amount; p++)
{
const unsigned char e = (messages_to_send_amount << 4) + p;
const unsigned char a = ((messages_to_send_amount - 1) == p) ? val_2 + real_command_info_length : max_message_length + real_command_info_length;
/*---------------------------------------------------------*\
| Service data |
\*---------------------------------------------------------*/
hid_command[0] = hid_cmd_service_data[0];
hid_command[1] = hid_cmd_service_data[1];
hid_command[2] = hid_cmd_service_data[2];
hid_command[3] = hid_cmd_service_data[3];
hid_command[4] = e;
hid_command[5] = a;
/*---------------------------------------------------------*\
| Static message |
\*---------------------------------------------------------*/
hid_command[6] = hid_cmd_static_message[0];
hid_command[7] = hid_cmd_static_message[1];
hid_command[8] = hid_cmd_static_message[2];
/*---------------------------------------------------------*\
| Command info |
\*---------------------------------------------------------*/
hid_command[9] = hid_cmd_command_info[0];
hid_command[10] = hid_cmd_command_info[1];
hid_command[11] = hid_cmd_command_info[2];
hid_command[12] = 2;
/*---------------------------------------------------------*\
| LED data |
\*---------------------------------------------------------*/
for(uint8_t i = 0; i < max_message_length; i++)
{
hid_command[13 + i] = frame_data[led_data];
led_data++;
}
hid_write(dev, hid_command, max_hid_length);
/*---------------------------------------------------------*\
| Needed due to Anne Pro 2 ignoring commands when they're |
| sent faster than 50ms apart from each other. |
\*---------------------------------------------------------*/
std::this_thread::sleep_for(50ms);
}
}
@@ -0,0 +1,36 @@
/*-----------------------------------------*\
| AnnePro2Controller.h |
| |
| Driver for Obins Lab AnnePro2 keyboard |
| |
| Sergey Gavrilov (DrZlo13) 06/06/2021 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include <string>
#include <vector>
#include <hidapi/hidapi.h>
#pragma once
class AnnePro2Controller
{
public:
AnnePro2Controller(hid_device* dev_handle, const char* path);
~AnnePro2Controller();
std::string GetDeviceLocation();
std::string GetSerialString();
void SendDirect
(
unsigned char frame_count,
unsigned char * frame_data
);
private:
hid_device* dev;
std::string location;
};
@@ -0,0 +1,36 @@
#include "Detector.h"
#include "AnnePro2Controller.h"
#include "RGBController.h"
#include "RGBController_AnnePro2.h"
#include <hidapi/hidapi.h>
#define ANNE_PRO_2_VID 0x04D9
#define ANNE_PRO_2_PID_1 0x8008
#define ANNE_PRO_2_PID_2 0x8009
#define ANNE_PRO_2_PID_3 0xA292
#define ANNE_PRO_2_PID_4 0xA293
/******************************************************************************************\
* *
* DetectAnnePro2Controllers *
* *
* Tests the USB address to see if an Obins Lab AnnePro2 keyboard exists there. *
* *
\******************************************************************************************/
void DetectAnnePro2Controllers(hid_device_info* info, const std::string&)
{
hid_device* dev = hid_open_path(info->path);
if( dev )
{
AnnePro2Controller* controller = new AnnePro2Controller(dev, info->path);
RGBController_AnnePro2* rgb_controller = new RGBController_AnnePro2(controller);
// Constructor sets the name
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
REGISTER_HID_DETECTOR_I("Anne Pro 2", DetectAnnePro2Controllers, ANNE_PRO_2_VID, ANNE_PRO_2_PID_1, 1);
REGISTER_HID_DETECTOR_I("Anne Pro 2", DetectAnnePro2Controllers, ANNE_PRO_2_VID, ANNE_PRO_2_PID_2, 1);
REGISTER_HID_DETECTOR_I("Anne Pro 2", DetectAnnePro2Controllers, ANNE_PRO_2_VID, ANNE_PRO_2_PID_3, 1);
REGISTER_HID_DETECTOR_I("Anne Pro 2", DetectAnnePro2Controllers, ANNE_PRO_2_VID, ANNE_PRO_2_PID_4, 1);
@@ -0,0 +1,235 @@
/*-----------------------------------------*\
| RGBController_AnnePro2.cpp |
| |
| Generic RGB Interface for Obins Lab |
| AnnePro2 keyboard |
| |
| Sergey Gavrilov (DrZlo13) 06/06/2021 |
\*-----------------------------------------*/
#include "RGBController_AnnePro2.h"
#define NA 0xFFFFFFFF
#define LED_REAL_COUNT (5*14)
#define LED_COUNT (LED_REAL_COUNT - 9)
static unsigned int matrix_map[5][14] =
{ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 },
{ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 },
{ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, NA },
{ 41, NA, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, NA },
{ 53, NA, 54, 55, NA, NA, 56, NA, NA, 57, 58, 59, 60, NA } };
static const char* zone_names[] =
{
"Keyboard",
};
static zone_type zone_types[] =
{
ZONE_TYPE_MATRIX
};
static const unsigned int zone_sizes[] =
{
LED_COUNT,
};
typedef struct
{
const char * name;
const unsigned char idx;
} led_type;
static const led_type led_names[] =
{
/* Key Label Index */
{ "Key: Escape", 0 },
{ "Key: 1", 1 },
{ "Key: 2", 2 },
{ "Key: 3", 3 },
{ "Key: 4", 4 },
{ "Key: 5", 5 },
{ "Key: 6", 6 },
{ "Key: 7", 7 },
{ "Key: 8", 8 },
{ "Key: 9", 9 },
{ "Key: 0", 10 },
{ "Key: -", 11 },
{ "Key: =", 12 },
{ "Key: Backspace", 13 },
{ "Key: Tab", 14 },
{ "Key: Q", 15 },
{ "Key: W", 16 },
{ "Key: E", 17 },
{ "Key: R", 18 },
{ "Key: T", 19 },
{ "Key: Y", 20 },
{ "Key: U", 21 },
{ "Key: I", 22 },
{ "Key: O", 23 },
{ "Key: P", 24 },
{ "Key: [", 25 },
{ "Key: ]", 26 },
{ "Key: \\ (ANSI)", 27 },
{ "Key: Caps Lock", 28 },
{ "Key: A", 29 },
{ "Key: S", 30 },
{ "Key: D", 31 },
{ "Key: F", 32 },
{ "Key: G", 33 },
{ "Key: H", 34 },
{ "Key: J", 35 },
{ "Key: K", 36 },
{ "Key: L", 37 },
{ "Key: ;", 38 },
{ "Key: '", 39 },
{ "Key: Enter", 40 },
{ "Key: Left Shift", 41 },
{ "Key: Z", 42 },
{ "Key: X", 43 },
{ "Key: C", 44 },
{ "Key: V", 45 },
{ "Key: B", 46 },
{ "Key: N", 47 },
{ "Key: M", 48 },
{ "Key: ,", 49 },
{ "Key: .", 50 },
{ "Key: /", 51 },
{ "Key: Right Shift", 52 },
{ "Key: Left Control", 53 },
{ "Key: Left Windows", 54 },
{ "Key: Left Alt", 55 },
{ "Key: Space", 56 },
{ "Key: Right Alt", 57 },
{ "Key: Right Fn", 58 },
{ "Key: Menu", 59 },
{ "Key: Right Control", 60 },
};
RGBController_AnnePro2::RGBController_AnnePro2(AnnePro2Controller* annepro2_ptr)
{
annepro2 = annepro2_ptr;
name = "Anne Pro 2";
vendor = "Obinslab";
type = DEVICE_TYPE_KEYBOARD;
description = "Obinslab Anne Pro 2 Device";
location = annepro2->GetDeviceLocation();
serial = annepro2->GetSerialString();
mode Direct;
Direct.name = "Direct";
Direct.value = 0;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
SetupZones();
}
RGBController_AnnePro2::~RGBController_AnnePro2()
{
delete annepro2;
}
void RGBController_AnnePro2::SetupZones()
{
/*---------------------------------------------------------*\
| Set up zones |
\*---------------------------------------------------------*/
unsigned int total_led_count = 0;
for(unsigned int zone_idx = 0; zone_idx < 1; zone_idx++)
{
zone new_zone;
new_zone.name = zone_names[zone_idx];
new_zone.type = zone_types[zone_idx];
new_zone.leds_min = zone_sizes[zone_idx];
new_zone.leds_max = zone_sizes[zone_idx];
new_zone.leds_count = zone_sizes[zone_idx];
if(zone_types[zone_idx] == ZONE_TYPE_MATRIX)
{
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = 5;
new_zone.matrix_map->width = 14;
new_zone.matrix_map->map = (unsigned int *)&matrix_map;
}
else
{
new_zone.matrix_map = NULL;
}
zones.push_back(new_zone);
total_led_count += zone_sizes[zone_idx];
}
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
{
led new_led;
new_led.name = led_names[led_idx].name;
new_led.value = led_names[led_idx].idx;
leds.push_back(new_led);
}
SetupColors();
}
void RGBController_AnnePro2::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_AnnePro2::DeviceUpdateLEDs()
{
const unsigned char frame_buf_length = LED_REAL_COUNT * 3;
unsigned char frame_buf[frame_buf_length];
/*---------------------------------------------------------*\
| TODO: Send packets with multiple LED frames |
\*---------------------------------------------------------*/
std::size_t led_real_idx = 0;
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
{
frame_buf[(led_real_idx * 3) + 0] = RGBGetRValue(colors[led_idx]);
frame_buf[(led_real_idx * 3) + 1] = RGBGetGValue(colors[led_idx]);
frame_buf[(led_real_idx * 3) + 2] = RGBGetBValue(colors[led_idx]);
if(led_idx == 40 || led_idx == 41 || led_idx == 52 || led_idx == 53 || led_idx == 60)
{
led_real_idx++;
}
else if(led_idx == 55 || led_idx == 56)
{
led_real_idx++;
led_real_idx++;
}
led_real_idx++;
}
annepro2->SendDirect(frame_buf_length, frame_buf);
}
void RGBController_AnnePro2::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_AnnePro2::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_AnnePro2::SetCustomMode()
{
active_mode = 0;
}
void RGBController_AnnePro2::DeviceUpdateMode()
{
}
@@ -0,0 +1,32 @@
/*-----------------------------------------*\
| RGBController_AnnePro2.h |
| |
| Generic RGB Interface for Obins Lab |
| AnnePro2 keyboard |
| |
| Sergey Gavrilov (DrZlo13) 06/06/2021 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "AnnePro2Controller.h"
class RGBController_AnnePro2 : public RGBController
{
public:
RGBController_AnnePro2(AnnePro2Controller* annepro2_ptr);
~RGBController_AnnePro2();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
AnnePro2Controller* annepro2;
};
@@ -50,6 +50,7 @@ static const gpu_pci_device device_list[] =
{ NVIDIA_VEN, NVIDIA_RTX2080TI_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX2080TI_O11G_GAMING, 0x2A, "ASUS ROG STRIX RTX 2080 Ti O11G Gaming" },
{ AMD_GPU_VEN, AMD_VEGA10_DEV, ASUS_SUB_VEN, ASUS_VEGA64_STRIX, 0x29, "ASUS Vega 64 Strix" },
{ AMD_GPU_VEN, AMD_NAVI10_DEV, ASUS_SUB_VEN, ASUS_RX5700XT_STRIX_GAMING_OC, 0x2A, "ASUS RX 5700XT Strix Gaming OC" },
{ AMD_GPU_VEN, AMD_POLARIS_DEV, ASUS_SUB_VEN, ASUS_RX570_STRIX_O4G_GAMING_OC, 0x29, "ASUS RX 570 Strix O4G Gaming OC" },
{ AMD_GPU_VEN, AMD_POLARIS_DEV, ASUS_SUB_VEN, ASUS_RX580_STRIX_GAMING_OC, 0x29, "ASUS RX 580 Strix Gaming OC" }
};
@@ -207,7 +207,7 @@ void AuraSMBusController::SetAllColorsDirect(RGBColor* colors)
AuraRegisterWriteBlock(direct_reg, color_buf, led_count * 3);
delete color_buf;
delete[] color_buf;
}
void AuraSMBusController::SetAllColorsEffect(RGBColor* colors)
@@ -0,0 +1,133 @@
/*-----------------------------------------*\
| AsusAuraHeadsetStandController.cpp |
| |
| Driver for ASUS Aura RGB USB |
| lighting controller |
| |
| Mola19 06/04/2021 |
\*-----------------------------------------*/
#include "AsusAuraHeadsetStandController.h"
#include <cstring>
AuraHeadsetStandController::AuraHeadsetStandController(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
location = path;
}
AuraHeadsetStandController::~AuraHeadsetStandController()
{
hid_close(dev);
}
std::string AuraHeadsetStandController::GetDeviceLocation()
{
return("HID: " + location);
}
std::string AuraHeadsetStandController::GetSerialString()
{
wchar_t serial_string[128];
int ret = hid_get_serial_number_string(dev, serial_string, 128);
if(ret != 0)
{
return("");
}
std::wstring return_wstring = serial_string;
std::string return_string(return_wstring.begin(), return_wstring.end());
return(return_string);
}
void AuraHeadsetStandController::UpdateLeds
(
std::vector<RGBColor> colors
)
{
unsigned char usb_buf_0[365];
memset(usb_buf_0, 0x00, sizeof(usb_buf_0));
usb_buf_0[0x00] = 0x00;
usb_buf_0[0x01] = 0xC0;
usb_buf_0[0x02] = 0x81;
usb_buf_0[0x03] = 0x00;
usb_buf_0[0x04] = 0x00;
for(unsigned int i = 0; i < 60; i += 4)
{
usb_buf_0[5 + i] = 0x00;
usb_buf_0[6 + i] = RGBGetRValue(colors[i / 4]);
usb_buf_0[7 + i] = RGBGetGValue(colors[i / 4]);
usb_buf_0[8 + i] = RGBGetBValue(colors[i / 4]);
}
hid_write(dev, usb_buf_0, 65);
unsigned char usb_buf_1[65];
memset(usb_buf_1, 0x00, sizeof(usb_buf_1));
usb_buf_1[0x00] = 0x00;
usb_buf_1[0x01] = 0xC0;
usb_buf_1[0x02] = 0x81;
usb_buf_1[0x03] = 0x01;
usb_buf_1[0x04] = 0x00;
for(unsigned int i = 0; i < 12; i += 4)
{
usb_buf_1[5 + i] = 0x00;
usb_buf_1[6 + i] = RGBGetRValue(colors[(i / 4) + 15]);
usb_buf_1[7 + i] = RGBGetGValue(colors[(i / 4) + 15]);
usb_buf_1[8 + i] = RGBGetBValue(colors[(i / 4) + 15]);
}
hid_write(dev, usb_buf_1, 65);
}
void AuraHeadsetStandController::UpdateDevice
(
unsigned char mode,
unsigned char red,
unsigned char grn,
unsigned char blu,
unsigned char speed,
bool save
)
{
unsigned char usb_buf[65];
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0x51;
usb_buf[0x02] = 0x28;
usb_buf[0x03] = 0x00;
usb_buf[0x04] = 0x00;
usb_buf[0x05] = mode;
usb_buf[0x06] = speed;
usb_buf[0x07] = 0x04;
usb_buf[0x08] = 0x00;
usb_buf[0x09] = 0x00;
usb_buf[0x0a] = red;
usb_buf[0x0b] = grn;
usb_buf[0x0c] = blu;
hid_write(dev, usb_buf, 65);
if(save)
{
unsigned char usb_save_buf[65];
memset(usb_save_buf, 0x00, sizeof(usb_save_buf));
usb_save_buf[0x00] = 0x00;
usb_save_buf[0x01] = 0x50;
usb_save_buf[0x02] = 0x55;
hid_write(dev, usb_save_buf, 65);
}
}
@@ -0,0 +1,59 @@
/*-----------------------------------------*\
| AsusAuraHeadsetStandController.h |
| |
| Definitions and types for ASUS Aura |
| USB RGB lighting controller |
| |
| Mola19 06/04/2021 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <hidapi/hidapi.h>
#pragma once
enum
{
AURA_HEADSET_STAND_ZONE_UNDERGLOW = 0,
AURA_HEADSET_STAND_ZONE_LOGO = 1
};
enum
{
AURA_HEADSET_STAND_MODE_DIRECT = 0,
AURA_HEADSET_STAND_MODE_STATIC = 1,
AURA_HEADSET_STAND_MODE_BREATHING = 2,
AURA_HEADSET_STAND_MODE_STROBING = 3,
AURA_HEADSET_STAND_MODE_COLOR_CYCLE = 4,
AURA_HEADSET_STAND_MODE_RAINBOW = 5
};
class AuraHeadsetStandController
{
public:
AuraHeadsetStandController(hid_device* dev_handle, const char* path);
virtual ~AuraHeadsetStandController();
std::string GetDeviceLocation();
std::string GetSerialString();
void UpdateLeds
(
std::vector<RGBColor> colors
);
void UpdateDevice
(
unsigned char mode,
unsigned char red,
unsigned char grn,
unsigned char blu,
unsigned char speed,
bool save
);
private:
hid_device* dev;
std::string location;
};
@@ -0,0 +1,218 @@
/*-----------------------------------------*\
| AsusAuraTUFKeyboardController.cpp |
| |
| Driver for ASUS Aura RGB USB |
| lighting controller |
| |
| Mola19 03/03/2021 |
\*-----------------------------------------*/
#include "AsusAuraTUFKeyboardController.h"
#include <cstring>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <iostream>
AuraTUFKeyboardController::AuraTUFKeyboardController(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
location = path;
}
AuraTUFKeyboardController::~AuraTUFKeyboardController()
{
hid_close(dev);
}
std::string AuraTUFKeyboardController::GetDeviceLocation()
{
return("HID: " + location);
}
std::string AuraTUFKeyboardController::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 AuraTUFKeyboardController::UpdateSingleLed
(
int led,
unsigned char red,
unsigned char green,
unsigned char blue
)
{
/*-----------------------------------------------------*\
| Set up message packet for single LED |
\*-----------------------------------------------------*/
unsigned char usb_buf[65];
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0] = 0x00;
usb_buf[1] = 0xc0;
usb_buf[2] = 0x81;
usb_buf[3] = 0x01;
usb_buf[4] = 0x00;
/*-----------------------------------------------------*\
| Convert LED index |
\*-----------------------------------------------------*/
usb_buf[5] = floor(led/6)*8 + led%6;
usb_buf[6] = red;
usb_buf[7] = green;
usb_buf[8] = blue;
hid_write(dev, usb_buf, 65);
}
void AuraTUFKeyboardController::UpdateLeds
(
std::vector<RGBColor> colors
)
{
/*-----------------------------------------------------*\
| Loop over every column (optimisation needed) |
\*-----------------------------------------------------*/
for(unsigned int i = 0; i < 192; i += 16)
{
unsigned char usb_buf[69];
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0] = 0x00;
usb_buf[1] = 0xc0;
usb_buf[2] = 0x81;
usb_buf[3] = (138 - i / 16 * 12);
usb_buf[4] = 0x00;
for(unsigned int n = 0; n < 6; n++)
{
usb_buf[n * 4 + 5] = i + n;
usb_buf[n * 4 + 6] = RGBGetRValue(colors[i/16*12+n]);
usb_buf[n * 4 + 7] = RGBGetGValue(colors[i/16*12+n]);
usb_buf[n * 4 + 8] = RGBGetBValue(colors[i/16*12+n]);
}
for(unsigned int n = 6; n < 8; n++)
{
usb_buf[n * 4 + 5] = i + n;
usb_buf[n * 4 + 6] = 0;
usb_buf[n * 4 + 7] = 0;
usb_buf[n * 4 + 8] = 0;
}
if(i != 176)
{
for(unsigned int n = 8; n < 14; n++)
{
usb_buf[n * 4 + 5] = i + n;
usb_buf[n * 4 + 6] = RGBGetRValue(colors[i/16*12+n-2]);
usb_buf[n * 4 + 7] = RGBGetGValue(colors[i/16*12+n-2]);
usb_buf[n * 4 + 8] = RGBGetBValue(colors[i/16*12+n-2]);
}
for(unsigned int n = 14; n < 16; n++)
{
usb_buf[n * 4 + 5] = i + n;
usb_buf[n * 4 + 6] = 0;
usb_buf[n * 4 + 7] = 0;
usb_buf[n * 4 + 8] = 0;
}
}
hid_write(dev, usb_buf, 69);
}
}
void AuraTUFKeyboardController::UpdateDevice
(
unsigned char mode,
std::vector<RGBColor> colors,
unsigned char dir,
unsigned char color_mode,
unsigned char speed
)
{
unsigned char usb_buf[65];
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x00;
usb_buf[0x01] = 0x51;
usb_buf[0x02] = 0x2C;
usb_buf[0x03] = mode;
usb_buf[0x04] = 0x00;
usb_buf[0x05] = speed;
usb_buf[0x06] = 0x64;
usb_buf[0x07] = color_mode;
usb_buf[0x08] = dir;
usb_buf[0x09] = 0x02;
if(mode == 4 || mode == 5)
{
/*-----------------------------------------------------*\
| If mode is Rainbow or Ripple |
\*-----------------------------------------------------*/
usb_buf[0x0A] = colors.size();
/*-----------------------------------------------------*\
| Loop over every color given |
\*-----------------------------------------------------*/
for(unsigned int i = 0; i / 4 < colors.size(); i += 4)
{
if(colors[i / 4])
{
usb_buf[11 + i] = 100/(double)colors.size()*(i/4+1);
usb_buf[12 + i] = RGBGetRValue(colors[i/4]);
usb_buf[13 + i] = RGBGetGValue(colors[i/4]);
usb_buf[14 + i] = RGBGetBValue(colors[i/4]);
}
}
}
else
{
/*-----------------------------------------------------*\
| Loop over Color1, Color2 and Background if there |
\*-----------------------------------------------------*/
for(unsigned int i = 0; i / 3 != colors.size(); i += 3)
{
if(colors[i / 3])
{
usb_buf[10 + i] = RGBGetRValue(colors[i/3]);
usb_buf[11 + i] = RGBGetGValue(colors[i/3]);
usb_buf[12 + i] = RGBGetBValue(colors[i/3]);
}
}
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
/*-----------------------------------------------------*\
| Set up and send packet save Packet |
\*-----------------------------------------------------*/
unsigned char usb_save_buf[65];
memset(usb_save_buf, 0x00, sizeof(usb_save_buf));
usb_save_buf[0x00] = 0x00;
usb_save_buf[0x01] = 0x50;
usb_save_buf[0x02] = 0x55;
hid_write(dev, usb_save_buf, 65);
}
@@ -0,0 +1,76 @@
/*-----------------------------------------*\
| AsusAuraTUFKeyboardController.h |
| |
| Definitions and types for ASUS Aura |
| USB RGB lighting controller |
| |
| Mola19 03/03/2021 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <vector>
#include <hidapi/hidapi.h>
#pragma once
enum
{
AURA_KEYBOARD_ZONE_LOGO = 0,
AURA_KEYBOARD_ZONE_SCROLL = 1,
AURA_KEYBOARD_ZONE_UNDERGLOW = 2,
AURA_KEYBOARD_ZONE_ALL = 3,
};
enum
{
AURA_KEYBOARD_MODE_STATIC = 0,
AURA_KEYBOARD_MODE_BREATHING = 1,
AURA_KEYBOARD_MODE_COLOR_CYCLE = 2,
AURA_KEYBOARD_MODE_REACTIVE = 3,
AURA_KEYBOARD_MODE_WAVE = 4,
AURA_KEYBOARD_MODE_RIPPLE = 5,
AURA_KEYBOARD_MODE_STARRY_NIGHT = 6,
AURA_KEYBOARD_MODE_QUICKSAND = 7,
AURA_KEYBOARD_MODE_CURRENT = 8,
AURA_KEYBOARD_MODE_RAIN_DROP = 9,
AURA_KEYBOARD_MODE_DIRECT = 15,
};
class AuraTUFKeyboardController
{
public:
AuraTUFKeyboardController(hid_device* dev_handle, const char* path);
~AuraTUFKeyboardController();
std::string GetDeviceLocation();
std::string GetSerialString();
void UpdateSingleLed
(
int led,
unsigned char red,
unsigned char green,
unsigned char blue
);
void UpdateLeds
(
std::vector<RGBColor> colors
);
void UpdateDevice
(
unsigned char mode,
std::vector<RGBColor> colors,
unsigned char dir,
unsigned char color_mode,
unsigned char speed
);
private:
hid_device* dev;
std::string location;
};
@@ -1,11 +1,15 @@
#include "Detector.h"
#include "AsusAuraAddressableController.h"
#include "AsusAuraHeadsetStandController.h"
#include "AsusAuraKeyboardController.h"
#include "AsusAuraTUFKeyboardController.h"
#include "AsusAuraMainboardController.h"
#include "AsusAuraMouseController.h"
#include "RGBController.h"
#include "RGBController_AsusAuraUSB.h"
#include "RGBController_AsusAuraHeadsetStand.h"
#include "RGBController_AsusAuraKeyboard.h"
#include "RGBController_AsusAuraTUFKeyboard.h"
#include "RGBController_AsusAuraMouse.h"
#include <stdexcept>
#include <hidapi/hidapi.h>
@@ -25,10 +29,13 @@
#define AURA_ROG_STRIX_FLARE_PID 0x1875
#define AURA_ROG_GLADIUS_II_ORIGIN_PID 0x1877
#define AURA_ROG_GLADIUS_II_ORIGIN_PNK_LTD_PID 0x18CD
#define AURA_ROG_GLADIUS_II_WIRELESS_PID 0x18A0
#define AURA_ROG_STRIX_FLARE_PNK_LTD_PID 0x18CF
#define AURA_ROG_CHAKRAM_WIRELESS_PID 0x18E5
#define AURA_ROG_CHAKRAM_WIRED_1_PID 0x18E3
#define AURA_ROG_CHAKRAM_WIRED_2_PID 0x1958
#define AURA_ROG_THRONE_QI_PID 0x18C5
#define AURA_TUF_K7_GAMING_PID 0x18AA
void DetectAsusAuraUSBTerminal(hid_device_info* info, const std::string& name)
{
@@ -101,6 +108,30 @@ void DetectAsusAuraUSBMice(hid_device_info* info, const std::string& name)
}
}
void DetectAsusAuraUSBHeadsetStand(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
AuraHeadsetStandController* controller = new AuraHeadsetStandController(dev, info->path);
RGBController_AuraHeadsetStand* rgb_controller = new RGBController_AuraHeadsetStand(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
void DetectAsusAuraTUFUSBKeyboard(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
AuraTUFKeyboardController* controller = new AuraTUFKeyboardController(dev, info->path);
RGBController_AuraTUFKeyboard* rgb_controller = new RGBController_AuraTUFKeyboard(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
REGISTER_HID_DETECTOR ("ASUS ROG AURA Terminal", DetectAsusAuraUSBTerminal, AURA_USB_VID, AURA_TERMINAL_PID);
REGISTER_HID_DETECTOR ("ASUS Aura Addressable", DetectAsusAuraUSBAddressable, AURA_USB_VID, AURA_ADDRESSABLE_1_PID);
REGISTER_HID_DETECTOR ("ASUS Aura Addressable", DetectAsusAuraUSBAddressable, AURA_USB_VID, AURA_ADDRESSABLE_2_PID);
@@ -113,8 +144,11 @@ REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius II Core", DetectAsusAuraUS
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);
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius II Origin PNK LTD", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_II_ORIGIN_PNK_LTD_PID, 2, 0xFF01);
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius II Wireless", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_II_WIRELESS_PID, 2, 0xFF01);
REGISTER_HID_DETECTOR_IP("ASUS ROG Chakram (Wireless)", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_CHAKRAM_WIRELESS_PID, 0, 0xFF01);
REGISTER_HID_DETECTOR_IP("Asus ROG Chakram (Wired)", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_CHAKRAM_WIRED_1_PID, 0, 0xFF01);
REGISTER_HID_DETECTOR_IP("Asus ROG Chakram (Wired)", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_CHAKRAM_WIRED_2_PID, 0, 0xFF01);
REGISTER_HID_DETECTOR_IP("ASUS ROG Strix Flare", DetectAsusAuraUSBKeyboards, AURA_USB_VID, AURA_ROG_STRIX_FLARE_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IP("ASUS ROG Strix Flare PNK LTD", DetectAsusAuraUSBKeyboards, AURA_USB_VID, AURA_ROG_STRIX_FLARE_PNK_LTD_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IP("ASUS ROG Strix Flare PNK LTD", DetectAsusAuraUSBKeyboards, AURA_USB_VID, AURA_ROG_STRIX_FLARE_PNK_LTD_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_I ("ASUS ROG Throne QI", DetectAsusAuraUSBHeadsetStand, AURA_USB_VID, AURA_ROG_THRONE_QI_PID, 0);
REGISTER_HID_DETECTOR_I ("ASUS TUF Gaming K7", DetectAsusAuraTUFUSBKeyboard, AURA_USB_VID, AURA_TUF_K7_GAMING_PID, 1);
@@ -0,0 +1,182 @@
/*-----------------------------------------*\
| RGBController_AsusAuraHeadsetStand.cpp |
| |
| Generic RGB Interface for Asus Aura |
| USB controller driver |
| |
| Mola19 06/04/2021 |
\*-----------------------------------------*/
#include "RGBController_AsusAuraHeadsetStand.h"
RGBController_AuraHeadsetStand::RGBController_AuraHeadsetStand(AuraHeadsetStandController* aura_ptr)
{
aura = aura_ptr;
name = "ASUS Aura Headset Stand";
vendor = "ASUS";
type = DEVICE_TYPE_HEADSET_STAND;
description = "ASUS Aura Headset Stand Device";
location = aura->GetDeviceLocation();
serial = aura->GetSerialString();
mode Direct;
Direct.name = "Direct";
Direct.value = AURA_HEADSET_STAND_MODE_DIRECT;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Static;
Static.name = "Static";
Static.value = AURA_HEADSET_STAND_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
Static.colors_min = 1;
Static.colors_max = 1;
Static.colors.resize(1);
modes.push_back(Static);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = AURA_HEADSET_STAND_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.speed_min = 0;
Breathing.speed_max = 255;
Breathing.speed = 127;
Breathing.colors_min = 1;
Breathing.colors_max = 1;
Breathing.colors.resize(1);
modes.push_back(Breathing);
mode Strobing;
Strobing.name = "Strobing";
Strobing.value = AURA_HEADSET_STAND_MODE_STROBING;
Strobing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Strobing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Strobing.colors_min = 1;
Strobing.colors_max = 1;
Strobing.colors.resize(1);
modes.push_back(Strobing);
mode SpectrumCycle;
SpectrumCycle.name = "Spectrum Cycle";
SpectrumCycle.value = AURA_HEADSET_STAND_MODE_COLOR_CYCLE;
SpectrumCycle.flags = MODE_FLAG_HAS_SPEED;
SpectrumCycle.speed_min = 0;
SpectrumCycle.speed_max = 255;
SpectrumCycle.speed = 127;
SpectrumCycle.color_mode = MODE_COLORS_NONE;
modes.push_back(SpectrumCycle);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = AURA_HEADSET_STAND_MODE_RAINBOW;
Rainbow.flags = MODE_FLAG_HAS_SPEED;
Rainbow.speed_min = 0;
Rainbow.speed_max = 255;
Rainbow.speed = 127;
modes.push_back(Rainbow);
SetupZones();
}
RGBController_AuraHeadsetStand::~RGBController_AuraHeadsetStand()
{
delete aura;
}
void RGBController_AuraHeadsetStand::SetupZones()
{
zone underglow_zone;
underglow_zone.name = "Underglow";
underglow_zone.type = ZONE_TYPE_LINEAR;
underglow_zone.leds_min = 17;
underglow_zone.leds_max = 17;
underglow_zone.leds_count = 17;
underglow_zone.matrix_map = NULL;
zones.push_back(underglow_zone);
for(unsigned int i = 0; i < 17; i++)
{
led underglow_led;
underglow_led.name = "Underglow LED " + std::to_string(i);
leds.push_back(underglow_led);
}
zone logo_zone;
logo_zone.name = "Logo";
logo_zone.type = ZONE_TYPE_SINGLE;
logo_zone.leds_min = 1;
logo_zone.leds_max = 1;
logo_zone.leds_count = 1;
logo_zone.matrix_map = NULL;
zones.push_back(logo_zone);
led logo_led;
logo_led.name = "Logo LED";
leds.push_back(logo_led);
SetupColors();
}
void RGBController_AuraHeadsetStand::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_AuraHeadsetStand::DeviceUpdateLEDs()
{
aura->UpdateLeds(std::vector<RGBColor>(colors));
}
void RGBController_AuraHeadsetStand::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_AuraHeadsetStand::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_AuraHeadsetStand::SetCustomMode()
{
active_mode = 0;
}
void RGBController_AuraHeadsetStand::DeviceUpdateMode()
{
unsigned char red = 0;
unsigned char grn = 0;
unsigned char blu = 0;
switch(modes[active_mode].value)
{
case 0:
aura->UpdateLeds(std::vector<RGBColor>(colors));
break;
case 1:
case 2:
case 3:
red = RGBGetRValue(modes[active_mode].colors[0]);
grn = RGBGetGValue(modes[active_mode].colors[0]);
blu = RGBGetBValue(modes[active_mode].colors[0]);
aura->UpdateDevice(modes[active_mode].value, red, grn, blu, modes[active_mode].speed, false);
break;
case 4:
case 5:
aura->UpdateDevice(modes[active_mode].value, red, grn, blu, modes[active_mode].speed, false);
break;
}
}
@@ -0,0 +1,33 @@
/*-----------------------------------------*\
| RGBController_AsusAuraHeadsetStand.h |
| |
| Generic RGB Interface for Asus Aura |
| USB controller driver |
| |
| Mola19 06/04/2021 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "AsusAuraHeadsetStandController.h"
class RGBController_AuraHeadsetStand : public RGBController
{
public:
RGBController_AuraHeadsetStand(AuraHeadsetStandController* aura_ptr);
~RGBController_AuraHeadsetStand();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
AuraHeadsetStandController* aura;
};
@@ -0,0 +1,470 @@
/*-----------------------------------------*\
| RGBController_AsusAuraTUFKeyboard.cpp |
| |
| Generic RGB Interface for Asus Aura |
| USB controller driver |
| |
| Mola19 03/03/2020 |
\*-----------------------------------------*/
#include "RGBController_AsusAuraTUFKeyboard.h"
#include <vector>
#define NA 0xFFFFFFFF
static unsigned int matrix_map[6][23] =
{ { 0, NA, 18, 24, 30, 36, NA, 48, 54, 60, 66, 72, 78, 84, 90, NA, 96, 102, 108, NA, NA, NA, NA },
{ 1, 13, 19, 25, 31, 37, 43, 49, 55, 61, 67, 73, 79, 91, NA, NA, 97, 103, 109, 115, 121, 127, 133 },
{ 2, NA, 14, 20, 26, 32, 38, 44, 50, 56, 62, 68, 74, 80, NA, NA, 98, 104, 110, 116, 122, 128, 134 },
{ 3, NA, 15, 21, 27, 33, 39, 45, 51, 57, 63, 69, 75, 81, 93, NA, NA, NA, NA, 117, 123, 129, NA },
{ 4, 10, 16, 22, 28, 34, 40, 46, 52, 58, 64, 70, NA, 94, NA, NA, NA, 106, NA, 118, 124, 130, 136 },
{ 5, 11, 17, NA, NA, NA, 41, NA, NA, NA, 59, 71, 77, NA, 95, NA, 101, 107, 113, 119, NA, 131, NA } };
static const char* zone_names[] =
{
"Keyboard"
};
static zone_type zone_types[] =
{
ZONE_TYPE_MATRIX,
};
static const unsigned int zone_sizes[] =
{
138
};
static const char *led_names[] =
{
"Key: Escape",
"Key: ^",
"Key: Tab",
"Key: Caps Lock",
"Key: Left Shift",
"Key: Left Control",
"Unused",
"Unused",
"Unused",
"Unused",
"Key: <",
"Key: Left Windows",
"Unused",
"Key: 1",
"Key: Q",
"Key: A",
"Key: Y",
"Key: Left Alt",
"Key: F1",
"Key: 2",
"Key: W",
"Key: S",
"Key: X",
"Unused",
"Key: F2",
"Key: 3",
"Key: E",
"Key: D",
"Key: C",
"Unused",
"Key: F3",
"Key: 4",
"Key: R",
"Key: F",
"Key: V",
"Unused",
"Key: F4",
"Key: 5",
"Key: T",
"Key: G",
"Key: B",
"Key: Space",
"Unused",
"Key: 6",
"Key: Z",
"Key: H",
"Key: N",
"Unused",
"Key: F5",
"Key: 7",
"Key: U",
"Key: J",
"Key: M",
"Unused",
"Key: F6",
"Key: 8",
"Key: I",
"Key: K",
"Key: ,",
"Key: Right Alt",
"Key: F7",
"Key: 9",
"Key: O",
"Key: L",
"Key: .",
"Unused",
"Key: F8",
"Key: 0",
"Key: P",
"Key: Ö",
"Key: -",
"Key: Right Fn",
"Key: F9",
"Key: ß",
"Key: Ü",
"Key: Ä",
"Unused",
"Key: Menu",
"Key: F10",
"Key: ´",
"Key: +",
"Key: #",
"Unused",
"Unused",
"Key: F11",
"Unused",
"Unused",
"Unused",
"Unused",
"Unused",
"Key: F12",
"Key: Backspace",
"Unused",
"Key: Enter",
"Key: Right Shift",
"Key: Right Control",
"Key: Print Screen",
"Key: Insert",
"Key: Delete",
"Unused",
"Unused",
"Key: Left Arrow",
"Key: Scroll Lock",
"Key: Home",
"Key: End",
"Unused",
"Key: Up Arrow",
"Key: Down Arrow",
"Key: Pause/Break",
"Key: Page Up",
"Key: Page Down",
"Unused",
"Unused",
"Key: Right Arrow",
"Unused",
"Key: Num Lock",
"Key: Number Pad 7",
"Key: Number Pad 4",
"Key: Number Pad 1",
"Key: Number Pad 0",
"Unused",
"Key: Number Pad /",
"Key: Number Pad 8",
"Key: Number Pad 5",
"Key: Number Pad 2",
"Unused",
"Unused",
"Key: Number Pad *",
"Key: Number Pad 9",
"Key: Number Pad 6",
"Key: Number Pad 3",
"Key: Number Pad ,",
"Unused",
"Key: Number Pad -",
"Key: Number Pad +",
"Unused",
"Key: Number Pad Enter",
"Unused",
};
RGBController_AuraTUFKeyboard::RGBController_AuraTUFKeyboard(AuraTUFKeyboardController* aura_ptr)
{
aura = aura_ptr;
name = "ASUS Aura Keyboard";
vendor = "ASUS";
type = DEVICE_TYPE_KEYBOARD;
description = "ASUS Aura Keyboard Device";
location = aura->GetDeviceLocation();
serial = aura->GetSerialString();
mode Direct;
Direct.name = "Direct";
Direct.value = AURA_KEYBOARD_MODE_DIRECT;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Static;
Static.name = "Static";
Static.value = AURA_KEYBOARD_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
Static.colors_min = 1;
Static.colors_max = 1;
Static.colors.resize(1);
modes.push_back(Static);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = AURA_KEYBOARD_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.speed_min = 0;
Breathing.speed_max = 15;
Breathing.speed = 8;
Breathing.colors_min = 1;
Breathing.colors_max = 2;
Breathing.colors.resize(1);
modes.push_back(Breathing);
mode Color_Cycle;
Color_Cycle.name = "Color Cycle";
Color_Cycle.value = AURA_KEYBOARD_MODE_COLOR_CYCLE;
Color_Cycle.flags = MODE_FLAG_HAS_SPEED;
Color_Cycle.color_mode = MODE_COLORS_NONE;
Color_Cycle.speed_min = 0;
Color_Cycle.speed_max = 15;
Color_Cycle.speed = 8;
modes.push_back(Color_Cycle);
mode Wave;
Wave.name = "Wave";
Wave.value = AURA_KEYBOARD_MODE_WAVE;
Wave.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_DIRECTION_UD | MODE_FLAG_HAS_DIRECTION_HV;
Wave.color_mode = MODE_COLORS_MODE_SPECIFIC;
Wave.speed_min = 0;
Wave.speed_max = 15;
Wave.speed = 8;
Wave.direction = MODE_DIRECTION_LEFT;
Wave.colors_min = 1;
Wave.colors_max = 7;
Wave.colors.resize(7);
modes.push_back(Wave);
mode Ripple;
Ripple.name = "Ripple";
Ripple.value = AURA_KEYBOARD_MODE_RIPPLE;
Ripple.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED;
Ripple.color_mode = MODE_COLORS_MODE_SPECIFIC;
Ripple.speed_min = 0;
Ripple.speed_max = 15;
Ripple.speed = 8;
Ripple.colors_min = 1;
Ripple.colors_max = 8;
Ripple.colors.resize(7);
modes.push_back(Ripple);
mode Reactive;
Reactive.name = "Reactive";
Reactive.value = AURA_KEYBOARD_MODE_REACTIVE;
Reactive.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED;
Reactive.color_mode = MODE_COLORS_MODE_SPECIFIC;
Reactive.speed_min = 0;
Reactive.speed_max = 15;
Reactive.speed = 8;
Reactive.colors_min = 1;
Reactive.colors_max = 2;
Reactive.colors.resize(1);
modes.push_back(Reactive);
mode Starry_Night;
Starry_Night.name = "Starry Night";
Starry_Night.value = AURA_KEYBOARD_MODE_STARRY_NIGHT;
Starry_Night.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED;
Starry_Night.color_mode = MODE_COLORS_MODE_SPECIFIC;
Starry_Night.speed_min = 0;
Starry_Night.speed_max = 15;
Starry_Night.speed = 8;
Starry_Night.colors_min = 1;
Starry_Night.colors_max = 3;
Starry_Night.colors.resize(1);
modes.push_back(Starry_Night);
mode Quicksand;
Quicksand.name = "Quicksand";
Quicksand.value = AURA_KEYBOARD_MODE_QUICKSAND;
Quicksand.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_UD;
Quicksand.color_mode = MODE_COLORS_MODE_SPECIFIC;
Quicksand.direction = MODE_DIRECTION_DOWN;
Quicksand.speed_min = 0;
Quicksand.speed_max = 15;
Quicksand.speed = 8;
Quicksand.colors_min = 6;
Quicksand.colors_max = 6;
Quicksand.colors.resize(6);
modes.push_back(Quicksand);
mode Current;
Current.name = "Current";
Current.value = AURA_KEYBOARD_MODE_CURRENT;
Current.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED;
Current.color_mode = MODE_COLORS_MODE_SPECIFIC;
Current.speed_min = 0;
Current.speed_max = 15;
Current.speed = 8;
Current.colors_min = 1;
Current.colors_max = 3;
Current.colors.resize(1);
modes.push_back(Current);
mode Rain_Drop;
Rain_Drop.name = "Rain Drop";
Rain_Drop.value = AURA_KEYBOARD_MODE_RAIN_DROP;
Rain_Drop.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED;
Rain_Drop.color_mode = MODE_COLORS_MODE_SPECIFIC;
Rain_Drop.speed_min = 0;
Rain_Drop.speed_max = 15;
Rain_Drop.speed = 8;
Rain_Drop.colors_min = 1;
Rain_Drop.colors_max = 3;
Rain_Drop.colors.resize(1);
modes.push_back(Rain_Drop);
SetupZones();
}
RGBController_AuraTUFKeyboard::~RGBController_AuraTUFKeyboard()
{
delete aura;
}
void RGBController_AuraTUFKeyboard::SetupZones()
{
unsigned int total_led_count = 0;
for(unsigned int zone_idx = 0; zone_idx < 1; zone_idx++)
{
zone new_zone;
new_zone.name = zone_names[zone_idx];
new_zone.type = zone_types[zone_idx];
new_zone.leds_min = zone_sizes[zone_idx];
new_zone.leds_max = zone_sizes[zone_idx];
new_zone.leds_count = zone_sizes[zone_idx];
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = 6;
new_zone.matrix_map->width = 23;
new_zone.matrix_map->map = (unsigned int *)&matrix_map;
zones.push_back(new_zone);
total_led_count += zone_sizes[zone_idx];
}
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
{
led new_led;
new_led.name = led_names[led_idx];
leds.push_back(new_led);
}
SetupColors();
}
void RGBController_AuraTUFKeyboard::ResizeZone(int /*zone*/, int /*new_size*/)
{
}
void RGBController_AuraTUFKeyboard::DeviceUpdateLEDs()
{
DeviceUpdateMode();
}
void RGBController_AuraTUFKeyboard::UpdateZoneLEDs(int /*zone*/)
{
aura->UpdateLeds(colors);
}
void RGBController_AuraTUFKeyboard::UpdateSingleLED(int led)
{
unsigned char red = RGBGetRValue(colors[led]);
unsigned char green = RGBGetGValue(colors[led]);
unsigned char blue = RGBGetBValue(colors[led]);
aura->UpdateSingleLed(led, red, green, blue);
}
void RGBController_AuraTUFKeyboard::SetCustomMode()
{
active_mode = 0;
}
void RGBController_AuraTUFKeyboard::DeviceUpdateMode()
{
unsigned char color_mode;
std::vector<RGBColor> mode_colors;
if(modes[active_mode].value == AURA_KEYBOARD_MODE_DIRECT)
{
aura->UpdateLeds(colors);
}
else
{
bool mode_with_double = (modes[active_mode].value == 1 || modes[active_mode].value == 3 || modes[active_mode].value == 6 || modes[active_mode].value == 8 || modes[active_mode].value == 9);
if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC && mode_with_double && modes[active_mode].colors.size() > 1)
{
if(modes[active_mode].colors[1] == 000)
{
color_mode = 0;
}
else
{
color_mode = 16;
}
}
else
{
color_mode = modes[active_mode].color_mode == MODE_COLORS_RANDOM ? 1 : 0;
}
int direction = 0;
switch (modes[active_mode].direction)
{
case MODE_DIRECTION_LEFT:
direction = 0;
break;
case MODE_DIRECTION_RIGHT:
direction = 4;
break;
case MODE_DIRECTION_UP:
direction = 6;
break;
case MODE_DIRECTION_DOWN:
direction = 2;
break;
case MODE_DIRECTION_HORIZONTAL:
direction = 8;
break;
case MODE_DIRECTION_VERTICAL:
direction = 1;
break;
}
mode_colors = modes[active_mode].color_mode == MODE_COLORS_PER_LED ? std::vector<RGBColor>(colors) : std::vector<RGBColor>(modes[active_mode].colors);
aura->UpdateDevice(modes[active_mode].value, mode_colors, direction, color_mode, (15 - modes[active_mode].speed));
}
}
@@ -0,0 +1,33 @@
/*-----------------------------------------*\
| RGBController_AsusAuraTUFKeyboard.h |
| |
| Generic RGB Interface for Asus Aura |
| USB controller driver |
| |
| Mola19 03/03/2021 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "AsusAuraTUFKeyboardController.h"
class RGBController_AuraTUFKeyboard : public RGBController
{
public:
RGBController_AuraTUFKeyboard(AuraTUFKeyboardController* aura_ptr);
~RGBController_AuraTUFKeyboard();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
AuraTUFKeyboardController* aura;
};
@@ -9,12 +9,15 @@
| Keyboard product IDs |
\*-----------------------------------------------------*/
#define EVISION_KEYBOARD_VID 0x0C45
#define WOMIER_K87_VID 0x320F
#define EVISION_KEYBOARD_USAGE_PAGE 0xFF1C
#define REDRAGON_K550_PID 0x5204
#define REDRAGON_K552_PID 0x5104
#define REDRAGON_K556_PID 0x5004
#define TECWARE_PHANTOM_ELITE_PID 0x652F
#define WARRIOR_KANE_TC235 0x8520
#define WOMIER_K87_PID 0x502A
#define WOMIER_K66_PID 0x7698
/******************************************************************************************\
* *
@@ -44,3 +47,5 @@ REGISTER_HID_DETECTOR_IP("EVision Keyboard 0C45:5104", DetectEVisionKeyboards,
REGISTER_HID_DETECTOR_IP("EVision Keyboard 0C45:5004", DetectEVisionKeyboards, EVISION_KEYBOARD_VID, REDRAGON_K556_PID, 1, EVISION_KEYBOARD_USAGE_PAGE);
REGISTER_HID_DETECTOR_IP("EVision Keyboard 0C45:652F", DetectEVisionKeyboards, EVISION_KEYBOARD_VID, TECWARE_PHANTOM_ELITE_PID, 1, EVISION_KEYBOARD_USAGE_PAGE);
REGISTER_HID_DETECTOR_IP("EVision Keyboard 0C45:8520", DetectEVisionKeyboards, EVISION_KEYBOARD_VID, WARRIOR_KANE_TC235, 1, EVISION_KEYBOARD_USAGE_PAGE);
REGISTER_HID_DETECTOR_IP("EVision Keyboard 320F:502A", DetectEVisionKeyboards, WOMIER_K87_VID, WOMIER_K87_PID, 1, EVISION_KEYBOARD_USAGE_PAGE);
REGISTER_HID_DETECTOR_IP("EVision Keyboard 0C45:7698", DetectEVisionKeyboards, EVISION_KEYBOARD_VID, WOMIER_K66_PID, 1, EVISION_KEYBOARD_USAGE_PAGE);
@@ -35,7 +35,7 @@ const uint8_t LED8 = 0x27;
/*-------------------------------------------------------------*\
| LED "headers" 0x20..0x27, As seen on Gigabyte X570 Elite board|
| Internal legacy shorthand naming and possibly depracated |
| Internal legacy shorthand naming and possibly deprecated |
\*-------------------------------------------------------------*/
const uint8_t HDR_BACK_IO = LED1;
const uint8_t HDR_CPU = LED2;
@@ -12,7 +12,7 @@
#include <cstring>
// Skip these indices in the color output
static unsigned int skip_idx[] = { 6, 23, 29, 41, 47, 59, 70, 71, 75, 76, 87, 88, 93, 99, 100, 102, 108, 113, 114, 120, 123, 124 };
static unsigned int skip_idx[] = { 23, 29, 41, 47, 59, 70, 71, 76, 87, 88, 93, 99, 100, 102, 108, 113, 114, 120, 123, 124 };
HyperXAlloyOriginsController::HyperXAlloyOriginsController(hid_device* dev_handle, const char* path)
{
@@ -0,0 +1,118 @@
/*------------------------------------------*\
| HyperXAlloyOriginsCoreController.cpp |
| |
| Driver for HyperX Alloy Origins Core |
| RGB Keyboard lighting controller |
| |
| Volodymyr Nazarchuk (Vavooon) 4/28/2021 |
| mike white (kamaaina) 6/9/2021 |
\*------------------------------------------*/
#include "HyperXAlloyOriginsCoreController.h"
#include <cstring>
// Skip these indices in the color output
static unsigned int skip_idx[] = {6, 7, 14, 15, 22, 23, 30, 31, 38, 39, 44, 46, 47, 54, 55, 58, 60, 61, 62, 63, 70, 71, 78, 79, 86, 87, 94, 95, 101, 102, 103, 109, 110, 111, 118, 119};
HyperXAlloyOriginsCoreController::HyperXAlloyOriginsCoreController(hid_device* dev_handle, hid_device_info* dev_info)
{
dev = dev_handle;
location = dev_info->path;
/*-----------------------------------------------------*\
| Get the firmware version from the device info |
\*-----------------------------------------------------*/
char fw_version_buf[8];
memset(fw_version_buf, '\0', sizeof(fw_version_buf));
unsigned short version = dev_info->release_number;
sprintf(fw_version_buf, "%.2X.%.2X", (version & 0xFF00) >> 8, version & 0x00FF);
firmware_version = fw_version_buf;
}
HyperXAlloyOriginsCoreController::~HyperXAlloyOriginsCoreController()
{
hid_close(dev);
}
std::string HyperXAlloyOriginsCoreController::GetDeviceLocation()
{
return("HID " + location);
}
std::string HyperXAlloyOriginsCoreController::GetSerialString()
{
wchar_t serial_string[128];
int ret = hid_get_serial_number_string(dev, serial_string, 128);
if(ret != 0)
{
return("");
}
std::wstring return_wstring = serial_string;
std::string return_string(return_wstring.begin(), return_wstring.end());
return(return_string);
}
std::string HyperXAlloyOriginsCoreController::GetFirmwareVersion()
{
return(firmware_version);
}
void HyperXAlloyOriginsCoreController::SetLEDsDirect(std::vector<RGBColor> colors)
{
for(unsigned int skip_cnt = 0; skip_cnt < (sizeof(skip_idx) / sizeof(skip_idx[0])); skip_cnt++)
{
colors.insert(colors.begin() + skip_idx[skip_cnt], 0x00000000);
}
unsigned char buf[380];
memset(buf, 0x00, sizeof(buf));
int offset = 0;
int rowPos = 0;
for(unsigned int color_idx = 0; color_idx < colors.size(); color_idx++)
{
if (color_idx > 0 && color_idx % 16 == 0)
{
offset += 48;
rowPos = 0;
}
buf[rowPos + offset] = RGBGetGValue(colors[color_idx]);
buf[rowPos + offset + 16] = RGBGetRValue(colors[color_idx]);
buf[rowPos + offset + 32] = RGBGetBValue(colors[color_idx]);
rowPos++;
}
unsigned int sentBytes = 0;
unsigned int bytesToSend = sizeof(buf);
unsigned int payloadSize = 60;
unsigned int seq = 0;
while(sentBytes < bytesToSend)
{
if (bytesToSend - sentBytes < payloadSize)
{
payloadSize = bytesToSend - sentBytes;
}
unsigned char packet[65];
memset(packet, 0x00, sizeof(packet));
packet[1] = 0xA2;
packet[2] = seq++;
packet[4] = payloadSize;
memcpy(&packet[5], &buf[sentBytes], payloadSize);
hid_write(dev, packet, 65);
sentBytes += payloadSize;
}
}
@@ -0,0 +1,34 @@
/*------------------------------------------*\
| HyperXAlloyOriginsCoreController.h |
| |
| Definitions and types for HyperX Alloy |
| Origins Core RGB Keyboard lighting |
| controller |
| |
| Volodymyr Nazarchuk (Vavooon) 4/28/2021 |
\*------------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
class HyperXAlloyOriginsCoreController
{
public:
HyperXAlloyOriginsCoreController(hid_device* dev_handle, hid_device_info* dev_info);
~HyperXAlloyOriginsCoreController();
std::string GetDeviceLocation();
std::string GetSerialString();
std::string GetFirmwareVersion();
void SetLEDsDirect(std::vector<RGBColor> colors);
private:
hid_device* dev;
std::string location;
std::string firmware_version;
};
@@ -1,10 +1,12 @@
#include "Detector.h"
#include "HyperXAlloyElite2Controller.h"
#include "HyperXAlloyOriginsController.h"
#include "HyperXAlloyOriginsCoreController.h"
#include "HyperXKeyboardController.h"
#include "RGBController.h"
#include "RGBController_HyperXAlloyElite2.h"
#include "RGBController_HyperXAlloyOrigins.h"
#include "RGBController_HyperXAlloyOriginsCore.h"
#include "RGBController_HyperXKeyboard.h"
#include <hidapi/hidapi.h>
@@ -41,6 +43,19 @@ void DetectHyperXAlloyOrigins(hid_device_info* info, const std::string& name)
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
void DetectHyperXAlloyOriginsCore(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if( dev )
{
HyperXAlloyOriginsCoreController* controller = new HyperXAlloyOriginsCoreController(dev, info);
RGBController_HyperXAlloyOriginsCore* rgb_controller = new RGBController_HyperXAlloyOriginsCore(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
void DetectHyperXAlloyElite2(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
@@ -53,15 +68,14 @@ void DetectHyperXAlloyElite2(hid_device_info* info, const std::string& name)
}
}
REGISTER_HID_DETECTOR_IP("HyperX Alloy Elite RGB", DetectHyperXKeyboards, HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ELITE_PID, 2, 0xFF01);
REGISTER_HID_DETECTOR_IP("HyperX Alloy FPS RGB", DetectHyperXKeyboards, HYPERX_KEYBOARD_VID, HYPERX_ALLOY_FPS_RGB_PID, 2, 0xFF01);
REGISTER_HID_DETECTOR_IP("HyperX Alloy Elite RGB", DetectHyperXKeyboards, HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ELITE_PID, 2, 0xFF01);
REGISTER_HID_DETECTOR_IP("HyperX Alloy FPS RGB", DetectHyperXKeyboards, HYPERX_KEYBOARD_VID, HYPERX_ALLOY_FPS_RGB_PID, 2, 0xFF01);
REGISTER_HID_DETECTOR_I("HyperX Alloy Origins Core", DetectHyperXAlloyOriginsCore, HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ORIGINS_CORE_PID, 2);
#ifdef _WIN32
REGISTER_HID_DETECTOR_I("HyperX Alloy Origins Core", DetectHyperXAlloyOrigins, HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ORIGINS_CORE_PID, 3);
REGISTER_HID_DETECTOR_I("HyperX Alloy Origins", DetectHyperXAlloyOrigins, HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ORIGINS_PID, 3);
REGISTER_HID_DETECTOR_IP("HyperX Alloy Elite 2", DetectHyperXAlloyElite2, HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ELITE_2_PID, 3, 0xFF90);
REGISTER_HID_DETECTOR_I("HyperX Alloy Origins", DetectHyperXAlloyOrigins, HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ORIGINS_PID, 3);
REGISTER_HID_DETECTOR_IP("HyperX Alloy Elite 2", DetectHyperXAlloyElite2, HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ELITE_2_PID, 3, 0xFF90);
#else
REGISTER_HID_DETECTOR_I("HyperX Alloy Origins Core", DetectHyperXAlloyOrigins, HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ORIGINS_CORE_PID, 0);
REGISTER_HID_DETECTOR_I("HyperX Alloy Origins", DetectHyperXAlloyOrigins, HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ORIGINS_PID, 0);
REGISTER_HID_DETECTOR_I("HyperX Alloy Elite 2", DetectHyperXAlloyElite2, HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ELITE_2_PID, 0);
REGISTER_HID_DETECTOR_I("HyperX Alloy Origins", DetectHyperXAlloyOrigins, HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ORIGINS_PID, 0);
REGISTER_HID_DETECTOR_I("HyperX Alloy Elite 2", DetectHyperXAlloyElite2, HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ELITE_2_PID, 0);
#endif
@@ -15,12 +15,12 @@ using namespace std::chrono_literals;
#define NA 0xFFFFFFFF
static unsigned int matrix_map[6][23] =
{ { 0, NA, 11, 17, 22, 27, NA, 33, 38, 43, 49, NA, 54, 60, 64, 68, 74, 78, 83, NA, NA, NA, NA },
{ 1, 6, 12, 18, 23, 28, 34, 39, 44, 50, 55, NA, 61, 65, 69, NA, 75, 79, 84, 87, 92, 96, 101 },
{ 2, NA, 7, 13, 19, 24, NA, 29, 35, 40, 45, 51, 56, 62, 66, 70, 76, 80, 85, 88, 93, 97, 102 },
{ 3, NA, 8, 14, 20, 25, NA, 30, 36, 41, 46, 52, 57, 63, 71, NA, NA, NA, NA, 89, 94, 98, NA },
{ 4, NA, 9, 15, 21, 26, NA, 31, NA, 37, 42, 47, 53, 58, 72, NA, NA, 81, NA, 90, 95, 99, 103 },
{ 5, 10, 16, NA, NA, NA, NA, 32, NA, NA, NA, NA, 48, 59, 67, 73, 77, 82, 86, 91, NA, 100, NA } };
{ { 0, NA, 12, 18, 23, 28, NA, 34, 39, 44, 50, NA, 55, 61, 65, 70, 76, 80, 85, NA, NA, NA, NA },
{ 1, 7, 13, 19, 24, 29, 35, 40, 45, 51, 56, NA, 62, 66, 71, NA, 77, 81, 86, 89, 94, 98, 103 },
{ 2, NA, 8, 14, 20, 25, NA, 30, 36, 41, 46, 52, 57, 63, 67, 72, 78, 82, 87, 90, 95, 99, 104 },
{ 3, NA, 9, 15, 21, 26, NA, 31, 37, 42, 47, 53, 58, 64, 68, 73, NA, NA, NA, 91, 96, 100, NA },
{ 4, 6, 10, 16, 22, 27, NA, 32, NA, 38, 43, 48, 54, 59, 74, NA, NA, 83, NA, 92, 97, 101, 105 },
{ 5, 11, 17, NA, NA, NA, NA, 33, NA, NA, NA, NA, 49, 60, 69, 75, 79, 84, 88, 93, NA, 102, NA } };
static const char* zone_names[] =
{
@@ -34,7 +34,7 @@ static zone_type zone_types[] =
static const unsigned int zone_sizes[] =
{
104,
106,
};
static const char *led_names[] =
@@ -45,7 +45,7 @@ static const char *led_names[] =
"Key: Caps Lock",
"Key: Left Shift",
"Key: Left Control",
// Skip index 6
"Key: \\ (ISO)",
"Key: 1",
"Key: Q",
"Key: A",
@@ -114,7 +114,7 @@ static const char *led_names[] =
"Key: F11",
"Key: =",
"Key: ]",
// Skip index 75
"Key: #",
// Skip index 76
"Key: Menu",
"Key: F12",
@@ -164,7 +164,7 @@ static const char *led_names[] =
"Key: Number Pad +",
// Skip index 123
// Skip index 124
"Key: Number Pad Enter",
"Key: Number Pad Enter",
};
RGBController_HyperXAlloyOrigins::RGBController_HyperXAlloyOrigins(HyperXAlloyOriginsController* hyperx_ptr)
@@ -0,0 +1,283 @@
/*------------------------------------------*\
| RGBController_HyperXAlloyOriginsCore.cpp |
| |
| Generic RGB Interface for HyperX Alloy |
| Origins Core RGB Keyboard |
| |
| Volodymyr Nazarchuk (Vavooon) 4/28/2021 |
\*------------------------------------------*/
#include "RGBController_HyperXAlloyOriginsCore.h"
using namespace std::chrono_literals;
//0xFFFFFFFF indicates an unused entry in matrix
#define NA 0xFFFFFFFF
static unsigned int matrix_map[6][19] =
{
{ 0, NA, 1, 2, 3, 4, 5, 6, 7, 44, NA, 45, 46, 47, 48, NA, 49, 50, 51 },
{ 8, 9, 10, 11, 12, 13, 14, 15, 16, 52, 53, 54, 55, 56, NA, NA, 57, 58, 59 },
{ 17, NA, 18, 19, 20, 21, 22, 23, 24, 60, 61, 62, 63, 64, 65, NA, 66, 67, 68 },
{ 25, NA, 26, 27, 28, 29, 30, 31, 32, 69, 70, 71, 72, 73, NA, NA, NA, NA, NA },
{ 33, NA, 34, 35, 36, 37, 38, NA, 39, 74, 75, 76, 77, 78, NA, NA, NA, 79, NA },
{ 40, 41, 42, NA, NA, NA, 43, NA, NA, NA, NA, 80, 81, 82, 83, NA, 84, 85, 86 }
};
static const char* zone_names[] =
{
"Keyboard",
};
static zone_type zone_types[] =
{
ZONE_TYPE_MATRIX,
};
static const unsigned int zone_sizes[] =
{
87,
};
static const char *led_names[] =
{
"Key: Escape",
"Key: F1",
"Key: F2",
"Key: F3",
"Key: F4",
"Key: F5",
"Key: F6",
"Key: F7",
"Key: `",
"Key: 1",
"Key: 2",
"Key: 3",
"Key: 4",
"Key: 5",
"Key: 6",
"Key: 7",
"Key: 8",
"Key: Tab",
"Key: Q",
"Key: W",
"Key: E",
"Key: R",
"Key: T",
"Key: Y",
"Key: U",
"Key: Caps Lock",
"Key: A",
"Key: S",
"Key: D",
"Key: F",
"Key: G",
"Key: H",
"Key: J",
"Key: Left Shift",
"Key: Z",
"Key: X",
"Key: C",
"Key: V",
"Key: B",
"Key: N",
"Key: Left Control",
"Key: Left Windows",
"Key: Left Alt",
"Key: Space",
// End of first section
"Key: F8",
"Key: F9",
"Key: F10",
"Key: F11",
"Key: F12",
"Key: Print Screen",
"Key: Scroll Lock",
"Key: Pause/Break",
"Key: 9",
"Key: 0",
"Key: -",
"Key: =",
"Key: Backspace",
"Key: Insert",
"Key: Page Up",
"Key: Home",
"Key: I",
"Key: O",
"Key: P",
"Key: [",
"Key: ]",
"Key: \\ (ANSI)",
"Key: Delete",
"Key: Page Down",
"Key: End",
"Key: K",
"Key: L",
"Key: ;",
"Key: '",
"Key: Enter",
"Key: M",
"Key: ,",
"Key: .",
"Key: /",
"Key: Right Shift",
"Key: Up Arrow",
"Key: Right Alt",
"Key: Right Fn",
"Key: Menu",
"Key: Right Control",
"Key: Left Arrow",
"Key: Down Arrow",
"Key: Right Arrow"
};
RGBController_HyperXAlloyOriginsCore::RGBController_HyperXAlloyOriginsCore(HyperXAlloyOriginsCoreController* hyperx_ptr)
{
hyperx = hyperx_ptr;
name = "HyperX Alloy Origins Core Keyboard Device";
vendor = "HyperX";
type = DEVICE_TYPE_KEYBOARD;
description = "HyperX Alloy Origins Core Keyboard Device";
location = hyperx->GetDeviceLocation();
serial = hyperx->GetSerialString();
version = hyperx->GetFirmwareVersion();
mode Direct;
Direct.name = "Direct";
Direct.value = 0xFFFF;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
SetupZones();
/*-----------------------------------------------------*\
| The HyperX Origins Core requires a packet within few |
| seconds of sending the lighting change in order to |
| not revert back into current profile. Start a thread |
| to continuously send color values each 10ms |
\*-----------------------------------------------------*/
keepalive_thread_run = 1;
keepalive_thread = new std::thread(&RGBController_HyperXAlloyOriginsCore::KeepaliveThread, this);
}
RGBController_HyperXAlloyOriginsCore::~RGBController_HyperXAlloyOriginsCore()
{
keepalive_thread_run = 0;
keepalive_thread->join();
delete keepalive_thread;
/*---------------------------------------------------------*\
| Delete the matrix map |
\*---------------------------------------------------------*/
for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++)
{
if(zones[zone_index].matrix_map != NULL)
{
delete zones[zone_index].matrix_map;
}
}
delete hyperx;
}
void RGBController_HyperXAlloyOriginsCore::SetupZones()
{
unsigned int total_led_count = 0;
for(unsigned int zone_idx = 0; zone_idx < 1; zone_idx++)
{
zone new_zone;
new_zone.name = zone_names[zone_idx];
new_zone.type = zone_types[zone_idx];
new_zone.leds_min = zone_sizes[zone_idx];
new_zone.leds_max = zone_sizes[zone_idx];
new_zone.leds_count = zone_sizes[zone_idx];
if(zone_types[zone_idx] == ZONE_TYPE_MATRIX)
{
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = 6;
new_zone.matrix_map->width = 19;
new_zone.matrix_map->map = (unsigned int *)&matrix_map;
}
else
{
new_zone.matrix_map = NULL;
}
zones.push_back(new_zone);
total_led_count += zone_sizes[zone_idx];
}
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
{
led new_led;
new_led.name = led_names[led_idx];
leds.push_back(new_led);
}
SetupColors();
}
void RGBController_HyperXAlloyOriginsCore::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_HyperXAlloyOriginsCore::DeviceUpdateLEDs()
{
hyperx->SetLEDsDirect(colors);
}
void RGBController_HyperXAlloyOriginsCore::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_HyperXAlloyOriginsCore::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_HyperXAlloyOriginsCore::SetCustomMode()
{
}
void RGBController_HyperXAlloyOriginsCore::DeviceUpdateMode()
{
}
void RGBController_HyperXAlloyOriginsCore::KeepaliveThread()
{
while(keepalive_thread_run.load())
{
if(active_mode == 0)
{
if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50))
{
DeviceUpdateLEDs();
}
}
std::this_thread::sleep_for(10ms);
}
}
@@ -0,0 +1,40 @@
/*------------------------------------------*\
| RGBController_HyperXAlloyOriginsCore.h |
| |
| Generic RGB Interface for HyperX Alloy |
| Origins Core RGB Keyboard |
| |
| Volodymyr Nazarchuk (Vavooon) 4/28/2021 |
\*------------------------------------------*/
#pragma once
#include <chrono>
#include "RGBController.h"
#include "HyperXAlloyOriginsCoreController.h"
class RGBController_HyperXAlloyOriginsCore : public RGBController
{
public:
RGBController_HyperXAlloyOriginsCore(HyperXAlloyOriginsCoreController* hyperx_ptr);
~RGBController_HyperXAlloyOriginsCore();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
void KeepaliveThread();
private:
HyperXAlloyOriginsCoreController* hyperx;
std::thread* keepalive_thread;
std::atomic<bool> keepalive_thread_run;
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
};
@@ -4,15 +4,18 @@
#include "LogitechG203LController.h"
#include "LogitechG213Controller.h"
#include "LogitechG560Controller.h"
#include "LogitechG933Controller.h"
#include "LogitechG810Controller.h"
#include "LogitechG910Controller.h"
#include "LogitechG815Controller.h"
#include "LogitechGLightsyncController.h"
#include "LogitechLightspeedController.h"
#include "LogitechX56Controller.h"
#include "RGBController.h"
#include "RGBController_LogitechG203L.h"
#include "RGBController_LogitechG213.h"
#include "RGBController_LogitechG560.h"
#include "RGBController_LogitechG933.h"
#include "RGBController_LogitechG810.h"
#include "RGBController_LogitechG910.h"
#include "RGBController_LogitechG815.h"
@@ -20,6 +23,7 @@
#include "RGBController_LogitechGLightsync1zone.h"
#include "RGBController_LogitechLightspeed.h"
#include "RGBController_LogitechGPowerPlay.h"
#include "RGBController_LogitechX56.h"
#include <vector>
#include <hidapi/hidapi.h>
@@ -72,6 +76,11 @@
\*-----------------------------------------------------*/
#define LOGITECH_G560_PID 0x0A78
/*-----------------------------------------------------*\
| Headset product IDs |
\*-----------------------------------------------------*/
#define LOGITECH_G933_PID 0x0A5B
/*-----------------------------------------------------*\
| Unifying Device IDs (Including Lightspeed receivers) |
| NB: Not used but preserved for debugging |
@@ -90,6 +99,13 @@
#define LOGITECH_G903_LIGHTSPEED_VIRTUAL_PID 0x4067
#define LOGITECH_G_PRO_WIRELESS_VIRTUAL_PID 0x4079
/*-----------------------------------------------------*\
| Joystick product IDs |
\*-----------------------------------------------------*/
#define LOGITECH_X56_VID 0x0738
#define LOGITECH_X56_JOYSTICK_PID 0x2221
#define LOGITECH_X56_THROTTLE_PID 0xA221
/*-----------------------------------------------------*\
| Logitech Keyboards |
\*-----------------------------------------------------*/
@@ -470,6 +486,38 @@ void DetectLogitechG560(hid_device_info* info, const std::string& name)
}
}
void DetectLogitechG933(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
/*---------------------------------------------*\
| Add G933 Headset |
\*---------------------------------------------*/
LogitechG933Controller* controller = new LogitechG933Controller(dev, info->path);
RGBController_LogitechG933* rgb_controller = new RGBController_LogitechG933(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
void DetectLogitechX56(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
/*---------------------------------------------*\
| Add X56 Devices |
\*---------------------------------------------*/
LogitechX56Controller* controller = new LogitechX56Controller(dev, info->path);
RGBController_LogitechX56* rgb_controller = new RGBController_LogitechX56(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
| Keyboards |
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
@@ -499,6 +547,15 @@ REGISTER_HID_DETECTOR_IP ("Logitech G Pro (HERO) Gaming Mouse", Dete
| Speakers |
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IPU("Logitech G560 Lightsync Speaker", DetectLogitechG560, LOGITECH_VID, LOGITECH_G560_PID, 2, 0xFF43, 514);
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
| Headsets |
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IPU("Logitech G933 Lightsync Headset", DetectLogitechG933, LOGITECH_VID, LOGITECH_G933_PID, 3, 0xFF43, 514);
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
| Joysticks |
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IP("Logitech X56 Rhino Hotas Joystick", DetectLogitechX56, LOGITECH_X56_VID, LOGITECH_X56_JOYSTICK_PID, 2, 0xFF00);
REGISTER_HID_DETECTOR_IP("Logitech X56 Rhino Hotas Throttle", DetectLogitechX56, LOGITECH_X56_VID, LOGITECH_X56_THROTTLE_PID, 2, 0xFF00);
/*---------------------------------------------------------------------------------------------------------*\
| Windows and MacOS Lightspeed Detection |
@@ -75,3 +75,78 @@ void LogitechG213Controller::SetDirect
\*-----------------------------------------------------*/
hid_write(dev, (unsigned char *)usb_buf, 20);
}
void LogitechG213Controller::SetMode
(
unsigned char mode,
unsigned short speed,
unsigned char direction,
unsigned char red,
unsigned char green,
unsigned char blue
)
{
SendMode(LOGITECH_G213_ZONE_MODE_KEYBOARD, mode, speed, direction, red, green, blue);
}
void LogitechG213Controller::SendMode
(
unsigned char zone,
unsigned char mode,
unsigned short speed,
unsigned char direction,
unsigned char red,
unsigned char green,
unsigned char blue
)
{
char usb_buf[20];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Lighting Control packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x11;
usb_buf[0x01] = 0xFF;
usb_buf[0x02] = 0x0C;
usb_buf[0x03] = 0x3C;
usb_buf[0x04] = zone;
usb_buf[0x05] = mode;
usb_buf[0x06] = red;
usb_buf[0x07] = green;
usb_buf[0x08] = blue;
speed = 100 * speed;
if(mode == LOGITECH_G213_MODE_BREATHING)
{
usb_buf[0x09] = speed >> 8;
usb_buf[0x0A] = speed & 0xFF;
usb_buf[0x0C] = 0x64;
}
else if(mode == LOGITECH_G213_MODE_CYCLE)
{
usb_buf[0x0B] = speed >> 8;
usb_buf[0x0C] = speed & 0xFF;
usb_buf[0x0D] = 0x64;
}
else if(mode == LOGITECH_G213_MODE_WAVE)
{
usb_buf[0x0B] = speed >> 8;
usb_buf[0x0C] = speed & 0xFF;
usb_buf[0x0D] = direction & 0xFF;
usb_buf[0x0F] = speed >> 8;
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, (unsigned char *)usb_buf, 20);
hid_read(dev, (unsigned char *)usb_buf, 20);
}
@@ -13,6 +13,39 @@
#pragma once
enum
{
LOGITECH_G213_ZONE_MODE_KEYBOARD = 0x00
};
enum
{
LOGITECH_G213_MODE_OFF = 0x00,
LOGITECH_G213_MODE_STATIC = 0x01,
LOGITECH_G213_MODE_BREATHING = 0x02,
LOGITECH_G213_MODE_CYCLE = 0x03,
LOGITECH_G213_MODE_WAVE = 0x04,
};
enum
{
LOGITECH_G213_WAVE_MODE_LEFT = 0x06,
LOGITECH_G213_WAVE_MODE_RIGHT = 0x01,
LOGITECH_G213_WAVE_MODE_CENTER_EDGE = 0x03,
LOGITECH_G213_WAVE_MODE_EDGE_CENTER = 0x08,
};
/*---------------------------------------------------------------------------------------------*\
| Speed is 1000 for fast and 20000 for slow. |
| Values are multiplied by 100 later to give lots of GUI steps. |
\*---------------------------------------------------------------------------------------------*/
enum
{
LOGITECH_G213_SPEED_SLOWEST = 0xC8, /* Slowest speed */
LOGITECH_G213_SPEED_NORMAL = 0x32, /* Normal speed */
LOGITECH_G213_SPEED_FASTEST = 0x0A, /* Fastest speed */
};
class LogitechG213Controller
{
public:
@@ -30,8 +63,28 @@ public:
unsigned char b
);
void SetMode
(
unsigned char mode,
unsigned short speed,
unsigned char direction,
unsigned char red,
unsigned char green,
unsigned char blue
);
private:
hid_device* dev;
std::string location;
void SendMode
(
unsigned char zone,
unsigned char mode,
unsigned short speed,
unsigned char direction,
unsigned char red,
unsigned char green,
unsigned char blue
);
};
@@ -0,0 +1,146 @@
/*-----------------------------------------*\
| LogitechG933Controller.cpp |
| |
| Driver for Logitech G933 RGB Headset |
| |
| Edbgon 06/21/2021 |
| Based on |
| TheRogueZeta 8/31/2020 |
\*-----------------------------------------*/
#include "LogitechG933Controller.h"
#include <cstring>
#include <stdio.h>
#include <stdlib.h>
using namespace std::chrono_literals;
LogitechG933Controller::LogitechG933Controller(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
location = path;
}
LogitechG933Controller::~LogitechG933Controller()
{
hid_close(dev);
}
std::string LogitechG933Controller::GetDeviceLocation()
{
return("HID: " + location);
}
void LogitechG933Controller::SetDirectMode(uint8_t zone)
{
unsigned char usb_buf[LOGI_G933_LED_PACKET_SIZE];
usb_buf[0x00] = 0x11;
usb_buf[0x01] = 0xFF;
usb_buf[0x02] = 0x04;
usb_buf[0x03] = 0xCA;
usb_buf[0x04] = zone;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
fail_retry_write(dev, usb_buf, LOGI_G933_LED_PACKET_SIZE);
}
void LogitechG933Controller::SetOffMode(uint8_t zone)
{
unsigned char usb_buf[LOGI_G933_LED_PACKET_SIZE];
usb_buf[0x00] = 0x11;
usb_buf[0x01] = 0xFF;
usb_buf[0x02] = 0x04;
usb_buf[0x03] = 0x3F;
usb_buf[0x04] = zone;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
fail_retry_write(dev, usb_buf, LOGI_G933_LED_PACKET_SIZE);
}
void LogitechG933Controller::SendHeadsetMode
(
unsigned char zone,
unsigned char mode,
unsigned char red,
unsigned char green,
unsigned char blue
)
{
unsigned char usb_buf[LOGI_G933_LED_PACKET_SIZE];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Lighting Control |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x11;
usb_buf[0x01] = 0xFF;
usb_buf[0x02] = 0x04;
/*-----------------------------------------------------*\
| This packet sets speaker into direct mode. This mode |
| is used by Lightsync Ambilight and Music Visualizer |
| realtime effect. |
\*-----------------------------------------------------*/
usb_buf[0x03] = 0x3A;
/*-----------------------------------------------------*\
| Set up mode and speed |
\*-----------------------------------------------------*/
usb_buf[0x04] = zone;
usb_buf[0x05] = mode;
/*-----------------------------------------------------*\
| And set up the colors |
\*-----------------------------------------------------*/
usb_buf[0x06] = red;
usb_buf[0x07] = green;
usb_buf[0x08] = blue;
if(mode == LOGITECH_G933_MODE_DIRECT) //G933 only has Direct Mode.
{
usb_buf[0x09] = 0x02;
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
fail_retry_write(dev, usb_buf, LOGI_G933_LED_PACKET_SIZE);
}
void LogitechG933Controller::fail_retry_write(hid_device *device, const unsigned char *data, size_t length)
{
unsigned char usb_buf_out[LOGI_G933_LED_PACKET_SIZE];
unsigned int write_max_retry = LOGI_G933_LED_COMMAND_SEND_RETRIES;
do
{
std::this_thread::sleep_for(1ms);
int ret = hid_write(device, data, length);
/*-------------------------------------------------------------------------------------*\
| HID write fails if a change led color and set volume command are sent at |
| the same time because RGB controller and volume control shares the same interface. |
\*-------------------------------------------------------------------------------------*/
if(ret == 20)
{
std::this_thread::sleep_for(1ms);
hid_read_timeout(dev, usb_buf_out, LOGI_G933_LED_PACKET_SIZE, 20);
break;
}
else
{
write_max_retry--;
std::this_thread::sleep_for(10ms);
}
}while (write_max_retry > 0);
}
@@ -0,0 +1,56 @@
/*-----------------------------------------*\
| LogitechG933Controller.h |
| |
| Definitions and types for |
| Logitech G933 RGB Headset |
| |
| Edbgon 06/21/2021 |
| Based on |
| TheRogueZeta 8/31/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
#define LOGI_G933_LED_PACKET_SIZE 20
#define LOGI_G933_LED_COMMAND_SEND_RETRIES 3
enum
{
LOGITECH_G933_MODE_OFF = 0x00,
LOGITECH_G933_MODE_DIRECT = 0x01,
LOGITECH_G933_MODE_CYCLE = 0x02,
LOGITECH_G933_MODE_BREATHING = 0x03,
};
class LogitechG933Controller
{
public:
LogitechG933Controller(hid_device* dev_handle, const char* path);
~LogitechG933Controller();
std::string GetDeviceLocation();
void SetDirectMode(uint8_t zone);
void SetOffMode(uint8_t zone);
void SendHeadsetMode
(
unsigned char zone,
unsigned char mode,
unsigned char red,
unsigned char green,
unsigned char blue
);
private:
hid_device* dev;
std::string location;
void fail_retry_write(hid_device *device, const unsigned char *data, size_t length);
};
@@ -0,0 +1,83 @@
/*-----------------------------------------*\
| LogitechX56Controller.cpp |
| |
| Generic RGB Interface Logitech X56 |
| Class |
| |
| Edbgon 11/06/2021 |
\*-----------------------------------------*/
#include "LogitechX56Controller.h"
#include <cstring>
LogitechX56Controller::LogitechX56Controller(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
location = path;
}
LogitechX56Controller::~LogitechX56Controller()
{
hid_close(dev);
}
std::string LogitechX56Controller::GetDeviceLocation()
{
return("HID: " + location);
}
char* LogitechX56Controller::GetDeviceName()
{
return device_name;
}
std::string LogitechX56Controller::GetSerialString()
{
wchar_t serial_string[128];
int ret = hid_get_serial_number_string(dev, serial_string, 128);
if(ret != 0)
{
return("");
}
std::wstring return_wstring = serial_string;
std::string return_string(return_wstring.begin(), return_wstring.end());
return(return_string);
}
void LogitechX56Controller::SetColor(RGBColor color)
{
unsigned char buf[64];
unsigned char cbuf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(buf, 0x00, sizeof(buf));
memset(cbuf, 0x00, sizeof(cbuf));
/*-----------------------------------------------------*\
| Set up init packet |
\*-----------------------------------------------------*/
buf[0x00] = 0x09;
buf[0x02] = 0x02;
buf[0x03] = 0x64;
/*-----------------------------------------------------*\
| Set up color packet |
\*-----------------------------------------------------*/
cbuf[0x00] = 0x09;
cbuf[0x02] = 0x03;
cbuf[0x03] = RGBGetRValue(color);
cbuf[0x04] = RGBGetGValue(color);
cbuf[0x05] = RGBGetBValue(color);
/*-----------------------------------------------------*\
| Send packets |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, buf, 64);
hid_send_feature_report(dev, cbuf, 64);
}
@@ -0,0 +1,33 @@
/*-----------------------------------------*\
| LogitechX56Controller.h |
| |
| Generic RGB Interface Logitech X56 |
| Class |
| |
| Edbgon 11/06/2021 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
class LogitechX56Controller
{
public:
LogitechX56Controller(hid_device* dev_handle, const char* path);
~LogitechX56Controller();
std::string GetDeviceLocation();
char* GetDeviceName();
std::string GetSerialString();
void SetColor(RGBColor colors);
private:
char device_name[32];
hid_device* dev;
std::string location;
};
@@ -46,6 +46,47 @@ RGBController_LogitechG213::RGBController_LogitechG213(LogitechG213Controller* l
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode Off;
Off.name = "Off";
Off.value = LOGITECH_G213_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Cycle;
Cycle.name = "Cycle";
Cycle.value = LOGITECH_G213_MODE_CYCLE;
Cycle.flags = MODE_FLAG_HAS_SPEED;
Cycle.color_mode = MODE_COLORS_NONE;
Cycle.speed_min = LOGITECH_G213_SPEED_SLOWEST;
Cycle.speed_max = LOGITECH_G213_SPEED_FASTEST;
Cycle.speed = LOGITECH_G213_SPEED_NORMAL;
modes.push_back(Cycle);
mode Wave;
Wave.name = "Wave";
Wave.value = LOGITECH_G213_MODE_WAVE;
Wave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_DIRECTION_UD;
Wave.color_mode = MODE_COLORS_NONE;
Wave.speed_min = LOGITECH_G213_SPEED_SLOWEST;
Wave.speed_max = LOGITECH_G213_SPEED_FASTEST;
Wave.speed = LOGITECH_G213_SPEED_NORMAL;
Wave.direction = MODE_DIRECTION_LEFT;
modes.push_back(Wave);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = LOGITECH_G213_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED;
Breathing.colors_min = 1;
Breathing.colors_max = 1;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.colors.resize(1);
Breathing.speed_min = LOGITECH_G213_SPEED_SLOWEST;
Breathing.speed_max = LOGITECH_G213_SPEED_FASTEST;
Breathing.speed = LOGITECH_G213_SPEED_NORMAL;
modes.push_back(Breathing);
SetupZones();
}
@@ -117,4 +158,43 @@ void RGBController_LogitechG213::DeviceUpdateMode()
| Direct mode does not send a mode packet |
| Call UpdateLEDs to send direct packet |
\*---------------------------------------------------------*/
if(active_mode == 0xFFFF)
{
UpdateLEDs();
return;
}
unsigned char red = 0;
unsigned char grn = 0;
unsigned char blu = 0;
unsigned char direction = 0;
if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
{
red = RGBGetRValue(modes[active_mode].colors[0]);
grn = RGBGetGValue(modes[active_mode].colors[0]);
blu = RGBGetBValue(modes[active_mode].colors[0]);
}
switch (modes[active_mode].direction)
{
case MODE_DIRECTION_LEFT:
// Right to left
direction = LOGITECH_G213_WAVE_MODE_LEFT;
break;
case MODE_DIRECTION_RIGHT:
// Left to right
direction = LOGITECH_G213_WAVE_MODE_RIGHT;
break;
case MODE_DIRECTION_UP:
// Edge to center
direction = LOGITECH_G213_WAVE_MODE_EDGE_CENTER;
break;
case MODE_DIRECTION_DOWN:
// Center to edge
direction = LOGITECH_G213_WAVE_MODE_CENTER_EDGE;
break;
}
logitechG213->SetMode(modes[active_mode].value, modes[active_mode].speed, direction, red, grn, blu);
}
@@ -0,0 +1,125 @@
/*-----------------------------------------*\
| RGBController_LogitechG933.cpp |
| |
| Generic RGB Interface for |
| Logitech G933 RGB Headset |
| |
| Edbgon 06/21/2021 |
| Based on |
| TheRogueZeta 8/31/2020 |
\*-----------------------------------------*/
#include "RGBController_LogitechG933.h"
RGBController_LogitechG933::RGBController_LogitechG933(LogitechG933Controller* logitech_ptr)
{
logitech = logitech_ptr;
name = "Logitech G933 Lightsync Headset";
vendor = "Logitech";
type = DEVICE_TYPE_HEADSET;
description = "Logitech G933 Lightsync Headset";
location = logitech->GetDeviceLocation();
mode Off;
Off.name = "Off";
Off.value = LOGITECH_G933_MODE_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Off);
mode Direct;
Direct.name = "Direct";
Direct.value = LOGITECH_G933_MODE_DIRECT;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
SetupZones();
}
void RGBController_LogitechG933::SetupZones()
{
zone G933_logo;
G933_logo.name = "Logo";
G933_logo.type = ZONE_TYPE_SINGLE;
G933_logo.leds_min = 1;
G933_logo.leds_max = 1;
G933_logo.leds_count = 1;
G933_logo.matrix_map = NULL;
zones.push_back(G933_logo);
led G933_logo_led;
G933_logo_led.name = "Logo";
G933_logo_led.value = 0x00;
leds.push_back(G933_logo_led);
zone G933_strip;
G933_strip.name = "LED Strip";
G933_strip.type = ZONE_TYPE_SINGLE;
G933_strip.leds_min = 1;
G933_strip.leds_max = 1;
G933_strip.leds_count = 1;
G933_strip.matrix_map = NULL;
zones.push_back(G933_strip);
led G933_strip_led;
G933_strip_led.name = "Led Strip";
G933_strip_led.value = 0x01;
leds.push_back(G933_strip_led);
SetupColors();
}
void RGBController_LogitechG933::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_LogitechG933::DeviceUpdateLEDs()
{
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
{
unsigned char red = RGBGetRValue(colors[led_idx]);
unsigned char grn = RGBGetGValue(colors[led_idx]);
unsigned char blu = RGBGetBValue(colors[led_idx]);
logitech->SendHeadsetMode((unsigned char)leds[led_idx].value, modes[active_mode].value, red, grn, blu);
}
}
void RGBController_LogitechG933::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_LogitechG933::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_LogitechG933::SetCustomMode()
{
active_mode = 1;
}
void RGBController_LogitechG933::DeviceUpdateMode()
{
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
{
if(modes[active_mode].value == LOGITECH_G933_MODE_OFF)
{
logitech->SetOffMode(leds[led_idx].value);
}
else
{
/*---------------------------------------------------------*\
| Required to "reset" RGB controller and start receiving |
| color in direct mode |
\*---------------------------------------------------------*/
logitech->SetDirectMode(leds[led_idx].value);
}
}
DeviceUpdateLEDs();
}
@@ -0,0 +1,34 @@
/*-----------------------------------------*\
| RGBController_LogitechG933.h |
| |
| Generic RGB Interface for |
| G933 RGB Headset |
| |
| Edbgon 06/21/2021 |
| Based on |
| TheRogueZeta 8/31/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "LogitechG933Controller.h"
class RGBController_LogitechG933 : public RGBController
{
public:
RGBController_LogitechG933(LogitechG933Controller* logitech_ptr);
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
LogitechG933Controller* logitech;
};
@@ -0,0 +1,94 @@
/*-----------------------------------------*\
| RGBController_LogitechX56.cpp |
| |
| Generic RGB Interface Logitech X56 |
| Class |
| |
| Edbgon 11/06/2021 |
\*-----------------------------------------*/
#include "RGBController_LogitechX56.h"
RGBController_LogitechX56::RGBController_LogitechX56(LogitechX56Controller* controller_ptr)
{
controller = controller_ptr;
name = controller->GetDeviceName();
vendor = "Logitech";
type = DEVICE_TYPE_GAMEPAD;
description = "Logitech X56 Device";
location = controller->GetDeviceLocation();
serial = controller->GetSerialString();
mode Direct;
Direct.name = "Direct";
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
SetupZones();
}
RGBController_LogitechX56::~RGBController_LogitechX56()
{
delete controller;
}
void RGBController_LogitechX56::SetupZones()
{
/*---------------------------------------------------------*\
| Each device has only one zone and LED |
\*---------------------------------------------------------*/
zone x56_zone;
x56_zone.name = "X56";
x56_zone.type = ZONE_TYPE_SINGLE;
x56_zone.leds_min = 1;
x56_zone.leds_max = 1;
x56_zone.leds_count = 1;
x56_zone.matrix_map = NULL;
zones.push_back(x56_zone);
led x56_led;
x56_led.name = "X56";
leds.push_back(x56_led);
SetupColors();
}
void RGBController_LogitechX56::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_LogitechX56::DeviceUpdateLEDs()
{
controller->SetColor(colors[0]);
}
void RGBController_LogitechX56::UpdateZoneLEDs(int /*zone*/)
{
/*---------------------------------------------------------*\
| Packet expects both LEDs |
\*---------------------------------------------------------*/
DeviceUpdateLEDs();
}
void RGBController_LogitechX56::UpdateSingleLED(int /*led*/)
{
/*---------------------------------------------------------*\
| Packet expects both LEDs |
\*---------------------------------------------------------*/
DeviceUpdateLEDs();
}
void RGBController_LogitechX56::SetCustomMode()
{
active_mode = 0;
}
void RGBController_LogitechX56::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}
@@ -0,0 +1,34 @@
/*-----------------------------------------*\
| RGBController_LogitechX56.h |
| |
| Generic RGB Interface Logitech X56 |
| Class |
| |
| Edbgon 11/06/2021 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "LogitechX56Controller.h"
class RGBController_LogitechX56 : public RGBController
{
public:
RGBController_LogitechX56(LogitechX56Controller* controller_ptr);
~RGBController_LogitechX56();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
LogitechX56Controller* controller;
};
@@ -11,6 +11,7 @@
#define NZXT_SMART_DEVICE_V2_PID 0x2006
#define NZXT_KRAKEN_X3_PID 0x2007
#define NZXT_RGB_FAN_CONTROLLER_PID 0x2009
#define NZXT_SMART_DEVICE_V2_1_PID 0x200D
static void spawn_hue(hid_device_info* info, const std::string& name, int rgb_channels, int fan_channels)
{
@@ -60,3 +61,4 @@ REGISTER_HID_DETECTOR("NZXT Hue 2 Motherboard", DetectNZXTHue2Motherboard, NZ
REGISTER_HID_DETECTOR("NZXT Smart Device V2", DetectNZXTSmartDeviceV2, NZXT_VID, NZXT_SMART_DEVICE_V2_PID);
REGISTER_HID_DETECTOR("NZXT Kraken X3", DetectNZXTKrakenX3, NZXT_VID, NZXT_KRAKEN_X3_PID);
REGISTER_HID_DETECTOR("NZXT RGB & Fan Controller", DetectNZXTFanController, NZXT_VID, NZXT_RGB_FAN_CONTROLLER_PID);
REGISTER_HID_DETECTOR("NZXT Smart Device V2", DetectNZXTSmartDeviceV2, NZXT_VID, NZXT_SMART_DEVICE_V2_1_PID);
@@ -37,32 +37,44 @@ void DetectPatriotViperControllers(std::vector<i2c_smbus_interface*> &busses)
// Test for Patriot Viper RGB SPD at slot_addr
// This test was copied from Viper RGB software
// Tests SPD addresses in order: 0x00, 0x40, 0x41, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68
busses[bus]->i2c_smbus_write_byte_data(0x36, 0x00, 0xFF);
bool pass = false;
std::this_thread::sleep_for(1ms);
int res = busses[bus]->i2c_smbus_read_byte(slot_addr);
if(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x00) == 0x23)
if (res >= 0)
{
busses[bus]->i2c_smbus_write_byte_data(0x37, 0x00, 0xFF);
pass = true;
}
if(pass)
{
busses[bus]->i2c_smbus_write_byte_data(0x36, 0x00, 0xFF);
std::this_thread::sleep_for(1ms);
if((busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x40) == 0x85)
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x41) == 0x02)
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x61) == 0x4D)
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x62) == 0x49)
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x63) == 0x43)
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x64) == 0x53)
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x65) == 0x59)
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x66) == 0x53)
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x67) == 0x5f)
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x68) == 0x44))
if(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x00) == 0x23)
{
slots_valid |= (1 << (slot_addr - 0x50));
}
}
busses[bus]->i2c_smbus_write_byte_data(0x37, 0x00, 0xFF);
std::this_thread::sleep_for(1ms);
std::this_thread::sleep_for(1ms);
if((busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x40) == 0x85)
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x41) == 0x02)
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x61) == 0x4D)
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x62) == 0x49)
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x63) == 0x43)
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x64) == 0x53)
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x65) == 0x59)
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x66) == 0x53)
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x67) == 0x5f)
&&(busses[bus]->i2c_smbus_read_byte_data(slot_addr, 0x68) == 0x44))
{
slots_valid |= (1 << (slot_addr - 0x50));
}
}
std::this_thread::sleep_for(1ms);
}
}
if(slots_valid != 0)
@@ -59,6 +59,30 @@ static std::map<uint8_t, std::string> QMKKeycodeToKeynameMap
QMKOpenRGBController::QMKOpenRGBController(hid_device *dev_handle, const char *path)
{
/*-------------------------------------------------*\
| Get QMKOpenRGB settings |
\*-------------------------------------------------*/
json qmk_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("QMKOpenRGBDevices");
if(qmk_settings.contains("leds_per_update"))
{
if(qmk_settings["leds_per_update"] > 20)
{
qmk_settings["leds_per_update"] = 20;
}
else if(qmk_settings["leds_per_update"] < 1)
{
qmk_settings["leds_per_update"] = 1;
}
SettingsManager* settings_manager = ResourceManager::get()->GetSettingsManager();
settings_manager->SetSettings("QMKOpenRGBDevices", qmk_settings);
settings_manager->SaveSettings();
leds_per_update = qmk_settings["leds_per_update"];
}
else
{
leds_per_update = 20;
}
dev = dev_handle;
location = path;
@@ -150,7 +174,7 @@ unsigned int QMKOpenRGBController::GetProtocolVersion()
do
{
hid_write(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE);
bytes_read = hid_read_timeout(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE, QMK_HID_READ_TIMEOUT);
bytes_read = hid_read_timeout(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE, QMK_OPENRGB_HID_READ_TIMEOUT);
} while(bytes_read <= 0);
return usb_buf[1];
@@ -204,7 +228,7 @@ void QMKOpenRGBController::GetDeviceInfo()
do
{
hid_write(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE);
bytes_read = hid_read_timeout(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE, QMK_HID_READ_TIMEOUT);
bytes_read = hid_read_timeout(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE, QMK_OPENRGB_HID_READ_TIMEOUT);
} while(bytes_read <= 0);
total_number_of_leds = usb_buf[QMK_OPENRGB_TOTAL_NUMBER_OF_LEDS_BYTE];
@@ -244,7 +268,7 @@ void QMKOpenRGBController::GetModeInfo()
do
{
hid_write(dev, usb_buf, 65);
bytes_read = hid_read_timeout(dev, usb_buf, 65, QMK_HID_READ_TIMEOUT);
bytes_read = hid_read_timeout(dev, usb_buf, 65, QMK_OPENRGB_HID_READ_TIMEOUT);
} while(bytes_read <= 0);
mode = usb_buf[QMK_OPENRGB_MODE_BYTE];
@@ -286,7 +310,7 @@ void QMKOpenRGBController::GetLEDInfo(unsigned int led)
do
{
hid_write(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE);
bytes_read = hid_read_timeout(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE, QMK_HID_READ_TIMEOUT);
bytes_read = hid_read_timeout(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE, QMK_OPENRGB_HID_READ_TIMEOUT);
} while(bytes_read <= 0);
if(usb_buf[62] != QMK_OPENRGB_FAILURE)
@@ -329,7 +353,7 @@ bool QMKOpenRGBController::GetIsModeEnabled(unsigned int mode)
do
{
hid_write(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE);
bytes_read = hid_read_timeout(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE, QMK_HID_READ_TIMEOUT);
bytes_read = hid_read_timeout(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE, QMK_OPENRGB_HID_READ_TIMEOUT);
} while(bytes_read <= 0);
return usb_buf[1] == QMK_OPENRGB_SUCCESS ? true : false;
@@ -359,7 +383,7 @@ void QMKOpenRGBController::SetMode(hsv_t hsv_color, unsigned char mode, unsigned
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
hid_read_timeout(dev, usb_buf, 65, QMK_HID_READ_TIMEOUT);
hid_read_timeout(dev, usb_buf, 65, QMK_OPENRGB_HID_READ_TIMEOUT);
}
void QMKOpenRGBController::DirectModeSetSingleLED(unsigned int led, unsigned char red, unsigned char green, unsigned char blue)
@@ -386,13 +410,12 @@ void QMKOpenRGBController::DirectModeSetSingleLED(unsigned int led, unsigned cha
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
hid_read_timeout(dev, usb_buf, 65, QMK_HID_READ_TIMEOUT);
hid_read_timeout(dev, usb_buf, 65, QMK_OPENRGB_HID_READ_TIMEOUT);
}
void QMKOpenRGBController::DirectModeSetLEDs(std::vector<RGBColor> colors, unsigned int leds_count)
{
unsigned int leds_sent = 0;
unsigned int leds_per_update = 20;
while (leds_sent < leds_count)
{
@@ -9,14 +9,15 @@
#pragma once
#include "ResourceManager.h"
#include "RGBController.h"
#include "hsv.h"
#include <hidapi/hidapi.h>
#include <cstring>
#include <map>
#define QMK_OPENRGB_PACKET_SIZE 65
#define QMK_HID_READ_TIMEOUT 50
#define QMK_OPENRGB_PACKET_SIZE 65
#define QMK_OPENRGB_HID_READ_TIMEOUT 50
enum CommandsId
{
@@ -160,6 +161,8 @@ protected:
hid_device *dev;
private:
unsigned int leds_per_update;
std::string location;
std::string device_name;
@@ -554,7 +554,7 @@ void RGBController_QMKOpenRGB::PlaceLEDsInMaps
VectorMatrix& matrix_map_xl,
VectorMatrix& underglow_map_xl
)
{
{
matrix_map_xl = MakeEmptyMatrixMap(unique_rows.size(), std::round(255/divisor) + 10);
underglow_map_xl = MakeEmptyMatrixMap(unique_rows.size(), std::round(255/divisor) + 10);
@@ -147,6 +147,7 @@ RazerController::RazerController(hid_device* dev_handle, hid_device* dev_argb_ha
case RAZER_BLADE_2020_ADVANCED_PID:
case RAZER_BLADE_2020_BASE_PID:
case RAZER_BLADE_2021_BASE_PID:
case RAZER_BLADE_14_2021_PID:
case RAZER_BLADE_PRO_2016_PID:
case RAZER_BLADE_PRO_2017_PID:
case RAZER_BLADE_PRO_2017_FULLHD_PID:
@@ -416,6 +417,7 @@ bool RazerController::SupportsWave()
case RAZER_BLADE_2020_ADVANCED_PID:
case RAZER_BLADE_2020_BASE_PID:
case RAZER_BLADE_2021_BASE_PID:
case RAZER_BLADE_14_2021_PID:
case RAZER_BLADE_PRO_2016_PID:
case RAZER_BLADE_PRO_2017_PID:
case RAZER_BLADE_PRO_2017_FULLHD_PID:
@@ -214,12 +214,14 @@ REGISTER_HID_DETECTOR_IPU("Razer Huntsman", Det
REGISTER_HID_DETECTOR_IPU("Razer Huntsman Elite", DetectRazerControllers, RAZER_VID, RAZER_HUNTSMAN_ELITE_PID, 0x00, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Huntsman Tournament Edition", DetectRazerControllers, RAZER_VID, RAZER_HUNTSMAN_TE_PID, 0x00, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Ornata Chroma", DetectRazerControllers, RAZER_VID, RAZER_ORNATA_CHROMA_PID, 0x00, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Ornata Chroma V2", DetectRazerControllers, RAZER_VID, RAZER_ORNATA_CHROMA_V2_PID, 0x00, 0x01, 0x02);
/*-----------------------------------------------------------------------------------------------------*\
| Laptops |
\*-----------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IPU("Razer Blade (2016)", DetectRazerControllers, RAZER_VID, RAZER_BLADE_2016_PID, 0x00, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Blade (Late 2016)", DetectRazerControllers, RAZER_VID, RAZER_BLADE_LATE_2016_PID, 0x00, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Blade 14 (2021)", DetectRazerControllers, RAZER_VID, RAZER_BLADE_14_2021_PID, 0x00, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Blade 15 (2018 Advanced)", DetectRazerControllers, RAZER_VID, RAZER_BLADE_2018_ADVANCED_PID, 0x00, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Blade 15 (2018 Base)", DetectRazerControllers, RAZER_VID, RAZER_BLADE_2018_BASE_PID, 0x00, 0x01, 0x02);
REGISTER_HID_DETECTOR_IPU("Razer Blade 15 (2018 Mercury)", DetectRazerControllers, RAZER_VID, RAZER_BLADE_2018_MERCURY_PID, 0x00, 0x01, 0x02);
+125
View File
@@ -36,6 +36,8 @@
#define RAZER_BLADE_2020_BASE_PID 0x0255
#define RAZER_BLADE_2021_BASE_PID 0x026F
#define RAZER_BLADE_14_2021_PID 0x0270
#define RAZER_BLADE_PRO_2016_PID 0x0210
#define RAZER_BLADE_PRO_2017_PID 0x0225
#define RAZER_BLADE_PRO_2017_FULLHD_PID 0x022F
@@ -406,6 +408,93 @@ static const razer_key blackwidow_chroma_te_keymap[] =
{ 0, 5, 17, "Key: Right Arrow" },
};
#define BLADE_14_2021_KEYMAP_SIZE (sizeof(blade_14_2021_keymap) / sizeof(blade_14_2021_keymap[0]))
static const razer_key blade_14_2021_keymap[] =
{
/*---------------------------------------------------------------------*\
| Zone, Row, Column, Key |
\*---------------------------------------------------------------------*/
{ 0, 0, 1, "Key: Escape" },
{ 0, 0, 2, "Key: F1" },
{ 0, 0, 3, "Key: F2" },
{ 0, 0, 4, "Key: F3" },
{ 0, 0, 5, "Key: F4" },
{ 0, 0, 6, "Key: F5" },
{ 0, 0, 7, "Key: F6" },
{ 0, 0, 8, "Key: F7" },
{ 0, 0, 9, "Key: F8" },
{ 0, 0, 10, "Key: F9" },
{ 0, 0, 11, "Key: F10" },
{ 0, 0, 12, "Key: F11" },
{ 0, 0, 13, "Key: F12" },
{ 0, 0, 14, "Key: Delete" },
{ 0, 0, 15, "Key: Power" },
{ 0, 1, 1, "Key: `" },
{ 0, 1, 2, "Key: 1" },
{ 0, 1, 3, "Key: 2" },
{ 0, 1, 4, "Key: 3" },
{ 0, 1, 5, "Key: 4" },
{ 0, 1, 6, "Key: 5" },
{ 0, 1, 7, "Key: 6" },
{ 0, 1, 8, "Key: 7" },
{ 0, 1, 9, "Key: 8" },
{ 0, 1, 10, "Key: 9" },
{ 0, 1, 11, "Key: 0" },
{ 0, 1, 12, "Key: -" },
{ 0, 1, 13, "Key: =" },
{ 0, 1, 15, "Key: Backspace" },
{ 0, 2, 1, "Key: Tab" },
{ 0, 2, 2, "Key: Q" },
{ 0, 2, 3, "Key: W" },
{ 0, 2, 4, "Key: E" },
{ 0, 2, 5, "Key: R" },
{ 0, 2, 6, "Key: T" },
{ 0, 2, 7, "Key: Y" },
{ 0, 2, 8, "Key: U" },
{ 0, 2, 9, "Key: I" },
{ 0, 2, 10, "Key: O" },
{ 0, 2, 11, "Key: P" },
{ 0, 2, 12, "Key: [" },
{ 0, 2, 13, "Key: ]" },
{ 0, 2, 15, "Key: \\ (ANSI)" },
{ 0, 3, 1, "Key: Caps Lock" },
{ 0, 3, 2, "Key: A" },
{ 0, 3, 3, "Key: S" },
{ 0, 3, 4, "Key: D" },
{ 0, 3, 5, "Key: F" },
{ 0, 3, 6, "Key: G" },
{ 0, 3, 7, "Key: H" },
{ 0, 3, 8, "Key: J" },
{ 0, 3, 9, "Key: K" },
{ 0, 3, 10, "Key: L" },
{ 0, 3, 11, "Key: ;" },
{ 0, 3, 12, "Key: '" },
{ 0, 3, 15, "Key: Enter" },
{ 0, 4, 1, "Key: Left Shift" },
{ 0, 4, 3, "Key: Z" },
{ 0, 4, 4, "Key: X" },
{ 0, 4, 5, "Key: C" },
{ 0, 4, 6, "Key: V" },
{ 0, 4, 7, "Key: B" },
{ 0, 4, 8, "Key: N" },
{ 0, 4, 9, "Key: M" },
{ 0, 4, 10, "Key: ," },
{ 0, 4, 11, "Key: ." },
{ 0, 4, 12, "Key: /" },
{ 0, 4, 15, "Key: Right Shift" },
{ 0, 5, 1, "Key: Left Control" },
{ 0, 5, 2, "Key: Left Fn" },
{ 0, 5, 3, "Key: Left Windows" },
{ 0, 5, 5, "Key: Left Alt" },
{ 0, 5, 9, "Key: Right Alt" },
{ 0, 5, 11, "Key: Right Control" },
{ 0, 5, 12, "Key: Left Arrow" },
{ 0, 5, 13, "Key: Up Arrow" },
{ 0, 5, 14, "Key: Right Arrow" },
{ 0, 5, 15, "Key: Down Arrow" },
};
#define BLADE_PRO_2017_KEYMAP_SIZE (sizeof(blade_pro_2017_keymap) / sizeof(blade_pro_2017_keymap[0]))
static const razer_key blade_pro_2017_keymap[] =
@@ -2515,6 +2604,41 @@ static const razer_device blade_15_2021_base_device =
0
};
/*-------------------------------------------------------------*\
| Razer Blade 14 (2021) |
| |
| Zone "Keyboard" |
| Matrix |
| 6 Rows, 16 Columns |
\*-------------------------------------------------------------*/
static const razer_zone blade_14_2021_zone =
{
"Keyboard",
ZONE_TYPE_MATRIX,
6,
16
};
static const razer_device blade_14_2021_device =
{
"Razer Blade 14 (2021)",
RAZER_BLADE_14_2021_PID,
DEVICE_TYPE_KEYBOARD,
true,
6,
16,
{
&blade_14_2021_zone,
NULL,
NULL,
NULL,
NULL,
NULL
},
blade_14_2021_keymap,
BLADE_14_2021_KEYMAP_SIZE
};
/*-------------------------------------------------------------*\
| Razer Blade Pro (2016) |
| |
@@ -5548,6 +5672,7 @@ static const razer_device* device_list[] =
&blade_15_2020_advanced_device,
&blade_15_2020_base_device,
&blade_15_2021_base_device,
&blade_14_2021_device,
&blade_pro_2016_device,
&blade_pro_2017_device,
&blade_pro_2017_fullhd_device,
@@ -12,6 +12,7 @@
#define REDRAGON_MOUSE_USAGE_PAGE 0xFFA0
#define REDRAGON_M711_PID 0xFC30
#define REDRAGON_M715_PID 0xFC39
#define REDRAGON_M716_PID 0xFC3A
#define REDRAGON_M908_PID 0xFC4D
/******************************************************************************************\
@@ -37,6 +38,7 @@ void DetectRedragonMice(hid_device_info* info, const std::string& name)
/*---------------------------------------------------------------------------------------------------------------------------------------------*\
| Mice |
\*---------------------------------------------------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IP("Redragon M711 Cobra", DetectRedragonMice, REDRAGON_MOUSE_VID, REDRAGON_M711_PID, 2, REDRAGON_MOUSE_USAGE_PAGE);
REGISTER_HID_DETECTOR_IP("Redragon M715 Dagger", DetectRedragonMice, REDRAGON_MOUSE_VID, REDRAGON_M715_PID, 2, REDRAGON_MOUSE_USAGE_PAGE);
REGISTER_HID_DETECTOR_IP("Redragon M908 Impact", DetectRedragonMice, REDRAGON_MOUSE_VID, REDRAGON_M908_PID, 2, REDRAGON_MOUSE_USAGE_PAGE);
REGISTER_HID_DETECTOR_IP("Redragon M711 Cobra", DetectRedragonMice, REDRAGON_MOUSE_VID, REDRAGON_M711_PID, 2, REDRAGON_MOUSE_USAGE_PAGE);
REGISTER_HID_DETECTOR_IP("Redragon M715 Dagger", DetectRedragonMice, REDRAGON_MOUSE_VID, REDRAGON_M715_PID, 2, REDRAGON_MOUSE_USAGE_PAGE);
REGISTER_HID_DETECTOR_IP("Redragon M716 Inquisitor", DetectRedragonMice, REDRAGON_MOUSE_VID, REDRAGON_M716_PID, 2, REDRAGON_MOUSE_USAGE_PAGE);
REGISTER_HID_DETECTOR_IP("Redragon M908 Impact", DetectRedragonMice, REDRAGON_MOUSE_VID, REDRAGON_M908_PID, 2, REDRAGON_MOUSE_USAGE_PAGE);
@@ -0,0 +1,472 @@
/*------------------------------------------*\
| RGBController_SinowealthKeyboard.cpp |
| |
| Definitions and types for Sinowealth |
| Keyboard, Hopefully generic, this was |
| made spefically for FL eSports F11 KB |
| |
| Dmitri Kalinichenko (Dima-Kal) 23/06/2021 |
\*-----------------------------------------=*/
#include "RGBController_SinowealthKeyboard.h"
#define NA 0xFFFFFFFF
static unsigned int tkl_matrix_map[6][17] =
{ { 8, NA, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24},
{ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45},
{ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66},
{ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 84, NA, NA, NA, NA},
{ 93, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 106, NA, NA, NA, 107, NA},
{ 113, 114, 115, NA, NA, NA, 118, NA, NA, NA, NA, 121, 122, 123, 127, 128, 129}};
static const char *led_names_tkl[] =
{
"Key: Escape",
"Key: F1",
"Key: F2",
"Key: F3",
"Key: F4",
"Key: F5",
"Key: F6",
"Key: F7",
"Key: F8",
"Key: F9",
"Key: F10",
"Key: F11",
"Key: F12",
"Key: Print Screen",
"Key: Scroll Lock",
"Key: Pause",
"Key: `",
"Key: 1",
"Key: 2",
"Key: 3",
"Key: 4",
"Key: 5",
"Key: 6",
"Key: 7",
"Key: 8",
"Key: 9",
"Key: 0",
"Key: -",
"Key: =",
"Key: Backspace",
"Key: Insert",
"Key: Home",
"Key: Page Up",
"Key: Tab",
"Key: Q",
"Key: W",
"Key: E",
"Key: R",
"Key: T",
"Key: Y",
"Key: U",
"Key: I",
"Key: O",
"Key: P",
"Key: [",
"Key: ]",
"Key: \\",
"Key: Delete",
"Key: End",
"Key: Page Down",
"Key: Caps Lock",
"Key: A",
"Key: S",
"Key: D",
"Key: F",
"Key: G",
"Key: H",
"Key: J",
"Key: K",
"Key: L",
"Key: ;",
"Key: '",
"Key: Enter",
"Key: Left Shift",
"Key: Z",
"Key: X",
"Key: C",
"Key: V",
"Key: B",
"Key: N",
"Key: M",
"Key: ,",
"Key: .",
"Key: /",
"Key: Right Shift",
"Key: Up Arrow",
"Key: Left Control",
"Key: Left Windows",
"Key: Left Alt",
"Key: Space",
"Key: Right Control",
"Key: Right Alt",
"Key: Right Windows",
"Key: Right Fn",
"Key: Left Arrow",
"Key: Down Arrow",
"Key: Right Arrow",
};
RGBController_SinowealthKeyboard::RGBController_SinowealthKeyboard(SinowealthKeyboardController* sinowealth_ptr)
{
sinowealth = sinowealth_ptr;
name = "Sinowealth Keyboard";
type = DEVICE_TYPE_KEYBOARD;
description = "Sinowealth Keyboard";
location = sinowealth->GetLocation();
serial = sinowealth->GetSerialString();
mode Static;
Static.name = "Static";
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
Static.value = MODE_STATIC;
Static.colors_min = 1;
Static.colors_max = 1;
Static.colors.resize(1);
modes.push_back(Static);
mode Custom;
Custom.name = "Custom";
Custom.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Custom.color_mode = MODE_COLORS_PER_LED;
Custom.value = MODE_PER_KEY;
modes.push_back(Custom);
mode Off;
Off.name = "Off";
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
Off.value = MODE_OFF;
modes.push_back(Off);
mode Respire;
Respire.name = "Respire";
Respire.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Respire.speed_min = SPEED_SLOW;
Respire.speed = SPEED_NORMAL;
Respire.speed_max = SPEED_FASTEST;
Respire.color_mode = MODE_COLORS_RANDOM;
Respire.value = MODE_RESPIRE;
Respire.colors_min = 1;
Respire.colors_max = 1;
Respire.colors.resize(1);
modes.push_back(Respire);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Rainbow.speed_min = SPEED_SLOW;
Rainbow.speed = SPEED_NORMAL;
Rainbow.speed_max = SPEED_FASTEST;
Rainbow.color_mode = MODE_COLORS_NONE;
Rainbow.value = MODE_RAINBOW;
modes.push_back(Rainbow);
mode FlashAway;
FlashAway.name = "Flash Away";
FlashAway.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
FlashAway.speed_min = SPEED_SLOW;
FlashAway.speed = SPEED_NORMAL;
FlashAway.speed_max = SPEED_FASTEST;
FlashAway.color_mode = MODE_COLORS_RANDOM;
FlashAway.value = MODE_FLASH_AWAY;
FlashAway.colors_min = 1;
FlashAway.colors_max = 1;
FlashAway.colors.resize(1);
modes.push_back(FlashAway);
mode Raindrops;
Raindrops.name = "Raindrops";
Raindrops.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Raindrops.speed_min = SPEED_SLOW;
Raindrops.speed = SPEED_NORMAL;
Raindrops.speed_max = SPEED_FASTEST;
Raindrops.color_mode = MODE_COLORS_RANDOM;
Raindrops.value = MODE_RAINDROPS;
Raindrops.colors_min = 1;
Raindrops.colors_max = 1;
Raindrops.colors.resize(1);
modes.push_back(Raindrops);
mode RainbowWheel;
RainbowWheel.name = "Rainbow Wheel";
RainbowWheel.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
RainbowWheel.speed_min = SPEED_SLOW;
RainbowWheel.speed = SPEED_NORMAL;
RainbowWheel.speed_max = SPEED_FASTEST;
RainbowWheel.color_mode = MODE_COLORS_RANDOM;
RainbowWheel.value = MODE_RAINBOW_WHEEL;
RainbowWheel.colors_min = 1;
RainbowWheel.colors_max = 1;
RainbowWheel.colors.resize(1);
modes.push_back(RainbowWheel);
mode RipplesShining;
RipplesShining.name = "Ripples Shining";
RipplesShining.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
RipplesShining.speed_min = SPEED_SLOW;
RipplesShining.speed = SPEED_NORMAL;
RipplesShining.speed_max = SPEED_FASTEST;
RipplesShining.color_mode = MODE_COLORS_RANDOM;
RipplesShining.value = MODE_RIPPLES_SHINING;
RipplesShining.colors_min = 1;
RipplesShining.colors_max = 1;
RipplesShining.colors.resize(1);
modes.push_back(RipplesShining);
mode StarsTwinkle;
StarsTwinkle.name = "Stars Twinkle";
StarsTwinkle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
StarsTwinkle.speed_min = SPEED_SLOW;
StarsTwinkle.speed = SPEED_NORMAL;
StarsTwinkle.speed_max = SPEED_FASTEST;
StarsTwinkle.color_mode = MODE_COLORS_RANDOM;
StarsTwinkle.value = MODE_STARS_TWINKLE;
StarsTwinkle.colors_min = 1;
StarsTwinkle.colors_max = 1;
StarsTwinkle.colors.resize(1);
modes.push_back(StarsTwinkle);
mode ShadowDisappear;
ShadowDisappear.name = "Shadow Disappear";
ShadowDisappear.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
ShadowDisappear.speed_min = SPEED_SLOW;
ShadowDisappear.speed = SPEED_NORMAL;
ShadowDisappear.speed_max = SPEED_FASTEST;
ShadowDisappear.color_mode = MODE_COLORS_RANDOM;
ShadowDisappear.value = MODE_SHADOW_DISAPPEAR;
ShadowDisappear.colors_min = 1;
ShadowDisappear.colors_max = 1;
ShadowDisappear.colors.resize(1);
modes.push_back(ShadowDisappear);
mode RetroSnake;
RetroSnake.name = "Retro Snake";
RetroSnake.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
RetroSnake.speed_min = SPEED_SLOW;
RetroSnake.speed = SPEED_NORMAL;
RetroSnake.speed_max = SPEED_FASTEST;
RetroSnake.color_mode = MODE_COLORS_RANDOM;
RetroSnake.value = MODE_RETRO_SNAKE;
RetroSnake.colors_min = 1;
RetroSnake.colors_max = 1;
RetroSnake.colors.resize(1);
modes.push_back(RetroSnake);
mode NeonStream;
NeonStream.name = "Neon Stream";
NeonStream.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
NeonStream.speed_min = SPEED_SLOW;
NeonStream.speed = SPEED_NORMAL;
NeonStream.speed_max = SPEED_FASTEST;
NeonStream.color_mode = MODE_COLORS_RANDOM;
NeonStream.value = MODE_NEON_STREAM;
NeonStream.colors_min = 1;
NeonStream.colors_max = 1;
NeonStream.colors.resize(1);
modes.push_back(NeonStream);
mode Reaction;
Reaction.name = "Reaction";
Reaction.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Reaction.speed_min = SPEED_SLOW;
Reaction.speed = SPEED_NORMAL;
Reaction.speed_max = SPEED_FASTEST;
Reaction.color_mode = MODE_COLORS_RANDOM;
Reaction.value = MODE_REACTION;
Reaction.colors_min = 1;
Reaction.colors_max = 1;
Reaction.colors.resize(1);
modes.push_back(Reaction);
mode SineWave;
SineWave.name = "Sine Wave";
SineWave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
SineWave.speed_min = SPEED_SLOW;
SineWave.speed = SPEED_NORMAL;
SineWave.speed_max = SPEED_FASTEST;
SineWave.color_mode = MODE_COLORS_RANDOM;
SineWave.value = MODE_SINE_WAVE;
SineWave.colors_min = 1;
SineWave.colors_max = 1;
SineWave.colors.resize(1);
modes.push_back(SineWave);
mode RetinueScanning;
RetinueScanning.name = "Retinue Scanning";
RetinueScanning.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
RetinueScanning.speed_min = SPEED_SLOW;
RetinueScanning.speed = SPEED_NORMAL;
RetinueScanning.speed_max = SPEED_FASTEST;
RetinueScanning.color_mode = MODE_COLORS_RANDOM;
RetinueScanning.value = MODE_RETINUE_SCANNING;
RetinueScanning.colors_min = 1;
RetinueScanning.colors_max = 1;
RetinueScanning.colors.resize(1);
modes.push_back(RetinueScanning);
mode RotatingWindmill;
RotatingWindmill.name = "Rotating Windmill";
RotatingWindmill.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
RotatingWindmill.speed_min = SPEED_SLOW;
RotatingWindmill.speed = SPEED_NORMAL;
RotatingWindmill.speed_max = SPEED_FASTEST;
RotatingWindmill.color_mode = MODE_COLORS_RANDOM;
RotatingWindmill.value = MODE_ROTATING_WINDMILL;
RotatingWindmill.colors_min = 1;
RotatingWindmill.colors_max = 1;
RotatingWindmill.colors.resize(1);
modes.push_back(RotatingWindmill);
mode ColorfulWaterfall;
ColorfulWaterfall.name = "Colorful Waterfall";
ColorfulWaterfall.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
ColorfulWaterfall.speed_min = SPEED_SLOW;
ColorfulWaterfall.speed = SPEED_NORMAL;
ColorfulWaterfall.speed_max = SPEED_FASTEST;
ColorfulWaterfall.color_mode = MODE_COLORS_NONE;
ColorfulWaterfall.value = MODE_COLORFUL_WATERFALL;
modes.push_back(ColorfulWaterfall);
mode Blossoming;
Blossoming.name = "Blossoming";
Blossoming.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Blossoming.speed_min = SPEED_SLOW;
Blossoming.speed = SPEED_NORMAL;
Blossoming.speed_max = SPEED_FASTEST;
Blossoming.color_mode = MODE_COLORS_NONE;
Blossoming.value = MODE_BLOSSOMING;
modes.push_back(Blossoming);
mode RotatingStorm;
RotatingStorm.name = "Rotating Storm";
RotatingStorm.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
RotatingStorm.speed_min = SPEED_SLOW;
RotatingStorm.speed = SPEED_NORMAL;
RotatingStorm.speed_max = SPEED_FASTEST;
RotatingStorm.color_mode = MODE_COLORS_RANDOM;
RotatingStorm.value = MODE_ROTATING_STORM;
RotatingStorm.colors_min = 1;
RotatingStorm.colors_max = 1;
RotatingStorm.colors.resize(1);
modes.push_back(RotatingStorm);
mode Collision;
Collision.name = "Collision";
Collision.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Collision.speed_min = SPEED_SLOW;
Collision.speed = SPEED_NORMAL;
Collision.speed_max = SPEED_FASTEST;
Collision.color_mode = MODE_COLORS_RANDOM;
Collision.value = MODE_COLLISION;
Collision.colors_min = 1;
Collision.colors_max = 1;
Collision.colors.resize(1);
modes.push_back(Collision);
mode Perfect;
Perfect.name = "Perfect";
Perfect.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Perfect.speed_min = SPEED_SLOW;
Perfect.speed = SPEED_NORMAL;
Perfect.speed_max = SPEED_FASTEST;
Perfect.color_mode = MODE_COLORS_RANDOM;
Perfect.value = MODE_PERFECT;
Perfect.colors_min = 1;
Perfect.colors_max = 1;
Perfect.colors.resize(1);
modes.push_back(Perfect);
SetupZones();
}
RGBController_SinowealthKeyboard::~RGBController_SinowealthKeyboard()
{
delete sinowealth;
}
void RGBController_SinowealthKeyboard::SetupZones()
{
/*---------------------------------------------------------*\
| Set up zones |
\*---------------------------------------------------------*/
zone new_zone;
new_zone.name = "Keyboard";
new_zone.type = ZONE_TYPE_MATRIX;
new_zone.leds_min = 86;
new_zone.leds_max = 86;
new_zone.leds_count = 86;
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = 6;
new_zone.matrix_map->width = 17;
new_zone.matrix_map->map = (unsigned int *)&tkl_matrix_map;
zones.push_back(new_zone);
/*---------------------------------------------------------*\
| Set up LEDs |
\*---------------------------------------------------------*/
for(unsigned int led_idx = 0; led_idx < 86; led_idx++)
{
led new_led;
new_led.name = led_names_tkl[led_idx];
leds.push_back(new_led);
}
SetupColors();
}
void RGBController_SinowealthKeyboard::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_SinowealthKeyboard::DeviceUpdateLEDs()
{
sinowealth->SetLEDsDirect(colors);
}
void RGBController_SinowealthKeyboard::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_SinowealthKeyboard::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_SinowealthKeyboard::SetCustomMode()
{
active_mode = 0;
}
void RGBController_SinowealthKeyboard::DeviceUpdateMode()
{
unsigned int brightness = BRIGHTNESS_FULL;
RGBColor* selected_color = (modes[active_mode].color_mode == MODE_COLORS_NONE) ? 0 : &modes[active_mode].colors[0];
if(modes[active_mode].value == MODE_STATIC)
{
sinowealth->SetStaticColor(selected_color);
}
else
{
sinowealth->SetMode(modes[active_mode].value, brightness, modes[active_mode].speed, modes[active_mode].color_mode, selected_color);
}
}
@@ -0,0 +1,36 @@
/*------------------------------------------*\
| RGBController_SinowealthKeyboard.h |
| |
| Definitions and types for Sinowealth |
| Keyboard, Hopefully generic, this was |
| made spefically for FL eSports F11 KB |
| |
| Dmitri Kalinichenko (Dima-Kal) 23/06/2021 |
\*-----------------------------------------=*/
#pragma once
#include "RGBController.h"
#include "SinowealthKeyboardController.h"
class RGBController_SinowealthKeyboard : public RGBController
{
public:
RGBController_SinowealthKeyboard(SinowealthKeyboardController* sinowealth_ptr);
~RGBController_SinowealthKeyboard();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
SinowealthKeyboardController* sinowealth;
};
@@ -1,13 +1,18 @@
#include "Detector.h"
#include "SinowealthController.h"
#include "SinowealthKeyboardController.h"
#include "RGBController.h"
#include "RGBController_Sinowealth.h"
#include "RGBController_SinowealthKeyboard.h"
#include <hidapi/hidapi.h>
#define SINOWEALTH_VID 0x258A
#define Glorious_Model_O_PID 0x0036
#define Glorious_Model_D_PID 0x0033
#define Everest_GT100_PID 0x0029
#define Fl_Esports_F11_PID 0x0049
typedef struct
{
@@ -26,7 +31,37 @@ typedef struct
* *
\******************************************************************************************/
void DetectSinowealthControllers(hid_device_info* info, const std::string& name)
int GetUsageCount(hid_device_info* info, hid_device* usages[])
{
int usage_count = 0;
hid_device_info* info_temp = info;
while(info_temp)
{
if(info_temp->vendor_id == info->vendor_id // constant SINOWEALTH_VID
&& info_temp->product_id == info->product_id // NON-constant
&& info_temp->usage_page == info->usage_page) // constant 0xFF00
{
if(usage_count > 3)
{
// Error! We only know what to do with those with 3 entries
break;
}
usages[usage_count] = hid_open_path(info_temp->path);
if(usages[usage_count])
{
++usage_count;
}
// An error otherwise?
}
info_temp = info_temp->next;
}
return usage_count;
}
void DetectSinowealthMouse(hid_device_info* info, const std::string& name)
{
#ifdef _WIN32
@@ -37,29 +72,8 @@ void DetectSinowealthControllers(hid_device_info* info, const std::string& name)
| all three (1), so we try to rely on their order being the same. If it's not, we're screwed. |
\*-------------------------------------------------------------------------------------------------*/
hid_device* usages[3];
int usage_count = 0;
hid_device_info* info_temp = info;
unsigned int usage_count = GetUsageCount(info, usages);
while(info_temp)
{
if(info_temp->vendor_id == info->vendor_id // constant SINOWEALTH_VID
&& info_temp->product_id == info->product_id // NON-constant
&& info_temp->usage_page == info->usage_page) // constant 0xFF00
{
if(usage_count > 3)
{
// Error! We only know what to do with those with 3 entries
break;
}
usages[usage_count] = hid_open_path(info_temp->path);
if(usages[usage_count])
{
++usage_count;
}
// An error otherwise?
}
info_temp = info_temp->next;
}
if(usage_count == 3)
{
SinowealthController* controller = new SinowealthController(usages[0], usages[2], info->path);
@@ -89,12 +103,51 @@ void DetectSinowealthControllers(hid_device_info* info, const std::string& name)
#endif
}
#ifdef USE_HID_USAGE
REGISTER_HID_DETECTOR_P("Glorious Model O / O-", DetectSinowealthControllers, SINOWEALTH_VID, Glorious_Model_O_PID, 0xFF00);
REGISTER_HID_DETECTOR_P("Glorious Model D / D-", DetectSinowealthControllers, SINOWEALTH_VID, Glorious_Model_D_PID, 0xFF00);
REGISTER_HID_DETECTOR_P("Everest GT-100 RGB", DetectSinowealthControllers, SINOWEALTH_VID, Everest_GT100_PID, 0xFF00);
void DetectSinowealthKeyboard(hid_device_info* info, const std::string& name)
{
#ifdef _WIN32
hid_device* usages[3];
unsigned int usage_count = GetUsageCount(info, usages);
if(usage_count == 3)
{
SinowealthKeyboardController* controller = new SinowealthKeyboardController(usages[1], usages[2], info->path);
RGBController_SinowealthKeyboard* rgb_controller = new RGBController_SinowealthKeyboard(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
else
{
for(int i = 0; i < usage_count; ++i)
{
if(usages[i])
{
hid_close(usages[i]);
}
}
}
#else
REGISTER_HID_DETECTOR_I("Glorious Model O / O-", DetectSinowealthControllers, SINOWEALTH_VID, Glorious_Model_O_PID, 1);
REGISTER_HID_DETECTOR_I("Glorious Model D / D-", DetectSinowealthControllers, SINOWEALTH_VID, Glorious_Model_D_PID, 1);
REGISTER_HID_DETECTOR_I("Everest GT-100 RGB", DetectSinowealthControllers, SINOWEALTH_VID, Everest_GT100_PID, 1);
hid_device* dev = hid_open_path(info->path);
if(dev)
{
SinowealthController* controller = new SinowealthController(dev, dev, info->path);
RGBController_Sinowealth* rgb_controller = new RGBController_Sinowealth(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
#endif
}
#ifdef USE_HID_USAGE
REGISTER_HID_DETECTOR_P("Glorious Model O / O-", DetectSinowealthMouse, SINOWEALTH_VID, Glorious_Model_O_PID, 0xFF00);
REGISTER_HID_DETECTOR_P("Glorious Model D / D-", DetectSinowealthMouse, SINOWEALTH_VID, Glorious_Model_D_PID, 0xFF00);
REGISTER_HID_DETECTOR_P("Everest GT-100 RGB", DetectSinowealthMouse, SINOWEALTH_VID, Everest_GT100_PID, 0xFF00);
REGISTER_HID_DETECTOR_P("FL ESPORTS F11", DetectSinowealthKeyboard, SINOWEALTH_VID, Fl_Esports_F11_PID, 0xFF00);
#else
REGISTER_HID_DETECTOR_I("Glorious Model O / O-", DetectSinowealthMouse, SINOWEALTH_VID, Glorious_Model_O_PID, 1);
REGISTER_HID_DETECTOR_I("Glorious Model D / D-", DetectSinowealthMouse, SINOWEALTH_VID, Glorious_Model_D_PID, 1);
REGISTER_HID_DETECTOR_I("Everest GT-100 RGB", DetectSinowealthMouse, SINOWEALTH_VID, Everest_GT100_PID, 1);
REGISTER_HID_DETECTOR_I("FL ESPORTS F11", DetectSinowealthKeyboard, SINOWEALTH_VID, Fl_Esports_F11_PID, 1);
#endif
@@ -0,0 +1,281 @@
/*------------------------------------------*\
| SinowealthKeyboardController.cpp |
| |
| Definitions and types for Sinowealth |
| Keyboard, Hopefully generic, this was |
| made spefically for FL eSports F11 KB |
| |
| Dmitri Kalinichenko (Dima-Kal) 23/06/2021 |
\*-----------------------------------------=*/
#include "SinowealthKeyboardController.h"
#include <cstring>
static unsigned char handshake_packet[] = { 0x06, 0x03, 0x01, 0x00, 0x08, 0x04 };
static unsigned char send_per_key_part_of_command_packet[] = { 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00,
0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00,
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
static unsigned char mode_brightness_speed_packet[] = { 0x06, 0x03, 0xB6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x5A, 0xA5, 0x03, 0x03, 0x00, 0x00, 0x00, 0x02, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00,
0x55, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x20, 0x00, 0x44, 0x07, 0x30,
0x07, 0x23, 0x00, 0x23, 0x00, 0x23, 0x07, 0x33, 0x07, 0x23, 0x07, 0x23, 0x07, 0x23, 0x07, 0x23,
0x07, 0x23, 0x07, 0x23, 0x07, 0x23, 0x07, 0x23, 0x07, 0x23, 0x07, 0x23, 0x07, 0x23, 0x07, 0x23,
0x07, 0x23, 0x00, 0x10, 0x00, 0x10, 0x07, 0x44, 0x07, 0x44, 0x07, 0x44, 0x07, 0x44, 0x07, 0x44,
0x07, 0x44, 0x07, 0x44, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5A, 0xA5, 0x03, 0x03 };
static unsigned char tkl_keys_per_key_index[] = { 0x08, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x1d, 0x1E, 0x1F,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D,
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
0x40, 0x41, 0x42, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
0x50, 0x51, 0x52, 0x54, 0x5D, 0x5f,
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x6A, 0x6B,
0x71, 0x72, 0x73, 0x76, 0x79, 0x7A, 0x7B, 0x7F, 0x80, 0x81 };
static unsigned int keys_tkl_keys_indices_static_command[] = { 0x0022, 0x0024, 0x0026, 0x0027, 0x0029, 0x002B, 0x002D, 0x002E, 0x002F,
0x0030, 0x0031, 0x0032, 0x0037, 0x0039, 0x003B, 0x003C, 0x003E,
0x0040, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x004C, 0x004E,
0x0050, 0x0051, 0x0053, 0x0055, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C,
0x0061, 0x0063, 0x0065, 0x0066, 0x0068, 0x006A, 0x006C, 0x006D, 0x006E, 0x006F,
0x0070, 0x0071, 0x0076, 0x0078, 0x007A, 0x007B, 0x007D, 0x007F,
0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x008B, 0x008D, 0x008F,
0x0090, 0x0092, 0x0094, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B,
0x00A0, 0x00A2, 0x00A4, 0x00A5, 0x00A7, 0x00A9, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
0x00B0, 0x00B5, 0x00B7, 0x00B9, 0x00BA, 0x00BC, 0x00BE,
0x00C0, 0x00E1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00CA, 0x00CC, 0x00CE, 0x00CF,
0x00D1, 0x00D3, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DF,
0x00E1, 0x00E3, 0x00E4, 0x00E6, 0x00E8, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
0x00F4, 0x00F6, 0x00F8, 0x00F9, 0x00FB, 0x00FD, 0x00FF,
0x0100, 0x0101, 0x0102, 0x0103, 0x0104, 0x0109, 0x010B, 0x010D, 0x010E,
0x0110, 0x0112, 0x0114, 0x0115, 0x0116, 0x0117, 0x0118, 0x0119, 0x011E,
0x0120, 0x0122, 0x0123, 0x0125, 0x0127, 0x0129, 0x012A, 0x012B, 0x012C, 0x012D, 0x012E,
0x0133, 0x0135, 0x0137, 0x0138, 0x013A, 0x013C, 0x013E, 0x013F,
0x0140, 0x0141, 0x0142, 0x0143, 0x0148, 0x014A, 0x014C, 0x014D, 0x014F,
0x0151, 0x0153, 0x0154, 0x0155, 0x0156, 0x0157, 0x0158, 0x015D, 0x015F,
0x0161, 0x0162, 0x0164, 0x0166, 0x0168, 0x0169, 0x016A, 0x016B, 0x016C, 0x016D,
0x0172, 0x0174, 0x0176, 0x0177, 0x0179, 0x017B, 0x017D, 0x017E, 0x017F,
0x0180, 0x0181, 0x0182, 0x0187, 0x0189, 0x018B, 0x018C, 0x018E,
0x0190, 0x0192, 0x0193, 0x0194, 0x0195, 0x0196, 0x0197, 0x019C, 0x019E,
0x01A0, 0x01A1, 0x01A3, 0x01A5, 0x01A7, 0x01A8, 0x01A9, 0x01AA, 0x01AB, 0x01AC,
0x01B1, 0x01B3, 0x01B5, 0x01B6, 0x01B8, 0x01BA, 0x01BC, 0x01BD, 0x01BE, 0x01BF,
0x01C0, 0x01C1, 0x01C6, 0x01C8, 0x01CA, 0x01Cb, 0x01CD, 0x01CF,
0x01D1, 0x01D2, 0x01D3, 0x01D4, 0x01D5, 0x01D6, 0x01DB, 0x01DD, 0x01DF,
0x01E0, 0x01E2, 0x01E4, 0x01E6, 0x01E7, 0x01E8, 0x01E9, 0x01EA};
SinowealthKeyboardController::SinowealthKeyboardController(hid_device* dev_handle_id_4, hid_device* dev_handle_id_5, char* path)
{
dev_report_id_4 = dev_handle_id_4;
dev_report_id_5 = dev_handle_id_5;
led_count = sizeof(tkl_keys_per_key_index) / sizeof(*tkl_keys_per_key_index);
current_mode = MODE_STATIC;
current_speed = SPEED_NORMAL;
location = path;
}
SinowealthKeyboardController::~SinowealthKeyboardController()
{
hid_close(dev_report_id_4);
hid_close(dev_report_id_5);
}
std::string SinowealthKeyboardController::GetLocation()
{
return("HID: " + location);
}
unsigned char SinowealthKeyboardController::GetCurrentMode()
{
return current_mode;
}
unsigned int SinowealthKeyboardController::GetLEDCount()
{
return(sizeof(tkl_keys_per_key_index) / sizeof(*tkl_keys_per_key_index));
}
std::string SinowealthKeyboardController::GetSerialString()
{
wchar_t serial_string[128];
int ret = hid_get_serial_number_string(dev_report_id_4, serial_string, 128);
if(ret != 0)
{
return("");
}
std::wstring return_wstring = serial_string;
std::string return_string(return_wstring.begin(), return_wstring.end());
return(return_string);
}
void SinowealthKeyboardController::SetLEDsDirect(std::vector<RGBColor> colors)
{
const int buffer_size = 1032;
unsigned char buf[buffer_size];
unsigned int num_keys = sizeof(tkl_keys_per_key_index) / sizeof(*tkl_keys_per_key_index);
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(buf, 0x00, sizeof(buf));
/*-----------------------------------------------------*\
| Set up Direct packet |
\*-----------------------------------------------------*/
buf[0x00] = 0x06;
buf[0x01] = 0x09;
buf[0x02] = 0xBC;
buf[0x03] = 0x00;
buf[0x04] = 0x40;
for(unsigned int i = 0 ; i < (sizeof(send_per_key_part_of_command_packet) / sizeof(char)); i++)
{
buf[0x027C + i] = send_per_key_part_of_command_packet[i];
}
/*-----------------------------------------------------*\
| Fill in color data |
\*-----------------------------------------------------*/
for(int i = 0; i < num_keys; i++)
{
buf[tkl_keys_per_key_index[i]] = RGBGetBValue(colors[i]);
buf[tkl_keys_per_key_index[i] + 0x7E] = RGBGetGValue(colors[i]);
buf[tkl_keys_per_key_index[i] + 0x7E + 0x7E] = RGBGetRValue(colors[i]);
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev_report_id_5, buf, sizeof(buf));
}
void SinowealthKeyboardController::SetStaticColor(RGBColor* color_buf)
{
const int buffer_size = 1032;
unsigned char usb_buf[buffer_size];
memset(usb_buf, 0x00, sizeof(usb_buf));
int offset = 0;
usb_buf[offset] = 0x06;
offset += 1;
usb_buf[offset] = 0x08;
offset += 1;
usb_buf[offset] = 0xB8;
offset += 2;
usb_buf[offset] = 0x40;
usb_buf[0x1D] = RGBGetRValue(color_buf[0]);
usb_buf[0x1E] = RGBGetGValue(color_buf[0]);
usb_buf[0x1F] = RGBGetBValue(color_buf[0]);
unsigned int size_of_keys_array = sizeof (keys_tkl_keys_indices_static_command)/ sizeof(int);
for(unsigned int i = 0x00; i < size_of_keys_array; i++)
{
unsigned int key_code = keys_tkl_keys_indices_static_command[i];
usb_buf[key_code] = 0xFF;
}
hid_send_feature_report(dev_report_id_5, usb_buf, sizeof(usb_buf));
}
void SinowealthKeyboardController::SetMode(unsigned char mode, unsigned char brightness, unsigned char speed, unsigned char color_mode, RGBColor* color_buf)
{
const int buffer_size = 1032;
int mode_byte_index = 0x15;
const int speed_and_brightness_byte_index_start = 0x29; // Speed + brightnes level value, Seriously?
unsigned int color_mode_value = color_mode == MODE_COLORS_RANDOM ? 0x07 : 0x00; // 0x07 - Value to set random color mode
unsigned char usb_buf[buffer_size];
memset(usb_buf, 0x00, sizeof(usb_buf));
unsigned int mode_brightness_speed_packet_length = sizeof(mode_brightness_speed_packet)/sizeof(char);
for(unsigned int i = 0x00; i < mode_brightness_speed_packet_length; i++)
{
usb_buf[i] = mode_brightness_speed_packet[i];
}
usb_buf[mode_byte_index] = mode;
int speed_and_brightness_byte_index = speed_and_brightness_byte_index_start + ((mode - 2) * 2);
switch(mode)
{
case MODE_OFF:
break;
case MODE_RAINBOW:
break;
case MODE_FLASH_AWAY:
break;
case MODE_RAINDROPS:
break;
case MODE_RAINBOW_WHEEL:
break;
case MODE_RIPPLES_SHINING:
break;
case MODE_STARS_TWINKLE:
break;
case MODE_SHADOW_DISAPPEAR:
break;
case MODE_RETRO_SNAKE:
break;
case MODE_NEON_STREAM:
break;
case MODE_REACTION:
break;
case MODE_SINE_WAVE:
break;
case MODE_RETINUE_SCANNING:
break;
case MODE_ROTATING_WINDMILL:
break;
case MODE_COLORFUL_WATERFALL:
break;
case MODE_BLOSSOMING:
break;
case MODE_ROTATING_STORM:
break;
case MODE_COLLISION:
break;
case MODE_PERFECT:
break;
case MODE_PER_KEY:
usb_buf[mode_byte_index - 1] = 0x01;
usb_buf[0x27] = 0x24;
break;
}
int color_mode_byte_index = speed_and_brightness_byte_index - 1;
usb_buf[speed_and_brightness_byte_index] = speed + brightness;
usb_buf[color_mode_byte_index] = color_mode_value;
int result = hid_send_feature_report(dev_report_id_5, usb_buf, sizeof(usb_buf));
if(result != -1)
{
current_mode = mode;
}
}
@@ -0,0 +1,90 @@
/*------------------------------------------*\
| SinowealthKeyboardController.h |
| |
| Definitions and types for Sinowealth |
| Keyboard, Hopefully generic, this was |
| made spefically for FL eSports F11 KB |
| |
| Dmitri Kalinichenko (Dima-Kal) 23/06/2021 |
\*-----------------------------------------=*/
#include "RGBController.h"
#include <vector>
#include <hidapi/hidapi.h>
#pragma once
enum
{
MODE_OFF = 0x0,
MODE_STATIC = 0x1,
MODE_RESPIRE = 0x2,
MODE_RAINBOW = 0x3,
MODE_FLASH_AWAY = 0x4,
MODE_RAINDROPS = 0x5,
MODE_RAINBOW_WHEEL = 0x6,
MODE_RIPPLES_SHINING = 0x7,
MODE_STARS_TWINKLE = 0x8,
MODE_SHADOW_DISAPPEAR = 0x9,
MODE_RETRO_SNAKE = 0xA,
MODE_NEON_STREAM = 0xB,
MODE_REACTION = 0xC,
MODE_SINE_WAVE = 0xD,
MODE_RETINUE_SCANNING = 0xE,
MODE_ROTATING_WINDMILL = 0xF,
MODE_COLORFUL_WATERFALL = 0x10,
MODE_BLOSSOMING = 0x11,
MODE_ROTATING_STORM = 0x12,
MODE_COLLISION = 0x13,
MODE_PERFECT = 0x14,
MODE_PER_KEY = 0x15
};
enum
{
SPEED_SLOW = 0x12,
SPEED_NORMAL = 0x22,
SPEED_FASTER = 0x32,
SPEED_FASTEST = 0x42,
};
enum
{
BRIGHTNESS_OFF = 0x0,
BRIGHTNESS_QUARTER = 0x1,
BRIGHTNESS_HALF = 0x2,
BRIGHTNESS_THREE_QUARTERS = 0x3,
BRIGHTNESS_FULL = 0x4
};
class SinowealthKeyboardController
{
public:
SinowealthKeyboardController(hid_device* dev_handle_id_4, hid_device* dev_handle_id_5, char *_path); //RGB, Command, path
~SinowealthKeyboardController();
unsigned int GetLEDCount();
std::string GetLocation();
std::string GetSerialString();
unsigned char GetCurrentMode();
void SetLEDColor(RGBColor* color_buf);
void SetStaticColor(RGBColor* color_buf);
void SetMode(unsigned char mode, unsigned char brightness, unsigned char speed, RGBColor* color_buf);
void SetMode(unsigned char mode, unsigned char brightness, unsigned char speed, unsigned char color_mode, RGBColor *color_buf);
void GetProfile();
void ReadFirmwareInfo();
void SetLEDsDirect(std::vector<RGBColor> colors);
private:
hid_device* dev_report_id_4;
hid_device* dev_report_id_5;
device_type type;
unsigned int led_count;
unsigned char current_mode;
unsigned char current_speed;
std::string location;
};
@@ -9,9 +9,25 @@
#include "RGBController_SteelSeriesRival.h"
typedef struct
{
const char* name;
const int value;
} steelseries_rival_led_info;
static const steelseries_rival_led_info rival_650_leds[]=
{
{"Left 1", 0x12},
{"Left 2", 0x14},
{"Left 3", 0x16},
{"Right 1", 0x13},
{"Right 2", 0x15},
{"Right 3", 0x17},
};
RGBController_SteelSeriesRival::RGBController_SteelSeriesRival(SteelSeriesRivalController* rival_ptr)
{
rival = rival_ptr;
rival = rival_ptr;
name = rival->GetDeviceName();
vendor = "SteelSeries";
@@ -58,11 +74,13 @@ void RGBController_SteelSeriesRival::SetupZones()
zones.push_back(logo_zone);
led logo_led;
logo_led.name = "Logo";
logo_led.name = "Logo";
logo_led.value = 0;
leds.push_back(logo_led);
/* Rival 300 extends this by adding another LED + Zone */
if (rival->GetMouseType() == RIVAL_300) {
/* Rival 300 extends this by adding Scroll Wheel LED + Zone */
if(rival->GetMouseType() == RIVAL_300)
{
zone wheel_zone;
wheel_zone.name = "Scroll Wheel";
wheel_zone.type = ZONE_TYPE_SINGLE;
@@ -73,9 +91,47 @@ void RGBController_SteelSeriesRival::SetupZones()
zones.push_back(wheel_zone);
led wheel_led;
wheel_led.name = "Scroll Wheel";
wheel_led.name = "Scroll Wheel";
wheel_led.value = 1;
leds.push_back(wheel_led);
}
/* Rival 650 extends this by Scroll Wheel LED + Zone and additional lights LEDs + Zone */
else if(rival->GetMouseType() == RIVAL_650)
{
leds[0].value = 0x11;
zone wheel_zone;
wheel_zone.name = "Scroll Wheel";
wheel_zone.type = ZONE_TYPE_SINGLE;
wheel_zone.leds_min = 1;
wheel_zone.leds_max = 1;
wheel_zone.leds_count = 1;
wheel_zone.matrix_map = NULL;
zones.push_back(wheel_zone);
led wheel_led;
wheel_led.name = "Scroll Wheel";
wheel_led.value = 0x10;
leds.push_back(wheel_led);
zone mouse_zone;
mouse_zone.name = "Mouse";
mouse_zone.type = ZONE_TYPE_LINEAR;
mouse_zone.leds_min = 6;
mouse_zone.leds_max = 6;
mouse_zone.leds_count = 6;
mouse_zone.matrix_map = NULL;
zones.push_back(mouse_zone);
for(const steelseries_rival_led_info led_info: rival_650_leds)
{
led mouse_led;
mouse_led.name = led_info.name;
mouse_led.value = led_info.value;
leds.push_back(mouse_led);
}
}
SetupColors();
}
@@ -88,43 +144,32 @@ void RGBController_SteelSeriesRival::ResizeZone(int /*zone*/, int /*new_size*/)
void RGBController_SteelSeriesRival::DeviceUpdateLEDs()
{
unsigned char red = RGBGetRValue(colors[0]);
unsigned char grn = RGBGetGValue(colors[0]);
unsigned char blu = RGBGetBValue(colors[0]);
rival->SetColorAll(red, grn, blu);
for(unsigned int i = 0; i < leds.size(); i++)
{
unsigned char red = RGBGetRValue(colors[i]);
unsigned char grn = RGBGetGValue(colors[i]);
unsigned char blu = RGBGetBValue(colors[i]);
rival->SetColor(leds[i].value, red, grn, blu);
}
}
void RGBController_SteelSeriesRival::UpdateZoneLEDs(int zone)
{
RGBColor color = colors[zone];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
if(zone == 0)
for(unsigned int i = 0; i < zones[zone].leds_count; i++)
{
rival->SetColorAll(red, grn, blu);
}
else
{
/* We can add custom cases depending on different devices here. */
switch(rival->GetMouseType())
{
case RIVAL_300:
rival->SetColor(zone, red, grn, blu);
break;
default:
break;
}
unsigned char red = RGBGetRValue(zones[zone].colors[i]);
unsigned char grn = RGBGetGValue(zones[zone].colors[i]);
unsigned char blu = RGBGetBValue(zones[zone].colors[i]);
rival->SetColor(zones[zone].leds[i].value, red, grn, blu);
}
}
void RGBController_SteelSeriesRival::UpdateSingleLED(int led)
{
/* Each zone only has a single LED, so we can use the LED ID to reference
* the existing zone code. */
UpdateZoneLEDs(led);
unsigned char red = RGBGetRValue(colors[led]);
unsigned char grn = RGBGetGValue(colors[led]);
unsigned char blu = RGBGetBValue(colors[led]);
rival->SetColor(leds[led].value, red, grn, blu);
}
void RGBController_SteelSeriesRival::SetCustomMode()
@@ -38,6 +38,8 @@
#define STEELSERIES_RIVAL_310_PID 0x1720
#define STEELSERIES_RIVAL_310_CSGO_HOWL_PID 0x171e
#define STEELSERIES_RIVAL_310_PUBG_PID 0x1736
#define STEELSERIES_RIVAL_650_PID 0x172B
#define STEELSERIES_RIVAL_650_WIRELESS_PID 0x1726
#define STEELSERIES_SENSEI_TEN_PID 0x1832
#define STEELSERIES_SENSEI_TEN_CSGO_NEON_RIDER_PID 0x1834
#define STEELSERIES_SENSEI_310_PID 0x1722
@@ -102,7 +104,7 @@ void DetectSteelSeriesApexOld(hid_device_info* info, const std::string& name)
hid_device* dev = hid_open_path(info->path);
if(dev)
{
SteelSeriesOldApexController* controller = new SteelSeriesOldApexController(dev, APEX_M, info->path);
SteelSeriesOldApexController* controller = new SteelSeriesOldApexController(dev, APEX_OLD, info->path);
RGBController_SteelSeriesOldApex* rgb_controller = new RGBController_SteelSeriesOldApex(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
@@ -156,6 +158,17 @@ void DetectSteelSeriesRival300(hid_device_info* info, const std::string& name)
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
void DetectSteelSeriesRival650(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
SteelSeriesRivalController* controller = new SteelSeriesRivalController(dev, RIVAL_650, info->path);
RGBController_SteelSeriesRival* rgb_controller = new RGBController_SteelSeriesRival(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
void DetectSteelSeriesSensei(hid_device_info* info, const std::string& name)
{
@@ -187,6 +200,8 @@ REGISTER_HID_DETECTOR_I("SteelSeries Rival 300 Black Ops Edition", Dete
REGISTER_HID_DETECTOR_I("SteelSeries Rival 310", DetectSteelSeriesSensei, STEELSERIES_VID, STEELSERIES_RIVAL_310_PID, 0 );
REGISTER_HID_DETECTOR_I("SteelSeries Rival 310 CS:GO Howl Edition", DetectSteelSeriesSensei, STEELSERIES_VID, STEELSERIES_RIVAL_310_CSGO_HOWL_PID, 0 );
REGISTER_HID_DETECTOR_I("SteelSeries Rival 310 PUBG Edition", DetectSteelSeriesSensei, STEELSERIES_VID, STEELSERIES_RIVAL_310_PUBG_PID, 0 );
REGISTER_HID_DETECTOR_I("SteelSeries Rival 650", DetectSteelSeriesRival650, STEELSERIES_VID, STEELSERIES_RIVAL_650_PID, 0 );
REGISTER_HID_DETECTOR_I("SteelSeries Rival 650 Wireless", DetectSteelSeriesRival650, STEELSERIES_VID, STEELSERIES_RIVAL_650_WIRELESS_PID, 0 );
REGISTER_HID_DETECTOR_I("SteelSeries Sensei TEN", DetectSteelSeriesSensei, STEELSERIES_VID, STEELSERIES_SENSEI_TEN_PID, 0 );
REGISTER_HID_DETECTOR_I("SteelSeries Sensei TEN CS:GO Neon Rider Edition", DetectSteelSeriesSensei, STEELSERIES_VID, STEELSERIES_SENSEI_TEN_CSGO_NEON_RIDER_PID,0 );
REGISTER_HID_DETECTOR_I("SteelSeries Sensei 310", DetectSteelSeriesSensei, STEELSERIES_VID, STEELSERIES_SENSEI_310_PID, 0 );
@@ -19,6 +19,7 @@ typedef enum
{
RIVAL_100 = 0x00,
RIVAL_300 = 0x01,
RIVAL_650 = 0x02,
SIBERIA_350 = 0x03,
APEX = 0x04,
APEX_TKL = 0x05,
@@ -128,12 +128,74 @@ void SteelSeriesRivalController::SetLightEffectAll
SetLightEffect(0, effect);
SetLightEffect(1, effect);
break;
case RIVAL_650:
for(int i=0x10; i<0x18; i++)
{
SetLightEffect(i, effect);
}
break;
default:
break;
}
}
void SteelSeriesRivalController::SetRival650Color
(
unsigned char zone_id,
unsigned char red,
unsigned char green,
unsigned char blue
)
{
char usb_buf[60];
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x03;
usb_buf[0x04] = 0x30;
usb_buf[0x06] = 0x10;
usb_buf[0x07] = 0x27;
usb_buf[0x16] = 0x01;
usb_buf[0x1E] = 0x04;
usb_buf[0x1F] = red;
usb_buf[0x20] = green;
usb_buf[0x21] = blue;
usb_buf[0x22] = 0xff;
usb_buf[0x27] = 0xff;
usb_buf[0x29] = 0x54;
usb_buf[0x2c] = 0xff;
usb_buf[0x2d] = 0x54;
usb_buf[0x2e] = red;
usb_buf[0x2f] = green;
usb_buf[0x30] = blue;
usb_buf[0x31] = 0x56;
send_usb_msg(dev, usb_buf, 60);
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x03;
usb_buf[0x02] = 0x30;
usb_buf[0x04] = 0x2c;
send_usb_msg(dev, usb_buf, 60);
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x05;
usb_buf[0x02] = zone_id;//mousekey 0x10-0x17
usb_buf[0x03] = 0xff;
usb_buf[0x08] = 0x5c;
send_usb_msg(dev, usb_buf, 60);
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x1c;
usb_buf[0x02] = 0x55;
usb_buf[0x04] = 0x46;
send_usb_msg(dev, usb_buf, 60);
}
void SteelSeriesRivalController::SetColor
(
@@ -157,6 +219,10 @@ void SteelSeriesRivalController::SetColor
usb_buf[0x01] = zone_id + 1;
break;
case RIVAL_650:
SetRival650Color(zone_id, red, green, blue);
return;
default:
break;
}
@@ -186,6 +252,13 @@ void SteelSeriesRivalController::SetColorAll
SetColor(1, red, green, blue);
break;
case RIVAL_650:
for(int i = 0x10; i < 0x18; i++)
{
SetColor(i, red, green, blue);
}
break;
default:
break;
}
@@ -17,17 +17,17 @@
/* Mode, we then use these to set actual effect based on speed. */
enum
{
STEELSERIES_RIVAL_DIRECT = 0x00,
STEELSERIES_RIVAL_PULSATE = 0x01
STEELSERIES_RIVAL_DIRECT = 0x00,
STEELSERIES_RIVAL_PULSATE = 0x01
};
/* Effects */
enum
{
STEELSERIES_RIVAL_EFFECT_DIRECT = 0x01,
STEELSERIES_RIVAL_EFFECT_PULSATE_MIN = 0x02,
STEELSERIES_RIVAL_EFFECT_PULSATE_MID = 0x03,
STEELSERIES_RIVAL_EFFECT_PULSATE_MAX = 0x04
STEELSERIES_RIVAL_EFFECT_DIRECT = 0x01,
STEELSERIES_RIVAL_EFFECT_PULSATE_MIN = 0x02,
STEELSERIES_RIVAL_EFFECT_PULSATE_MID = 0x03,
STEELSERIES_RIVAL_EFFECT_PULSATE_MAX = 0x04
};
class SteelSeriesRivalController
@@ -80,4 +80,12 @@ private:
hid_device* dev;
std::string location;
steelseries_type proto;
void SetRival650Color
(
unsigned char zone_id,
unsigned char red,
unsigned char green,
unsigned char blue
);
};
+31 -2
View File
@@ -133,7 +133,6 @@ INCLUDEPATH +=
qt/
HEADERS += \
Controllers/LogitechController/LogitechProtocolCommon.h \
dependencies/ColorWheel/ColorWheel.h \
dependencies/json/json.hpp \
dependencies/libcmmk/include/libcmmk/libcmmk.h \
@@ -173,6 +172,8 @@ HEADERS +=
super_io/super_io.h \
Controllers/AMDWraithPrismController/AMDWraithPrismController.h \
Controllers/AMDWraithPrismController/RGBController_AMDWraithPrism.h \
Controllers/AnnePro2Controller/AnnePro2Controller.h \
Controllers/AnnePro2Controller/RGBController_AnnePro2.h \
Controllers/ASRockPolychromeSMBusController/ASRockPolychromeSMBusController.h \
Controllers/ASRockPolychromeSMBusController/RGBController_ASRockPolychromeSMBus.h \
Controllers/ASRockPolychromeUSBController/ASRockPolychromeUSBController.h \
@@ -185,11 +186,15 @@ HEADERS +=
Controllers/AsusAuraSMBusController/RGBController_AsusAuraSMBus.h \
Controllers/AsusAuraUSBController/AsusAuraUSBController.h \
Controllers/AsusAuraUSBController/AsusAuraAddressableController.h \
Controllers/AsusAuraUSBController/AsusAuraHeadsetStandController.h \
Controllers/AsusAuraUSBController/AsusAuraKeyboardController.h \
Controllers/AsusAuraUSBController/AsusAuraMainboardController.h \
Controllers/AsusAuraUSBController/AsusAuraMouseController.h \
Controllers/AsusAuraUSBController/AsusAuraTUFKeyboardController.h \
Controllers/AsusAuraUSBController/RGBController_AsusAuraHeadsetStand.h \
Controllers/AsusAuraUSBController/RGBController_AsusAuraKeyboard.h \
Controllers/AsusAuraUSBController/RGBController_AsusAuraMouse.h \
Controllers/AsusAuraUSBController/RGBController_AsusAuraTUFKeyboard.h \
Controllers/AsusAuraUSBController/RGBController_AsusAuraUSB.h \
Controllers/CoolerMasterController/CMARGBcontroller.h \
Controllers/CoolerMasterController/CMMP750Controller.h \
@@ -268,9 +273,11 @@ HEADERS +=
Controllers/HyperXDRAMController/RGBController_HyperXDRAM.h \
Controllers/HyperXKeyboardController/HyperXAlloyElite2Controller.h \
Controllers/HyperXKeyboardController/HyperXAlloyOriginsController.h \
Controllers/HyperXKeyboardController/HyperXAlloyOriginsCoreController.h \
Controllers/HyperXKeyboardController/HyperXKeyboardController.h \
Controllers/HyperXKeyboardController/RGBController_HyperXAlloyElite2.h \
Controllers/HyperXKeyboardController/RGBController_HyperXAlloyOrigins.h \
Controllers/HyperXKeyboardController/RGBController_HyperXAlloyOriginsCore.h \
Controllers/HyperXKeyboardController/RGBController_HyperXKeyboard.h \
Controllers/HyperXMouseController/HyperXPulsefireFPSProController.h \
Controllers/HyperXMouseController/HyperXPulsefireSurgeController.h \
@@ -284,17 +291,21 @@ HEADERS +=
Controllers/LEDStripController/RGBController_LEDStrip.h \
Controllers/LianLiController/LianLiUniHubController.h \
Controllers/LianLiController/RGBController_LianLiUniHub.h \
Controllers/LogitechController/LogitechProtocolCommon.h \
Controllers/LogitechController/LogitechG203LController.h \
Controllers/LogitechController/LogitechG213Controller.h \
Controllers/LogitechController/LogitechG560Controller.h \
Controllers/LogitechController/LogitechG933Controller.h \
Controllers/LogitechController/LogitechG810Controller.h \
Controllers/LogitechController/LogitechG910Controller.h \
Controllers/LogitechController/LogitechG815Controller.h \
Controllers/LogitechController/LogitechGLightsyncController.h \
Controllers/LogitechController/LogitechLightspeedController.h \
Controllers/LogitechController/LogitechX56Controller.h \
Controllers/LogitechController/RGBController_LogitechG203L.h \
Controllers/LogitechController/RGBController_LogitechG213.h \
Controllers/LogitechController/RGBController_LogitechG560.h \
Controllers/LogitechController/RGBController_LogitechG933.h \
Controllers/LogitechController/RGBController_LogitechG810.h \
Controllers/LogitechController/RGBController_LogitechG910.h \
Controllers/LogitechController/RGBController_LogitechG815.h \
@@ -302,6 +313,7 @@ HEADERS +=
Controllers/LogitechController/RGBController_LogitechGLightsync1zone.h \
Controllers/LogitechController/RGBController_LogitechGPowerPlay.h \
Controllers/LogitechController/RGBController_LogitechLightspeed.h \
Controllers/LogitechController/RGBController_LogitechX56.h \
Controllers/MSI3ZoneController/MSI3ZoneController.h \
Controllers/MSI3ZoneController/RGBController_MSI3Zone.h \
Controllers/MSIGPUController/MSIGPUController.h \
@@ -343,7 +355,9 @@ HEADERS +=
Controllers/SapphireGPUController/RGBController_SapphireNitroGlowV1.h \
Controllers/SapphireGPUController/RGBController_SapphireNitroGlowV3.h \
Controllers/SinowealthController/SinowealthController.h \
Controllers/SinowealthController/SinowealthKeyboardController.h \
Controllers/SinowealthController/RGBController_Sinowealth.h \
Controllers/SinowealthController/RGBController_SinowealthKeyboard.h \
Controllers/SonyDS4Controller/SonyDS4Controller.h \
Controllers/SonyDS4Controller/RGBController_SonyDS4.h \
Controllers/SteelSeriesController/color32.h \
@@ -381,7 +395,6 @@ HEADERS +=
RGBController/RGBController_Network.h \
SOURCES += \
Controllers/LogitechController/LogitechProtocolCommon.cpp \
dependencies/dmiinfo.cpp \
dependencies/ColorWheel/ColorWheel.cpp \
dependencies/hueplusplus-1.0.0/src/Action.cpp \
@@ -448,6 +461,9 @@ SOURCES +=
Controllers/AMDWraithPrismController/AMDWraithPrismController.cpp \
Controllers/AMDWraithPrismController/AMDWraithPrismControllerDetect.cpp \
Controllers/AMDWraithPrismController/RGBController_AMDWraithPrism.cpp \
Controllers/AnnePro2Controller/AnnePro2Controller.cpp \
Controllers/AnnePro2Controller/AnnePro2ControllerDetect.cpp \
Controllers/AnnePro2Controller/RGBController_AnnePro2.cpp \
Controllers/ASRockPolychromeSMBusController/ASRockPolychromeSMBusController.cpp \
Controllers/ASRockPolychromeSMBusController/ASRockPolychromeSMBusControllerDetect.cpp \
Controllers/ASRockPolychromeSMBusController/RGBController_ASRockPolychromeSMBus.cpp \
@@ -465,12 +481,16 @@ SOURCES +=
Controllers/AsusAuraSMBusController/RGBController_AsusAuraSMBus.cpp \
Controllers/AsusAuraUSBController/AsusAuraUSBController.cpp \
Controllers/AsusAuraUSBController/AsusAuraAddressableController.cpp \
Controllers/AsusAuraUSBController/AsusAuraHeadsetStandController.cpp \
Controllers/AsusAuraUSBController/AsusAuraKeyboardController.cpp \
Controllers/AsusAuraUSBController/AsusAuraMainboardController.cpp \
Controllers/AsusAuraUSBController/AsusAuraMouseController.cpp \
Controllers/AsusAuraUSBController/AsusAuraTUFKeyboardController.cpp \
Controllers/AsusAuraUSBController/AsusAuraUSBControllerDetect.cpp \
Controllers/AsusAuraUSBController/RGBController_AsusAuraHeadsetStand.cpp \
Controllers/AsusAuraUSBController/RGBController_AsusAuraKeyboard.cpp \
Controllers/AsusAuraUSBController/RGBController_AsusAuraMouse.cpp \
Controllers/AsusAuraUSBController/RGBController_AsusAuraTUFKeyboard.cpp \
Controllers/AsusAuraUSBController/RGBController_AsusAuraUSB.cpp \
Controllers/CoolerMasterController/CMARGBcontroller.cpp \
Controllers/CoolerMasterController/CMMP750Controller.cpp \
@@ -580,10 +600,12 @@ SOURCES +=
Controllers/HyperXDRAMController/RGBController_HyperXDRAM.cpp \
Controllers/HyperXKeyboardController/HyperXAlloyElite2Controller.cpp \
Controllers/HyperXKeyboardController/HyperXAlloyOriginsController.cpp \
Controllers/HyperXKeyboardController/HyperXAlloyOriginsCoreController.cpp \
Controllers/HyperXKeyboardController/HyperXKeyboardController.cpp \
Controllers/HyperXKeyboardController/HyperXKeyboardControllerDetect.cpp \
Controllers/HyperXKeyboardController/RGBController_HyperXAlloyElite2.cpp \
Controllers/HyperXKeyboardController/RGBController_HyperXAlloyOrigins.cpp \
Controllers/HyperXKeyboardController/RGBController_HyperXAlloyOriginsCore.cpp \
Controllers/HyperXKeyboardController/RGBController_HyperXKeyboard.cpp \
Controllers/HyperXMouseController/HyperXMouseControllerDetect.cpp \
Controllers/HyperXMouseController/HyperXPulsefireFPSProController.cpp \
@@ -602,17 +624,21 @@ SOURCES +=
Controllers/LianLiController/LianLiUniHubController.cpp \
Controllers/LianLiController/RGBController_LianLiUniHub.cpp \
Controllers/LogitechController/LogitechControllerDetect.cpp \
Controllers/LogitechController/LogitechProtocolCommon.cpp \
Controllers/LogitechController/LogitechG203LController.cpp \
Controllers/LogitechController/LogitechG213Controller.cpp \
Controllers/LogitechController/LogitechG560Controller.cpp \
Controllers/LogitechController/LogitechG933Controller.cpp \
Controllers/LogitechController/LogitechG810Controller.cpp \
Controllers/LogitechController/LogitechG910Controller.cpp \
Controllers/LogitechController/LogitechG815Controller.cpp \
Controllers/LogitechController/LogitechGLightsyncController.cpp \
Controllers/LogitechController/LogitechLightspeedController.cpp \
Controllers/LogitechController/LogitechX56Controller.cpp \
Controllers/LogitechController/RGBController_LogitechG203L.cpp \
Controllers/LogitechController/RGBController_LogitechG213.cpp \
Controllers/LogitechController/RGBController_LogitechG560.cpp \
Controllers/LogitechController/RGBController_LogitechG933.cpp \
Controllers/LogitechController/RGBController_LogitechG810.cpp \
Controllers/LogitechController/RGBController_LogitechG910.cpp \
Controllers/LogitechController/RGBController_LogitechG815.cpp \
@@ -620,6 +646,7 @@ SOURCES +=
Controllers/LogitechController/RGBController_LogitechGLightsync1zone.cpp \
Controllers/LogitechController/RGBController_LogitechGPowerPlay.cpp \
Controllers/LogitechController/RGBController_LogitechLightspeed.cpp \
Controllers/LogitechController/RGBController_LogitechX56.cpp \
Controllers/MSI3ZoneController/MSI3ZoneController.cpp \
Controllers/MSI3ZoneController/MSI3ZoneControllerDetect.cpp \
Controllers/MSI3ZoneController/RGBController_MSI3Zone.cpp \
@@ -675,8 +702,10 @@ SOURCES +=
Controllers/SapphireGPUController/RGBController_SapphireNitroGlowV1.cpp \
Controllers/SapphireGPUController/RGBController_SapphireNitroGlowV3.cpp \
Controllers/SinowealthController/SinowealthController.cpp \
Controllers/SinowealthController/SinowealthKeyboardController.cpp \
Controllers/SinowealthController/SinowealthControllerDetect.cpp \
Controllers/SinowealthController/RGBController_Sinowealth.cpp \
Controllers/SinowealthController/RGBController_SinowealthKeyboard.cpp \
Controllers/SonyDS4Controller/SonyDS4Controller.cpp \
Controllers/SonyDS4Controller/SonyDS4ControllerDetect.cpp \
Controllers/SonyDS4Controller/RGBController_SonyDS4.cpp \
+5 -3
View File
@@ -58,12 +58,13 @@ There have been two instances of hardware damage in OpenRGB's development and we
* Pre-built binaries in AppImage format are available under the Releases section on GitLab.
* You can build the project using Qt Creator or on the command line.
1. Install build dependencies
- Debian/Ubuntu: `sudo apt install git build-essential qtcreator qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libusb-1.0-0-dev libhidapi-dev pkgconf`
- Debian (before `bullseye`) or Ubuntu (before 21.04): `sudo apt install git build-essential qtcreator qt5-default libusb-1.0-0-dev libhidapi-dev pkgconf`
- Fedora: `sudo dnf install git make automake gcc gcc-c++ qt-creator qt5-devel hidapi-devel libusb-devel`
- Debian/Ubuntu: `sudo apt install git build-essential qtcreator qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libusb-1.0-0-dev libhidapi-dev pkgconf libmbedtls-dev`
- Debian (before `bullseye`) or Ubuntu (before 21.04): `sudo apt install git build-essential qtcreator qt5-default libusb-1.0-0-dev libhidapi-dev pkgconf libmbedtls-dev`
- Fedora: `sudo dnf install automake gcc-c++ qt5-qtbase-devel hidapi-devel libusbx-devel mbedtls-devel`
2. git clone https://gitlab.com/CalcProgrammer1/OpenRGB
3. cd OpenRGB
4. qmake OpenRGB.pro
- On Fedora, replace qmake with qmake-qt5
5. make -j8
* Run the application with ./openrgb
* You can also build a Debian package (.deb) from this source code with dpkg-buildpackage -us -B
@@ -218,3 +219,4 @@ While no code from these projects directly made its way into OpenRGB, these proj
* VRMTool: https://github.com/rbrune/VRMtool
* g810-led: https://github.com/MatMoul/g810-led
* liquidctl: https://github.com/jonasmalacofilho/liquidctl
* Annemone: https://github.com/manualmanul/Annemone
+1 -1
View File
@@ -835,7 +835,7 @@ void ResourceManager::DetectDevicesThreadFunction()
while(current_hid_device)
{
LOG_DEBUG("HID device [0x%04x:$0x%04x]", current_hid_device->vendor_id, current_hid_device->product_id);
LOG_DEBUG("HID device [%04X:%04X]", current_hid_device->vendor_id, current_hid_device->product_id);
detection_string = "";
DetectionProgressChanged();
+34 -7
View File
@@ -42,6 +42,7 @@ struct DeviceOptions
std::vector<std::tuple<unsigned char, unsigned char, unsigned char>> colors;
std::string mode;
unsigned int size;
bool random_colors;
bool hasSize;
bool hasOption;
};
@@ -237,15 +238,31 @@ bool ParseColors(std::string colors_string, DeviceOptions *options)
if (color.length() <= 0)
break;
/* swy: (A) try interpreting it as text; as human keywords, otherwise strtoul() will pick up 'darkgreen' as 0xDA */
for (const struct HumanColors *hc = human_colors; hc->keyword != NULL; hc++)
/*-----------------------------------------------------------------*\
| This will set correct colour mode for modes with a |
| MODE_COLORS_RANDOM else generate a random colour from the |
| human_colors list above |
\*-----------------------------------------------------------------*/
if (color == "random")
{
if (strcasecmp(hc->keyword, color.c_str()) != 0)
continue;
options->random_colors = true;
srand(time(NULL));
int index = rand() % (sizeof(human_colors) / sizeof(human_colors[0])) + 1; //Anything other than black
rgb = human_colors[index].rgb;
parsed = true;
}
else
{
/* swy: (A) try interpreting it as text; as human keywords, otherwise strtoul() will pick up 'darkgreen' as 0xDA */
for (const struct HumanColors *hc = human_colors; hc->keyword != NULL; hc++)
{
if (strcasecmp(hc->keyword, color.c_str()) != 0)
continue;
rgb = hc->rgb; parsed = true;
rgb = hc->rgb; parsed = true;
break;
break;
}
}
/* swy: (B) no luck, try interpreting it as an hexadecimal number instead */
@@ -365,7 +382,7 @@ void OptionHelp()
help_text += " Can be specified multiple times with different modes and colors\n";
help_text += "-z, --zone [0-9] Selects zone to apply colors and/or sizes to, or applies to all zones in device if omitted\n";
help_text += " Must be specified after specifying a device\n";
help_text += "-c, --color FFFFFF,00AAFF... Sets colors on each device directly if no effect is specified, and sets the effect color if an effect is specified\n";
help_text += "-c, --color [random | FFFFF,00AAFF ...] Sets colors on each device directly if no effect is specified, and sets the effect color if an effect is specified\n";
help_text += " If there are more LEDs than colors given, the last color will be applied to the remaining LEDs\n";
help_text += "-m, --mode [breathing | static | ...] Sets the mode to be applied, check --list-devices to see which modes are supported on your device\n";
help_text += "-s, --size [0-N] Sets the new size of the specified device zone.\n";
@@ -879,6 +896,16 @@ void ApplyOptions(DeviceOptions& options, std::vector<RGBController *> &rgb_cont
\*---------------------------------------------------------*/
unsigned int mode = ParseMode(options, rgb_controllers);
/*---------------------------------------------------------*\
| If the user has specified random colours and the device |
| supports that colour mode then swich to it before |
| evaluating if a colour needs to be set |
\*---------------------------------------------------------*/
if (options.random_colors && (device->modes[mode].flags & MODE_FLAG_HAS_RANDOM_COLOR))
{
device->modes[mode].color_mode = MODE_COLORS_RANDOM;
}
/*---------------------------------------------------------*\
| Determine which color mode this mode uses and update |
| colors accordingly |
+4
View File
@@ -13,6 +13,10 @@
#include <vector>
#ifdef WIN32
/*---------------------------------------------------------*\
| Windows interferes with std::max unless NOMINMAX defined |
\*---------------------------------------------------------*/
#define NOMINMAX
#include <winsock2.h>
#include <ws2tcpip.h>
#else
+6 -2
View File
@@ -96,6 +96,7 @@
#define ASUS_ROG_STRIX_RTX2080TI_O11G_GAMING 0x866A
#define ASUS_VEGA64_STRIX 0x04C4
#define ASUS_RX5700XT_STRIX_GAMING_OC 0x04E2
#define ASUS_RX570_STRIX_O4G_GAMING_OC 0x04C2
#define ASUS_RX580_STRIX_GAMING_OC 0x0517
/*-----------------------------------------------------*\
@@ -204,7 +205,10 @@
| PCI ID Macros |
\*---------------------------------------------------------*/
#define IF_DRAM_SMBUS(ven, dev) \
if((ven == AMD_VEN) || (ven == INTEL_VEN))
if(((ven == AMD_VEN) && (dev == AMD_FCH_SMBUS_DEV)) || \
((ven == INTEL_VEN) && (dev == INTEL_ICH10_SMBUS_DEV)))
#define IF_MOBO_SMBUS(ven, dev) \
if((ven == 0) || (ven == AMD_VEN) || (ven == INTEL_VEN))
if((ven == 0) || \
((ven == AMD_VEN) && (dev == AMD_FCH_SMBUS_DEV)) || \
((ven == INTEL_VEN) && (dev == INTEL_ICH10_SMBUS_DEV)))
+8
View File
@@ -147,6 +147,14 @@ HRESULT Wmi::query(std::string queryStr, std::vector<QueryObj>& queryVectorOut,
int nIdx = 0;
IEnumWbemClassObject* pEnumerator = nullptr;
// Initialize COM. ------------------------------------------
hres = CoInitializeEx(0, COINIT_MULTITHREADED);
if (FAILED(hres))
{
return hres;
}
pSvc->Release();
// Reconnect to server before each query as we were seeing disconnected failures
hres = pLoc->ConnectServer(
_bstr_t(L"ROOT\\CIMV2"), // Object path of WMI namespace