Compare commits

..
Author SHA1 Message Date
Adam Honse 4a31751ea1 Remove some detection checks for Corsair Vengeance RGB Pro detection as it was no longer detecting my modules with them 2020-01-25 17:22:36 -06:00
Adam Honse 862bf8605d Set custom mode when applying color to all devices 2020-01-25 17:09:56 -06:00
Adam Honse 3ea9839770 Move Get/Set mode functions to generic RGBController.cpp functions and add device-specific UpdateMode function to use active_mode value 2020-01-25 16:57:53 -06:00
Adam Honse 320bf22274 Fix some small issues with AMD Wraith Prism driver 2020-01-25 16:06:28 -06:00
Adam Honse 8f911d9a85 Fix issues with inverted speed and random flag 2020-01-25 16:04:35 -06:00
Adam Honse 7e9df3ab7d Add speed control to HyperX driver 2020-01-24 23:19:38 -06:00
Adam Honse 16b488169e Clean up speed values for Patriot Viper RGB 2020-01-24 14:36:17 -06:00
Adam Honse 60531f4d76 Shifted the wrong way... 2020-01-24 12:55:36 -06:00
Adam Honse 6bbbcffcad Add speed control to RGB Fusion 1.0 driver 2020-01-24 12:31:23 -06:00
Adam Honse f4dc9862f5 Add delay to improve Corsair Pro detection, default modes to down instead of left, clean up Wraith Prism initialization 2020-01-24 00:23:37 -06:00
Adam Honse fb3690127c Finish AMD Wraith Prism mode updates including working speed table, working random color flag, and appropriate fan/logo modes for ring-specific effects 2020-01-23 23:27:35 -06:00
Adam Honse 79f0137440 Implement a speed table for AMD Wraith Prism to use the values taken from the official software. Interpolation was causing strange issues. 2020-01-23 22:23:37 -06:00
Adam Honse 24d7d8a3b0 Start adding modes to AMD Wraith Prism driver. Speed and random bit implemented, but it seems to have issues. Speeds way too fast 2020-01-23 21:28:44 -06:00
Adam Honse ef5bec4a59 Prepare AMD Wraith Prism driver for mode control 2020-01-23 18:55:00 -06:00
Adam Honse 8cfca6ba16 Add direction support to Corsair Vengeance RGB Pro 2020-01-23 12:50:49 -06:00
Adam Honse d9eb5ff3f4 Add direction support for NZXT Hue 2 2020-01-23 12:28:50 -06:00
Adam Honse 7343c570df Add direction support to Corsair Commander/Lighting Node Pro 2020-01-18 21:47:16 -06:00
Adam Honse 74708b91bb Add direction support for NZXT Hue+ 2020-01-18 18:34:00 -06:00
Adam Honse 3cb2fa7e75 Fix Corsair Commander Pro/Lighting Node Pro on Linux 2020-01-18 17:51:47 -06:00
Adam Honse 8a56e712c2 Add direction support 2020-01-18 17:07:37 -06:00
Adam Honse b9ead7ae17 Add the rest of the Corsair Commander/Lighting Node Pro modes 2020-01-18 11:51:07 -06:00
Adam Honse 3f710119f2 Add label to Speed slider 2020-01-18 11:12:46 -06:00
Adam Honse 0a0818a3a5 Copy Corsair Commander Pro updates to Lighting Node Pro driver. Need to consolidate these eventually 2020-01-17 22:26:02 -06:00
Adam Honse dcea6502bf Add inverted speed flag to device UI to handle devices where slowest speed is a larger value than fastest speed 2020-01-17 21:12:47 -06:00
Adam Honse d0b4e2078f Speed values are reversed on Corsair Commander Pro. Removed all references to SendKeepalive function. 2020-01-17 20:50:26 -06:00
Adam Honse b2f2fb2204 Clean up Corsair Commander Pro code and get effects mode working 2020-01-17 20:40:40 -06:00
Adam Honse 4beeaf4044 Initial Corsair Commander Pro support, it's the same protocol as the Lighting Node Pro but on a different endpoint 2020-01-16 21:25:39 -06:00
Adam Honse 6c6e75b673 Add speed control to Hue 2 2020-01-16 20:46:46 -06:00
Adam Honse 50517b5159 Add speed control for Hue+ and add support for Wings mode 2020-01-16 20:11:59 -06:00
Adam Honse b4de1177e5 Add random color modes for HyperX Predator RGB 2020-01-14 19:19:16 -06:00
Adam Honse 3cec45bdc2 Add slider for speed control, add min/max speed parameters to mode information, update Corsair Pro and Patriot Viper drivers to include speed control 2020-01-14 18:05:43 -06:00
Adam Honse 6e7c248407 Fix Corsair Pro mode initialization 2020-01-14 00:16:58 -06:00
Adam Honse c75874d4d6 Add mode parameters to Corsair Vengeance RGB Pro controller 2020-01-13 23:55:54 -06:00
Adam Honse 34f8df07f3 Add Random Color checkbox and combine Aura fixed-color and cycling ("random") modes to use this new checkbox 2020-01-13 22:22:15 -06:00
Adam Honse aa52d93198 Add additional mode parameters to RGBController API and update most of the RGBController drivers' mode specifications to match 2020-01-13 19:55:45 -06:00
87 changed files with 2369 additions and 8062 deletions
-1
View File
@@ -1 +0,0 @@
*.pro.user*
-3
View File
@@ -1,6 +1,3 @@
[submodule "dependencies/libe131"]
path = dependencies/libe131
url = https://github.com/CalcProgrammer1/libe131
[submodule "razer-drivers-win32"]
path = razer-drivers-win32
url = https://github.com/rsandoz/razer-drivers-win32
@@ -20,7 +20,7 @@ static void Sleep(unsigned int milliseconds)
/*----------------------------------------------------------------------*\
| This list contains the available SMBus addresses for mapping Aura RAM |
\*----------------------------------------------------------------------*/
#define AURA_RAM_ADDRESS_COUNT 21
#define AURA_RAM_ADDRESS_COUNT 17
static const unsigned char aura_ram_addresses[] =
{
@@ -40,11 +40,7 @@ static const unsigned char aura_ram_addresses[] =
0x7F,
0x4F,
0x66,
0x67,
0x39,
0x3B,
0x3C,
0x3D
0x67
};
/*---------------------------------------------------------------------------------*\
@@ -80,6 +80,7 @@ public:
CorsairCmdrProController(libusb_device_handle* dev_handle);
~CorsairCmdrProController();
char* GetLEDString();
unsigned int GetStripsOnChannel(unsigned int channel);
void SetChannelEffect(unsigned char channel,
@@ -104,22 +104,6 @@ void DetectCorsairControllers(std::vector<i2c_smbus_interface*> &busses, std::ve
new_controller = new RGBController_Corsair(new_corsair);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5E
if (TestForCorsairController(busses[bus], 0x5E))
{
new_corsair = new CorsairController(busses[bus], 0x5E);
new_controller = new RGBController_Corsair(new_corsair);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5F
if (TestForCorsairController(busses[bus], 0x5F))
{
new_corsair = new CorsairController(busses[bus], 0x5F);
new_controller = new RGBController_Corsair(new_corsair);
rgb_controllers.push_back(new_controller);
}
}
} /* DetectCorsairControllers() */
@@ -1,253 +0,0 @@
/*-----------------------------------------*\
| CorsairKeyboardController.cpp |
| |
| Driver for Corsair RGB keyboard lighting |
| controller |
| |
| Adam Honse (CalcProgrammer1) 1/9/2020 |
\*-----------------------------------------*/
#include "CorsairKeyboardController.h"
#include <cstring>
static unsigned int keys[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0C, 0x0D, 0x0E, 0x0F, 0x11, 0x12,
0x14, 0x15, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x24, 0x25, 0x26,
0x27, 0x28, 0x2A, 0x2B, 0x2C, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x42, 0x43, 0x44, 0x45, 0x48, 73, 74, 75, 76, 78,
79, 80, 81, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 96, 97,
98, 99, 100, 101, 102, 103, 104, 105, 108, 109, 110, 111, 112, 113, 115,
116, 117, 120, 121, 122, 123, 124, 126, 127, 128, 129, 132, 133, 134, 135,
136, 137, 139, 140, 141};
static void send_usb_msg(hid_device* dev, char * data_pkt)
{
char usb_pkt[65];
usb_pkt[0] = 0x00;
for(int i = 1; i < 65; i++)
{
usb_pkt[i] = data_pkt[i-1];
}
int bytes = hid_send_feature_report(dev, (unsigned char *)usb_pkt, 65);
bytes++;
}
static void get_usb_msg(hid_device* dev, char* data_pkt)
{
char usb_pkt[65];
usb_pkt[0] = 0x00;
for(int i = 1; i < 65; i++)
{
usb_pkt[i] = data_pkt[i-1];
}
int bytes = hid_get_feature_report(dev, (unsigned char*)data_pkt, 64);
bytes++;
}
CorsairKeyboardController::CorsairKeyboardController(hid_device* dev_handle)
{
dev = dev_handle;
char data_pkt[64] = { 0 };
LightingControl();
}
CorsairKeyboardController::~CorsairKeyboardController()
{
}
void CorsairKeyboardController::SetLEDs(std::vector<RGBColor> colors)
{
unsigned char data_pkt[216];
unsigned char red_val[144];
unsigned char grn_val[144];
unsigned char blu_val[144];
/*-----------------------------------------------------*\
| Zero out buffers |
\*-----------------------------------------------------*/
memset(data_pkt, 0x00, sizeof( data_pkt ));
memset(red_val, 0x00, sizeof( red_val ));
memset(grn_val, 0x00, sizeof( grn_val ));
memset(blu_val, 0x00, sizeof( blu_val ));
/*-----------------------------------------------------*\
| Scale color values to 9-bit |
\*-----------------------------------------------------*/
for(int color_idx = 0; color_idx < colors.size(); color_idx++)
{
RGBColor color = colors[color_idx];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
if( red > 7 ) red = 7;
if( grn > 7 ) grn = 7;
if( blu > 7 ) blu = 7;
red = 7 - red;
grn = 7 - grn;
blu = 7 - blu;
red_val[keys[color_idx]] = red;
grn_val[keys[color_idx]] = grn;
blu_val[keys[color_idx]] = blu;
}
/*-----------------------------------------------------*\
| Pack the color values, 2 values per byte |
\*-----------------------------------------------------*/
for(int red_idx = 0; red_idx < 72; red_idx++)
{
data_pkt[red_idx] = red_val[(red_idx * 2) + 1] << 4 | red_val[red_idx * 2];
}
for(int grn_idx = 0; grn_idx < 72; grn_idx++)
{
data_pkt[grn_idx + 72] = grn_val[(grn_idx * 2) + 1] << 4 | grn_val[grn_idx * 2];
}
for(int blu_idx = 0; blu_idx < 72; blu_idx++)
{
data_pkt[blu_idx + 144] = blu_val[(blu_idx * 2) + 1] << 4 | blu_val[blu_idx * 2];
}
/*-----------------------------------------------------*\
| Send the packets |
\*-----------------------------------------------------*/
StreamPacket(1, 60, &data_pkt[0]);
StreamPacket(2, 60, &data_pkt[60]);
StreamPacket(3, 60, &data_pkt[120]);
StreamPacket(4, 36, &data_pkt[180]);
SubmitLimitedColors(216);
}
/*-------------------------------------------------------------------------------------------------*\
| Private packet sending functions. |
\*-------------------------------------------------------------------------------------------------*/
void CorsairKeyboardController::LightingControl()
{
char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Lighting Control packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_COMMAND_WRITE;
usb_buf[0x01] = CORSAIR_PROPERTY_LIGHTING_CONTROL;
usb_buf[0x02] = CORSAIR_LIGHTING_CONTROL_SOFTWARE;
usb_buf[0x04] = 0x03;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
send_usb_msg(dev, usb_buf);
}
void CorsairKeyboardController::ReadFirmwareInfo()
{
char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Read Firmware Info packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_COMMAND_READ;
usb_buf[0x01] = CORSAIR_PROPERTY_FIRMWARE_INFO;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
send_usb_msg(dev, usb_buf);
get_usb_msg(dev, usb_buf);
}
void CorsairKeyboardController::StreamPacket
(
unsigned char packet_id,
unsigned char data_sz,
unsigned char* data_ptr
)
{
char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Stream packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_COMMAND_STREAM;
usb_buf[0x01] = packet_id;
usb_buf[0x02] = data_sz;
/*-----------------------------------------------------*\
| Copy in data bytes |
\*-----------------------------------------------------*/
memcpy(&usb_buf[0x04], data_ptr, data_sz);
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
send_usb_msg(dev, usb_buf);
}
void CorsairKeyboardController::SubmitColors()
{
char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Submit Keyboard 24-Bit Colors packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_COMMAND_WRITE;
usb_buf[0x01] = CORSAIR_PROPERTY_SUBMIT_KEYBOARD_COLOR_24;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
send_usb_msg(dev, usb_buf);
}
void CorsairKeyboardController::SubmitLimitedColors
(
unsigned char byte_count
)
{
char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Submit Keyboard 9-Bit Colors packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_COMMAND_WRITE;
usb_buf[0x01] = CORSAIR_PROPERTY_SUBMIT_KEYBOARD_COLOR_9;
usb_buf[0x04] = byte_count;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
send_usb_msg(dev, usb_buf);
}
@@ -1,78 +0,0 @@
/*-----------------------------------------*\
| CorsairKeyboardController.h |
| |
| Definitions and types for Corsair RGB |
| keyboard lighting controller |
| |
| Adam Honse (CalcProgrammer1) 1/9/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
CORSAIR_COMMAND_WRITE = 0x07,
CORSAIR_COMMAND_READ = 0x0E,
CORSAIR_COMMAND_STREAM = 0x7F
};
enum
{
CORSAIR_PROPERTY_FIRMWARE_INFO = 0x01,
CORSAIR_PROPERTY_RESET = 0x02,
CORSAIR_PROPERTY_SPECIAL_FUNCTION = 0x04,
CORSAIR_PROPERTY_LIGHTING_CONTROL = 0x05,
CORSAIR_PROPERTY_HARDWARE_PROFILE = 0x13,
CORSAIR_PROPERTY_SUBMIT_MOUSE_COLOR = 0x22,
CORSAIR_PROPERTY_SUBMIT_KEYBOARD_COLOR_9 = 0x27,
CORSAIR_PROPERTY_SUBMIT_KEYBOARD_COLOR_24 = 0x28,
};
enum
{
CORSAIR_LIGHTING_CONTROL_HARDWARE = 0x01,
CORSAIR_LIGHTING_CONTROL_SOFTWARE = 0x02
};
enum
{
CORSAIR_COLOR_CHANNEL_RED = 0x01,
CORSAIR_COLOR_CHANNEL_GREEN = 0x02,
CORSAIR_COLOR_CHANNEL_BLUE = 0x03
};
class CorsairKeyboardController
{
public:
CorsairKeyboardController(hid_device* dev_handle);
~CorsairKeyboardController();
void SetLEDsDirect(std::vector<RGBColor> colors);
void SetLEDs(std::vector<RGBColor> colors);
private:
hid_device* dev;
void LightingControl();
void ReadFirmwareInfo();
void StreamPacket
(
unsigned char packet_id,
unsigned char data_sz,
unsigned char* data_ptr
);
void SubmitColors();
void SubmitLimitedColors
(
unsigned char byte_count
);
};
@@ -1,52 +0,0 @@
#include "CorsairKeyboardController.h"
#include "RGBController.h"
#include "RGBController_CorsairKeyboard.h"
#include <vector>
#include <hidapi/hidapi.h>
#define CORSAIR_RGB_KEYBOARD_VID 0x1B1C
#define CORSAIR_RGB_KEYBOARD_K70_PID 0x1B13
#define CORSAIR_RGB_KEYBOARD_K95_PID 0x1B11
/******************************************************************************************\
* *
* DetectCorsairKeyboardControllers *
* *
* Tests the USB address to see if a Corsair RGB Keyboard controller exists there. *
* *
\******************************************************************************************/
void DetectCorsairKeyboardControllers(std::vector<RGBController*>& rgb_controllers)
{
hid_device_info* info;
hid_device* dev = NULL;
hid_init();
info = hid_enumerate(CORSAIR_RGB_KEYBOARD_VID, CORSAIR_RGB_KEYBOARD_K70_PID);
//Look for Corsair RGB Keyboard, interface 1
while(info)
{
if((info->vendor_id == CORSAIR_RGB_KEYBOARD_VID)
&&(info->product_id == CORSAIR_RGB_KEYBOARD_K70_PID)
&&(info->interface_number == 1))
{
dev = hid_open_path(info->path);
break;
}
else
{
info = info->next;
}
}
if( dev )
{
CorsairKeyboardController* controller = new CorsairKeyboardController(dev);
RGBController_CorsairKeyboard* rgb_controller = new RGBController_CorsairKeyboard(controller);
rgb_controllers.push_back(rgb_controller);
}
}
@@ -87,6 +87,7 @@ public:
CorsairNodeProController(libusb_device_handle* dev_handle);
~CorsairNodeProController();
char* GetLEDString();
unsigned int GetStripsOnChannel(unsigned int channel);
void SetChannelEffect(unsigned char channel,
@@ -121,22 +121,6 @@ void DetectCorsairProControllers(std::vector<i2c_smbus_interface*> &busses, std:
new_controller = new RGBController_CorsairPro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5E
if (TestForCorsairProController(busses[bus], 0x5E))
{
new_corsair_pro = new CorsairProController(busses[bus], 0x5E);
new_controller = new RGBController_CorsairPro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
// Check for Corsair controller at 0x5F
if (TestForCorsairProController(busses[bus], 0x5F))
{
new_corsair_pro = new CorsairProController(busses[bus], 0x5F);
new_controller = new RGBController_CorsairPro(new_corsair_pro);
rgb_controllers.push_back(new_controller);
}
}
} /* DetectCorsairProControllers() */
@@ -1,133 +0,0 @@
/*-----------------------------------------*\
| CrucialController.cpp |
| |
| Driver for Crucial Ballistix RGB lighting|
| controller |
| |
| Adam Honse (CalcProgrammer1) 1/19/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include "CrucialController.h"
#include <cstring>
CrucialController::CrucialController(i2c_smbus_interface* bus, crucial_dev_id dev)
{
this->bus = bus;
this->dev = dev;
}
CrucialController::~CrucialController()
{
}
std::string CrucialController::GetDeviceName()
{
return(device_name);
}
std::string CrucialController::GetDeviceLocation()
{
std::string return_string(bus->device_name);
char addr[5];
snprintf(addr, 5, "0x%02X", dev);
return_string.append(", address ");
return_string.append(addr);
return(return_string);
}
unsigned int CrucialController::GetLEDCount()
{
return(led_count);
}
void CrucialController::SetMode(unsigned char mode)
{
SendEffectMode(mode, 0x10);
}
void CrucialController::SetAllColorsDirect(RGBColor* colors)
{
SendDirectColors(colors);
}
void CrucialController::SendEffectColors(unsigned char red, unsigned char green, unsigned char blue)
{
CrucialRegisterWrite(0x82E9, 0xFF);
CrucialRegisterWrite(0x82EA, 0x00);
CrucialRegisterWrite(0x82EB, 0x00);
CrucialRegisterWrite(0x82EC, 0x00);
CrucialRegisterWrite(0x82ED, red);
CrucialRegisterWrite(0x82EE, green);
CrucialRegisterWrite(0x82EF, blue);
CrucialRegisterWrite(0x82F0, 0x01);
}
void CrucialController::SendBrightness(unsigned char brightness)
{
CrucialRegisterWrite(0x82EE, 0xFF);
CrucialRegisterWrite(0x82EF, brightness);
CrucialRegisterWrite(0x82F0, 0x83);
}
void CrucialController::SendEffectMode(unsigned char mode, unsigned char speed)
{
CrucialRegisterWrite(0x820F, mode);
CrucialRegisterWrite(0x82EE, 0x00);
CrucialRegisterWrite(0x82EF, speed);
CrucialRegisterWrite(0x82F0, 0x84);
}
void CrucialController::SendDirectColors(RGBColor* color_buf)
{
//Red Channels
CrucialRegisterWrite(0x8300, RGBGetRValue(color_buf[0]));
CrucialRegisterWrite(0x8301, RGBGetRValue(color_buf[1]));
CrucialRegisterWrite(0x8302, RGBGetRValue(color_buf[2]));
CrucialRegisterWrite(0x8303, RGBGetRValue(color_buf[3]));
CrucialRegisterWrite(0x8304, RGBGetRValue(color_buf[4]));
CrucialRegisterWrite(0x8305, RGBGetRValue(color_buf[5]));
CrucialRegisterWrite(0x8306, RGBGetRValue(color_buf[6]));
CrucialRegisterWrite(0x8307, RGBGetRValue(color_buf[7]));
//Green Channels
CrucialRegisterWrite(0x8340, RGBGetGValue(color_buf[0]));
CrucialRegisterWrite(0x8341, RGBGetGValue(color_buf[1]));
CrucialRegisterWrite(0x8342, RGBGetGValue(color_buf[2]));
CrucialRegisterWrite(0x8343, RGBGetGValue(color_buf[3]));
CrucialRegisterWrite(0x8344, RGBGetGValue(color_buf[4]));
CrucialRegisterWrite(0x8345, RGBGetGValue(color_buf[5]));
CrucialRegisterWrite(0x8346, RGBGetGValue(color_buf[6]));
CrucialRegisterWrite(0x8347, RGBGetGValue(color_buf[7]));
//Blue Channels
CrucialRegisterWrite(0x8380, RGBGetBValue(color_buf[0]));
CrucialRegisterWrite(0x8381, RGBGetBValue(color_buf[1]));
CrucialRegisterWrite(0x8382, RGBGetBValue(color_buf[2]));
CrucialRegisterWrite(0x8383, RGBGetBValue(color_buf[3]));
CrucialRegisterWrite(0x8384, RGBGetBValue(color_buf[4]));
CrucialRegisterWrite(0x8385, RGBGetBValue(color_buf[5]));
CrucialRegisterWrite(0x8386, RGBGetBValue(color_buf[6]));
CrucialRegisterWrite(0x8387, RGBGetBValue(color_buf[7]));
}
unsigned char CrucialController::CrucialRegisterRead(crucial_register reg)
{
//Write Crucial register
bus->i2c_smbus_write_word_data(dev, 0x00, ((reg << 8) & 0xFF00) | ((reg >> 8) & 0x00FF));
//Read Crucial value
return(bus->i2c_smbus_read_byte_data(dev, 0x81));
}
void CrucialController::CrucialRegisterWrite(crucial_register reg, unsigned char val)
{
//Write Crucial register
bus->i2c_smbus_write_word_data(dev, 0x00, ((reg << 8) & 0xFF00) | ((reg >> 8) & 0x00FF));
//Write Crucial value
bus->i2c_smbus_write_byte_data(dev, 0x01, val);
}
@@ -1,62 +0,0 @@
/*-----------------------------------------*\
| CrucialController.h |
| |
| Definitions and types for Crucial |
| Ballistix RGB lighting controller |
| |
| Adam Honse (CalcProgrammer1) 1/19/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include "i2c_smbus.h"
#pragma once
typedef unsigned char crucial_dev_id;
typedef unsigned short crucial_register;
enum
{
CRUCIAL_MODE_SHIFT = 0x1F, /* Shift effect mode */
CRUCIAL_MODE_GRADIENT_SHIFT = 0x2F, /* Gradient shift mode */
CRUCIAL_MODE_FILL = 0x3F, /* Fill effect mode */
CRUCIAL_MODE_STACK = 0x4F, /* Stack effect mode */
CRUCIAL_MODE_DOUBLE_STACK = 0x5F, /* Double stack effect mode */
CRUCIAL_MODE_BREATHING = 0x6F, /* Breathing effect mode */
CRUCIAL_MODE_MOTION_POINT = 0x7F, /* Motion point effect mode */
CRUCIAL_MODE_INSIDE_OUT = 0x8F, /* Inside out effect mode */
CRUCIAL_MODE_COLOR_STEP = 0x9F, /* Color step effect mode */
CRUCIAL_MODE_WATER_WAVE = 0xAF, /* Water wave effect mode */
CRUCIAL_MODE_FLASHING = 0xBF, /* Flashing effect mode */
CRUCIAL_MODE_STATIC = 0xCF, /* Static effect mode */
};
class CrucialController
{
public:
CrucialController(i2c_smbus_interface* bus, crucial_dev_id dev);
~CrucialController();
std::string GetDeviceName();
std::string GetDeviceLocation();
unsigned int GetLEDCount();
void SetAllColorsDirect(RGBColor* colors);
void SetMode(unsigned char mode);
unsigned char CrucialRegisterRead(crucial_register reg);
void CrucialRegisterWrite(crucial_register reg, unsigned char val);
private:
char device_name[16];
unsigned char config_table[64];
unsigned int led_count;
unsigned char channel_cfg;
i2c_smbus_interface * bus;
crucial_dev_id dev;
void SendDirectColors(RGBColor* color_buf);
void SendEffectColors(unsigned char red, unsigned char green, unsigned char blue);
void SendBrightness(unsigned char brightness);
void SendEffectMode(unsigned char mode, unsigned char speed);
};
@@ -1,88 +0,0 @@
#include "CrucialController.h"
#include "RGBController.h"
#include "RGBController_Crucial.h"
#include "i2c_smbus.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
/*----------------------------------------------------------------------*\
| This list contains the available SMBus addresses for Crucial RAM |
\*----------------------------------------------------------------------*/
#define CRUCIAL_ADDRESS_COUNT 4
static const unsigned char crucial_addresses[] =
{
0x20,
0x21,
0x22,
0x23
};
/******************************************************************************************\
* *
* TestForCrucialController *
* *
* Tests the given address to see if an Crucial controller exists there. First does a*
* quick write to test for a response, and if so does a simple read at 0xA0 to test *
* for incrementing values 0...F which was observed at this location during data dump *
* *
\******************************************************************************************/
bool TestForCrucialController(i2c_smbus_interface* bus, unsigned char address)
{
bool pass = false;
int res = bus->i2c_smbus_write_quick(address, I2C_SMBUS_WRITE);
if (res >= 0)
{
pass = true;
for (int i = 0xA0; i < 0xB0; i++)
{
res = bus->i2c_smbus_read_byte_data(address, i);
if (res != (i - 0xA0))
{
pass = false;
}
}
}
return(pass);
} /* TestForCrucialController() */
/******************************************************************************************\
* *
* DetectCrucialControllers *
* *
* Detect Crucial controllers on the enumerated I2C busses. *
* *
* bus - pointer to i2c_smbus_interface where Aura device is connected *
* dev - I2C address of Aura device *
* *
\******************************************************************************************/
void DetectCrucialControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers)
{
CrucialController* new_crucial;
RGBController_Crucial* new_controller;
for (unsigned int bus = 0; bus < busses.size(); bus++)
{
// Add Crucial controllers
for (unsigned int address_list_idx = 0; address_list_idx < CRUCIAL_ADDRESS_COUNT; address_list_idx++)
{
if (TestForCrucialController(busses[bus], crucial_addresses[address_list_idx]))
{
new_crucial = new CrucialController(busses[bus], crucial_addresses[address_list_idx]);
new_controller = new RGBController_Crucial(new_crucial);
rgb_controllers.push_back(new_controller);
}
}
}
} /* DetectCrucialControllers() */
@@ -72,11 +72,7 @@ unsigned int Hue2Controller::GetStripsOnChannel(unsigned int /*channel*/)
num_leds_on_channel += 10;
break;
case 0x0B: //Aer 2 fan (120mm)
num_leds_on_channel += 8;
break;
case 0x0C: //Aer 2 fan (140mm)
case 0x0B: //Aer 2 fan
num_leds_on_channel += 8;
break;
+2 -1
View File
@@ -55,7 +55,8 @@ class Hue2Controller
public:
Hue2Controller(libusb_device_handle* dev_handle);
~Hue2Controller();
char* GetLEDString();
unsigned int GetStripsOnChannel(unsigned int channel);
void SetChannelLEDs(unsigned char channel, std::vector<RGBColor> colors);
void SetMode(unsigned char mode, unsigned char speed, bool direction);
@@ -6,7 +6,6 @@
#define NZXT_HUE_2_VID 0x1E71
#define NZXT_HUE_2_PID 0x2001
#define NZXT_SMART_DEVICE_V2_PID 0x2006
/******************************************************************************************\
* *
@@ -22,29 +21,14 @@ void DetectHue2Controllers(std::vector<RGBController*> &rgb_controllers)
libusb_init(&ctx);
//Look for NZXT Hue 2
libusb_device_handle * hue_2_dev = libusb_open_device_with_vid_pid(ctx, NZXT_HUE_2_VID, NZXT_HUE_2_PID);
libusb_device_handle * dev = libusb_open_device_with_vid_pid(ctx, NZXT_HUE_2_VID, NZXT_HUE_2_PID);
if( hue_2_dev )
if( dev )
{
libusb_detach_kernel_driver(hue_2_dev, 0);
libusb_claim_interface(hue_2_dev, 0);
libusb_detach_kernel_driver(dev, 0);
libusb_claim_interface(dev, 0);
Hue2Controller* controller = new Hue2Controller(hue_2_dev);
RGBController_Hue2* rgb_controller = new RGBController_Hue2(controller);
rgb_controllers.push_back(rgb_controller);
}
//Look for NZXT Smart Device V2
libusb_device_handle * smart_dev_2_dev = libusb_open_device_with_vid_pid(ctx, NZXT_HUE_2_VID, NZXT_SMART_DEVICE_V2_PID);
if( smart_dev_2_dev )
{
libusb_detach_kernel_driver(smart_dev_2_dev, 0);
libusb_claim_interface(smart_dev_2_dev, 0);
Hue2Controller* controller = new Hue2Controller(smart_dev_2_dev);
Hue2Controller* controller = new Hue2Controller(dev);
RGBController_Hue2* rgb_controller = new RGBController_Hue2(controller);
@@ -1,414 +0,0 @@
/*-----------------------------------------*\
| HyperXKeyboardController.cpp |
| |
| Driver for HyperX RGB Keyboard lighting |
| controller |
| |
| Adam Honse (CalcProgrammer1) 1/30/2020 |
\*-----------------------------------------*/
#include "HyperXKeyboardController.h"
#include <cstring>
#ifdef WIN32
#include <Windows.h>
#else
#include <unistd.h>
static void Sleep(unsigned int milliseconds)
{
usleep(1000 * milliseconds);
}
#endif
static unsigned int keys[] = {0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14,
0x15, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1D, 0x1E, 0x20, 0x21, 0x22, 0x23, 0x24,
0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32,
0x33, 0x34, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3E, 0x3F, 0x41, 0x44, 0x45,
0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x51, 0x54, 0x55, 0x58, 0x59,
0x5A, 0x5B, 0x5C, 0x5E, 0x5F, 0x61, 0x64, 0x65, 0x68, 0x69, 0x6A, 0x6B, 0x6C,
0x6E, 0x6F, 0x74, 0x75, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, 0x81,
0x84, 0x85, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x91, 0x94, 0x95 };
static unsigned int extended_red[] = {0x08, 0x48, 0x88, 0x09, 0x89, 0x0A, 0x8A, 0x0B, 0x8B, 0x0C, 0x8C, 0x0D, 0x8D, 0x0E, 0x8F, 0x8E, 0x0F, 0x4F, 0x92, 0x13, 0x93, 0x12 };
static unsigned int extended_grn[] = {0x29, 0x28, 0x78, 0x19, 0x79, 0x1A, 0x7A, 0x1B, 0x7B, 0x1C, 0x7C, 0x1D, 0x7D, 0x1E, 0x6E, 0x7E, 0x1F, 0x6F, 0x82, 0x23, 0x83, 0x22 };
static unsigned int extended_blu[] = {0x39, 0x38, 0x68, 0x3A, 0x69, 0x2A, 0x6A, 0x2B, 0x6B, 0x2C, 0x6C, 0x2D, 0x6D, 0x2E, 0x5E, 0x5D, 0x2F, 0x5F, 0x72, 0x33, 0x73, 0x32 };
HyperXKeyboardController::HyperXKeyboardController(hid_device* dev_handle)
{
dev = dev_handle;
}
HyperXKeyboardController::~HyperXKeyboardController()
{
}
void HyperXKeyboardController::SetMode(unsigned char mode, unsigned char direction, unsigned char speed)
{
active_mode = mode;
active_direction = direction;
active_speed = speed;
SendEffect
(
0x01,
active_mode,
active_direction,
HYPERX_REACTIVE_MODE_NONE,
active_speed,
HYPERX_COLOR_MODE_SPECTRUM
);
}
void HyperXKeyboardController::SetLEDsDirect(std::vector<RGBColor> colors)
{
unsigned char red_color_data[104];
unsigned char grn_color_data[104];
unsigned char blu_color_data[104];
unsigned char ext_color_data[150];
for(std::size_t i = 0; i < 104; i++)
{
red_color_data[i] = RGBGetRValue(colors[i]);
grn_color_data[i] = RGBGetGValue(colors[i]);
blu_color_data[i] = RGBGetBValue(colors[i]);
}
for(std::size_t i = 0; i < 22; i++)
{
ext_color_data[extended_red[i]] = RGBGetRValue(colors[i + 104]);
ext_color_data[extended_grn[i]] = RGBGetGValue(colors[i + 104]);
ext_color_data[extended_blu[i]] = RGBGetBValue(colors[i + 104]);
}
SendDirect
(
HYPERX_COLOR_CHANNEL_RED,
red_color_data
);
Sleep(2);
SendDirect
(
HYPERX_COLOR_CHANNEL_GREEN,
grn_color_data
);
Sleep(2);
SendDirect
(
HYPERX_COLOR_CHANNEL_BLUE,
blu_color_data
);
Sleep(2);
SendDirectExtended
(
ext_color_data
);
}
void HyperXKeyboardController::SetLEDs(std::vector<RGBColor> colors)
{
unsigned char red_color_data[104];
unsigned char grn_color_data[104];
unsigned char blu_color_data[104];
unsigned char ext_color_data[150];
for(std::size_t i = 0; i < 104; i++)
{
red_color_data[i] = RGBGetRValue(colors[i]);
grn_color_data[i] = RGBGetGValue(colors[i]);
blu_color_data[i] = RGBGetBValue(colors[i]);
}
for(std::size_t i = 0; i < 22; i++)
{
ext_color_data[extended_red[i]] = RGBGetRValue(colors[i + 104]);
ext_color_data[extended_grn[i]] = RGBGetGValue(colors[i + 104]);
ext_color_data[extended_blu[i]] = RGBGetBValue(colors[i + 104]);
}
SendColor
(
0x01,
HYPERX_COLOR_CHANNEL_RED,
red_color_data
);
SendColor
(
0x01,
HYPERX_COLOR_CHANNEL_GREEN,
grn_color_data
);
SendColor
(
0x01,
HYPERX_COLOR_CHANNEL_BLUE,
blu_color_data
);
SendExtendedColor
(
0x01,
ext_color_data
);
}
/*-------------------------------------------------------------------------------------------------*\
| Private packet sending functions. |
\*-------------------------------------------------------------------------------------------------*/
void HyperXKeyboardController::SelectProfile
(
unsigned char profile
)
{
unsigned char buf[264];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(buf, 0x00, sizeof(buf));
/*-----------------------------------------------------*\
| Set up Select Profile packet |
\*-----------------------------------------------------*/
buf[0x00] = 0x07;
buf[0x01] = 0x01;
buf[0x02] = profile;
buf[0x06] = 0x03;
buf[0x07] = 0x01;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, buf, 264);
}
void HyperXKeyboardController::SendEffect
(
unsigned char profile,
unsigned char mode,
unsigned char direction,
unsigned char reactive_mode,
unsigned char speed,
unsigned char color_mode
)
{
unsigned char buf[264];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(buf, 0x00, sizeof(buf));
/*-----------------------------------------------------*\
| Set up Effect packet |
\*-----------------------------------------------------*/
buf[0x00] = 0x07;
buf[0x01] = HYPERX_PACKET_ID_SET_EFFECT;
buf[0x02] = profile;
/*-----------------------------------------------------*\
| Set mode |
\*-----------------------------------------------------*/
buf[0x09] = 0x01;
buf[0x0A] = mode;
/*-----------------------------------------------------*\
| Set direction |
\*-----------------------------------------------------*/
buf[0x0D] = direction;
buf[0x0E] = direction;
/*-----------------------------------------------------*\
| Set reactive mode |
\*-----------------------------------------------------*/
buf[0x1B] = reactive_mode;
buf[0x1C] = reactive_mode;
buf[0x1D] = reactive_mode;
buf[0x1E] = reactive_mode;
buf[0x1F] = reactive_mode;
buf[0x20] = reactive_mode;
buf[0x21] = reactive_mode;
buf[0x22] = reactive_mode;
buf[0x6B] = 0x09;
buf[0x6C] = 0x09;
buf[0x6D] = 0x05;
buf[0x6E] = 0x05;
buf[0x6F] = 0x06;
buf[0x70] = 0x05;
/*-----------------------------------------------------*\
| Set speed |
\*-----------------------------------------------------*/
buf[0x71] = speed;
buf[0x72] = 0x09;
/*-----------------------------------------------------*\
| Set color mode |
\*-----------------------------------------------------*/
buf[0x73] = color_mode;
buf[0x74] = color_mode;
buf[0x75] = color_mode;
buf[0x76] = color_mode;
buf[0x77] = color_mode;
buf[0x78] = color_mode;
buf[0x79] = color_mode;
buf[0x7A] = color_mode;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, buf, 264);
}
void HyperXKeyboardController::SendColor
(
unsigned char profile,
unsigned char color_channel,
unsigned char* color_data
)
{
unsigned char buf[264];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(buf, 0x00, sizeof(buf));
/*-----------------------------------------------------*\
| Set up Color packet |
\*-----------------------------------------------------*/
buf[0x00] = 0x07;
buf[0x01] = HYPERX_PACKET_ID_SET_COLOR;
buf[0x02] = profile;
buf[0x03] = color_channel;
/*-----------------------------------------------------*\
| Fill in color data |
\*-----------------------------------------------------*/
for(int i = 0; i < 104; i++)
{
buf[keys[i]] = color_data[i];
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, buf, 264);
}
void HyperXKeyboardController::SendExtendedColor
(
unsigned char profile,
unsigned char* color_data
)
{
unsigned char buf[264];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(buf, 0x00, sizeof(buf));
/*-----------------------------------------------------*\
| Set up Color packet |
\*-----------------------------------------------------*/
buf[0x00] = 0x07;
buf[0x01] = HYPERX_PACKET_ID_SET_COLOR;
buf[0x02] = profile;
buf[0x03] = HYPERX_COLOR_CHANNEL_EXTENDED;
/*-----------------------------------------------------*\
| Fill in color data |
\*-----------------------------------------------------*/
for(int i = 0x08; i <= 0x93; i++)
{
buf[i] = color_data[i];
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, buf, 264);
}
void HyperXKeyboardController::SendDirect
(
unsigned char color_channel,
unsigned char* color_data
)
{
unsigned char buf[264];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(buf, 0x00, sizeof(buf));
/*-----------------------------------------------------*\
| Set up Direct packet |
\*-----------------------------------------------------*/
buf[0x00] = 0x07;
buf[0x01] = HYPERX_PACKET_ID_DIRECT;
buf[0x02] = color_channel;
/*-----------------------------------------------------*\
| Fill in color data |
\*-----------------------------------------------------*/
for(int i = 0; i < 104; i++)
{
buf[keys[i]] = color_data[i];
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, buf, 264);
}
void HyperXKeyboardController::SendDirectExtended
(
unsigned char* color_data
)
{
unsigned char buf[264];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(buf, 0x00, sizeof(buf));
/*-----------------------------------------------------*\
| Set up Direct packet |
\*-----------------------------------------------------*/
buf[0x00] = 0x07;
buf[0x01] = HYPERX_PACKET_ID_DIRECT;
buf[0x02] = HYPERX_COLOR_CHANNEL_EXTENDED;
/*-----------------------------------------------------*\
| Fill in color data |
\*-----------------------------------------------------*/
for(int i = 0x08; i <= 0x93; i++)
{
buf[i] = color_data[i];
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, buf, 264);
}
@@ -1,119 +0,0 @@
/*-----------------------------------------*\
| HyperXKeyboardController.h |
| |
| Definitions and types for HyperX RGB |
| Keyboard lighting controller |
| |
| Adam Honse (CalcProgrammer1) 1/30/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <string>
#include <hidapi/hidapi.h>
#pragma once
enum
{
HYPERX_PACKET_ID_SET_EFFECT = 0x02, /* Set profile effect packet */
HYPERX_PACKET_ID_SET_COLOR = 0x06, /* Set profile color packet */
HYPERX_PACKET_ID_DIRECT = 0x16, /* Direct control packet */
};
enum
{
HYPERX_DIRECTION_RIGHT = 0x00,
HYPERX_DIRECTION_LEFT = 0x01,
HYPERX_DIRECTION_UP = 0x02,
HYPERX_DIRECTION_DOWN = 0x03,
HYPERX_DIRECTION_IN = 0x04,
HYPERX_DIRECTION_OUT = 0x05
};
enum
{
HYPERX_MODE_WAVE = 0x00,
HYPERX_MODE_STATIC = 0x01,
HYPERX_MODE_BREATHING = 0x02,
};
enum
{
HYPERX_REACTIVE_MODE_TRIGGER = 0x03,
HYPERX_REACTIVE_MODE_EXPLOSION = 0x04,
HYPERX_REACTIVE_MODE_HYPERX_FLAME = 0x05,
HYPERX_REACTIVE_MODE_NONE = 0xFF
};
enum
{
HYPERX_COLOR_MODE_SINGLE = 0x00,
HYPERX_COLOR_MODE_DUAL = 0x01,
HYPERX_COLOR_MODE_SPECTRUM = 0x02
};
enum
{
HYPERX_COLOR_CHANNEL_RED = 0x01,
HYPERX_COLOR_CHANNEL_GREEN = 0x02,
HYPERX_COLOR_CHANNEL_BLUE = 0x03,
HYPERX_COLOR_CHANNEL_EXTENDED = 0x04
};
class HyperXKeyboardController
{
public:
HyperXKeyboardController(hid_device* dev_handle);
~HyperXKeyboardController();
void SetMode(unsigned char mode, unsigned char direction, unsigned char speed);
void SetLEDsDirect(std::vector<RGBColor> colors);
void SetLEDs(std::vector<RGBColor> colors);
private:
hid_device* dev;
unsigned char active_mode;
unsigned char active_direction;
unsigned char active_speed;
void SelectProfile
(
unsigned char profile
);
void SendEffect
(
unsigned char profile,
unsigned char mode,
unsigned char direction,
unsigned char reactive_mode,
unsigned char speed,
unsigned char color_mode
);
void SendColor
(
unsigned char profile,
unsigned char color_channel,
unsigned char* color_data
);
void SendExtendedColor
(
unsigned char profile,
unsigned char* color_data
);
void SendDirect
(
unsigned char color_channel,
unsigned char* color_data
);
void SendDirectExtended
(
unsigned char* color_data
);
};
@@ -1,51 +0,0 @@
#include "HyperXKeyboardController.h"
#include "RGBController.h"
#include "RGBController_HyperXKeyboard.h"
#include <vector>
#include <hidapi/hidapi.h>
#define HYPERX_KEYBOARD_VID 0x0951
#define HYPERX_ALLOY_ELITE_PID 0x16BE
/******************************************************************************************\
* *
* DetectHyperXKeyboardControllers *
* *
* Tests the USB address to see if a HyperX Keyboard controller exists there. *
* *
\******************************************************************************************/
void DetectHyperXKeyboardControllers(std::vector<RGBController*>& rgb_controllers)
{
hid_device_info* info;
hid_device* dev = NULL;
hid_init();
info = hid_enumerate(HYPERX_KEYBOARD_VID, HYPERX_ALLOY_ELITE_PID);
//Look for HyperX Keyboard, Interface 2
while(info)
{
if((info->vendor_id == HYPERX_KEYBOARD_VID)
&&(info->product_id == HYPERX_ALLOY_ELITE_PID)
&&(info->interface_number == 2))
{
dev = hid_open_path(info->path);
break;
}
else
{
info = info->next;
}
}
if( dev )
{
HyperXKeyboardController* controller = new HyperXKeyboardController(dev);
RGBController_HyperXKeyboard* rgb_controller = new RGBController_HyperXKeyboard(controller);
rgb_controllers.push_back(rgb_controller);
}
}
@@ -29,18 +29,6 @@ PolychromeController::PolychromeController(i2c_smbus_interface* bus, polychrome_
strcpy(device_name, "ASRock Polychrome FW 2.00");
break;
case FIRMWARE_VER_2_PT_08:
led_count = 1;
asr_led = false;
strcpy(device_name, "ASRock Polychrome FW 2.08");
break;
case FIRMWARE_VER_2_PT_10:
led_count = 1;
asr_led = true;
strcpy(device_name, "ASRock Polychrome FW 2.10");
break;
case FIRMWARE_VER_3_PT_00:
led_count = 1;
asr_led = false;
@@ -88,38 +76,45 @@ unsigned int PolychromeController::GetLEDCount()
unsigned int PolychromeController::GetMode()
{
return(active_mode);
return(0);
}
bool PolychromeController::IsAsrLed()
void PolychromeController::SetAllColors(unsigned char red, unsigned char green, unsigned char blue)
{
return(asr_led);
}
void PolychromeController::SetColor(unsigned char red, unsigned char green, unsigned char blue)
{
unsigned char colors[3] = { red, green, blue };
if (asr_led)
{
bus->i2c_smbus_write_block_data(dev, active_mode, 3, colors);
}
else
{
unsigned char colors[3] = { red, green, blue };
bus->i2c_smbus_write_block_data(dev, POLYCHROME_REG_COLOR, 3, colors);
}
}
void PolychromeController::SetLEDColor(unsigned int /*led*/, unsigned char red, unsigned char green, unsigned char blue)
{
if (asr_led)
{
}
else
{
unsigned char colors[3] = { red, green, blue };
bus->i2c_smbus_write_block_data(dev, POLYCHROME_REG_COLOR, 3, colors);
}
}
void PolychromeController::SetMode(unsigned char mode)
{
active_mode = mode;
if (asr_led)
{
bus->i2c_smbus_write_block_data(dev, ASRLED_REG_MODE, 1, &active_mode);
}
else
{
bus->i2c_smbus_write_block_data(dev, POLYCHROME_REG_MODE, 1, &active_mode);
bus->i2c_smbus_write_byte_data(dev, POLYCHROME_REG_MODE, mode);
}
}
@@ -18,8 +18,6 @@ enum
{
FIRMWARE_VER_1_PT_10 = 0x010A, /* Firmware nu51_1.10 */
FIRMWARE_VER_2_PT_00 = 0x0200, /* Firmware nu51_2.00 */
FIRMWARE_VER_2_PT_08 = 0x0208, /* Firmware nu51_2.08 */
FIRMWARE_VER_2_PT_10 = 0x020A, /* Firmware nu51_2.10 */
FIRMWARE_VER_3_PT_00 = 0x0300, /* Firmware nu51_3.00 */
};
@@ -79,8 +77,8 @@ public:
char* GetDeviceName();
unsigned int GetLEDCount();
unsigned int GetMode();
bool IsAsrLed();
void SetColor(unsigned char red, unsigned char green, unsigned char blue);
void SetAllColors(unsigned char red, unsigned char green, unsigned char blue);
void SetLEDColor(unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
void SetMode(unsigned char mode);
unsigned short GetFirmwareVersion();
@@ -88,8 +86,7 @@ private:
bool asr_led;
char device_name[32];
unsigned int led_count;
unsigned char active_mode;
i2c_smbus_interface* bus;
polychrome_dev_id dev;
};
};
@@ -9,8 +9,6 @@
#include "PoseidonZRGBController.h"
#include <cstring>
#ifdef WIN32
#include <Windows.h>
#else
@@ -22,14 +20,15 @@ static void Sleep(unsigned int milliseconds)
}
#endif
static unsigned int keys[] = {0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x15,
0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23,
0x24, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31,
0x32, 0x33, 0x34, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3E, 0x3F, 0x40,
0x41, 0x42, 0x43, 0x44, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4E, 0x4F,
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C,
0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x66, 0x67, 0x68, 0x69, 0x6A,
0x6C, 0x6D, 0x6F, 0x70, 0x72, 0x73, 0x75, 0x76, 0x77, 0x78, 0x7C, 0x80, 0x81 };
static unsigned int keys[] = {8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21,
22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35,
36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
50, 51, 52, 54, 55, 56, 57, 58, 59, 60, 62, 63, 64,
65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 76, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
93, 94, 95, 96, 97, 98, 99, 100, 102, 103, 104, 105,
106, 108, 109, 111, 112, 114, 115, 117, 118, 119, 120,
124, 128, 129 };
PoseidonZRGBController::PoseidonZRGBController(hid_device* dev_handle)
{
@@ -41,21 +40,9 @@ PoseidonZRGBController::~PoseidonZRGBController()
}
void PoseidonZRGBController::SetMode(unsigned char mode, unsigned char direction, unsigned char speed)
char* PoseidonZRGBController::GetDeviceName()
{
active_mode = mode;
active_direction = direction;
active_speed = speed;
SendControl
(
POSEIDONZ_PROFILE_P1,
POSEIDONZ_PROFILE_P1,
active_direction,
active_mode,
POSEIDONZ_BRIGHTNESS_MAX,
active_speed
);
return device_name;
}
void PoseidonZRGBController::SetLEDsDirect(std::vector<RGBColor> colors)
@@ -63,174 +50,124 @@ void PoseidonZRGBController::SetLEDsDirect(std::vector<RGBColor> colors)
unsigned char red_grn_buf[264];
unsigned char blu_buf[264];
/*-----------------------------------------------------*\
| Zero out buffers |
\*-----------------------------------------------------*/
memset(red_grn_buf, 0x00, sizeof(red_grn_buf));
memset(blu_buf, 0x00, sizeof(blu_buf));
for(int i = 0; i < 264; i++)
{
red_grn_buf[i] = 0x00;
blu_buf[i] = 0x00;
}
/*-----------------------------------------------------*\
| Set up Direct packets |
\*-----------------------------------------------------*/
red_grn_buf[0] = 0x07;
red_grn_buf[1] = POSEIDONZ_PACKET_ID_SET_DIRECT;
red_grn_buf[2] = POSEIDONZ_PROFILE_P1;
red_grn_buf[3] = POSEIDONZ_DIRECT_RED_GREEN;
red_grn_buf[0] = POSEIDONZ_START;
red_grn_buf[1] = POSEIDONZ_LED_CMD;
red_grn_buf[2] = POSEIDONZ_PROFILE;
red_grn_buf[3] = POSEIDONZ_RED_GRN_CH;
red_grn_buf[4] = 0x00;
red_grn_buf[5] = 0x00;
red_grn_buf[6] = 0x00;
red_grn_buf[7] = 0x00;
blu_buf[0] = 0x07;
blu_buf[1] = POSEIDONZ_PACKET_ID_SET_DIRECT;
blu_buf[2] = POSEIDONZ_PROFILE_P1;
blu_buf[3] = POSEIDONZ_DIRECT_BLUE;
blu_buf[0] = POSEIDONZ_START;
blu_buf[1] = POSEIDONZ_LED_CMD;
blu_buf[2] = POSEIDONZ_PROFILE;
blu_buf[3] = POSEIDONZ_BLU_CH;
blu_buf[4] = 0x00;
blu_buf[5] = 0x00;
blu_buf[6] = 0x00;
blu_buf[7] = 0x00;
/*-----------------------------------------------------*\
| Fill in color data |
\*-----------------------------------------------------*/
for(std::size_t i = 0; i < 104; i++)
for(int i = 0; i < 104; i++)
{
red_grn_buf[keys[i] ] = RGBGetRValue(colors[i]);
red_grn_buf[keys[i] + 128] = RGBGetGValue(colors[i]);
blu_buf[ keys[i] ] = RGBGetBValue(colors[i]);
}
/*-----------------------------------------------------*\
| Send packets |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, red_grn_buf, 264);
Sleep(1);
hid_send_feature_report(dev, blu_buf, 264);
}
void PoseidonZRGBController::SetLEDs(std::vector<RGBColor> colors)
{
unsigned char red_color_data[104];
unsigned char grn_color_data[104];
unsigned char blu_color_data[104];
unsigned char buf[264] = {0};
for(std::size_t i = 0; i < 104; i++)
//Send Red Packet
for(int i = 0; i < 264; i++)
{
red_color_data[i] = RGBGetRValue(colors[i]);
grn_color_data[i] = RGBGetGValue(colors[i]);
blu_color_data[i] = RGBGetBValue(colors[i]);
buf[i] = 0xFF;
}
SendColor
(
POSEIDONZ_PROFILE_P1,
POSEIDONZ_COLOR_RED,
red_color_data
);
buf[0] = 0x07;
buf[1] = 0x09;
buf[2] = 0x01;
buf[3] = 0x01;
Sleep(10);
SendColor
(
POSEIDONZ_PROFILE_P1,
POSEIDONZ_COLOR_GREEN,
grn_color_data
);
Sleep(10);
SendColor
(
POSEIDONZ_PROFILE_P1,
POSEIDONZ_COLOR_BLUE,
blu_color_data
);
Sleep(10);
SendControl
(
POSEIDONZ_PROFILE_P1,
POSEIDONZ_PROFILE_P1,
active_direction,
active_mode,
POSEIDONZ_BRIGHTNESS_MAX,
active_speed
);
}
/*-------------------------------------------------------------------------------------------------*\
| Private packet sending functions. |
\*-------------------------------------------------------------------------------------------------*/
void PoseidonZRGBController::SendColor
(
unsigned char profile_to_edit,
unsigned char color_channel,
unsigned char* color_data
)
{
unsigned char buf[264];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(buf, 0x00, sizeof(buf));
/*-----------------------------------------------------*\
| Set up Color packet |
\*-----------------------------------------------------*/
buf[0x00] = 0x07;
buf[0x01] = POSEIDONZ_PACKET_ID_SET_COLOR;
buf[0x02] = profile_to_edit;
buf[0x03] = color_channel;
/*-----------------------------------------------------*\
| Fill in color data |
\*-----------------------------------------------------*/
for(int i = 0; i < 104; i++)
{
buf[keys[i]] = color_data[i];
buf[keys[i]] = RGBGetRValue(colors[i]);
}
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, buf, 264);
}
void PoseidonZRGBController::SendControl
(
unsigned char profile_to_activate,
unsigned char profile_to_edit,
unsigned char direction,
unsigned char mode,
unsigned char brightness,
unsigned char speed
)
{
unsigned char buf[264];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(buf, 0x00, sizeof(buf));
/*-----------------------------------------------------*\
| Set up Effect packet |
\*-----------------------------------------------------*/
buf[0x00] = 0x07;
buf[0x01] = POSEIDONZ_PACKET_ID_SET_EFFECT;
buf[0x02] = profile_to_activate;
buf[0x08] = profile_to_edit;
buf[0x0A] = direction;
buf[0x0C] = mode;
buf[0x0D] = brightness;
buf[0x10] = 0x08;
buf[0x12] = speed;
buf[0x13] = 0x50;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
Sleep(10);
//Send Green Packet
for(int i = 0; i < 264; i++)
{
buf[i] = 0x00;
}
buf[0] = 0x07;
buf[1] = 0x09;
buf[2] = 0x01;
buf[3] = 0x02;
buf[8] = 0xFF;
for(int i = 0; i < 104; i++)
{
buf[keys[i]] = RGBGetGValue(colors[i]);
}
hid_send_feature_report(dev, buf, 264);
Sleep(10);
//Send Blue Packet
for(int i = 0; i < 264; i++)
{
buf[i] = 0x11;
}
buf[0] = 0x07;
buf[1] = 0x09;
buf[2] = 0x01;
buf[3] = 0x03;
for(int i = 0; i < 104; i++)
{
buf[keys[i]] = RGBGetBValue(colors[i]);
}
hid_send_feature_report(dev, buf, 264);
Sleep(10);
//Send Update Packet
for(int i = 0; i < 264; i++)
{
buf[i] = 0x00;
}
buf[0] = 0x07;
buf[1] = 0x02;
buf[2] = 0x01;
buf[8] = 0x01; //Preset to save
buf[13] = 0x04; //Brightness?
buf[16] = 0x08;
buf[22] = 0x03;
hid_send_feature_report(dev, buf, 264);
}
@@ -21,86 +21,18 @@
#define POSEIDONZ_RED_GRN_CH 0x01
#define POSEIDONZ_BLU_CH 0x02
enum
{
POSEIDONZ_PACKET_ID_SET_EFFECT = 0x02, /* Set profile effect packet */
POSEIDONZ_PACKET_ID_SET_COLOR = 0x09, /* Set profile color packet */
POSEIDONZ_PACKET_ID_SET_DIRECT = 0x0E, /* Set direct color packet */
};
enum
{
POSEIDONZ_MODE_STATIC = 0x00,
POSEIDONZ_MODE_REACTIVE = 0x01,
POSEIDONZ_MODE_ARROW_FLOW = 0x02,
POSEIDONZ_MODE_WAVE = 0x03,
POSEIDONZ_MODE_RIPPLE = 0x04
};
enum
{
POSEIDONZ_PROFILE_P1 = 0x01,
POSEIDONZ_PROFILE_P2 = 0x02,
POSEIDONZ_PROFILE_P3 = 0x03,
POSEIDONZ_PROFILE_P4 = 0x04,
POSEIDONZ_PROFILE_P5 = 0x05
};
enum
{
POSEIDONZ_BRIGHTNESS_MIN = 0x00,
POSEIDONZ_BRIGHTNESS_MAX = 0x04
};
enum
{
POSEIDONZ_COLOR_RED = 0x01,
POSEIDONZ_COLOR_GREEN = 0x02,
POSEIDONZ_COLOR_BLUE = 0x03
};
enum
{
POSEIDONZ_DIRECT_RED_GREEN = 0x01,
POSEIDONZ_DIRECT_BLUE = 0x02
};
enum
{
POSEIDONZ_SPEED_SLOW = 0x10,
POSEIDONZ_SPEED_FAST = 0x05
};
class PoseidonZRGBController
{
public:
PoseidonZRGBController(hid_device* dev_handle);
~PoseidonZRGBController();
void SetMode(unsigned char mode, unsigned char direction, unsigned char speed);
char* GetDeviceName();
void SetLEDsDirect(std::vector<RGBColor> colors);
void SetLEDs(std::vector<RGBColor> colors);
private:
char device_name[32];
hid_device* dev;
unsigned char active_mode;
unsigned char active_direction;
unsigned char active_speed;
void SendControl
(
unsigned char profile_to_activate,
unsigned char profile_to_edit,
unsigned char direction,
unsigned char mode,
unsigned char brightness,
unsigned char speed
);
void SendColor
(
unsigned char profile_to_edit,
unsigned char color_channel,
unsigned char* color_data
);
};
@@ -18,28 +18,12 @@
void DetectPoseidonZRGBControllers(std::vector<RGBController*>& rgb_controllers)
{
hid_device_info* info;
hid_device* dev = NULL;
hid_device* dev;
//Look for Thermaltake Poseidon Z RGB Keyboard
hid_init();
info = hid_enumerate(TT_POSEIDON_Z_RGB_VID, TT_POSEIDON_Z_RGB_PID);
//Look for Thermaltake Poseidon Z RGB, Interface 2
while(info)
{
if((info->vendor_id == TT_POSEIDON_Z_RGB_VID)
&&(info->product_id == TT_POSEIDON_Z_RGB_PID)
&&(info->interface_number == 2))
{
dev = hid_open_path(info->path);
break;
}
else
{
info = info->next;
}
}
dev = hid_open(TT_POSEIDON_Z_RGB_VID, TT_POSEIDON_Z_RGB_PID, 0);
if( dev )
{
@@ -1,121 +0,0 @@
/*-----------------------------------------*\
| RGBFusion2Controller.cpp |
| |
| Driver for Gigabyte Aorus RGB Fusion 2.0 |
| lighting controller |
| |
| Adam Honse (CalcProgrammer1) 1/15/2020 |
\*-----------------------------------------*/
#include "RGBFusion2Controller.h"
#include <cstring>
#include <stdio.h>
#include <stdlib.h>
RGBFusion2Controller::RGBFusion2Controller(hid_device* dev_handle)
{
dev = dev_handle;
// Set Device name
strcpy(device_name, "Gigabyte Motherboard");
// Set LED count
led_count = 8;
}
RGBFusion2Controller::~RGBFusion2Controller()
{
}
std::string RGBFusion2Controller::GetDeviceName()
{
return(device_name);
}
std::string RGBFusion2Controller::GetDeviceLocation()
{
return("");
}
unsigned int RGBFusion2Controller::GetLEDCount()
{
return(led_count);
}
unsigned char RGBFusion2Controller::GetMode()
{
return(0);
}
void RGBFusion2Controller::SetAllColors(unsigned char red, unsigned char green, unsigned char blue)
{
}
void RGBFusion2Controller::SetLEDColor(unsigned int led, unsigned char red, unsigned char green, unsigned char blue)
{
unsigned char usb_buf[] =
{
0xCC, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
0x5A, 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,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
usb_buf[0x01] = (0x20 | led);
usb_buf[0x02] = (0x01 << led );
usb_buf[0x0E] = blue;
usb_buf[0x0F] = green;
usb_buf[0x10] = red;
hid_send_feature_report(dev, usb_buf, 64);
SendApply();
}
void RGBFusion2Controller::SendApply()
{
unsigned char usb_buf[] =
{
0xCC, 0x28, 0xFF, 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, 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,
};
hid_send_feature_report(dev, usb_buf, 64);
}
void RGBFusion2Controller::SetMode(unsigned char mode)
{
}
void RGBFusion2Controller::dump()
{
}
@@ -1,39 +0,0 @@
/*-----------------------------------------*\
| RGBFusion2Controller.h |
| |
| Definitions and types for Gigabyte Aorus |
| RGB Fusion 2.0 lighting controller |
| |
| Adam Honse (CalcProgrammer1) 1/15/2020 |
\*-----------------------------------------*/
#include <string>
#include <hidapi/hidapi.h>
#pragma once
class RGBFusion2Controller
{
public:
RGBFusion2Controller(hid_device* dev_handle);
~RGBFusion2Controller();
std::string GetDeviceName();
std::string GetDeviceLocation();
unsigned int GetLEDCount();
unsigned char GetMode();
void SetAllColors(unsigned char red, unsigned char green, unsigned char blue);
void SetLEDColor(unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
void SetMode(unsigned char mode);
private:
void dump();
char device_name[32];
unsigned int led_count;
void SendApply();
hid_device* dev;
};
@@ -1,36 +0,0 @@
#include "RGBFusion2Controller.h"
#include "RGBController.h"
#include "RGBController_RGBFusion2.h"
#include <vector>
#include <hidapi/hidapi.h>
#define RGB_FUSION_2_VID 0x048D
#define RGB_FUSION_2_PID 0x8297
/******************************************************************************************\
* *
* DetectRGBFusion2Controllers *
* *
* Detect RGB Fusion 2.0 controllers on the USB interface. *
* *
\******************************************************************************************/
void DetectRGBFusion2Controllers(std::vector<RGBController*>& rgb_controllers)
{
hid_device* dev;
//Look for RGB Fusion 2.0 Controller
hid_init();
dev = hid_open(RGB_FUSION_2_VID, RGB_FUSION_2_PID, 0);
if( dev )
{
RGBFusion2Controller* controller = new RGBFusion2Controller(dev);
RGBController_RGBFusion2* rgb_controller = new RGBController_RGBFusion2(controller);
rgb_controllers.push_back(rgb_controller);
}
} /* DetectRGBFusionControllers() */
@@ -1,117 +0,0 @@
/*-----------------------------------------*\
| ThermaltakeRiingController.cpp |
| |
| Definitions and types for Thermaltake |
| Riing Plus lighting controller |
| |
| Adam Honse (CalcProgrammer1) 2/7/2020 |
\*-----------------------------------------*/
#include "ThermaltakeRiingController.h"
#include <cstring>
ThermaltakeRiingController::ThermaltakeRiingController(libusb_device_handle* dev_handle)
{
dev = dev_handle;
SendInit();
channel_leds[0] = 9;
channel_leds[1] = 9;
channel_leds[2] = 9;
channel_leds[3] = 0;
channel_leds[4] = 0;
}
ThermaltakeRiingController::~ThermaltakeRiingController()
{
}
void ThermaltakeRiingController::SetChannelLEDs(unsigned char channel, std::vector<RGBColor> colors)
{
unsigned char* color_data = new unsigned char[3 * colors.size()];
for(int color = 0; color < colors.size(); color++)
{
int color_idx = color * 3;
color_data[color_idx + 0] = RGBGetGValue(colors[color]);
color_data[color_idx + 1] = RGBGetRValue(colors[color]);
color_data[color_idx + 2] = RGBGetBValue(colors[color]);
}
SendRGB(channel, current_mode, current_speed, colors.size(), color_data);
delete[] color_data;
}
void ThermaltakeRiingController::SetMode(unsigned char mode, unsigned char speed)
{
current_mode = mode;
current_speed = speed;
}
/*-------------------------------------------------------------------------------------------------*\
| Private packet sending functions. |
\*-------------------------------------------------------------------------------------------------*/
void ThermaltakeRiingController::SendInit()
{
unsigned char usb_buf[64];
int actual;
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Init packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0xFE;
usb_buf[0x01] = 0x33;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
libusb_interrupt_transfer(dev, 0x81, usb_buf, 64, &actual, 0);
}
void ThermaltakeRiingController::SendRGB
(
unsigned char port,
unsigned char mode,
unsigned char speed,
unsigned char num_colors,
unsigned char* color_data
)
{
unsigned char usb_buf[64];
int actual;
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up RGB packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x32;
usb_buf[0x01] = 0x52;
usb_buf[0x02] = port;
usb_buf[0x03] = mode + ( speed & 0x03 );
/*-----------------------------------------------------*\
| Copy in GRB color data |
\*-----------------------------------------------------*/
memcpy(&usb_buf[0x04], color_data, (num_colors * 3));
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
libusb_interrupt_transfer(dev, 0x81, usb_buf, 64, &actual, 0);
}
@@ -1,75 +0,0 @@
/*-----------------------------------------*\
| ThermaltakeRiingController.h |
| |
| Definitions and types for Thermaltake |
| Riing Plus lighting controller |
| |
| Adam Honse (CalcProgrammer1) 2/7/2020 |
\*-----------------------------------------*/
#include "RGBController.h"
#include <vector>
#include <libusb-1.0/libusb.h>
#pragma once
enum
{
THERMALTAKE_PORT_1 = 0x01,
THERMALTAKE_PORT_2 = 0x02,
THERMALTAKE_PORT_3 = 0x03,
THERMALTAKE_PORT_4 = 0x04,
THERMALTAKE_PORT_5 = 0x05
};
enum
{
THERMALTAKE_MODE_FLOW = 0x00,
THERMALTAKE_MODE_SPECTRUM = 0x04,
THERMALTAKE_MODE_RIPPLE = 0x08,
THERMALTAKE_MODE_BLINK = 0x0C,
THERMALTAKE_MODE_PULSE = 0x10,
THERMALTAKE_MODE_WAVE = 0x14,
THERMALTAKE_MODE_PER_LED = 0x18,
THERMALTAKE_MODE_FULL = 0x19
};
enum
{
THERMALTAKE_SPEED_SLOW = 0x03,
THERMALTAKE_SPEED_NORMAL = 0x02,
THERMALTAKE_SPEED_FAST = 0x01,
THERMALTAKE_SPEED_EXTREME = 0x00
};
class ThermaltakeRiingController
{
public:
ThermaltakeRiingController(libusb_device_handle* dev_handle);
~ThermaltakeRiingController();
void SetChannelLEDs(unsigned char channel, std::vector<RGBColor> colors);
void SetMode(unsigned char mode, unsigned char speed);
unsigned int channel_leds[5];
private:
libusb_device_handle* dev;
unsigned char current_mode;
unsigned char current_speed;
void SendInit();
void SendRGB
(
unsigned char port,
unsigned char mode,
unsigned char speed,
unsigned char num_colors,
unsigned char* color_data
);
void SendFan();
void SendSave();
};
@@ -1,41 +0,0 @@
#include "ThermaltakeRiingController.h"
#include "RGBController.h"
#include "RGBController_ThermaltakeRiing.h"
#include <vector>
#include <libusb-1.0/libusb.h>
#define THERMALTAKE_RIING_VID 0x264A
#define THERMALTAKE_RIING_PID_BEGIN 0x1FA5
#define THERMALTAKE_RIING_PID_END 0x1FB5
/******************************************************************************************\
* *
* DetectThermaltakeRiingControllers *
* *
* Tests the USB address to see if an AMD Wraith Prism controller exists there. *
* *
\******************************************************************************************/
void DetectThermaltakeRiingControllers(std::vector<RGBController*>& rgb_controllers)
{
libusb_context * ctx;
libusb_init(&ctx);
for(int pid = THERMALTAKE_RIING_PID_BEGIN; pid <= THERMALTAKE_RIING_PID_END; pid++)
{
//Look for Thermaltake Riing device
libusb_device_handle * dev = libusb_open_device_with_vid_pid(ctx, THERMALTAKE_RIING_VID, pid);
if( dev )
{
libusb_detach_kernel_driver(dev, 0);
libusb_claim_interface(dev, 0);
ThermaltakeRiingController* controller = new ThermaltakeRiingController(dev);
RGBController_ThermaltakeRiing* rgb_controller = new RGBController_ThermaltakeRiing(controller);
rgb_controllers.push_back(rgb_controller);
}
}
}
+69 -14
View File
@@ -13,12 +13,15 @@
#include <stdlib.h>
#ifdef WIN32
#include <regex>
#include "i2c_smbus_piix4.h"
#include "i2c_smbus_i801.h"
#include "i2c_smbus_nct6775.h"
#include "super_io.h"
#include "wmi.h"
#include "inpout32.h"
#pragma comment(lib, "inpout32.lib")
#else /* WIN32 */
#include "i2c_smbus_linux.h"
@@ -33,6 +36,68 @@ std::vector<i2c_smbus_interface*> busses;
std::vector<RGBController*> rgb_controllers;
#ifdef WIN32
/******************************************************************************************\
* *
* Nuvoton Super IO constants *
* *
\******************************************************************************************/
#define SIO_NCT5577_ID 0xC330 /* Device ID for NCT5577D (C333) */
#define SIO_NCT6102_ID 0x1060 /* Device ID for NCT6102D/6106D (1061) */
#define SIO_NCT6793_ID 0xd120 /* Device ID for NCT6793D (D121) */
#define SIO_NCT6796_ID 0xd420 /* Device ID for NCT6796D (D421) */
#define SIO_REG_LOGDEV 0x07 /* Logical Device Register */
#define SIO_REG_DEVID 0x20 /* Device ID Register */
#define SIO_REG_SMBA 0x62 /* SMBus Base Address Register */
#define SIO_LOGDEV_SMBUS 0x0B /* Logical Device for SMBus */
#define SIO_ID_MASK 0xFFF8 /* Device ID mask */
/******************************************************************************************\
* *
* superio_enter *
* *
* Put the Super IO chip into Extended Function Mode *
* *
\******************************************************************************************/
void superio_enter(int ioreg)
{
Out32(ioreg, 0x87);
Out32(ioreg, 0x87);
}
/******************************************************************************************\
* *
* superio_outb *
* *
* Write a byte to the Super IO configuration register *
* *
\******************************************************************************************/
void superio_outb(int ioreg, int reg, int val)
{
Out32(ioreg, reg);
Out32(ioreg + 1, val);
}
/******************************************************************************************\
* *
* superio_inb *
* *
* Read a byte to the Super IO configuration register *
* *
\******************************************************************************************/
int superio_inb(int ioreg, int reg)
{
Out32(ioreg, reg);
return Inp32(ioreg + 1);
}
/******************************************************************************************\
* *
* DetectNuvotonI2CBusses (Windows) *
@@ -255,7 +320,6 @@ void DetectI2CBusses()
void DetectAuraControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers);
void DetectCorsairControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers);
void DetectCorsairProControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers);
void DetectCrucialControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers);
void DetectHyperXControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers);
void DetectPatriotViperControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers);
void DetectPolychromeControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
@@ -271,11 +335,7 @@ void DetectAorusGPUControllers(std::vector<RGBController*> &rgb_controllers);
void DetectMSI3ZoneControllers(std::vector<RGBController*>& rgb_controllers);
void DetectPoseidonZRGBControllers(std::vector<RGBController*>& rgb_controllers);
void DetectCorsairCmdrProControllers(std::vector<RGBController*> &rgb_controllers);
void DetectCorsairKeyboardControllers(std::vector<RGBController*>& rgb_controllers);
void DetectCorsairNodeProControllers(std::vector<RGBController*> &rgb_controllers);
void DetectFaustusControllers(std::vector<RGBController*> &rgb_controllers);
void DetectHyperXKeyboardControllers(std::vector<RGBController*>& rgb_controllers);
void DetectThermaltakeRiingControllers(std::vector<RGBController*>& rgb_controllers);
/******************************************************************************************\
* *
@@ -292,7 +352,6 @@ void DetectRGBControllers(void)
DetectAuraControllers(busses, rgb_controllers);
DetectCorsairControllers(busses, rgb_controllers);
DetectCorsairProControllers(busses, rgb_controllers);
DetectCrucialControllers(busses, rgb_controllers);
DetectHyperXControllers(busses, rgb_controllers);
DetectPatriotViperControllers(busses, rgb_controllers);
DetectPolychromeControllers(busses, rgb_controllers);
@@ -305,11 +364,8 @@ void DetectRGBControllers(void)
DetectAMDWraithPrismControllers(rgb_controllers);
DetectMSI3ZoneControllers(rgb_controllers);
DetectPoseidonZRGBControllers(rgb_controllers);
DetectHyperXKeyboardControllers(rgb_controllers);
DetectCorsairCmdrProControllers(rgb_controllers);
DetectCorsairKeyboardControllers(rgb_controllers);
DetectCorsairNodeProControllers(rgb_controllers);
DetectThermaltakeRiingControllers(rgb_controllers);
DetectE131Controllers(rgb_controllers);
@@ -317,15 +373,14 @@ void DetectRGBControllers(void)
| Windows-only devices |
\*-------------------------------------*/
#ifdef WIN32
// DetectRazerChromaSDKControllers(rgb_controllers);
DetectAorusGPUControllers(rgb_controllers);
DetectOpenRazerControllers(rgb_controllers);
DetectRazerChromaSDKControllers(rgb_controllers);
//DetectAorusGPUControllers(rgb_controllers);
/*-------------------------------------*\
| Linux-only devices |
\*-------------------------------------*/
#else
DetectOpenRazerControllers(rgb_controllers);
DetectFaustusControllers(rgb_controllers);
#endif
} /* DetectRGBControllers() */
+5 -53
View File
@@ -11,27 +11,21 @@ INCLUDEPATH += \
i2c_tools/ \
net_port/ \
serial_port/ \
super_io/ \
Controllers/AMDWraithPrismController/ \
Controllers/AuraController/ \
Controllers/CorsairController/ \
Controllers/CorsairCmdrProController/ \
Controllers/CorsairKeyboardController/ \
Controllers/CorsairNodeProController/ \
Controllers/CorsairProController/ \
Controllers/CrucialController/ \
Controllers/Hue2Controller/ \
Controllers/HuePlusController/ \
Controllers/HyperXController/ \
Controllers/HyperXKeyboardController/ \
Controllers/LEDStripController/ \
Controllers/MSI3ZoneController/ \
Controllers/PatriotViperController/ \
Controllers/PolychromeController/ \
Controllers/PoseidonZRGBController/ \
Controllers/RGBFusionController/ \
Controllers/RGBFusion2Controller/ \
Controllers/ThermaltakeRiingController/ \
RGBController/ \
qt/
@@ -49,7 +43,6 @@ SOURCES += \
qt/OpenRGBSystemInfoPage.cpp \
qt/hsv.cpp \
serial_port/serial_port.cpp \
super_io/super_io.cpp \
Controllers/AMDWraithPrismController/AMDWraithPrismController.cpp \
Controllers/AMDWraithPrismController/AMDWraithPrismControllerDetect.cpp \
Controllers/AuraController/AuraController.cpp \
@@ -58,22 +51,16 @@ SOURCES += \
Controllers/CorsairController/CorsairControllerDetect.cpp \
Controllers/CorsairCmdrProController/CorsairCmdrProController.cpp \
Controllers/CorsairCmdrProController/CorsairCmdrProControllerDetect.cpp \
Controllers/CorsairKeyboardController/CorsairKeyboardController.cpp \
Controllers/CorsairKeyboardController/CorsairKeyboardControllerDetect.cpp \
Controllers/CorsairNodeProController/CorsairNodeProController.cpp \
Controllers/CorsairNodeProController/CorsairNodeProControllerDetect.cpp \
Controllers/CorsairProController/CorsairProController.cpp \
Controllers/CorsairProController/CorsairProControllerDetect.cpp \
Controllers/CrucialController/CrucialController.cpp \
Controllers/CrucialController/CrucialControllerDetect.cpp \
Controllers/Hue2Controller/Hue2Controller.cpp \
Controllers/Hue2Controller/Hue2ControllerDetect.cpp \
Controllers/HuePlusController/HuePlusController.cpp \
Controllers/HuePlusController/HuePlusControllerDetect.cpp \
Controllers/HyperXController/HyperXController.cpp \
Controllers/HyperXController/HyperXControllerDetect.cpp \
Controllers/HyperXKeyboardController/HyperXKeyboardController.cpp \
Controllers/HyperXKeyboardController/HyperXKeyboardControllerDetect.cpp \
Controllers/LEDStripController/LEDStripController.cpp \
Controllers/LEDStripController/LEDStripControllerDetect.cpp \
Controllers/MSI3ZoneController/MSI3ZoneController.cpp \
@@ -86,33 +73,24 @@ SOURCES += \
Controllers/PoseidonZRGBController/PoseidonZRGBControllerDetect.cpp \
Controllers/RGBFusionController/RGBFusionController.cpp \
Controllers/RGBFusionController/RGBFusionControllerDetect.cpp \
Controllers/RGBFusion2Controller/RGBFusion2Controller.cpp \
Controllers/RGBFusion2Controller/RGBFusion2ControllerDetect.cpp \
Controllers/ThermaltakeRiingController/ThermaltakeRiingController.cpp \
Controllers/ThermaltakeRiingController/ThermaltakeRiingControllerDetect.cpp \
RGBController/RGBController.cpp \
RGBController/E131ControllerDetect.cpp \
RGBController/RGBController_AMDWraithPrism.cpp \
RGBController/RGBController_Aura.cpp \
RGBController/RGBController_Corsair.cpp \
RGBController/RGBController_CorsairCmdrPro.cpp \
RGBController/RGBController_CorsairKeyboard.cpp \
RGBController/RGBController_CorsairNodePro.cpp \
RGBController/RGBController_CorsairPro.cpp \
RGBController/RGBController_Crucial.cpp \
RGBController/RGBController_Hue2.cpp \
RGBController/RGBController_HuePlus.cpp \
RGBController/RGBController_HyperX.cpp \
RGBController/RGBController_HyperXKeyboard.cpp \
RGBController/RGBController_E131.cpp \
RGBController/RGBController_LEDStrip.cpp \
RGBController/RGBController_MSI3Zone.cpp \
RGBController/RGBController_PatriotViper.cpp \
RGBController/RGBController_Polychrome.cpp \
RGBController/RGBController_PoseidonZRGB.cpp \
RGBController/RGBController_RGBFusion.cpp \
RGBController/RGBController_RGBFusion2.cpp \
RGBController/RGBController_ThermaltakeRiing.cpp \
RGBController/RGBController_RGBFusion.cpp
HEADERS += \
qt/OpenRGBDeviceInfoPage.h \
@@ -125,27 +103,21 @@ HEADERS += \
qt/OpenRGBSystemInfoPage.h \
serial_port/find_usb_serial_port.h \
serial_port/serial_port.h \
super_io/super_io.h \
Controllers/AMDWraithPrismController/AMDWraithPrismController.h \
Controllers/AuraController/AuraController.h \
Controllers/CorsairController/CorsairController.h \
Controllers/CorsairCmdrProController/CorsairCmdrProController.h \
Controllers/CorsairKeyboardController/CorsairKeyboardController.h \
Controllers/CorsairNodeProController/CorsairNodeProController.h \
Controllers/CorsairProController/CorsairProController.h \
Controllers/CrucialController/CrucialController.h \
Controllers/Hue2Controller/Hue2Controller.h \
Controllers/HuePlusController/HuePlusController.h \
Controllers/HyperXController/HyperXController.h \
Controllers/HyperXKeyboardController/HyperXKeyboardController.h \
Controllers/LEDStripController/LEDStripController.h \
Controllers/MSI3ZoneController/MSI3ZoneController.h \
Controllers/PatriotViperController/PatriotViperController.h \
Controllers/PolychromeController/PolychromeController.h \
Controllers/PoseidonZRGBController/PoseidonZRGBController.h \
Controllers/RGBFusionController/RGBFusionController.h \
Controllers/RGBFusion2Controller/RGBFusion2Controller.h \
Controllers/ThermaltakeRiingController/ThermaltakeRiingController.h \
RGBController/RGBController.h \
RGBController/RGBController_AMDWraithPrism.h \
RGBController/RGBController_Aura.h \
@@ -153,20 +125,16 @@ HEADERS += \
RGBController/RGBController_CorsairCmdrPro.h \
RGBController/RGBController_CorsairNodePro.h \
RGBController/RGBController_CorsairPro.h \
RGBController/RGBController_Crucial.h \
RGBController/RGBController_E131.h \
RGBController/RGBController_Hue2.h \
RGBController/RGBController_HuePlus.h \
RGBController/RGBController_HyperX.h \
RGBController/RGBController_HyperXKeyboard.h \
RGBController/RGBController_LEDStrip.h \
RGBController/RGBController_MSI3Zone.h \
RGBController/RGBController_PatriotViper.h \
RGBController/RGBController_Polychrome.h \
RGBController/RGBController_PoseidonZRGB.h \
RGBController/RGBController_RGBFusion.h \
RGBController/RGBController_RGBFusion2.h \
RGBController/RGBController_ThermaltakeRiing.h \
RGBController/RGBController_RGBFusion.h
RESOURCES += \
qt/resources.qrc
@@ -186,7 +154,6 @@ win32:INCLUDEPATH += \
dependencies/razer-chroma-2.9.0/inc \
dependencies/libusb-1.0.22/include \
dependencies/hidapi \
dependencies/openrazer-win32 \
wmi/ \
win32:SOURCES += \
@@ -196,11 +163,9 @@ win32:SOURCES += \
serial_port/find_usb_serial_port_win.cpp \
wmi/wmi.cpp \
RGBController/AorusGPUDetect.cpp \
RGBController/OpenRazerWindowsDetect.cpp \
RGBController/RGBController_AorusGPU.cpp \
RGBController/RGBController_OpenRazerWindows.cpp \
# RGBController/RazerChromaSDKDetect.cpp \
# RGBController/RGBController_RazerChromaSDK.cpp \
RGBController/RazerChromaSDKDetect.cpp \
RGBController/RGBController_RazerChromaSDK.cpp \
win32:HEADERS += \
dependencies/inpout32_1501/Win32/inpout32.h \
@@ -209,8 +174,7 @@ win32:HEADERS += \
i2c_smbus/i2c_smbus_piix4.h \
wmi/wmi.h \
RGBController/RGBController_AorusGPU.h \
RGBController/RGBController_OpenRazerWindows.h \
# RGBController/RGBController_RazerChromaSDK.h \
RGBController/RGBController_RazerChromaSDK.h \
win32:LIBS += \
-lws2_32 \
@@ -228,16 +192,6 @@ win32:DEFINES += \
_WINSOCK_DEPRECATED_NO_WARNINGS \
WIN32_LEAN_AND_MEAN
# Copy OpenRazer.dll to output directory
win32
{
copydata.commands = $(COPY_FILE) \"$$shell_path($$PWD\\dependencies\\openrazer-win32\\OpenRazer.dll)\" \"$$shell_path($$OUT_PWD)\"
first.depends = $(first) copydata
export(first.depends)
export(copydata.commands)
QMAKE_EXTRA_TARGETS += first copydata
}
#-----------------------------------------------
# Linux specific project configuration
#-----------------------------------------------
@@ -245,7 +199,6 @@ unix:INCLUDEPATH += \
unix:HEADERS += \
i2c_smbus/i2c_smbus_linux.h \
RGBController/RGBController_Faustus.h \
unix:LIBS += \
-lusb-1.0 \
@@ -265,5 +218,4 @@ unix:SOURCES += \
i2c_smbus/i2c_smbus_linux.cpp \
serial_port/find_usb_serial_port_linux.cpp \
RGBController/OpenRazerDetect.cpp \
RGBController/RGBController_Faustus.cpp \
RGBController/RGBController_OpenRazer.cpp \
+6 -14
View File
@@ -21,21 +21,13 @@ See the [Project Wiki](https://gitlab.com/CalcProgrammer1/OpenRGB/-/wikis/home)
**You must run the application as Administrator the first time to allow InpOut32 to set up. It can be run as a normal user afterwards**
#### Linux:
1. Either open the project using QT Creator or build it using qmake. You will need the libusb-1.0-0 (or equivalent) and libhidapi development packages from your distribution's package manager installed.
1. Either open the project using QT Creator or build it using qmake. You will need the libusb-1.0-0 (or equivalent) development package from your distribution's package manager installed.
* sudo apt install qt5-default libusb-1.0-0-dev libhidapi-dev
* git clone https://gitlab.com/CalcProgrammer1/OpenRGB
* cd OpenRGB
* git submodule update --init --recursive
* qmake OpenRGB.pro
* make -j8
* ./OpenRGB
git clone https://gitlab.com/CalcProgrammer1/OpenRGB
cd OpenRGB
git submodule update --init --recursive
qmake OpenRGB.pro
make
2. Allow access to SMBus:<br>
+2 -2
View File
@@ -58,7 +58,7 @@ void DetectOpenRazerControllers(std::vector<RGBController*> &rgb_controllers)
break;
case 7:
strcpy(driver_path, "/sys/bus/hid/drivers/razeraccessory/");
strcpy(driver_path, "/sys/bus/hid/drivers/razerchromahdk/");
break;
}
@@ -102,7 +102,7 @@ void DetectOpenRazerControllers(std::vector<RGBController*> &rgb_controllers)
RGBController_OpenRazer * razer_rgb = new RGBController_OpenRazer(device_string);
if(razer_rgb->device_index != -1)
if(razer_rgb->device != -1)
{
rgb_controllers.push_back(razer_rgb);
}
File diff suppressed because it is too large Load Diff
-387
View File
@@ -1,387 +0,0 @@
#include "RGBController.h"
#include "RGBController_OpenRazerWindows.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <Windows.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/hid.h>
#ifdef _WIN64
#define OPENRAZERDLL "OpenRazer64.dll"
#elif WIN32
#define OPENRAZERDLL "OpenRazer.dll"
#endif
/******************************************************************************************\
* *
* DetectOpenRazerControllers *
* *
* Detect devices supported by the OpenRazer kernel drivers *
* *
\******************************************************************************************/
void DetectOpenRazerControllers(std::vector<RGBController*> &rgb_controllers)
{
static HMODULE module = LoadLibrary(OPENRAZERDLL);
if(module == nullptr)
{
return;
}
// map DLL calls
typedef unsigned int(*INITRAZERDRIVER)(struct hid_device** hdev);
INITRAZERDRIVER init_razer_kbd_driver = reinterpret_cast<INITRAZERDRIVER>(GetProcAddress(module, "init_razer_kbd_driver"));
static struct device_attribute devkbd_attr_device_type = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devkbd_attr_device_type"));
static struct device_attribute devkbd_attr_device_serial = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devkbd_attr_device_serial"));
static struct device_attribute devkbd_attr_firmware_version = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devkbd_attr_firmware_version"));
static struct device_attribute devkbd_attr_matrix_effect_custom = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devkbd_attr_matrix_effect_custom"));
static struct device_attribute devkbd_attr_matrix_custom_frame = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devkbd_attr_matrix_custom_frame"));
static struct device_attribute devkbd_attr_matrix_brightness = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devkbd_attr_matrix_brightness"));
static struct device_attribute devkbd_attr_matrix_effect_none = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devkbd_attr_matrix_effect_none"));
static struct device_attribute devkbd_attr_matrix_effect_static = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devkbd_attr_matrix_effect_static"));
static struct device_attribute devkbd_attr_matrix_effect_breath = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devkbd_attr_matrix_effect_breath"));
static struct device_attribute devkbd_attr_matrix_effect_spectrum = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devkbd_attr_matrix_effect_spectrum"));
static struct device_attribute devkbd_attr_matrix_effect_reactive = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devkbd_attr_matrix_effect_reactive"));
static struct device_attribute devkbd_attr_matrix_effect_wave = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devkbd_attr_matrix_effect_wave"));
INITRAZERDRIVER init_razer_mousemat_driver = reinterpret_cast<INITRAZERDRIVER>(GetProcAddress(module, "init_razer_mousemat_driver"));
static struct device_attribute devmousemat_attr_device_type = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmousemat_attr_device_type"));
static struct device_attribute devmousemat_attr_device_serial = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmousemat_attr_device_serial"));
static struct device_attribute devmousemat_attr_firmware_version = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmousemat_attr_firmware_version"));
static struct device_attribute devmousemat_attr_matrix_effect_custom = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmousemat_attr_matrix_effect_custom"));
static struct device_attribute devmousemat_attr_matrix_custom_frame = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmousemat_attr_matrix_custom_frame"));
static struct device_attribute devmousemat_attr_matrix_brightness = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmousemat_attr_matrix_brightness"));
static struct device_attribute devmousemat_attr_matrix_effect_none = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmousemat_attr_matrix_effect_none"));
static struct device_attribute devmousemat_attr_matrix_effect_static = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmousemat_attr_matrix_effect_static"));
static struct device_attribute devmousemat_attr_matrix_effect_breath = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmousemat_attr_matrix_effect_breath"));
static struct device_attribute devmousemat_attr_matrix_effect_spectrum = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmousemat_attr_matrix_effect_spectrum"));
static struct device_attribute devmousemat_attr_matrix_effect_reactive = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmousemat_attr_matrix_effect_reactive"));
static struct device_attribute devmousemat_attr_matrix_effect_wave = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmousemat_attr_matrix_effect_wave"));
INITRAZERDRIVER init_razer_mouse_driver = reinterpret_cast<INITRAZERDRIVER>(GetProcAddress(module, "init_razer_mouse_driver"));
static struct device_attribute devmouse_attr_device_type = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmouse_attr_device_type"));
static struct device_attribute devmouse_attr_device_serial = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmouse_attr_device_serial"));
static struct device_attribute devmouse_attr_firmware_version = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmouse_attr_firmware_version"));
static struct device_attribute devmouse_attr_matrix_effect_custom = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmouse_attr_matrix_effect_custom"));
static struct device_attribute devmouse_attr_matrix_custom_frame = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmouse_attr_matrix_custom_frame"));
static struct device_attribute devmouse_attr_matrix_brightness = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmouse_attr_matrix_brightness"));
static struct device_attribute devmouse_attr_logo_led_brightness = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmouse_attr_logo_led_brightness"));
static struct device_attribute devmouse_attr_scroll_led_brightness = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmouse_attr_scroll_led_brightness"));
static struct device_attribute devmouse_attr_matrix_effect_none = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmouse_attr_matrix_effect_none"));
static struct device_attribute devmouse_attr_logo_matrix_effect_none = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmouse_attr_logo_matrix_effect_none"));
static struct device_attribute devmouse_attr_scroll_matrix_effect_none = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmouse_attr_scroll_matrix_effect_none"));
static struct device_attribute devmouse_attr_matrix_effect_static = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmouse_attr_matrix_effect_static"));
static struct device_attribute devmouse_attr_logo_matrix_effect_static = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmouse_attr_logo_matrix_effect_static"));
static struct device_attribute devmouse_attr_scroll_matrix_effect_static = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmouse_attr_scroll_matrix_effect_static"));
static struct device_attribute devmouse_attr_matrix_effect_breath = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmouse_attr_matrix_effect_breath"));
static struct device_attribute devmouse_attr_matrix_effect_spectrum = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmouse_attr_matrix_effect_spectrum"));
static struct device_attribute devmouse_attr_logo_matrix_effect_spectrum = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmouse_attr_logo_matrix_effect_spectrum"));
static struct device_attribute devmouse_attr_scroll_matrix_effect_spectrum = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmouse_attr_scroll_matrix_effect_spectrum"));
static struct device_attribute devmouse_attr_matrix_effect_reactive = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmouse_attr_matrix_effect_reactive"));
static struct device_attribute devmouse_attr_logo_matrix_effect_reactive = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmouse_attr_logo_matrix_effect_reactive"));
static struct device_attribute devmouse_attr_scroll_matrix_effect_reactive = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmouse_attr_scroll_matrix_effect_reactive"));
static struct device_attribute devmouse_attr_scroll_led_effect = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmouse_attr_scroll_led_effect"));
static struct device_attribute devmouse_attr_scroll_led_rgb = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmouse_attr_scroll_led_rgb"));
static struct device_attribute devmouse_attr_scroll_led_state = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmouse_attr_scroll_led_state"));
static struct device_attribute devmouse_attr_matrix_effect_wave = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devmouse_attr_matrix_effect_wave"));
INITRAZERDRIVER init_razer_accessory_driver = reinterpret_cast<INITRAZERDRIVER>(GetProcAddress(module, "init_razer_accessory_driver"));
static struct device_attribute devaccessory_attr_device_type = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devaccessory_attr_device_type"));
static struct device_attribute devaccessory_attr_device_serial = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devaccessory_attr_device_serial"));
static struct device_attribute devaccessory_attr_firmware_version = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devaccessory_attr_firmware_version"));
static struct device_attribute devaccessory_attr_matrix_effect_custom = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devaccessory_attr_matrix_effect_custom"));
static struct device_attribute devaccessory_attr_matrix_custom_frame = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devaccessory_attr_matrix_custom_frame"));
static struct device_attribute devaccessory_attr_matrix_brightness = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devaccessory_attr_matrix_brightness"));
static struct device_attribute devaccessory_attr_matrix_effect_none = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devaccessory_attr_matrix_effect_none"));
static struct device_attribute devaccessory_attr_matrix_effect_static = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devaccessory_attr_matrix_effect_static"));
static struct device_attribute devaccessory_attr_matrix_effect_breath = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devaccessory_attr_matrix_effect_breath"));
static struct device_attribute devaccessory_attr_matrix_effect_spectrum = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devaccessory_attr_matrix_effect_spectrum"));
//static struct device_attribute devaccessory_attr_matrix_effect_reactive = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devaccessory_attr_matrix_effect_reactive"));
static struct device_attribute devaccessory_attr_matrix_effect_wave = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devaccessory_attr_matrix_effect_wave"));
INITRAZERDRIVER init_razer_kraken_driver = reinterpret_cast<INITRAZERDRIVER>(GetProcAddress(module, "init_razer_kraken_driver"));
static struct device_attribute devkraken_attr_device_type = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devkraken_attr_device_type"));
static struct device_attribute devkraken_attr_device_serial = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devkraken_attr_device_serial"));
static struct device_attribute devkraken_attr_firmware_version = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devkraken_attr_firmware_version"));
static struct device_attribute devkraken_attr_matrix_effect_custom = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devkraken_attr_matrix_effect_custom"));
//static struct device_attribute devkraken_attr_matrix_custom_frame = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devkraken_attr_matrix_custom_frame"));
//static struct device_attribute devkraken_attr_matrix_brightness = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devkraken_attr_matrix_brightness"));
static struct device_attribute devkraken_attr_matrix_effect_none = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devkraken_attr_matrix_effect_none"));
static struct device_attribute devkraken_attr_matrix_effect_static = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devkraken_attr_matrix_effect_static"));
static struct device_attribute devkraken_attr_matrix_effect_breath = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devkraken_attr_matrix_effect_breath"));
static struct device_attribute devkraken_attr_matrix_effect_spectrum = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devkraken_attr_matrix_effect_spectrum"));
INITRAZERDRIVER init_razer_core_driver = reinterpret_cast<INITRAZERDRIVER>(GetProcAddress(module, "init_razer_core_driver"));
static struct device_attribute devcore_attr_device_type = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devcore_attr_device_type"));
static struct device_attribute devcore_attr_device_serial = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devcore_attr_device_serial"));
static struct device_attribute devcore_attr_firmware_version = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devcore_attr_firmware_version"));
static struct device_attribute devcore_attr_matrix_effect_custom = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devcore_attr_matrix_effect_custom"));
static struct device_attribute devcore_attr_matrix_custom_frame = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devcore_attr_matrix_custom_frame"));
static struct device_attribute devcore_attr_matrix_brightness = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devcore_attr_matrix_brightness"));
static struct device_attribute devcore_attr_matrix_effect_none = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devcore_attr_matrix_effect_none"));
static struct device_attribute devcore_attr_matrix_effect_static = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devcore_attr_matrix_effect_static"));
static struct device_attribute devcore_attr_matrix_effect_breath = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devcore_attr_matrix_effect_breath"));
static struct device_attribute devcore_attr_matrix_effect_spectrum = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devcore_attr_matrix_effect_spectrum"));
static struct device_attribute devcore_attr_matrix_effect_reactive = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devcore_attr_matrix_effect_reactive"));
static struct device_attribute devcore_attr_matrix_effect_wave = *(struct device_attribute*)reinterpret_cast<void*>(GetProcAddress(module, "devcore_attr_matrix_effect_wave"));
struct hid_device* hdev;
unsigned int num;
hdev = NULL;
num = init_razer_kbd_driver(&hdev);
for (unsigned int i = 0; i < num; i++)
{
device_fn_type* device_fn = new device_fn_type;
device_fn->device_type = &devkbd_attr_device_type;
device_fn->device_serial = &devkbd_attr_device_serial;
device_fn->firmware_version = &devkbd_attr_firmware_version;
device_fn->matrix_effect_custom = &devkbd_attr_matrix_effect_custom;
device_fn->matrix_custom_frame = &devkbd_attr_matrix_custom_frame;
device_fn->matrix_brightness = &devkbd_attr_matrix_brightness;
device_fn->matrix_effect_none = &devkbd_attr_matrix_effect_none;
device_fn->matrix_effect_static = &devkbd_attr_matrix_effect_static;
device_fn->matrix_effect_breath = &devkbd_attr_matrix_effect_breath;
device_fn->matrix_effect_spectrum = &devkbd_attr_matrix_effect_spectrum;
device_fn->matrix_effect_reactive = &devkbd_attr_matrix_effect_reactive;
device_fn->matrix_effect_wave = &devkbd_attr_matrix_effect_wave;
device_fn->logo_led_brightness = NULL;
device_fn->logo_matrix_effect_none = NULL;
device_fn->logo_matrix_effect_static = NULL;
device_fn->logo_matrix_effect_spectrum = NULL;
device_fn->logo_matrix_effect_reactive = NULL;
device_fn->scroll_led_brightness = NULL;
device_fn->scroll_matrix_effect_none = NULL;
device_fn->scroll_matrix_effect_static = NULL;
device_fn->scroll_matrix_effect_spectrum = NULL;
device_fn->scroll_matrix_effect_reactive = NULL;
device_fn->scroll_led_effect = NULL;
device_fn->scroll_led_rgb = NULL;
RGBController_OpenRazer * razer_rgb = new RGBController_OpenRazer(&hdev[i].dev, device_fn);
if(razer_rgb->device_index != -1)
{
rgb_controllers.push_back(razer_rgb);
}
else
{
delete razer_rgb;
}
}
hdev = NULL;
num = init_razer_mouse_driver(&hdev);
for (unsigned int i = 0; i < num; i++)
{
device_fn_type* device_fn = new device_fn_type;
device_fn->device_type = &devmouse_attr_device_type;
device_fn->device_serial = &devmouse_attr_device_serial;
device_fn->firmware_version = &devmouse_attr_firmware_version;
device_fn->matrix_effect_custom = &devmouse_attr_matrix_effect_custom;
device_fn->matrix_custom_frame = &devmouse_attr_matrix_custom_frame;
device_fn->matrix_brightness = &devmouse_attr_matrix_brightness;
device_fn->matrix_effect_none = &devmouse_attr_matrix_effect_none;
device_fn->matrix_effect_static = &devmouse_attr_matrix_effect_static;
device_fn->matrix_effect_breath = &devmouse_attr_matrix_effect_breath;
device_fn->matrix_effect_spectrum = &devmouse_attr_matrix_effect_spectrum;
device_fn->matrix_effect_reactive = &devmouse_attr_matrix_effect_reactive;
device_fn->matrix_effect_wave = &devmouse_attr_matrix_effect_wave;
device_fn->logo_led_brightness = NULL;
device_fn->logo_matrix_effect_none = NULL;
device_fn->logo_matrix_effect_static = NULL;
device_fn->logo_matrix_effect_spectrum = NULL;
device_fn->logo_matrix_effect_reactive = NULL;
device_fn->scroll_led_brightness = NULL;
device_fn->scroll_matrix_effect_none = NULL;
device_fn->scroll_matrix_effect_static = NULL;
device_fn->scroll_matrix_effect_spectrum = NULL;
device_fn->scroll_matrix_effect_reactive = NULL;
device_fn->scroll_led_effect = NULL;
device_fn->scroll_led_rgb = NULL;
RGBController_OpenRazer * razer_rgb = new RGBController_OpenRazer(&hdev[i].dev, device_fn);
if(razer_rgb->device_index != -1)
{
rgb_controllers.push_back(razer_rgb);
}
else
{
delete razer_rgb;
}
}
hdev = NULL;
num = init_razer_mousemat_driver(&hdev);
for (unsigned int i = 0; i < num; i++)
{
device_fn_type* device_fn = new device_fn_type;
device_fn->device_type = &devmousemat_attr_device_type;
device_fn->device_serial = &devmousemat_attr_device_serial;
device_fn->firmware_version = &devmousemat_attr_firmware_version;
device_fn->matrix_effect_custom = &devmousemat_attr_matrix_effect_custom;
device_fn->matrix_custom_frame = &devmousemat_attr_matrix_custom_frame;
device_fn->matrix_brightness = &devmousemat_attr_matrix_brightness;
device_fn->matrix_effect_none = &devmousemat_attr_matrix_effect_none;
device_fn->matrix_effect_static = &devmousemat_attr_matrix_effect_static;
device_fn->matrix_effect_breath = &devmousemat_attr_matrix_effect_breath;
device_fn->matrix_effect_spectrum = &devmousemat_attr_matrix_effect_spectrum;
device_fn->matrix_effect_reactive = &devmousemat_attr_matrix_effect_reactive;
device_fn->matrix_effect_wave = &devmousemat_attr_matrix_effect_wave;
device_fn->logo_led_brightness = NULL;
device_fn->logo_matrix_effect_none = NULL;
device_fn->logo_matrix_effect_static = NULL;
device_fn->logo_matrix_effect_spectrum = NULL;
device_fn->logo_matrix_effect_reactive = NULL;
device_fn->scroll_led_brightness = NULL;
device_fn->scroll_matrix_effect_none = NULL;
device_fn->scroll_matrix_effect_static = NULL;
device_fn->scroll_matrix_effect_spectrum = NULL;
device_fn->scroll_matrix_effect_reactive = NULL;
device_fn->scroll_led_effect = NULL;
device_fn->scroll_led_rgb = NULL;
RGBController_OpenRazer * razer_rgb = new RGBController_OpenRazer(&hdev[i].dev, device_fn);
if(razer_rgb->device_index != -1)
{
rgb_controllers.push_back(razer_rgb);
}
else
{
delete razer_rgb;
}
}
hdev = NULL;
num = init_razer_accessory_driver(&hdev);
for (unsigned int i = 0; i < num; i++)
{
device_fn_type* device_fn = new device_fn_type;
device_fn->device_type = &devaccessory_attr_device_type;
device_fn->device_serial = &devaccessory_attr_device_serial;
device_fn->firmware_version = &devaccessory_attr_firmware_version;
device_fn->matrix_effect_custom = &devaccessory_attr_matrix_effect_custom;
device_fn->matrix_custom_frame = &devaccessory_attr_matrix_custom_frame;
device_fn->matrix_brightness = &devaccessory_attr_matrix_brightness;
device_fn->matrix_effect_none = &devaccessory_attr_matrix_effect_none;
device_fn->matrix_effect_static = &devaccessory_attr_matrix_effect_static;
device_fn->matrix_effect_breath = &devaccessory_attr_matrix_effect_breath;
device_fn->matrix_effect_spectrum = &devaccessory_attr_matrix_effect_spectrum;
device_fn->matrix_effect_reactive = NULL;//&devaccessory_attr_matrix_effect_reactive;
device_fn->matrix_effect_wave = &devaccessory_attr_matrix_effect_wave;
device_fn->logo_led_brightness = NULL;
device_fn->logo_matrix_effect_none = NULL;
device_fn->logo_matrix_effect_static = NULL;
device_fn->logo_matrix_effect_spectrum = NULL;
device_fn->logo_matrix_effect_reactive = NULL;
device_fn->scroll_led_brightness = NULL;
device_fn->scroll_matrix_effect_none = NULL;
device_fn->scroll_matrix_effect_static = NULL;
device_fn->scroll_matrix_effect_spectrum = NULL;
device_fn->scroll_matrix_effect_reactive = NULL;
device_fn->scroll_led_effect = NULL;
device_fn->scroll_led_rgb = NULL;
RGBController_OpenRazer * razer_rgb = new RGBController_OpenRazer(&hdev[i].dev, device_fn);
if(razer_rgb->device_index != -1)
{
rgb_controllers.push_back(razer_rgb);
}
else
{
delete razer_rgb;
}
}
hdev = NULL;
num = init_razer_kraken_driver(&hdev);
for (unsigned int i = 0; i < num; i++)
{
device_fn_type* device_fn = new device_fn_type;
device_fn->device_type = &devkraken_attr_device_type;
device_fn->device_serial = &devkraken_attr_device_serial;
device_fn->firmware_version = &devkraken_attr_firmware_version;
device_fn->matrix_effect_custom = &devkraken_attr_matrix_effect_custom;
device_fn->matrix_custom_frame = NULL;//&devkraken_attr_matrix_custom_frame;
device_fn->matrix_brightness = NULL;//&devkraken_attr_matrix_brightness;
device_fn->matrix_effect_none = &devkraken_attr_matrix_effect_none;
device_fn->matrix_effect_static = &devkraken_attr_matrix_effect_static;
device_fn->matrix_effect_breath = &devkraken_attr_matrix_effect_breath;
device_fn->matrix_effect_spectrum = &devkraken_attr_matrix_effect_spectrum;
device_fn->matrix_effect_reactive = NULL;//&devkraken_attr_matrix_effect_reactive;
device_fn->matrix_effect_wave = NULL;//&devkraken_attr_matrix_effect_wave;
device_fn->logo_led_brightness = NULL;
device_fn->logo_matrix_effect_none = NULL;
device_fn->logo_matrix_effect_static = NULL;
device_fn->logo_matrix_effect_spectrum = NULL;
device_fn->logo_matrix_effect_reactive = NULL;
device_fn->scroll_led_brightness = NULL;
device_fn->scroll_matrix_effect_none = NULL;
device_fn->scroll_matrix_effect_static = NULL;
device_fn->scroll_matrix_effect_spectrum = NULL;
device_fn->scroll_matrix_effect_reactive = NULL;
device_fn->scroll_led_effect = NULL;
device_fn->scroll_led_rgb = NULL;
RGBController_OpenRazer * razer_rgb = new RGBController_OpenRazer(&hdev[i].dev, device_fn);
if(razer_rgb->device_index != -1)
{
rgb_controllers.push_back(razer_rgb);
}
else
{
delete razer_rgb;
}
}
hdev = NULL;
num = init_razer_core_driver(&hdev);
for (unsigned int i = 0; i < num; i++)
{
device_fn_type* device_fn = new device_fn_type;
device_fn->device_type = &devcore_attr_device_type;
device_fn->device_serial = &devcore_attr_device_serial;
device_fn->firmware_version = &devcore_attr_firmware_version;
device_fn->matrix_effect_custom = &devcore_attr_matrix_effect_custom;
device_fn->matrix_custom_frame = &devcore_attr_matrix_custom_frame;
device_fn->matrix_brightness = &devcore_attr_matrix_brightness;
device_fn->matrix_effect_none = &devcore_attr_matrix_effect_none;
device_fn->matrix_effect_static = &devcore_attr_matrix_effect_static;
device_fn->matrix_effect_breath = &devcore_attr_matrix_effect_breath;
device_fn->matrix_effect_spectrum = &devcore_attr_matrix_effect_spectrum;
device_fn->matrix_effect_reactive = &devcore_attr_matrix_effect_reactive;
device_fn->matrix_effect_wave = &devcore_attr_matrix_effect_wave;
device_fn->logo_led_brightness = NULL;
device_fn->logo_matrix_effect_none = NULL;
device_fn->logo_matrix_effect_static = NULL;
device_fn->logo_matrix_effect_spectrum = NULL;
device_fn->logo_matrix_effect_reactive = NULL;
device_fn->scroll_led_brightness = NULL;
device_fn->scroll_matrix_effect_none = NULL;
device_fn->scroll_matrix_effect_static = NULL;
device_fn->scroll_matrix_effect_spectrum = NULL;
device_fn->scroll_matrix_effect_reactive = NULL;
device_fn->scroll_led_effect = NULL;
device_fn->scroll_led_rgb = NULL;
RGBController_OpenRazer * razer_rgb = new RGBController_OpenRazer(&hdev[i].dev, device_fn);
if(razer_rgb->device_index != -1)
{
rgb_controllers.push_back(razer_rgb);
}
else
{
delete razer_rgb;
}
}
} /* DetectOpenRazerControllers() */
@@ -175,7 +175,7 @@ void RGBController_AMDWraithPrism::UpdateSingleLED(int led)
void RGBController_AMDWraithPrism::SetCustomMode()
{
active_mode = 0;
SetMode(0);
}
void RGBController_AMDWraithPrism::UpdateMode()
+1 -1
View File
@@ -259,7 +259,7 @@ RGBController_Aura::RGBController_Aura(AuraController * aura_ptr)
void RGBController_Aura::SetCustomMode()
{
active_mode = 0;
SetMode(0);
}
void RGBController_Aura::UpdateMode()
+1 -1
View File
@@ -85,7 +85,7 @@ RGBController_Corsair::RGBController_Corsair(CorsairController* corsair_ptr)
void RGBController_Corsair::SetCustomMode()
{
active_mode = 0;
SetMode(0);
}
void RGBController_Corsair::UpdateMode()
@@ -240,7 +240,7 @@ void RGBController_CorsairCmdrPro::UpdateSingleLED(int led)
void RGBController_CorsairCmdrPro::SetCustomMode()
{
active_mode = 9;
SetMode(9);
}
void RGBController_CorsairCmdrPro::UpdateMode()
@@ -9,6 +9,7 @@
#pragma once
#include "RGBController.h"
#include "serial_port.h"
#include "CorsairCmdrProController.h"
class RGBController_CorsairCmdrPro : public RGBController
@@ -1,208 +0,0 @@
/*-----------------------------------------*\
| RGBController_CorsairKeyboard.cpp |
| |
| Generic RGB Interface for Corsair RGB |
| keyboards |
| |
| Adam Honse (CalcProgrammer1) 1/9/2020 |
\*-----------------------------------------*/
#include "RGBController_CorsairKeyboard.h"
static const char* zone_names[] =
{
"Keyboard",
"Media Keys"
};
static const unsigned int zone_sizes[] =
{
104,
7
};
static const char* led_names[] =
{
"Key: Escape", //0
"Key: `", //1
"Key: Tab", //2
"Key: Caps Lock", //3
"Key: Left Shift", //4
"Key: Left Control", //5
"Key: F12", //6
"Key: =", //7
"Key: Lock", //8
"Key: Number Pad 7", //9
"Key: F1", //12
"Key: 1", //13
"Key: Q", //14
"Key: A", //15
"Key: Left Windows", //17
"Key: Print Screen", //18
"Media Mute", //20
"Key: Number Pad 8", //21
"Key: F2", //24
"Key: 2", //25
"Key: W", //26
"Key: S", //27
"Key: Z", //28
"Key: Left Alt", //29
"Key: Scroll Lock", //30
"Key: Backspace", //31
"Media Stop", //32
"Key: Number Pad 9", //33
"Key: F3", //36
"Key: 3", //37
"Key: E", //38
"Key: D", //39
"Key: X", //40
"Key: Pause/Break", //42
"Key: Delete", //43
"Media Previous", //44
"Key: F4", //48
"Key: 4", //49
"Key: R", //50
"Key: F", //51
"Key: C", //52
"Key: Space", //53
"Key: Insert", //54
"Key: End", //55
"Media Play/Pause", //56
"Key: Number Pad 4", //57
"Key: F5", //60
"Key: 5", //61
"Key: T", //62
"Key: G", //63
"Key: V", //64
"Key: Home", //66
"Key: Page Down", //67
"Media Next", //68
"Key: Number Pad 5", //69
"Key: F6", //72
"Key: 6", //73
"Key: Y", //74
"Key: H", //75
"Key: B", //76
"Key: Page Up", //78
"Key: Right Shift", //79
"Key: Num Lock", //80
"Key: Number Pad 6", //81
"Key: F7", //84
"Key: 7", //85
"Key: U", //86
"Key: J", //87
"Key: N", //88
"Key: Right Alt", //89
"Key: ]", //90
"Key: Right Control", //91
"Key: Number Pad /", //92
"Key: Number Pad 1", //93
"Key: F8", //96
"Key: 8", //97
"Key: I", //98
"Key: K", //99
"Key: M", //100
"Key: Right Windows", //101
"Key: \\", //102
"Key: Up Arrow", //103
"Key: Number Pad *", //104
"Key: Number Pad 2", //105
"Key: F9", //108
"Key: 9", //109
"Key: O", //110
"Key: L", //111
"Key: ,", //112
"Key: Context", //113
"Key: Left Arrow", //115
"Key: Number Pad -", //116
"Key: Number Pad 3", //117
"Key: F10", //120
"Key: 0", //121
"Key: P", //122
"Key: ;", //123
"Key: .", //124
"Key: Enter", //126
"Key: Down Arrow", //127
"Key: Number Pad +", //128
"Key: Number Pad 0", //129
"Key: F11", //132
"Key: -", //133
"Key: [", //134
"Key: '", //135
"Key: /", //136
"Key: Brightness", //137
"Key: Right Arrow", //139
"Key: Number Pad Enter",//140
"Key: Number Pad .", //141
"Key: F12"
};
RGBController_CorsairKeyboard::RGBController_CorsairKeyboard(CorsairKeyboardController* corsair_ptr)
{
corsair = corsair_ptr;
name = "Corsair RGB Keyboard";
type = DEVICE_TYPE_KEYBOARD;
mode Direct;
Direct.name = "Direct";
Direct.value = 0;
Direct.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
modes.push_back(Direct);
colors.resize(111);
unsigned int led_idx = 0;
for(unsigned int zone_idx = 0; zone_idx < 2; zone_idx++)
{
zone new_zone;
new_zone.name.append(zone_names[zone_idx]);
std::vector<int> new_zone_map;
for(unsigned int led_count = 0; led_count < zone_sizes[zone_idx]; led_count++)
{
led new_led;
new_led.name.append(led_names[led_idx]);
leds.push_back(new_led);
new_zone_map.push_back(led_idx);
led_idx++;
}
new_zone.map.push_back(new_zone_map);
zones.push_back(new_zone);
}
}
RGBController_CorsairKeyboard::~RGBController_CorsairKeyboard()
{
}
void RGBController_CorsairKeyboard::UpdateLEDs()
{
corsair->SetLEDs(colors);
}
void RGBController_CorsairKeyboard::UpdateZoneLEDs(int zone)
{
corsair->SetLEDs(colors);
}
void RGBController_CorsairKeyboard::UpdateSingleLED(int led)
{
corsair->SetLEDs(colors);
}
void RGBController_CorsairKeyboard::SetCustomMode()
{
active_mode = 0;
}
void RGBController_CorsairKeyboard::UpdateMode()
{
}
@@ -1,29 +0,0 @@
/*-----------------------------------------*\
| RGBController_CorsairKeyboard.h |
| |
| Generic RGB Interface for Corsair RGB |
| keyboards |
| |
| Adam Honse (CalcProgrammer1) 1/9/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "CorsairKeyboardController.h"
class RGBController_CorsairKeyboard : public RGBController
{
public:
RGBController_CorsairKeyboard(CorsairKeyboardController* corsair_ptr);
~RGBController_CorsairKeyboard();
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
private:
CorsairKeyboardController* corsair;
};
@@ -240,7 +240,7 @@ void RGBController_CorsairNodePro::UpdateSingleLED(int led)
void RGBController_CorsairNodePro::SetCustomMode()
{
active_mode = 9;
SetMode(9);
}
void RGBController_CorsairNodePro::UpdateMode()
@@ -9,6 +9,7 @@
#pragma once
#include "RGBController.h"
#include "serial_port.h"
#include "CorsairNodeProController.h"
class RGBController_CorsairNodePro : public RGBController
+1 -1
View File
@@ -185,7 +185,7 @@ RGBController_CorsairPro::RGBController_CorsairPro(CorsairProController* corsair
void RGBController_CorsairPro::SetCustomMode()
{
active_mode = 9;
SetMode(9);
}
void RGBController_CorsairPro::UpdateMode()
-137
View File
@@ -1,137 +0,0 @@
/*-----------------------------------------*\
| RGBController_Crucial.cpp |
| |
| Generic RGB Interface for Crucial |
| Ballistix RGB controller |
| |
| Adam Honse (CalcProgrammer1) 1/19/2020 |
\*-----------------------------------------*/
#include "RGBController_Crucial.h"
void RGBController_Crucial::UpdateLEDs()
{
crucial->SetAllColorsDirect(&colors[0]);
}
void RGBController_Crucial::UpdateZoneLEDs(int zone)
{
crucial->SetAllColorsDirect(&colors[0]);
}
void RGBController_Crucial::UpdateSingleLED(int led)
{
crucial->SetAllColorsDirect(&colors[0]);
}
RGBController_Crucial::RGBController_Crucial(CrucialController * crucial_ptr)
{
crucial = crucial_ptr;
location = crucial->GetDeviceLocation();
type = DEVICE_TYPE_DRAM;
name = "Crucial DRAM";
mode Shift;
Shift.name = "Shift";
Shift.value = CRUCIAL_MODE_SHIFT;
Shift.flags = 0;
modes.push_back(Shift);
mode GradientShift;
GradientShift.name = "Gradient Shift";
GradientShift.value = CRUCIAL_MODE_GRADIENT_SHIFT;
GradientShift.flags = 0;
modes.push_back(GradientShift);
mode Fill;
Fill.name = "Fill";
Fill.value = CRUCIAL_MODE_FILL;
Fill.flags = 0;
modes.push_back(Fill);
mode Stack;
Stack.name = "Stack";
Stack.value = CRUCIAL_MODE_STACK;
Stack.flags = 0;
modes.push_back(Stack);
mode DoubleStack;
DoubleStack.name = "Double Stack";
DoubleStack.value = CRUCIAL_MODE_DOUBLE_STACK;
DoubleStack.flags = 0;
modes.push_back(DoubleStack);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = CRUCIAL_MODE_BREATHING;
Breathing.flags = 0;
modes.push_back(Breathing);
mode MotionPoint;
MotionPoint.name = "Motion Point";
MotionPoint.value = CRUCIAL_MODE_MOTION_POINT;
MotionPoint.flags = 0;
modes.push_back(MotionPoint);
mode InsideOut;
InsideOut.name = "Inside Out";
InsideOut.value = CRUCIAL_MODE_INSIDE_OUT;
InsideOut.flags = 0;
modes.push_back(InsideOut);
mode ColorStep;
ColorStep.name = "Color Step";
ColorStep.value = CRUCIAL_MODE_COLOR_STEP;
ColorStep.flags = 0;
modes.push_back(ColorStep);
mode WaterWave;
WaterWave.name = "Water Wave (Color Blending)";
WaterWave.value = CRUCIAL_MODE_WATER_WAVE;
WaterWave.flags = 0;
modes.push_back(WaterWave);
mode Flashing;
Flashing.name = "Flashing";
Flashing.value = CRUCIAL_MODE_FLASHING;
Flashing.flags = 0;
modes.push_back(Flashing);
mode Static;
Static.name = "Static";
Static.value = CRUCIAL_MODE_STATIC;
Static.flags = 0;
modes.push_back(Static);
zone new_zone;
new_zone.name = "DRAM";
new_zone.type = ZONE_TYPE_LINEAR;
std::vector<int> new_zone_map;
for(int led_idx = 0; led_idx < 8; led_idx++)
{
colors.push_back(0x00000000);
led new_led;
new_led.name = "DRAM LED";
leds.push_back(new_led);
new_zone_map.push_back(led_idx);
}
new_zone.map.push_back(new_zone_map);
zones.push_back(new_zone);
}
void RGBController_Crucial::SetCustomMode()
{
active_mode = 0;
}
void RGBController_Crucial::UpdateMode()
{
crucial->SetMode(modes[active_mode].value);
}
-28
View File
@@ -1,28 +0,0 @@
/*-----------------------------------------*\
| RGBController_Crucial.h |
| |
| Generic RGB Interface for Crucial |
| Ballistix RGB controller |
| |
| Adam Honse (CalcProgrammer1) 1/19/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "CrucialController.h"
class RGBController_Crucial : public RGBController
{
public:
RGBController_Crucial(CrucialController* crucial_ptr);
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
private:
CrucialController* crucial;
};
+2 -9
View File
@@ -24,23 +24,16 @@ RGBController_E131::RGBController_E131(std::vector<E131Device> device_list)
sockfd = e131_socket();
colors.resize(0);
for (std::size_t i = 0; i < devices.size(); i++)
{
/*-----------------------------------------*\
| Add LEDs |
\*-----------------------------------------*/
colors.resize(colors.size() + devices[i].num_leds);
for (unsigned int led_idx = 0; led_idx < devices[i].num_leds; led_idx++)
{
char id_buf[16];
snprintf(id_buf, 16, "%d", led_idx);
colors.push_back(0x00000000);
led new_led;
new_led.name = devices[i].name + " LED ";
new_led.name.append(id_buf);
new_led.name = devices[i].name + " LED";
leds.push_back(new_led);
}
-150
View File
@@ -1,150 +0,0 @@
#include "RGBController_Faustus.h"
#include <dirent.h>
#include <string.h>
RGBController_Faustus::RGBController_Faustus(const std::string& dev_path)
{
name = "Faustus";
description = "ASUS TUF Keyboard Backlight";
type = DEVICE_TYPE_KEYBOARD;
modes.resize(4);
modes[0].name = "Static";
modes[0].value = FAUSTUS_MODE_STATIC;
modes[0].flags = MODE_FLAG_HAS_COLOR;
modes[0].random = false;
modes[1].name = "Breathing";
modes[1].value = FAUSTUS_MODE_BREATHING;
modes[1].flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR;
modes[1].speed_min = FAUSTUS_SPEED_SLOWEST;
modes[1].speed_max = FAUSTUS_SPEED_FASTEST;
modes[1].random = false;
modes[1].speed = FAUSTUS_SPEED_NORMAL;
modes[2].name = "Color Cycle";
modes[2].value = FAUSTUS_MODE_COLOR_CYCLE;
modes[2].flags = MODE_FLAG_HAS_SPEED;
modes[2].speed_min = FAUSTUS_SPEED_SLOWEST;
modes[2].speed_max = FAUSTUS_SPEED_FASTEST;
modes[2].random = false;
modes[2].speed = FAUSTUS_SPEED_NORMAL;
modes[3].name = "Strobe";
modes[3].value = FAUSTUS_MODE_STROBE;
modes[3].flags = MODE_FLAG_HAS_SPEED;
modes[3].speed_min = FAUSTUS_SPEED_SLOWEST;
modes[3].speed_max = FAUSTUS_SPEED_FASTEST;
modes[3].random = false;
modes[3].speed = FAUSTUS_SPEED_NORMAL;
colors.resize(1);
leds.resize(1);
leds[0].name = "Keyboard backlight LED";
zones.resize(1);
zones[0].type = ZONE_TYPE_SINGLE;
zones[0].name = "Keyboard backlight zone";
zones[0].map.push_back(std::vector<int>(1, 0));
// Prepare file streams
r_path = dev_path;
g_path = dev_path;
b_path = dev_path;
mode_path = dev_path;
flags_path = dev_path;
set_path = dev_path;
r_path.append("/kbbl_red");
g_path.append("/kbbl_green");
b_path.append("/kbbl_blue");
mode_path.append("/kbbl_mode");
flags_path.append("/kbbl_flags");
set_path.append("/kbbl_set");
}
void RGBController_Faustus::UpdateLEDs()
{
int rv = uint8_t(RGBGetRValue(colors[0]));
int gv = uint8_t(RGBGetGValue(colors[0]));
int bv = uint8_t(RGBGetBValue(colors[0]));
std::ofstream str_r;
std::ofstream str_g;
std::ofstream str_b;
std::ofstream str_mode;
std::ofstream str_flags;
std::ofstream str_set;
str_r.open(r_path, std::ios::out | std::ios::trunc);
str_g.open(g_path, std::ios::out | std::ios::trunc);
str_b.open(b_path, std::ios::out | std::ios::trunc);
str_mode.open(mode_path, std::ios::out | std::ios::trunc);
str_flags.open(flags_path, std::ios::out | std::ios::trunc);
str_set.open(set_path, std::ios::out | std::ios::trunc);
str_r << std::hex;
str_g << std::hex;
str_b << std::hex;
str_mode << std::hex;
str_flags << std::hex;
str_set << std::hex;
str_r << rv;
str_g << gv;
str_b << bv;
str_mode << active_mode;
str_flags << 0x2a; // All of em
str_set << 2;
// Flush everything
str_r.close();
str_g.close();
str_b.close();
str_mode.close();
str_flags.close();
str_set.close();
}
void RGBController_Faustus::UpdateZoneLEDs(int zone)
{
UpdateLEDs();
}
void RGBController_Faustus::UpdateSingleLED(int led)
{
UpdateLEDs();
}
void RGBController_Faustus::SetCustomMode()
{
SetMode(0);
}
void RGBController_Faustus::UpdateMode()
{
UpdateLEDs();
}
void DetectFaustusControllers(std::vector<RGBController*> &rgb_controllers)
{
const char* base_path = "/sys/devices/platform/faustus/kbbl";
DIR* dir = opendir(base_path);
if(!dir) return;
// Directory is present - we pretty much have a driver confirmation already, but double check for all files required just in case
struct dirent* dent = readdir(dir);
if(!dent) return;
int found = 0;
while(dent)
{
const char* fname = dent->d_name;
if(!strcmp(fname, "kbbl_red") || !strcmp(fname, "kbbl_green") || !strcmp(fname, "kbbl_blue") || !strcmp(fname, "kbbl_mode") || !strcmp(fname, "kbbl_flags") || !strcmp(fname, "kbbl_set"))
{
++found;
}
dent = readdir(dir);
}
closedir(dir);
if(found != 6) return;
rgb_controllers.push_back(new RGBController_Faustus(base_path));
}
-41
View File
@@ -1,41 +0,0 @@
#ifndef RGBCONTROLLER_FAUSTUS_H
#define RGBCONTROLLER_FAUSTUS_H
#include "RGBController.h"
#include <fstream>
enum
{
FAUSTUS_MODE_STATIC = 0,
FAUSTUS_MODE_BREATHING = 1,
FAUSTUS_MODE_COLOR_CYCLE = 2,
FAUSTUS_MODE_STROBE = 3
};
enum
{
FAUSTUS_SPEED_SLOWEST = 0,
FAUSTUS_SPEED_NORMAL = 1,
FAUSTUS_SPEED_FASTEST = 2,
};
class RGBController_Faustus : public RGBController
{
private:
std::string r_path;
std::string g_path;
std::string b_path;
std::string mode_path;
std::string flags_path;
std::string set_path;
public:
RGBController_Faustus(const std::string& dev_path);
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
};
#endif // RGBCONTROLLER_FAUSTUS_H
+1 -1
View File
@@ -209,7 +209,7 @@ void RGBController_Hue2::UpdateSingleLED(int led)
void RGBController_Hue2::SetCustomMode()
{
active_mode = 0;
SetMode(0);
}
void RGBController_Hue2::UpdateMode()
+1
View File
@@ -8,6 +8,7 @@
#pragma once
#include "RGBController.h"
#include "serial_port.h"
#include "Hue2Controller.h"
class RGBController_Hue2 : public RGBController
+1 -1
View File
@@ -243,7 +243,7 @@ void RGBController_HuePlus::UpdateSingleLED(int led)
void RGBController_HuePlus::SetCustomMode()
{
active_mode = 0;
SetMode(0);
}
void RGBController_HuePlus::UpdateMode()
+1 -1
View File
@@ -212,7 +212,7 @@ RGBController_HyperX::RGBController_HyperX(HyperXController* hyperx_ptr)
void RGBController_HyperX::SetCustomMode()
{
active_mode = 0;
SetMode(0);
}
void RGBController_HyperX::UpdateMode()
@@ -1,260 +0,0 @@
/*-----------------------------------------*\
| RGBController_HyperXKeyboard.cpp |
| |
| Generic RGB Interface for HyperX RGB |
| Keyboard |
| |
| Adam Honse (CalcProgrammer1) 2/2/2020 |
\*-----------------------------------------*/
#include "RGBController_HyperXKeyboard.h"
static const char* zone_names[] =
{
"Keyboard",
"RGB Strip",
"Media Keys"
};
static const unsigned int zone_sizes[] =
{
104,
18,
4
};
static const char* led_names[] =
{
"Key: Escape",
"Key: `",
"Key: Tab",
"Key: Caps Lock",
"Key: Left Shift",
"Key: Left Control",
"Key: F12",
"Key: =",
"Key: F9",
"Key: 9",
"Key: O",
"Key: L",
"Key: ,",
"Key: Context",
"Key: Left Arrow",
"Key: F1",
"Key: 1",
"Key: Q",
"Key: A",
"Key: Left Windows",
"Key: Print Screen",
"Key: F10",
"Key: 0",
"Key: P",
"Key: ;",
"Key: .",
"Key: Enter",
"Key: Down Arrow",
"Key: F2",
"Key: 2",
"Key: W",
"Key: S",
"Key: Z",
"Key: Left Alt",
"Key: Scroll Lock",
"Key: Backspace",
"Key: F11",
"Key: -",
"Key: [",
"Key: '",
"Key: /",
"Key: Right Arrow",
"Key: F3",
"Key: 3",
"Key: E",
"Key: D",
"Key: X",
"Key: Pause/Break",
"Key: Delete",
"Key: Number Pad 7",
"Key: Num Lock",
"Key: Number Pad 6",
"Key: F4",
"Key: 4",
"Key: R",
"Key: F",
"Key: C",
"Key: Space",
"Key: Insert",
"Key: End",
"Key: Number Pad 8",
"Key: Number Pad /",
"Key: Number Pad 1",
"Key: F5",
"Key: 5",
"Key: T",
"Key: G",
"Key: V",
"Key: Home",
"Key: Page Down",
"Key: Number Pad 9",
"Key: Number Pad *",
"Key: Number Pad 2",
"Key: F6",
"Key: 6",
"Key: Y",
"Key: H",
"Key: B",
"Key: Page Up",
"Key: Right Shift",
"Key: Number Pad -",
"Key: Number Pad 3",
"Key: F7",
"Key: 7",
"Key: U",
"Key: J",
"Key: N",
"Key: Right Alt",
"Key: ]",
"Key: Right Control",
"Key: Number Pad 4",
"Key: Number Pad +",
"Key: Number Pad 0",
"Key: F8",
"Key: 8",
"Key: I",
"Key: K",
"Key: M",
"Key: Right Windows",
"Key: \\",
"Key: Up Arrow",
"Key: Number Pad 5",
"Key: Number Pad Enter",
"Key: Number Pad .",
"RGB Strip 1",
"RGB Strip 2",
"RGB Strip 3",
"RGB Strip 4",
"RGB Strip 5",
"RGB Strip 6",
"RGB Strip 7",
"RGB Strip 8",
"RGB Strip 9",
"RGB Strip 10",
"RGB Strip 11",
"RGB Strip 12",
"RGB Strip 13",
"RGB Strip 14",
"RGB Strip 15",
"RGB Strip 16",
"RGB Strip 17",
"RGB Strip 18",
"Media Previous",
"Media Play/Pause",
"Media Next",
"Media Mute"
};
RGBController_HyperXKeyboard::RGBController_HyperXKeyboard(HyperXKeyboardController* hyperx_ptr)
{
hyperx = hyperx_ptr;
name = "HyperX RGB Keyboard";
type = DEVICE_TYPE_KEYBOARD;
mode Direct;
Direct.name = "Direct";
Direct.value = HYPERX_MODE_STATIC;
Direct.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Direct.random = false;
modes.push_back(Direct);
mode Static;
Static.name = "Static";
Static.value = HYPERX_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Static.random = false;
modes.push_back(Static);
mode Wave;
Wave.name = "Wave";
Wave.value = HYPERX_MODE_WAVE;
Wave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR;
Wave.speed_min = 0x00;
Wave.speed_max = 0x09;
Wave.random = false;
Wave.speed = 0x09;
Wave.direction = MODE_DIRECTION_LEFT;
modes.push_back(Wave);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = HYPERX_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED;
Breathing.speed_min = 0x00;
Breathing.speed_max = 0x09;
Breathing.random = false;
Breathing.speed = 0x09;
modes.push_back(Breathing);
colors.resize(126);
unsigned int led_idx = 0;
for(unsigned int zone_idx = 0; zone_idx < 3; zone_idx++)
{
zone new_zone;
new_zone.name.append(zone_names[zone_idx]);
std::vector<int> new_zone_map;
for(unsigned int led_count = 0; led_count < zone_sizes[zone_idx]; led_count++)
{
led new_led;
new_led.name.append(led_names[led_idx]);
leds.push_back(new_led);
new_zone_map.push_back(led_idx);
led_idx++;
}
new_zone.map.push_back(new_zone_map);
zones.push_back(new_zone);
}
}
RGBController_HyperXKeyboard::~RGBController_HyperXKeyboard()
{
}
void RGBController_HyperXKeyboard::UpdateLEDs()
{
if(active_mode == 0)
{
hyperx->SetLEDsDirect(colors);
}
else
{
hyperx->SetLEDs(colors);
}
}
void RGBController_HyperXKeyboard::UpdateZoneLEDs(int zone)
{
UpdateLEDs();
}
void RGBController_HyperXKeyboard::UpdateSingleLED(int led)
{
UpdateLEDs();
}
void RGBController_HyperXKeyboard::SetCustomMode()
{
active_mode = 1;
}
void RGBController_HyperXKeyboard::UpdateMode()
{
hyperx->SetMode(modes[active_mode].value, modes[active_mode].direction, modes[active_mode].speed);
}
@@ -1,28 +0,0 @@
/*-----------------------------------------*\
| RGBController_HyperXKeyboard.h |
| |
| Generic RGB Interface for HyperX RGB |
| Keyboard |
| |
| Adam Honse (CalcProgrammer1) 2/2/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "HyperXKeyboardController.h"
class RGBController_HyperXKeyboard : public RGBController
{
public:
RGBController_HyperXKeyboard(HyperXKeyboardController* hyperx_ptr);
~RGBController_HyperXKeyboard();
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
private:
HyperXKeyboardController* hyperx;
};
+1 -6
View File
@@ -26,13 +26,8 @@ RGBController_LEDStrip::RGBController_LEDStrip(LEDStripController* ledstrip_ptr)
for (int i = 0; i < strip->num_leds; i++)
{
char id_buf[16];
snprintf(id_buf, 16, "%d", i);
led new_led;
new_led.name = "LED ";
new_led.name.append(id_buf);
new_led.name = "LED Strip";
leds.push_back(new_led);
}
+75 -122
View File
@@ -12,6 +12,7 @@
#include <fstream>
#include <unistd.h>
void RGBController_OpenRazer::UpdateLEDs()
{
switch(matrix_type)
@@ -80,7 +81,7 @@ void RGBController_OpenRazer::UpdateLEDs()
}
}
break;
#if 0
case RAZER_TYPE_NOMATRIX:
{
unsigned int output_array_size = 3;
@@ -106,7 +107,6 @@ void RGBController_OpenRazer::UpdateLEDs()
scroll_led_effect.flush();
}
break;
#endif
}
}
@@ -120,8 +120,59 @@ void RGBController_OpenRazer::UpdateSingleLED(int led)
UpdateLEDs();
}
static std::string GetDeviceTypeString(std::string dev_path)
{
// Read device_type for device name string
std::string dev_type_path = dev_path + "/device_type";
std::ifstream dev_type_file;
std::string ret_str;
dev_type_file.open(dev_type_path);
std::getline(dev_type_file, ret_str);
dev_type_file.close();
return(ret_str);
}
static std::string GetFirmwareVersionString(std::string dev_path)
{
// Read firmware_version for firmware version string
std::string firm_ver_path = dev_path + "/firmware_version";
std::ifstream firm_ver_file;
std::string ret_str;
firm_ver_file.open(firm_ver_path);
std::getline(firm_ver_file, ret_str);
firm_ver_file.close();
return(ret_str);
}
static std::string GetSerialNumberString(std::string dev_path)
{
// Read device_serial for serial number string
std::string ser_num_path = dev_path + "/device_serial";
std::ifstream ser_num_file;
std::string ret_str;
ser_num_file.open(ser_num_path);
std::getline(ser_num_file, ret_str);
ser_num_file.close();
return(ret_str);
}
void RGBController_OpenRazer::SetupMatrixDevice(std::string dev_path, unsigned int rows, unsigned int cols)
{
matrix_custom_frame.open(dev_path + "/matrix_custom_frame");
matrix_effect_custom.open(dev_path + "/matrix_effect_custom");
matrix_effect_breath.open(dev_path + "/matrix_effect_breath");
matrix_effect_none.open(dev_path + "/matrix_effect_none");
matrix_effect_reactive.open(dev_path + "/matrix_effect_reactive");
matrix_effect_spectrum.open(dev_path + "/matrix_effect_spectrum");
matrix_effect_static.open(dev_path + "/matrix_effect_static");
matrix_effect_wave.open(dev_path + "/matrix_effect_wave");
if(!matrix_custom_frame)
{
if(!matrix_effect_custom)
@@ -147,60 +198,27 @@ void RGBController_OpenRazer::SetupMatrixDevice(std::string dev_path, unsigned i
void RGBController_OpenRazer::SetupNonMatrixDevice(std::string dev_path)
{
logo_led_effect.open(dev_path + "/logo_led_effect");
logo_led_rgb.open(dev_path + "/logo_led_rgb");
scroll_led_effect.open(dev_path + "/scroll_led_effect");
scroll_led_rgb.open(dev_path + "/scroll_led_rgb");
matrix_type = RAZER_TYPE_NOMATRIX;
}
void RGBController_OpenRazer::OpenFunctions(std::string dev_path)
{
device_type.open( dev_path + "/device_type");
device_serial.open( dev_path + "/device_serial");
firmware_version.open( dev_path + "/firmware_version");
matrix_custom_frame.open( dev_path + "/matrix_custom_frame");
matrix_brightness.open( dev_path + "/matrix_brightness");
matrix_effect_custom.open( dev_path + "/matrix_effect_custom");
matrix_effect_none.open( dev_path + "/matrix_effect_none");
matrix_effect_static.open( dev_path + "/matrix_effect_static");
matrix_effect_breath.open( dev_path + "/matrix_effect_breath");
matrix_effect_spectrum.open( dev_path + "/matrix_effect_spectrum");
matrix_effect_reactive.open( dev_path + "/matrix_effect_reactive");
matrix_effect_wave.open( dev_path + "/matrix_effect_wave");
logo_led_brightness.open( dev_path + "/logo_led_brightness");
logo_matrix_effect_none.open( dev_path + "/logo_matrix_effect_none");
logo_matrix_effect_static.open( dev_path + "/logo_matrix_effect_static");
logo_matrix_effect_spectrum.open( dev_path + "/logo_matrix_effect_spectrum");
logo_matrix_effect_reactive.open( dev_path + "/logo_matrix_effect_reactive");
scroll_led_brightness.open( dev_path + "/scroll_led_brightness");
scroll_matrix_effect_none.open( dev_path + "/scroll_matrix_effect_none");
scroll_matrix_effect_static.open( dev_path + "/scroll_matrix_effect_static");
scroll_matrix_effect_spectrum.open(dev_path + "/scroll_matrix_effect_spectrum");
scroll_matrix_effect_reactive.open(dev_path + "/scroll_matrix_effect_reactive");
scroll_led_effect.open( dev_path + "/scroll_led_effect");
scroll_led_rgb.open( dev_path + "/scroll_led_rgb");
}
RGBController_OpenRazer::RGBController_OpenRazer(std::string dev_path)
{
unsigned int led_count = 0;
/*-----------------------------------------------------------------*\
| Open the OpenRazer device functions |
\*-----------------------------------------------------------------*/
OpenFunctions(dev_path);
/*-----------------------------------------------------------------*\
| Start device at -1. This indicates the device was not detected |
\*-----------------------------------------------------------------*/
device_index = -1;
device = -1;
/*-----------------------------------------------------------------*\
| Get the device name from the OpenRazer driver |
\*-----------------------------------------------------------------*/
std::getline(device_type, name);
name = GetDeviceTypeString(dev_path);
/*-----------------------------------------------------------------*\
| Set the description to indicate this is an OpenRazer device |
@@ -215,12 +233,12 @@ RGBController_OpenRazer::RGBController_OpenRazer(std::string dev_path)
/*-----------------------------------------------------------------*\
| Get the serial number from the dev path |
\*-----------------------------------------------------------------*/
std::getline(device_serial, serial);
serial = GetSerialNumberString(dev_path);
/*-----------------------------------------------------------------*\
| Get the firmware version from the dev path |
\*-----------------------------------------------------------------*/
std::getline(firmware_version, version);
version = GetFirmwareVersionString(dev_path);
/*-----------------------------------------------------------------*\
| Loop through all known devices to look for a name match |
@@ -232,7 +250,7 @@ RGBController_OpenRazer::RGBController_OpenRazer(std::string dev_path)
/*---------------------------------------------------------*\
| Set device ID |
\*---------------------------------------------------------*/
device_index = i;
device = i;
/*---------------------------------------------------------*\
| Set device type |
@@ -242,69 +260,19 @@ RGBController_OpenRazer::RGBController_OpenRazer(std::string dev_path)
/*---------------------------------------------------------*\
| Initialize modes |
\*---------------------------------------------------------*/
if(matrix_effect_custom)
{
mode Custom;
Custom.name = "Custom";
Custom.value = RAZER_MODE_CUSTOM;
Custom.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
modes.push_back(Custom);
}
mode razer_modes[RAZER_NUM_MODES];
if(matrix_effect_none)
{
mode Off;
Off.name = "Off";
Off.value = RAZER_MODE_OFF;
Off.flags = 0;
modes.push_back(Off);
}
razer_modes[0].name = "Custom";
razer_modes[1].name = "Off";
razer_modes[2].name = "Static";
razer_modes[3].name = "Breathing";
razer_modes[4].name = "Spectrum Cycle";
razer_modes[5].name = "Wave";
razer_modes[6].name = "Reactive";
if(matrix_effect_static)
for (int i = 0; i < RAZER_NUM_MODES; i++)
{
mode Static;
Static.name = "Static";
Static.value = RAZER_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_COLOR;
modes.push_back(Static);
}
if(matrix_effect_breath)
{
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = RAZER_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
Breathing.random = false;
modes.push_back(Breathing);
}
if(matrix_effect_spectrum)
{
mode SpectrumCycle;
SpectrumCycle.name = "Spectrum Cycle";
SpectrumCycle.value = RAZER_MODE_SPECTRUM_CYCLE;
SpectrumCycle.flags = 0;
modes.push_back(SpectrumCycle);
}
if(matrix_effect_wave)
{
mode Wave;
Wave.name = "Wave";
Wave.value = RAZER_MODE_WAVE;
Wave.flags = MODE_FLAG_HAS_DIRECTION_LR;
Wave.direction = MODE_DIRECTION_RIGHT;
modes.push_back(Wave);
}
if(matrix_effect_reactive)
{
mode Reactive;
Reactive.name = "Reactive";
Reactive.value = RAZER_MODE_REACTIVE;
Reactive.flags = 0;
modes.push_back(Reactive);
modes.push_back(razer_modes[i]);
}
/*---------------------------------------------------------*\
@@ -359,7 +327,7 @@ RGBController_OpenRazer::RGBController_OpenRazer(std::string dev_path)
void RGBController_OpenRazer::SetCustomMode()
{
active_mode = RAZER_MODE_CUSTOM;
SetMode(RAZER_MODE_CUSTOM);
}
void RGBController_OpenRazer::UpdateMode()
@@ -384,13 +352,9 @@ void RGBController_OpenRazer::UpdateMode()
break;
case RAZER_MODE_STATIC:
matrix_effect_static.write(&update_value, 1);
matrix_effect_static.flush();
break;
case RAZER_MODE_BREATHING:
matrix_effect_breath.write(&update_value, 1);
matrix_effect_breath.flush();
break;
case RAZER_MODE_SPECTRUM_CYCLE:
@@ -399,16 +363,6 @@ void RGBController_OpenRazer::UpdateMode()
break;
case RAZER_MODE_WAVE:
switch(modes[active_mode].direction)
{
case MODE_DIRECTION_LEFT:
update_value = '2';
break;
default:
update_value = '1';
break;
}
matrix_effect_wave.write(&update_value, 1);
matrix_effect_wave.flush();
break;
@@ -420,7 +374,7 @@ void RGBController_OpenRazer::UpdateMode()
}
}
break;
#if 0
case RAZER_TYPE_NOMATRIX:
{
switch(active_mode)
@@ -442,6 +396,5 @@ void RGBController_OpenRazer::UpdateMode()
break;
}
}
#endif
}
}
+890 -26
View File
@@ -10,10 +10,890 @@
#pragma once
#include "RGBController.h"
#include "OpenRazerDevices.h"
#include <fstream>
#define RAZER_MAX_ZONES 6
typedef struct
{
std::string name;
unsigned int type;
unsigned int rows;
unsigned int cols;
} razer_zone;
typedef struct
{
std::string name;
device_type type;
bool matrix_type;
unsigned int rows;
unsigned int cols;
const razer_zone* zones[RAZER_MAX_ZONES];
} razer_device;
/*-------------------------------------------------------------------------*\
| KEYBOARDS |
\*-------------------------------------------------------------------------*/
/*-------------------------------------------------------------*\
| Razer BlackWidow Chroma |
| |
| Zone "Keyboard" |
| Matrix |
| 6 Rows, 22 Columns |
\*-------------------------------------------------------------*/
static const razer_zone blackwidow_chroma_zone =
{
"Keyboard",
ZONE_TYPE_MATRIX,
6,
22
};
static const razer_device blackwidow_chroma_device =
{
"Razer BlackWidow Chroma",
DEVICE_TYPE_KEYBOARD,
true,
6,
22,
{
&blackwidow_chroma_zone,
NULL,
NULL,
NULL,
NULL,
NULL
}
};
/*-------------------------------------------------------------*\
| Razer BlackWidow Chroma Tournament Edition |
| |
| Zone "Keyboard" |
| Matrix |
| 6 Rows, 22 Columns |
\*-------------------------------------------------------------*/
static const razer_zone blackwidow_chroma_te_zone =
{
"Keyboard",
ZONE_TYPE_MATRIX,
6,
22
};
static const razer_device blackwidow_chroma_te_device =
{
"Razer BlackWidow Chroma Tournament Edition",
DEVICE_TYPE_KEYBOARD,
true,
6,
22,
{
&blackwidow_chroma_te_zone,
NULL,
NULL,
NULL,
NULL,
NULL
}
};
/*-------------------------------------------------------------*\
| Razer Ornata Chroma |
| |
| Zone "Keyboard" |
| Matrix |
| 6 Rows, 22 Columns |
\*-------------------------------------------------------------*/
static const razer_zone ornata_chroma_zone =
{
"Keyboard",
ZONE_TYPE_MATRIX,
6,
22
};
static const razer_device ornata_chroma_device =
{
"Razer Ornata Chroma",
DEVICE_TYPE_KEYBOARD,
true,
6,
22,
{
&ornata_chroma_zone,
NULL,
NULL,
NULL,
NULL,
NULL
}
};
/*-------------------------------------------------------------*\
| Razer DeathStalker Chroma |
| |
| Zone "Keyboard" |
| Linear |
| 12 LEDs |
\*-------------------------------------------------------------*/
static const razer_zone deathstalker_chroma_zone =
{
"Keyboard",
ZONE_TYPE_LINEAR,
1,
12
};
static const razer_device deathstalker_chroma_device =
{
"Razer DeathStalker Chroma",
DEVICE_TYPE_KEYBOARD,
true,
1,
12,
{
&deathstalker_chroma_zone,
NULL,
NULL,
NULL,
NULL,
NULL
}
};
/*-------------------------------------------------------------------------*\
| LAPTOPS |
\*-------------------------------------------------------------------------*/
/*-------------------------------------------------------------*\
| Razer Blade Stealth |
| |
| Zone "Keyboard" |
| Matrix |
| 6 Rows, 16 Columns |
\*-------------------------------------------------------------*/
static const razer_zone blade_stealth_zone =
{
"Keyboard",
ZONE_TYPE_MATRIX,
6,
16
};
static const razer_device blade_stealth_device =
{
"Razer Blade Stealth",
DEVICE_TYPE_KEYBOARD,
true,
6,
16,
{
&blade_stealth_zone,
NULL,
NULL,
NULL,
NULL,
NULL
}
};
/*-------------------------------------------------------------*\
| Razer Blade Pro (Late 2016) |
| |
| Zone "Keyboard" |
| Matrix |
| 6 Rows, 25 Columns |
\*-------------------------------------------------------------*/
static const razer_zone blade_pro_late_2016_zone =
{
"Keyboard",
ZONE_TYPE_MATRIX,
6,
25
};
static const razer_device blade_pro_late_2016_device =
{
"Razer Blade Pro (Late 2016)",
DEVICE_TYPE_KEYBOARD,
true,
6,
25,
{
&blade_pro_late_2016_zone,
NULL,
NULL,
NULL,
NULL,
NULL
}
};
/*-------------------------------------------------------------*\
| Razer Blade Pro (2017) |
| |
| Zone "Keyboard" |
| Matrix |
| 6 Rows, 25 Columns |
\*-------------------------------------------------------------*/
static const razer_zone blade_pro_2017_zone =
{
"Keyboard",
ZONE_TYPE_MATRIX,
6,
25
};
static const razer_device blade_pro_2017_device =
{
"Razer Blade Pro (2017)",
DEVICE_TYPE_KEYBOARD,
true,
6,
25,
{
&blade_pro_2017_zone,
NULL,
NULL,
NULL,
NULL,
NULL
}
};
/*-------------------------------------------------------------------------*\
| MICE |
\*-------------------------------------------------------------------------*/
/*-------------------------------------------------------------*\
| Razer Mamba Tournament Edition |
| |
| Zone "Left" |
| Linear |
| 7 LEDs |
| |
| Zone "Right" |
| Linear |
| 7 LEDs |
| |
| Zone "Logo" |
| Single |
| 1 LED |
| |
| Zone "Scroll Wheel" |
| Single |
| 1 LED |
\*-------------------------------------------------------------*/
static const razer_zone mamba_te_left_zone =
{
"Left LED Strip",
ZONE_TYPE_LINEAR,
1,
7
};
static const razer_zone mamba_te_right_zone =
{
"Right LED Strip",
ZONE_TYPE_LINEAR,
1,
7
};
static const razer_zone mamba_te_logo_zone =
{
"Logo",
ZONE_TYPE_SINGLE,
1,
1
};
static const razer_zone mamba_te_scroll_wheel_zone =
{
"Scroll Wheel",
ZONE_TYPE_SINGLE,
1,
1
};
static const razer_device mamba_te_device =
{
"Razer Mamba Tournament Edition",
DEVICE_TYPE_MOUSE,
true,
1,
16,
{
&mamba_te_left_zone,
&mamba_te_right_zone,
&mamba_te_logo_zone,
&mamba_te_scroll_wheel_zone,
NULL,
NULL
}
};
/*-------------------------------------------------------------*\
| Razer Diamondback Chroma |
| |
| Zone "Right" |
| Linear |
| 7 LEDs |
| |
| Zone "Bottom" |
| Linear |
| 5 LEDs |
| |
| Zone "Left" |
| Linear |
| 7 LEDs |
| |
| Zone "Logo" |
| Single |
| 1 LED |
| |
| Zone "Scroll Wheel" |
| Single |
| 1 LED |
\*-------------------------------------------------------------*/
static const razer_zone diamondback_chroma_right_zone =
{
"Right LED Strip",
ZONE_TYPE_LINEAR,
1,
7
};
static const razer_zone diamondback_chroma_bottom_zone =
{
"Bottom LED Strip",
ZONE_TYPE_LINEAR,
1,
5
};
static const razer_zone diamondback_chroma_left_zone =
{
"Left LED Strip",
ZONE_TYPE_LINEAR,
1,
7
};
static const razer_zone diamondback_chroma_logo_zone =
{
"Logo",
ZONE_TYPE_SINGLE,
1,
1
};
static const razer_zone diamondback_chroma_scroll_wheel_zone =
{
"Scroll Wheel",
ZONE_TYPE_SINGLE,
1,
1
};
static const razer_device diamondback_chroma_device =
{
"Razer Diamondback Chroma",
DEVICE_TYPE_MOUSE,
true,
1,
21,
{
&diamondback_chroma_right_zone,
&diamondback_chroma_bottom_zone,
&diamondback_chroma_left_zone,
&diamondback_chroma_logo_zone,
&diamondback_chroma_scroll_wheel_zone,
NULL
}
};
/*-------------------------------------------------------------*\
| Razer DeathAdder Chroma |
| |
| Zone "Logo" |
| Single |
| 1 LED |
| |
| Zone "Scroll Wheel" |
| Single |
| 1 LED |
\*-------------------------------------------------------------*/
static const razer_zone deathadder_chroma_logo_zone =
{
"Logo",
ZONE_TYPE_SINGLE,
1,
1
};
static const razer_zone deathadder_chroma_scroll_wheel_zone =
{
"Scroll Wheel",
ZONE_TYPE_SINGLE,
1,
1
};
static const razer_device deathadder_chroma_device =
{
"Razer DeathAdder Chroma",
DEVICE_TYPE_MOUSE,
false,
1,
2,
{
&deathadder_chroma_logo_zone,
&deathadder_chroma_scroll_wheel_zone,
NULL,
NULL,
NULL,
NULL
}
};
/*-------------------------------------------------------------*\
| Razer Naga Chroma |
| |
| Zone "Logo" |
| Single |
| 1 LED |
| |
| Zone "Scroll Wheel" |
| Single |
| 1 LED |
| |
| Zone "Numpad" |
| Single |
| 1 LED |
\*-------------------------------------------------------------*/
static const razer_zone naga_chroma_logo_zone =
{
"Logo",
ZONE_TYPE_SINGLE,
1,
1
};
static const razer_zone naga_chroma_scroll_wheel_zone =
{
"Scroll Wheel",
ZONE_TYPE_SINGLE,
1,
1
};
static const razer_zone naga_chroma_numpad_zone =
{
"Numpad",
ZONE_TYPE_SINGLE,
1,
1
};
static const razer_device naga_chroma_device =
{
"Razer Naga Chroma",
DEVICE_TYPE_MOUSE,
false,
1,
3,
{
&naga_chroma_logo_zone,
&naga_chroma_scroll_wheel_zone,
&naga_chroma_numpad_zone,
NULL,
NULL,
NULL
}
};
/*-------------------------------------------------------------------------*\
| KEYPADS |
\*-------------------------------------------------------------------------*/
/*-------------------------------------------------------------*\
| Razer Orbweaver Chroma |
| |
| Zone "Keypad" |
| Matrix |
| 4 Rows, 5 Columns |
\*-------------------------------------------------------------*/
static const razer_zone orbweaver_chroma_zone =
{
"Keypad",
ZONE_TYPE_MATRIX,
4,
5
};
static const razer_device orbweaver_chroma_device =
{
"Razer Orbweaver Chroma",
DEVICE_TYPE_KEYBOARD,
true,
6,
25,
{
&orbweaver_chroma_zone,
NULL,
NULL,
NULL,
NULL,
NULL
}
};
/*-------------------------------------------------------------*\
| Razer Tartarus Chroma |
| |
| Zone "Keypad" |
| Single |
| 1 LED |
\*-------------------------------------------------------------*/
static const razer_zone tartarus_chroma_zone =
{
"Keypad",
ZONE_TYPE_SINGLE,
1,
1
};
static const razer_device tartarus_chroma_device =
{
"Razer Tartarus Chroma",
DEVICE_TYPE_KEYBOARD,
true,
1,
1,
{
&tartarus_chroma_zone,
NULL,
NULL,
NULL,
NULL,
NULL
}
};
/*-------------------------------------------------------------------------*\
| MOUSEMATS |
\*-------------------------------------------------------------------------*/
/*-------------------------------------------------------------*\
| Razer Firefly |
| |
| Zone "LED Strip" |
| Linear |
| 15 LEDs |
\*-------------------------------------------------------------*/
static const razer_zone firefly_zone =
{
"LED Strip",
ZONE_TYPE_LINEAR,
1,
15
};
static const razer_device firefly_device =
{
"Razer Firefly",
DEVICE_TYPE_MOUSEMAT,
true,
1,
15,
{
&firefly_zone,
NULL,
NULL,
NULL,
NULL,
NULL
}
};
/*-------------------------------------------------------------*\
| Razer Goliathus Extended |
| |
| Zone "LED Strip" |
| Single |
| 1 LED |
\*-------------------------------------------------------------*/
static const razer_zone goliathus_extended_zone =
{
"LED Strip",
ZONE_TYPE_SINGLE,
1,
1
};
static const razer_device goliathus_extended_device =
{
"Razer Goliathus Extended",
DEVICE_TYPE_MOUSEMAT,
true,
1,
1,
{
&goliathus_extended_zone,
NULL,
NULL,
NULL,
NULL,
NULL
}
};
/*-------------------------------------------------------------------------*\
| HEADSETS |
\*-------------------------------------------------------------------------*/
/*-------------------------------------------------------------*\
| Razer Kraken 7.1 Chroma |
| |
| Zone "Headset" |
| Single |
| 1 LED |
\*-------------------------------------------------------------*/
static const razer_zone kraken_chroma_zone =
{
"Headset",
ZONE_TYPE_SINGLE,
1,
1
};
static const razer_device kraken_chroma_device =
{
"Razer Kraken 7.1 Chroma",
DEVICE_TYPE_HEADSET,
true,
1,
1,
{
&kraken_chroma_zone,
NULL,
NULL,
NULL,
NULL,
NULL
}
};
/*-------------------------------------------------------------*\
| Razer Kraken 7.1 V2 |
| |
| Zone "Headset" |
| Single |
| 1 LED |
\*-------------------------------------------------------------*/
static const razer_zone kraken_v2_zone =
{
"Headset",
ZONE_TYPE_SINGLE,
1,
1
};
static const razer_device kraken_v2_device =
{
"Razer Kraken 7.1 V2",
DEVICE_TYPE_HEADSET,
true,
1,
1,
{
&kraken_v2_zone,
NULL,
NULL,
NULL,
NULL,
NULL
}
};
/*-------------------------------------------------------------------------*\
| OTHER |
\*-------------------------------------------------------------------------*/
/*-------------------------------------------------------------*\
| Razer Core |
| |
| Zone "Side Window Lights" |
| Single |
| 1 LED |
| |
| Zone "LED Strip" |
| Linear |
| 8 LEDs |
\*-------------------------------------------------------------*/
static const razer_zone core_side_zone =
{
"Side Window Lights",
ZONE_TYPE_SINGLE,
1,
1
};
static const razer_zone core_led_strip_zone =
{
"LED Strip",
ZONE_TYPE_LINEAR,
1,
8
};
static const razer_device core_device =
{
"Razer Core",
DEVICE_TYPE_UNKNOWN,
true,
1,
9,
{
&core_side_zone,
&core_led_strip_zone,
NULL,
NULL,
NULL,
NULL
}
};
/*-------------------------------------------------------------*\
| Razer Chroma Mug Holder |
| |
| Zone "LED Strip" |
| Linear |
| 15 LEDs |
\*-------------------------------------------------------------*/
static const razer_zone mug_holder_zone =
{
"LED Strip",
ZONE_TYPE_LINEAR,
1,
15
};
static const razer_device mug_holder_device =
{
"Razer Chroma Mug Holder",
DEVICE_TYPE_UNKNOWN,
true,
1,
15,
{
&mug_holder_zone,
NULL,
NULL,
NULL,
NULL,
NULL
}
};
/*-------------------------------------------------------------*\
| Razer Chroma HDK |
| |
| Zone "LED Strip" |
| Linear |
| 16 LEDs |
| |
| Zone "LED Strip" |
| Linear |
| 16 LEDs |
| |
| Zone "LED Strip" |
| Linear |
| 16 LEDs |
| |
| Zone "LED Strip" |
| Linear |
| 16 LEDs |
\*-------------------------------------------------------------*/
static const razer_zone chromahdk_zone =
{
"LED Strip",
ZONE_TYPE_LINEAR,
1,
16
};
static const razer_device chromahdk_device =
{
"Razer Chroma HDK",
DEVICE_TYPE_LEDSTRIP,
true,
4,
16,
{
&chromahdk_zone,
&chromahdk_zone,
&chromahdk_zone,
&chromahdk_zone,
NULL,
NULL
}
};
/*-------------------------------------------------------------------------*\
| DEVICE MASTER LIST |
\*-------------------------------------------------------------------------*/
#define RAZER_NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
static const razer_device* device_list[] =
{
/*-----------------------------------------------------------------*\
| KEYBOARDS |
\*-----------------------------------------------------------------*/
&blackwidow_chroma_device,
&blackwidow_chroma_te_device,
&ornata_chroma_device,
&deathstalker_chroma_device,
/*-----------------------------------------------------------------*\
| LAPTOPS |
\*-----------------------------------------------------------------*/
&blade_stealth_device,
&blade_pro_late_2016_device,
&blade_pro_2017_device,
/*-----------------------------------------------------------------*\
| MICE |
\*-----------------------------------------------------------------*/
&mamba_te_device,
&diamondback_chroma_device,
&deathadder_chroma_device,
/*-----------------------------------------------------------------*\
| KEYPADS |
\*-----------------------------------------------------------------*/
&orbweaver_chroma_device,
&tartarus_chroma_device,
/*-----------------------------------------------------------------*\
| MOUSEMATS |
\*-----------------------------------------------------------------*/
&firefly_device,
&goliathus_extended_device,
/*-----------------------------------------------------------------*\
| HEADSETS |
\*-----------------------------------------------------------------*/
&kraken_chroma_device,
&kraken_v2_device,
/*-----------------------------------------------------------------*\
| OTHER |
\*-----------------------------------------------------------------*/
&core_device,
&mug_holder_device,
&chromahdk_device
};
class RGBController_OpenRazer : public RGBController
{
public:
@@ -47,7 +927,7 @@ public:
void SetCustomMode();
void UpdateMode();
int device_index;
int device;
private:
void SetupMatrixDevice(std::string dev_path, unsigned int rows, unsigned int cols);
@@ -57,35 +937,19 @@ private:
unsigned int matrix_rows;
unsigned int matrix_cols;
void OpenFunctions(std::string dev_path);
std::ifstream device_type;
std::ifstream device_serial;
std::ifstream firmware_version;
//OpenRazer Sysfs Entries for Matrix Devices
std::ofstream matrix_custom_frame;
std::ofstream matrix_brightness;
std::ofstream matrix_effect_custom;
std::ofstream matrix_effect_none;
std::ofstream matrix_effect_static;
std::ofstream matrix_effect_breath;
std::ofstream matrix_effect_spectrum;
std::ofstream matrix_effect_none;
std::ofstream matrix_effect_reactive;
std::ofstream matrix_effect_spectrum;
std::ofstream matrix_effect_static;
std::ofstream matrix_effect_wave;
std::ofstream logo_led_brightness;
std::ofstream logo_matrix_effect_none;
std::ofstream logo_matrix_effect_static;
std::ofstream logo_matrix_effect_spectrum;
std::ofstream logo_matrix_effect_reactive;
std::ofstream scroll_led_brightness;
std::ofstream scroll_matrix_effect_none;
std::ofstream scroll_matrix_effect_static;
std::ofstream scroll_matrix_effect_spectrum;
std::ofstream scroll_matrix_effect_reactive;
//OpenRazer Sysfs Entries for Non-Matrix Devices
std::ofstream logo_led_effect;
std::ofstream logo_led_rgb;
std::ofstream scroll_led_effect;
std::ofstream scroll_led_rgb;
};
@@ -1,435 +0,0 @@
/*-----------------------------------------*\
| RGBController_OpenRazer.cpp |
| |
| Generic RGB Interface for OpenRazer |
| kernel drivers for Chroma peripherals |
| |
| Adam Honse (CalcProgrammer1) 6/15/2019 |
\*-----------------------------------------*/
#include "RGBController_OpenRazerWindows.h"
#include <algorithm>
#include <fstream>
#include <string.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/hid.h>
void RGBController_OpenRazer::UpdateLEDs()
{
switch(matrix_type)
{
case RAZER_TYPE_MATRIX_FRAME:
case RAZER_TYPE_MATRIX_NOFRAME:
case RAZER_TYPE_MATRIX_STATIC:
{
char update_value = 1;
for (unsigned int row = 0; row < matrix_rows; row++)
{
unsigned int output_array_size;
unsigned int output_offset;
unsigned int row_offset = (row * matrix_cols);
if(matrix_type == RAZER_TYPE_MATRIX_FRAME)
{
output_array_size = 3 + (matrix_cols* 3);
output_offset = 3;
}
else
{
output_array_size = 3;
output_offset = 0;
}
char* output_array = new char[output_array_size];
if(matrix_type == RAZER_TYPE_MATRIX_FRAME)
{
output_array[0] = row;
output_array[1] = 0;
output_array[2] = matrix_cols - 1;
}
for(unsigned int col = 0; col < matrix_cols; col++)
{
unsigned int color_idx = col + row_offset;
output_array[(col * 3) + 0 + output_offset] = (char)RGBGetRValue(colors[color_idx]);
output_array[(col * 3) + 1 + output_offset] = (char)RGBGetGValue(colors[color_idx]);
output_array[(col * 3) + 2 + output_offset] = (char)RGBGetBValue(colors[color_idx]);
}
if(matrix_type == RAZER_TYPE_MATRIX_FRAME)
{
razer_functions->matrix_custom_frame->store(razer_device, NULL, output_array, output_array_size);
}
else if(matrix_type == RAZER_TYPE_MATRIX_NOFRAME)
{
razer_functions->matrix_effect_custom->store(razer_device, NULL, output_array, output_array_size);
}
else
{
razer_functions->matrix_effect_static->store(razer_device, NULL, output_array, output_array_size);
}
}
if(matrix_type == RAZER_TYPE_MATRIX_FRAME)
{
razer_functions->matrix_effect_custom->store(razer_device, NULL, &update_value, 1);
}
}
break;
#if 0
case RAZER_TYPE_NOMATRIX:
{
unsigned int output_array_size = 3;
char output_array[output_array_size];
char update_value = 0;
output_array[0] = (char)RGBGetRValue(colors[0]);
output_array[1] = (char)RGBGetGValue(colors[0]);
output_array[2] = (char)RGBGetBValue(colors[0]);
logo_led_rgb.write(output_array, output_array_size);
output_array[0] = (char)RGBGetRValue(colors[1]);
output_array[1] = (char)RGBGetGValue(colors[1]);
output_array[2] = (char)RGBGetBValue(colors[1]);
scroll_led_rgb.write(output_array, output_array_size);
logo_led_rgb.flush();
scroll_led_rgb.flush();
logo_led_effect.write(&update_value, 1);
scroll_led_effect.write(&update_value, 1);
logo_led_effect.flush();
scroll_led_effect.flush();
}
break;
#endif
}
}
void RGBController_OpenRazer::UpdateZoneLEDs(int zone)
{
UpdateLEDs();
}
void RGBController_OpenRazer::UpdateSingleLED(int led)
{
UpdateLEDs();
}
void RGBController_OpenRazer::SetupMatrixDevice(device * razer_device, device_fn_type* razer_functions, unsigned int rows, unsigned int cols)
{
if(!razer_functions->matrix_custom_frame)
{
if(!razer_functions->matrix_effect_custom)
{
matrix_type = RAZER_TYPE_MATRIX_STATIC;
}
else
{
matrix_type = RAZER_TYPE_MATRIX_NOFRAME;
}
matrix_rows = 1;
matrix_cols = 1;
}
else
{
matrix_type = RAZER_TYPE_MATRIX_FRAME;
matrix_rows = rows;
matrix_cols = cols;
}
}
void RGBController_OpenRazer::SetupNonMatrixDevice(device * razer_device, device_fn_type* razer_functions)
{
matrix_type = RAZER_TYPE_NOMATRIX;
}
RGBController_OpenRazer::RGBController_OpenRazer(device * razer_device, device_fn_type* razer_functions)
{
char string_buf[1024];
this->razer_device = razer_device;
this->razer_functions = razer_functions;
unsigned int led_count = 0;
/*-----------------------------------------------------------------*\
| Initialize buffer |
\*-----------------------------------------------------------------*/
memset(string_buf, 0xFF, sizeof(string_buf));
string_buf[1023] = '\0';
/*-----------------------------------------------------------------*\
| Start device at -1. This indicates the device was not detected |
\*-----------------------------------------------------------------*/
device_index = -1;
/*-----------------------------------------------------------------*\
| Get the device name from the OpenRazer driver |
\*-----------------------------------------------------------------*/
razer_functions->device_type->show(razer_device, NULL, string_buf);
name = string_buf;
name.erase(std::remove(name.begin(), name.end(), '\n'), name.end());
name.erase(std::remove(name.begin(), name.end(), '\r'), name.end());
/*-----------------------------------------------------------------*\
| Set the description to indicate this is an OpenRazer device |
\*-----------------------------------------------------------------*/
description = "OpenRazer Device";
/*-----------------------------------------------------------------*\
| Set the device path as the location |
\*-----------------------------------------------------------------*/
location = "";
/*-----------------------------------------------------------------*\
| Initialize buffer |
\*-----------------------------------------------------------------*/
//memset(string_buf, 0xFF, sizeof(string_buf));
//string_buf[1023] = '\0';
/*-----------------------------------------------------------------*\
| Get the serial number from the dev path |
\*-----------------------------------------------------------------*/
//razer_functions->device_serial->show(razer_device, NULL, string_buf);
//serial = string_buf;
/*-----------------------------------------------------------------*\
| Initialize buffer |
\*-----------------------------------------------------------------*/
//memset(string_buf, 0xFF, sizeof(string_buf));
//string_buf[1023] = '\0';
/*-----------------------------------------------------------------*\
| Get the firmware version from the dev path |
\*-----------------------------------------------------------------*/
//razer_functions->firmware_version->show(razer_device, NULL, string_buf);
//version = string_buf;
/*-----------------------------------------------------------------*\
| Loop through all known devices to look for a name match |
\*-----------------------------------------------------------------*/
for (unsigned int i = 0; i < RAZER_NUM_DEVICES; i++)
{
if (device_list[i]->name == name)
{
/*---------------------------------------------------------*\
| Set device ID |
\*---------------------------------------------------------*/
device_index = i;
/*---------------------------------------------------------*\
| Set device type |
\*---------------------------------------------------------*/
type = device_list[i]->type;
/*---------------------------------------------------------*\
| Initialize modes |
\*---------------------------------------------------------*/
if(razer_functions->matrix_effect_custom)
{
mode Custom;
Custom.name = "Custom";
Custom.value = RAZER_MODE_CUSTOM;
Custom.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
modes.push_back(Custom);
}
if(razer_functions->matrix_effect_none)
{
mode Off;
Off.name = "Off";
Off.value = RAZER_MODE_OFF;
Off.flags = 0;
modes.push_back(Off);
}
if(razer_functions->matrix_effect_static)
{
mode Static;
Static.name = "Static";
Static.value = RAZER_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_COLOR;
modes.push_back(Static);
}
if(razer_functions->matrix_effect_breath)
{
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = RAZER_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
Breathing.random = false;
modes.push_back(Breathing);
}
if(razer_functions->matrix_effect_spectrum)
{
mode SpectrumCycle;
SpectrumCycle.name = "Spectrum Cycle";
SpectrumCycle.value = RAZER_MODE_SPECTRUM_CYCLE;
SpectrumCycle.flags = 0;
modes.push_back(SpectrumCycle);
}
if(razer_functions->matrix_effect_wave)
{
mode Wave;
Wave.name = "Wave";
Wave.value = RAZER_MODE_WAVE;
Wave.flags = MODE_FLAG_HAS_DIRECTION_LR;
Wave.direction = MODE_DIRECTION_RIGHT;
modes.push_back(Wave);
}
if(razer_functions->matrix_effect_reactive)
{
mode Reactive;
Reactive.name = "Reactive";
Reactive.value = RAZER_MODE_REACTIVE;
Reactive.flags = 0;
modes.push_back(Reactive);
}
/*---------------------------------------------------------*\
| Initialize file descriptors |
\*---------------------------------------------------------*/
if(device_list[i]->matrix_type == true)
{
SetupMatrixDevice(razer_device, razer_functions, device_list[i]->rows, device_list[i]->cols);
}
else
{
SetupNonMatrixDevice(razer_device, razer_functions);
}
/*---------------------------------------------------------*\
| Fill in zone information based on device table |
\*---------------------------------------------------------*/
for (int zone_id = 0; zone_id < RAZER_MAX_ZONES; zone_id++)
{
if (device_list[i]->zones[zone_id] != NULL)
{
zone new_zone;
new_zone.name = device_list[i]->zones[zone_id]->name;
new_zone.type = device_list[i]->zones[zone_id]->type;
for (unsigned int row_id = 0; row_id < device_list[i]->zones[zone_id]->rows; row_id++)
{
std::vector<int> new_zone_map;
for (unsigned int col_id = 0; col_id < device_list[i]->zones[zone_id]->cols; col_id++)
{
char id_buf[8];
snprintf(id_buf, 8, "%d", col_id + 1);
RGBColor new_color = 0x00000000;
colors.push_back(new_color);
led* new_led = new led();
new_led->name = device_list[i]->zones[zone_id]->name + " LED ";
new_led->name.append(id_buf);
leds.push_back(*new_led);
new_zone_map.push_back(led_count);
led_count++;
}
new_zone.map.push_back(new_zone_map);
}
zones.push_back(new_zone);
}
}
}
}
}
void RGBController_OpenRazer::SetCustomMode()
{
SetMode(RAZER_MODE_CUSTOM);
}
void RGBController_OpenRazer::UpdateMode()
{
char update_value = 1;
switch(matrix_type)
{
case RAZER_TYPE_MATRIX_FRAME:
case RAZER_TYPE_MATRIX_NOFRAME:
{
switch(modes[active_mode].value)
{
case RAZER_MODE_CUSTOM:
razer_functions->matrix_effect_custom->store(razer_device, NULL, &update_value, 1);
break;
case RAZER_MODE_OFF:
razer_functions->matrix_effect_none->store(razer_device, NULL, &update_value, 1);
break;
case RAZER_MODE_STATIC:
razer_functions->matrix_effect_static->store(razer_device, NULL, &update_value, 1);
break;
case RAZER_MODE_BREATHING:
razer_functions->matrix_effect_breath->store(razer_device, NULL, &update_value, 1);
break;
case RAZER_MODE_SPECTRUM_CYCLE:
razer_functions->matrix_effect_spectrum->store(razer_device, NULL, &update_value, 1);
break;
case RAZER_MODE_WAVE:
switch(modes[active_mode].direction)
{
case MODE_DIRECTION_LEFT:
update_value = '2';
break;
default:
update_value = '1';
break;
}
razer_functions->matrix_effect_wave->store(razer_device, NULL, &update_value, 1);
break;
case RAZER_MODE_REACTIVE:
razer_functions->matrix_effect_reactive->store(razer_device, NULL, &update_value, 1);
break;
}
}
break;
#if 0
case RAZER_TYPE_NOMATRIX:
{
switch(modes[active_mode].value)
{
case RAZER_MODE_CUSTOM:
update_value = 0;
logo_led_effect.write(&update_value, 1);
scroll_led_effect.write(&update_value, 1);
logo_led_effect.flush();
scroll_led_effect.flush();
break;
case RAZER_MODE_SPECTRUM_CYCLE:
update_value = '4';
logo_led_effect.write(&update_value, 1);
scroll_led_effect.write(&update_value, 1);
logo_led_effect.flush();
scroll_led_effect.flush();
break;
}
}
#endif
}
}
@@ -1,112 +0,0 @@
/*-----------------------------------------*\
| RGBController_OpenRazerWindows.h |
| |
| Generic RGB Interface for OpenRazer |
| kernel drivers for Chroma peripherals |
| |
| Adam Honse (CalcProgrammer1) 6/15/2019 |
\*-----------------------------------------*/
#include "RGBController.h"
#include "OpenRazerDevices.h"
#include <fstream>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/hid.h>
typedef struct
{
struct device_attribute * device_type;
struct device_attribute * device_serial;
struct device_attribute * firmware_version;
struct device_attribute * matrix_custom_frame;
struct device_attribute * matrix_brightness;
struct device_attribute * matrix_effect_custom;
struct device_attribute * matrix_effect_none;
struct device_attribute * matrix_effect_static;
struct device_attribute * matrix_effect_breath;
struct device_attribute * matrix_effect_spectrum;
struct device_attribute * matrix_effect_reactive;
struct device_attribute * matrix_effect_wave;
struct device_attribute * logo_led_brightness;
struct device_attribute * logo_matrix_effect_none;
struct device_attribute * logo_matrix_effect_static;
struct device_attribute * logo_matrix_effect_spectrum;
struct device_attribute * logo_matrix_effect_reactive;
struct device_attribute * scroll_led_brightness;
struct device_attribute * scroll_matrix_effect_none;
struct device_attribute * scroll_matrix_effect_static;
struct device_attribute * scroll_matrix_effect_spectrum;
struct device_attribute * scroll_matrix_effect_reactive;
struct device_attribute * scroll_led_effect;
struct device_attribute * scroll_led_rgb;
} device_fn_type;
class RGBController_OpenRazer : public RGBController
{
public:
enum
{
RAZER_MODE_CUSTOM,
RAZER_MODE_OFF,
RAZER_MODE_STATIC,
RAZER_MODE_BREATHING,
RAZER_MODE_SPECTRUM_CYCLE,
RAZER_MODE_WAVE,
RAZER_MODE_REACTIVE,
RAZER_NUM_MODES
};
enum
{
RAZER_TYPE_MATRIX_FRAME,
RAZER_TYPE_MATRIX_NOFRAME,
RAZER_TYPE_MATRIX_STATIC,
RAZER_TYPE_NOMATRIX,
RAZER_NUM_TYPES
};
public:
RGBController_OpenRazer(device * razer_device, device_fn_type* razer_functions);
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
int device_index;
private:
void SetupMatrixDevice(device * razer_device, device_fn_type* razer_functions, unsigned int rows, unsigned int cols);
void SetupNonMatrixDevice(device * razer_device, device_fn_type* razer_functions);
unsigned int matrix_type;
unsigned int matrix_rows;
unsigned int matrix_cols;
device* razer_device;
device_fn_type* razer_functions;
//OpenRazer Sysfs Entries for Matrix Devices
std::ofstream matrix_custom_frame;
std::ofstream matrix_effect_custom;
std::ofstream matrix_effect_breath;
std::ofstream matrix_effect_none;
std::ofstream matrix_effect_reactive;
std::ofstream matrix_effect_spectrum;
std::ofstream matrix_effect_static;
std::ofstream matrix_effect_wave;
//OpenRazer Sysfs Entries for Non-Matrix Devices
std::ofstream logo_led_effect;
std::ofstream logo_led_rgb;
std::ofstream scroll_led_effect;
std::ofstream scroll_led_rgb;
};
+1 -1
View File
@@ -186,7 +186,7 @@ RGBController_PatriotViper::RGBController_PatriotViper(PatriotViperController* v
void RGBController_PatriotViper::SetCustomMode()
{
active_mode = 0;
SetMode(0);
}
void RGBController_PatriotViper::UpdateMode()
+12 -138
View File
@@ -18,7 +18,7 @@ void RGBController_Polychrome::UpdateLEDs()
unsigned char grn = RGBGetGValue(colors[led]);
unsigned char blu = RGBGetBValue(colors[led]);
polychrome->SetColor(red, grn, blu);
polychrome->SetLEDColor(led, red, grn, blu);
}
}
@@ -43,141 +43,15 @@ RGBController_Polychrome::RGBController_Polychrome(PolychromeController* polychr
name = polychrome->GetDeviceName();
if(polychrome->IsAsrLed())
mode polychrome_modes[POLYCHROME_NUM_MODES];
polychrome_modes[0].name = "Static";
polychrome_modes[1].name = "Breathing";
polychrome_modes[2].name = "Flashing";
for (int i = 0; i < POLYCHROME_NUM_MODES; i++)
{
mode Off;
Off.name = "Off";
Off.value = ASRLED_MODE_OFF;
Off.flags = 0;
modes.push_back(Off);
mode Static;
Static.name = "Static";
Static.value = ASRLED_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_COLOR;
modes.push_back(Static);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = ASRLED_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR;
modes.push_back(Breathing);
mode Strobe;
Strobe.name = "Strobe";
Strobe.value = ASRLED_MODE_FLASHING;
Strobe.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR;
modes.push_back(Strobe);
mode SpectrumCycle;
SpectrumCycle.name = "Spectrum Cycle";
SpectrumCycle.value = ASRLED_MODE_SPECTRUM_CYCLE;
SpectrumCycle.flags = MODE_FLAG_HAS_SPEED;
modes.push_back(SpectrumCycle);
mode Random;
Random.name = "Random";
Random.value = ASRLED_MODE_RANDOM;
Random.flags = MODE_FLAG_HAS_SPEED;
modes.push_back(Random);
mode Music;
Music.name = "Music";
Music.value = ASRLED_MODE_MUSIC;
Music.flags = MODE_FLAG_HAS_COLOR;
modes.push_back(Music);
mode Wave;
Wave.name = "Wave";
Wave.value = ASRLED_MODE_WAVE;
Wave.flags = MODE_FLAG_HAS_SPEED;
modes.push_back(Wave);
}
else
{
mode Off;
Off.name = "Off";
Off.value = POLYCHROME_MODE_OFF;
Off.flags = 0;
modes.push_back(Off);
mode Static;
Static.name = "Static";
Static.value = POLYCHROME_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_COLOR;
modes.push_back(Static);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = POLYCHROME_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR;
modes.push_back(Breathing);
mode Strobe;
Strobe.name = "Strobe";
Strobe.value = POLYCHROME_MODE_FLASHING;
Strobe.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR;
modes.push_back(Strobe);
mode SpectrumCycle;
SpectrumCycle.name = "Spectrum Cycle";
SpectrumCycle.value = POLYCHROME_MODE_SPECTRUM_CYCLE;
SpectrumCycle.flags = MODE_FLAG_HAS_SPEED;
modes.push_back(SpectrumCycle);
mode Random;
Random.name = "Random";
Random.value = POLYCHROME_MODE_RANDOM;
Random.flags = MODE_FLAG_HAS_SPEED;
modes.push_back(Random);
mode Wave;
Wave.name = "Wave";
Wave.value = POLYCHROME_MODE_WAVE;
Wave.flags = MODE_FLAG_HAS_SPEED;
modes.push_back(Wave);
mode Spring;
Spring.name = "Spring";
Spring.value = POLYCHROME_MODE_SPRING;
Spring.flags = MODE_FLAG_HAS_SPEED;
modes.push_back(Spring);
mode Stack;
Stack.name = "Stack";
Stack.value = POLYCHROME_MODE_STACK;
Stack.flags = MODE_FLAG_HAS_SPEED;
modes.push_back(Stack);
mode Cram;
Cram.name = "Cram";
Cram.value = POLYCHROME_MODE_CRAM;
Cram.flags = MODE_FLAG_HAS_SPEED;
modes.push_back(Cram);
mode Scan;
Scan.name = "Scan";
Scan.value = POLYCHROME_MODE_SCAN;
Scan.flags = MODE_FLAG_HAS_SPEED;
modes.push_back(Scan);
mode Neon;
Neon.name = "Neon";
Neon.value = POLYCHROME_MODE_NEON;
Neon.flags = 0;
modes.push_back(Neon);
mode Water;
Water.name = "Water";
Water.value = POLYCHROME_MODE_WATER;
Water.flags = MODE_FLAG_HAS_SPEED;
modes.push_back(Water);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = POLYCHROME_MODE_RAINBOW;
Rainbow.flags = MODE_FLAG_HAS_SPEED;
modes.push_back(Rainbow);
modes.push_back(polychrome_modes[i]);
}
colors.resize(polychrome->GetLEDCount());
@@ -210,10 +84,10 @@ RGBController_Polychrome::RGBController_Polychrome(PolychromeController* polychr
void RGBController_Polychrome::SetCustomMode()
{
active_mode = 1;
SetMode(0);
}
void RGBController_Polychrome::UpdateMode()
{
polychrome->SetMode(modes[active_mode].value);
}
polychrome->SetMode(active_mode);
}
+8 -193
View File
@@ -9,124 +9,6 @@
#include "RGBController_PoseidonZRGB.h"
static const char* zone_names[] =
{
"Keyboard"
};
static const unsigned int zone_sizes[] =
{
104
};
static const char* led_names[] =
{
"Key: Escape",
"Key: `",
"Key: Tab",
"Key: Caps Lock",
"Key: Left Shift",
"Key: Left Control",
"Key: Left Arrow",
"Key: Insert",
"Key: F1",
"Key: 1",
"Key: Q",
"Key: A",
"Key: Windows",
"Key: Down Arrow",
"Key: Delete",
"Key: F2",
"Key: 2",
"Key: W",
"Key: S",
"Key: Left Alt",
"Key: Right Arrow",
"Key: Home",
"Key: F3",
"Key: 3",
"Key: E",
"Key: D",
"Key: Z",
"Key: Up Arrow",
"Key: End",
"Key: F4",
"Key: 4",
"Key: R",
"Key: F",
"Key: X",
"Key: Space",
"Key: Number Pad 4",
"Key: Page Up",
"Key: F5",
"Key: 5",
"Key: T",
"Key: G",
"Key: C",
"Key: Number Pad 1",
"Key: Page Down",
"Key: F6",
"Key: 6",
"Key: Y",
"Key: H",
"Key: V",
"Key: Number Pad 2",
"Key: Num Lock",
"Key: F7",
"Key: 7",
"Key: U",
"Key: J",
"Key: B",
"Key: Number Pad 0",
"Key: Number Pad 7",
"Key: F8",
"Key: 8",
"Key: I",
"Key: K",
"Key: N",
"Key: Number Pad 6",
"Key: Number Pad /",
"Key: F9",
"Key: 9",
"Key: O",
"Key: L",
"Key: M",
"Key: Right Alt",
"Key: Number Pad 3",
"Key: Number Pad 8",
"Key: F10",
"Key: 0",
"Key: P",
"Key: ;",
"Key: ,",
"Key: Fn",
"Key: Number Pad .",
"Key: Number Pad *",
"Key: F11",
"Key: -",
"Key: [",
"Key: '",
"Key: .",
"Key: Number Pad +",
"Key: Number Pad 9",
"Key: F12",
"Key: =",
"Key: ]",
"Key: /",
"Key: Context",
"Key: Number Pad -",
"Key: Print Screen",
"Key: \\",
"Key: Enter",
"Key: Right Control",
"Key: Number Pad Enter",
"Key: Number Pad 5",
"Key: Scroll Lock",
"Key: Right Shift",
"Key: Pause/Break",
"Key: Backspace"
};
RGBController_PoseidonZRGB::RGBController_PoseidonZRGB(PoseidonZRGBController* poseidon_ptr)
{
poseidon = poseidon_ptr;
@@ -134,69 +16,9 @@ RGBController_PoseidonZRGB::RGBController_PoseidonZRGB(PoseidonZRGBController* p
name = "Thermaltake Poseidon Z RGB";
type = DEVICE_TYPE_KEYBOARD;
mode Direct;
Direct.name = "Direct";
Direct.value = POSEIDONZ_MODE_STATIC;
Direct.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Direct.random = false;
modes.push_back(Direct);
mode Static;
Static.name = "Static";
Static.value = POSEIDONZ_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Static.random = false;
modes.push_back(Static);
mode Wave;
Wave.name = "Wave";
Wave.value = POSEIDONZ_MODE_WAVE;
Wave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR;
Wave.speed_min = POSEIDONZ_SPEED_SLOW;
Wave.speed_max = POSEIDONZ_SPEED_FAST;
Wave.random = false;
Wave.speed = POSEIDONZ_SPEED_FAST;
Wave.direction = MODE_DIRECTION_LEFT;
modes.push_back(Wave);
mode Ripple;
Ripple.name = "Ripple";
Ripple.value = POSEIDONZ_MODE_RIPPLE;
Ripple.flags = 0;
Ripple.random = false;
modes.push_back(Ripple);
mode Reactive;
Reactive.name = "Reactive";
Reactive.value = POSEIDONZ_MODE_REACTIVE;
Reactive.flags = 0;
Reactive.random = false;
modes.push_back(Reactive);
colors.resize(104);
unsigned int led_idx = 0;
for(unsigned int zone_idx = 0; zone_idx < 1; zone_idx++)
for(int i = 0; i < 104; i++)
{
zone new_zone;
new_zone.name.append(zone_names[zone_idx]);
std::vector<int> new_zone_map;
for(unsigned int led_count = 0; led_count < zone_sizes[zone_idx]; led_count++)
{
led new_led;
new_led.name.append(led_names[led_idx]);
leds.push_back(new_led);
new_zone_map.push_back(led_idx);
led_idx++;
}
new_zone.map.push_back(new_zone_map);
zones.push_back(new_zone);
colors.push_back(0x00000000);
}
}
@@ -207,32 +29,25 @@ RGBController_PoseidonZRGB::~RGBController_PoseidonZRGB()
void RGBController_PoseidonZRGB::UpdateLEDs()
{
if(active_mode == 0)
{
poseidon->SetLEDsDirect(colors);
}
else
{
poseidon->SetLEDs(colors);
}
poseidon->SetLEDs(colors);
}
void RGBController_PoseidonZRGB::UpdateZoneLEDs(int zone)
{
UpdateLEDs();
poseidon->SetLEDs(colors);
}
void RGBController_PoseidonZRGB::UpdateSingleLED(int led)
{
UpdateLEDs();
poseidon->SetLEDs(colors);
}
void RGBController_PoseidonZRGB::SetCustomMode()
{
active_mode = 0;
}
void RGBController_PoseidonZRGB::UpdateMode()
{
poseidon->SetMode(modes[active_mode].value, modes[active_mode].direction, modes[active_mode].speed);
}
}
+2 -2
View File
@@ -126,10 +126,10 @@ int RGBController_RGBFusion::GetDeviceMode()
void RGBController_RGBFusion::SetCustomMode()
{
active_mode = 0;
rgb_fusion->SetMode(RGB_FUSION_MODE_STATIC, 0);
}
void RGBController_RGBFusion::UpdateMode()
{
rgb_fusion->SetMode(modes[active_mode].value, modes[active_mode].speed);
}
}
@@ -1,95 +0,0 @@
/*-----------------------------------------*\
| RGBController_RGBFusion2.cpp |
| |
| Generic RGB Interface for OpenRGB |
| Gigabyte RGB Fusion 2.0 Driver |
| |
| Adam Honse (CalcProgrammer1) 1/15/2020 |
\*-----------------------------------------*/
#include "RGBController_RGBFusion2.h"
void RGBController_RGBFusion2::UpdateLEDs()
{
for (std::size_t led = 0; led < colors.size(); led++)
{
RGBColor color = colors[led];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
rgb_fusion->SetLEDColor(led, red, grn, blu);
}
}
void RGBController_RGBFusion2::UpdateZoneLEDs(int zone)
{
RGBColor color = colors[zone];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
rgb_fusion->SetLEDColor(zone, red, grn, blu);
}
void RGBController_RGBFusion2::UpdateSingleLED(int led)
{
UpdateZoneLEDs(led);
}
RGBController_RGBFusion2::RGBController_RGBFusion2(RGBFusion2Controller* rgb_fusion_ptr)
{
rgb_fusion = rgb_fusion_ptr;
name = rgb_fusion->GetDeviceName();
description = "RGB Fusion 2.0";
location = rgb_fusion->GetDeviceLocation();
type = DEVICE_TYPE_MOTHERBOARD;
mode rgb_fusion_modes[1];
rgb_fusion_modes[0].name = "Static";
for (int i = 0; i < 1; i++)
{
modes.push_back(rgb_fusion_modes[i]);
}
colors.resize(rgb_fusion->GetLEDCount());
// Search through all LEDs and create zones for each channel type
for (unsigned int i = 0; i < rgb_fusion->GetLEDCount(); i++)
{
zone* new_zone = new zone();
led* new_led = new led();
std::vector<int>* zone_row = new std::vector<int>();
// Set zone name to channel name
new_zone->name = "Zone";
new_led->name = "LED";
zone_row->push_back(i);
// Aura devices can be either single or linear, never matrix
// That means only one row is needed
new_zone->map.push_back(*zone_row);
// Push new LED to LEDs vector
leds.push_back(*new_led);
// Push new zone to zones vector
zones.push_back(*new_zone);
}
}
void RGBController_RGBFusion2::SetCustomMode()
{
active_mode = 0;
}
void RGBController_RGBFusion2::UpdateMode()
{
rgb_fusion->SetMode(modes[active_mode].value);
}
-28
View File
@@ -1,28 +0,0 @@
/*-----------------------------------------*\
| RGBController_RGBFusion2.h |
| |
| Generic RGB Interface for OpenRGB |
| Gigabyte RGB Fusion 2.0 Driver |
| |
| Adam Honse (CalcProgrammer1) 1/15/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "RGBFusion2Controller.h"
class RGBController_RGBFusion2 : public RGBController
{
public:
RGBController_RGBFusion2(RGBFusion2Controller* rgb_fusion_ptr);
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
private:
RGBFusion2Controller* rgb_fusion;
};
@@ -1,237 +0,0 @@
/*-----------------------------------------*\
| RGBController_ThermaltakeRiing.cpp |
| |
| Generic RGB Interface for Thermaltake |
| Riing controller |
| |
| Adam Honse (CalcProgrammer1) 2/9/2020 |
\*-----------------------------------------*/
#include "RGBController_ThermaltakeRiing.h"
RGBController_ThermaltakeRiing::RGBController_ThermaltakeRiing(ThermaltakeRiingController* riing_ptr)
{
riing = riing_ptr;
name = "Thermaltake Riing";
type = DEVICE_TYPE_COOLER;
mode Flow;
Flow.name = "Flow";
Flow.value = THERMALTAKE_MODE_FLOW;
Flow.flags = MODE_FLAG_HAS_SPEED;
Flow.speed_min = THERMALTAKE_SPEED_SLOW;
Flow.speed_max = THERMALTAKE_SPEED_EXTREME;
Flow.speed = THERMALTAKE_SPEED_NORMAL;
modes.push_back(Flow);
mode Spectrum;
Spectrum.name = "Spectrum";
Spectrum.value = THERMALTAKE_MODE_SPECTRUM;
Spectrum.flags = MODE_FLAG_HAS_SPEED;
Spectrum.speed_min = THERMALTAKE_SPEED_SLOW;
Spectrum.speed_max = THERMALTAKE_SPEED_EXTREME;
Spectrum.speed = THERMALTAKE_SPEED_NORMAL;
modes.push_back(Spectrum);
mode Ripple;
Ripple.name = "Ripple";
Ripple.value = THERMALTAKE_MODE_RIPPLE;
Ripple.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR;
Ripple.speed_min = THERMALTAKE_SPEED_SLOW;
Ripple.speed_max = THERMALTAKE_SPEED_EXTREME;
Ripple.speed = THERMALTAKE_SPEED_NORMAL;
modes.push_back(Ripple);
mode Blink;
Blink.name = "Blink";
Blink.value = THERMALTAKE_MODE_BLINK;
Blink.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Blink.speed_min = THERMALTAKE_SPEED_SLOW;
Blink.speed_max = THERMALTAKE_SPEED_EXTREME;
Blink.speed = THERMALTAKE_SPEED_NORMAL;
modes.push_back(Blink);
mode Pulse;
Pulse.name = "Pulse";
Pulse.value = THERMALTAKE_MODE_PULSE;
Pulse.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Pulse.speed_min = THERMALTAKE_SPEED_SLOW;
Pulse.speed_max = THERMALTAKE_SPEED_EXTREME;
Pulse.speed = THERMALTAKE_SPEED_NORMAL;
modes.push_back(Pulse);
mode Wave;
Wave.name = "Wave";
Wave.value = THERMALTAKE_MODE_WAVE;
Wave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Wave.speed_min = THERMALTAKE_SPEED_SLOW;
Wave.speed_max = THERMALTAKE_SPEED_EXTREME;
Wave.speed = THERMALTAKE_SPEED_NORMAL;
modes.push_back(Wave);
mode Direct;
Direct.name = "Direct";
Direct.value = THERMALTAKE_MODE_PER_LED;
Direct.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Direct.speed_min = 0;
Direct.speed_max = 0;
Direct.speed = 0;
modes.push_back(Direct);
mode Static;
Static.name = "Static";
Static.value = THERMALTAKE_MODE_FULL;
Static.flags = MODE_FLAG_HAS_COLOR;
Static.speed_min = 0;
Static.speed_max = 0;
Static.speed = 0;
modes.push_back(Static);
/*-------------------------------------------------*\
| Set size of colors array |
\*-------------------------------------------------*/
unsigned int led_count = 0;
for (unsigned int channel_idx = 0; channel_idx < 5; channel_idx++)
{
led_count += riing->channel_leds[channel_idx];
}
colors.resize(led_count);
/*-------------------------------------------------*\
| Set zones and leds |
\*-------------------------------------------------*/
unsigned int led_idx = 0;
for (unsigned int channel_idx = 0; channel_idx < 5; channel_idx++)
{
if(riing->channel_leds[channel_idx] > 0)
{
zone* new_zone = new zone;
char ch_idx_string[2];
sprintf(ch_idx_string, "%d", channel_idx + 1);
new_zone->name = "Riing Channel ";
new_zone->name.append(ch_idx_string);
new_zone->type = ZONE_TYPE_LINEAR;
std::vector<int> *new_zone_map = new std::vector<int>();
for (unsigned int led_ch_idx = 0; led_ch_idx < riing->channel_leds[channel_idx]; led_ch_idx++)
{
char led_idx_string[3];
sprintf(led_idx_string, "%d", led_ch_idx + 1);
led new_led;
new_led.name = "Riing Channel ";
new_led.name.append(ch_idx_string);
new_led.name.append(", LED ");
new_led.name.append(led_idx_string);
leds.push_back(new_led);
leds_channel.push_back(channel_idx + 1);
new_zone_map->push_back(led_idx);
led_idx++;
}
new_zone->map.push_back(*new_zone_map);
zones.push_back(*new_zone);
zones_channel.push_back(channel_idx + 1);
}
}
}
void RGBController_ThermaltakeRiing::UpdateLEDs()
{
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
unsigned int channel = zones_channel[zone_idx];
std::vector<RGBColor> channel_colors;
for(std::size_t color = 0; color < colors.size(); color++)
{
if(leds_channel[color] == channel)
{
channel_colors.push_back(colors[color]);
}
}
if(channel_colors.size() > 0)
{
riing->SetChannelLEDs(channel, channel_colors);
}
}
}
void RGBController_ThermaltakeRiing::UpdateZoneLEDs(int zone)
{
unsigned int channel = zones_channel[zone];
std::vector<RGBColor> channel_colors;
for(std::size_t color = 0; color < colors.size(); color++)
{
if(leds_channel[color] == channel)
{
channel_colors.push_back(colors[color]);
}
}
if(channel_colors.size() > 0)
{
riing->SetChannelLEDs(channel, channel_colors);
}
}
void RGBController_ThermaltakeRiing::UpdateSingleLED(int led)
{
unsigned int channel = leds_channel[led];
std::vector<RGBColor> channel_colors;
for(std::size_t color = 0; color < colors.size(); color++)
{
if(leds_channel[color] == channel)
{
channel_colors.push_back(colors[color]);
}
}
if(channel_colors.size() > 0)
{
riing->SetChannelLEDs(channel, channel_colors);
}
}
void RGBController_ThermaltakeRiing::SetCustomMode()
{
active_mode = 6;
}
void RGBController_ThermaltakeRiing::UpdateMode()
{
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
unsigned int channel = zones_channel[zone_idx];
std::vector<RGBColor> channel_colors;
for(std::size_t color = 0; color < colors.size(); color++)
{
if(leds_channel[color] == channel)
{
channel_colors.push_back(colors[color]);
}
}
if(channel_colors.size() > 0)
{
riing->SetMode(modes[active_mode].value, modes[active_mode].speed);
riing->SetChannelLEDs(channel, channel_colors);
}
}
}
@@ -1,29 +0,0 @@
/*-----------------------------------------*\
| RGBController_ThermaltakeRiing.h |
| |
| Generic RGB Interface for Thermaltake |
| Riing controller |
| |
| Adam Honse (CalcProgrammer1) 2/9/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "ThermaltakeRiingController.h"
class RGBController_ThermaltakeRiing : public RGBController
{
public:
RGBController_ThermaltakeRiing(ThermaltakeRiingController* riing_ptr);
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
private:
ThermaltakeRiingController* riing;
std::vector<unsigned int> leds_channel;
std::vector<unsigned int> zones_channel;
};
Binary file not shown.
-31
View File
@@ -1,31 +0,0 @@
#ifndef DMI_H_
#define DMI_H_
enum dmi_field {
DMI_NONE,
DMI_BIOS_VENDOR,
DMI_BIOS_VERSION,
DMI_BIOS_DATE,
DMI_SYS_VENDOR,
DMI_PRODUCT_NAME,
DMI_PRODUCT_VERSION,
DMI_PRODUCT_SERIAL,
DMI_PRODUCT_UUID,
DMI_BOARD_VENDOR,
DMI_BOARD_NAME,
DMI_BOARD_VERSION,
DMI_BOARD_SERIAL,
DMI_BOARD_ASSET_TAG,
DMI_CHASSIS_VENDOR,
DMI_CHASSIS_TYPE,
DMI_CHASSIS_VERSION,
DMI_CHASSIS_SERIAL,
DMI_CHASSIS_ASSET_TAG,
DMI_STRING_MAX,
};
static inline char* dmi_get_system_info(int x) {
return "BLADESERIAL";
}
#endif /* DMI_H_ */
-300
View File
@@ -1,300 +0,0 @@
#ifndef HID_H_
#define HID_H_
#include <SetupAPI.h>
#include <cfgmgr32.h>
#include <Winusb.h>
#pragma comment(lib, "setupapi.lib")
#pragma comment(lib, "Winusb.lib")
#define HID_STAT_ADDED 1
#define HID_STAT_PARSED 2
#define HID_CONNECT_HIDINPUT 0x01
#define HID_CONNECT_HIDRAW 0x04
#define HID_CONNECT_HIDDEV 0x08
#define HID_CONNECT_FF 0x20
#define HID_CONNECT_DEFAULT (HID_CONNECT_HIDINPUT|HID_CONNECT_HIDRAW| HID_CONNECT_HIDDEV|HID_CONNECT_FF)
#define HID_GD_WHEEL 0x00010038
#define HID_REQ_GET_REPORT 0x01
#define HID_REQ_SET_REPORT 0x09
#define USB_INTERFACE_PROTOCOL_KEYBOARD 1
#define USB_INTERFACE_PROTOCOL_MOUSE 2
static const GUID GUID_DEVINTERFACE = { 0xDEE824EF, 0x729B, 0x4A0E, 0x9C, 0x14, 0xB7, 0x11, 0x7D, 0x33, 0xA8, 0x17 };
typedef enum
{
HID_TYPE_OTHER,
HID_TYPE_USBMOUSE,
HID_TYPE_USBNONE
} hid_type;
struct hid_input {
struct input_dev *input;
};
struct hid_field {
struct hid_input *hidinput; /* associated input structure */
};
struct hid_usage {
unsigned hid;
__u16 code; /* input driver code */
__u8 type; /* input driver type */
};
struct hid_driver {
char *name;
const struct hid_device_id *id_table;
int (*probe)(struct hid_device *dev, const struct hid_device_id *id);
void (*remove)(struct hid_device *dev);
int (*raw_event)(struct hid_device *hdev, struct hid_report *report, u8 *data, int size);
int (*event)(struct hid_device *hdev, struct hid_field *field, struct hid_usage *usage, __s32 value);
int (*input_configured)(struct hid_device *hdev,
struct hid_input *hidinput);
int (*input_mapping)(struct hid_device *hdev,
struct hid_input *hidinput, struct hid_field *field,
struct hid_usage *usage, unsigned long **bit, int *max);
};
struct hid_device_id {
__u16 bus;
__u32 vendor;
__u32 product;
};
struct hid_device {
__u16 product;
enum hid_type type;
struct device dev;
struct hid_ll_driver *ll_driver;
unsigned int status;
struct hid_driver *driver;
};
struct hid_ll_driver {
int (*start)(struct hid_device *hdev);
void (*stop)(struct hid_device *hdev);
int (*parse)(struct hid_device *hdev);
};
inline int ll_start(struct hid_device *hdev) {
printf("ll_start\n");
return 0;
}
inline void ll_stop(struct hid_device *hdev) {
printf("ll_stop\n");
}
inline int ll_parse(struct hid_device *hdev) {
printf("ll_parse\n");
return 0;
}
inline void dev_err(struct device** dev, const char* msg) {
printf("dev_err device=%s msg=%s", (*dev)->init_name, msg);
}
inline void dev_info(struct device** dev, const char* msg) {
printf("dev_err device=%s msg=%s", (*dev)->init_name, msg);
}
inline void *dev_get_drvdata(const struct device *dev) {
return dev->driver_data;
}
inline void dev_set_drvdata(struct device *dev, void *data) {
dev->driver_data = data;
}
inline int hid_connect(struct hid_device *hdev, unsigned int connect_mask) {
printf("hid_connect\n");
return 0;
}
inline int hid_parse(struct hid_device *hdev) {
int ret;
if (hdev->status & HID_STAT_PARSED)
return 0;
ret = hdev->ll_driver->parse(hdev);
if (!ret)
hdev->status |= HID_STAT_PARSED;
return ret;
}
inline void *hid_get_drvdata(struct hid_device *hdev) {
return dev_get_drvdata(&hdev->dev);
}
inline void hid_set_drvdata(struct hid_device *hdev, void *data) {
dev_set_drvdata(&hdev->dev, data);
}
inline int hid_hw_start(struct hid_device *hdev, unsigned int connect_mask) {
int ret = hdev->ll_driver->start(hdev);
if (ret || !connect_mask)
return ret;
ret = hid_connect(hdev, connect_mask);
if (ret)
hdev->ll_driver->stop(hdev);
return ret;
}
inline void hid_hw_stop(struct hid_device *hdev) {
hdev->ll_driver->stop(hdev);
}
inline void hid_err(struct hid_device *hdev, const char* msg, ...) {
va_list args;
va_start(args, msg);
printf("hid_err device=%s", hdev->dev.init_name);
printf(msg, args);
va_end(args);
}
inline void hid_map_usage(struct hid_input* hidinput,
struct hid_usage* usage, unsigned long** bit, int* max,
__u8 type, __u16 c)
{
};
#define container_of(ptr, type, member) (type*)((char*)(ptr)-(char*)&((type *)0)->member)
inline void close(struct device* dev) {
printf("close %04X\n", (to_usb_device(dev))->descriptor.idProduct);
struct usb_interface *intf = to_usb_interface(dev->parent);
struct usb_device *usb_dev = interface_to_usbdev(intf);
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
free(hdev->ll_driver);
free(usb_dev);
free(intf->cur_altsetting);
free(intf);
free(hdev);
//TODO:cleanup malloc memory, move this function into DLL
}
inline void openChromaDevice(struct hid_device** hdev, unsigned int* numHdev, struct hid_driver hdr) {
for (unsigned int i = 0; hdr.id_table[i].vendor != 0; i++) {
HDEVINFO hDevInfo = SetupDiGetClassDevs(&GUID_DEVINTERFACE, 0, 0, DIGCF_DEVICEINTERFACE);
if (hDevInfo == INVALID_HANDLE_VALUE) {
printf("SetupDiGetClassDevs failed\n");
return;
}
SP_DEVINFO_DATA deviceData = { 0 };
deviceData.cbSize = sizeof(SP_DEVINFO_DATA);
for (unsigned int j = 0; SetupDiEnumDeviceInfo(hDevInfo, j, &deviceData); ++j) {
char deviceID[MAX_DEVICE_ID_LEN];
if (CM_Get_Device_ID(deviceData.DevInst, deviceID, MAX_DEVICE_ID_LEN, 0))
continue;
char* vid = strstr(deviceID, "VID_");
if (!vid || hdr.id_table[i].vendor != strtoul(vid+4, NULL, 16))
continue;
char* pid = strstr(deviceID, "PID_");
if (!pid || hdr.id_table[i].product != strtoul(pid+4, NULL, 16))
continue;
SP_INTERFACE_DEVICE_DATA interfaceData = { 0 };
interfaceData.cbSize = sizeof(SP_INTERFACE_DEVICE_DATA);
if (!SetupDiEnumDeviceInterfaces(hDevInfo, &deviceData, &GUID_DEVINTERFACE, 0, &interfaceData))
continue;
DWORD dwRequiredSize = 0;
SetupDiGetDeviceInterfaceDetail(hDevInfo, &interfaceData, 0, 0, &dwRequiredSize, 0);
SP_INTERFACE_DEVICE_DETAIL_DATA* pData = (SP_INTERFACE_DEVICE_DETAIL_DATA*)malloc(dwRequiredSize);
pData->cbSize = sizeof(SP_INTERFACE_DEVICE_DETAIL_DATA);
if (!SetupDiGetDeviceInterfaceDetail(hDevInfo, &interfaceData, pData, dwRequiredSize, 0, 0)) {
free(pData);
continue;
}
HANDLE hDevice = CreateFile(pData->DevicePath
, GENERIC_READ | GENERIC_WRITE
, FILE_SHARE_READ | FILE_SHARE_WRITE
, 0
, OPEN_EXISTING
, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED
, 0);
if (hDevice == INVALID_HANDLE_VALUE) {
free(pData);
continue;
}
WINUSB_INTERFACE_HANDLE hWinUSBHandle;
if (!WinUsb_Initialize(hDevice, &hWinUSBHandle))
continue;
SetupDiDestroyDeviceInfoList(hDevInfo);
printf("CM_Get_Device_ID (%s)\n", deviceID);
printf("device %04X:%04X opened!\n", hdr.id_table[i].vendor, hdr.id_table[i].product);
*hdev = (struct hid_device*)realloc(*hdev, (*numHdev+1) * sizeof(struct hid_device));
if (!*hdev) {
printf("out of memory\n");
continue;
}
if (*numHdev > 0)
{
//Correct all previous pointers to their new locations
for (int old_dev = 0; old_dev < *numHdev; old_dev++)
{
(*hdev)[old_dev].dev.parent = &((*hdev)[old_dev].dev);
(*hdev)[old_dev].dev.parent_usb_interface->dev = &((*hdev)[old_dev].dev);
(*hdev)[old_dev].dev.parent_usb_interface->parent_usb_device->dev = &((*hdev)[old_dev].dev);
}
}
struct usb_interface* intf = (struct usb_interface*)malloc(sizeof(struct usb_interface));
intf->cur_altsetting = (struct usb_host_interface*)malloc(sizeof(struct usb_host_interface));
intf->cur_altsetting->desc.bInterfaceProtocol = 0;
struct usb_device *usbdevice = (struct usb_device*)malloc(sizeof(struct usb_device));
usbdevice->descriptor.idVendor = hdr.id_table[i].vendor;
usbdevice->descriptor.idProduct = hdr.id_table[i].product;
intf->parent_usb_device = usbdevice;
(*hdev)[*numHdev].product = hdr.id_table[i].product;
(*hdev)[*numHdev].dev.parent = &((*hdev)[*numHdev].dev);
(*hdev)[*numHdev].dev.driver_data;
(*hdev)[*numHdev].dev.p = hWinUSBHandle;
(*hdev)[*numHdev].dev.parent_usb_interface = intf;
(*hdev)[*numHdev].dev.init_name = hdr.name;
usbdevice->dev = &((*hdev)[*numHdev].dev);
intf->dev = &((*hdev)[*numHdev].dev);
(*hdev)[*numHdev].status = 2;
(*hdev)[*numHdev].driver = &hdr;
(*hdev)[*numHdev].ll_driver = (struct hid_ll_driver*)malloc(sizeof(struct hid_ll_driver));
(*hdev)[*numHdev].ll_driver->parse = ll_parse;
(*hdev)[*numHdev].ll_driver->start = ll_start;
(*hdev)[*numHdev].ll_driver->stop = ll_stop;
(*hdev)[*numHdev].driver->probe(&((*hdev)[*numHdev]), &(hdr.id_table[i]));
(*numHdev)++;
}
if (!numHdev)
printf("device %04X:%04X NOT opened!\n", hdr.id_table[i].vendor, hdr.id_table[i].product);
}
}
#endif /* HID_H_ */
-60
View File
@@ -1,60 +0,0 @@
#ifndef INIT_H_
#define INIT_H_
static inline int sprint_f(char* buf, const char* fmt, ...) {
va_list args;
int i;
va_start(args, fmt);
i = sprintf_s(buf, strlen(buf) - 1, fmt, args);
va_end(args);
return i;
}
#define sprintf sprint_f
static inline int strncpy_f(char* dest, const char* source, const size_t sourceLen) {
return strncpy_s(dest, strlen(dest) - 1, source, sourceLen);
}
#define strncpy strncpy_f
static inline int strcpy_f(char* dest, const char* source) {
return strcpy_s(dest, strlen(dest) - 1, source);
}
#define strcpy strcpy_f
#define strdup _strdup
#define KERN_WARNING
#define KERN_ALERT
#define KERN_CRIT
#define printk printf
inline unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base) {
return strtoul(cp, endp, base);
}
inline void usleep(__int64 usec) {
HANDLE timer;
LARGE_INTEGER ft;
ft.QuadPart = -(10 * usec); // Convert to 100 nanosecond interval, negative value indicates relative time
timer = CreateWaitableTimer(NULL, TRUE, NULL);
SetWaitableTimer(timer, &ft, 0, NULL, NULL, 0);
WaitForSingleObject(timer, INFINITE);
CloseHandle(timer);
}
inline void msleep(__int64 msec) {
usleep(1000 * msec);
}
inline void usleep_range(__int64 usec1, __int64 usec2) {
usleep((usec1 + usec2) / 2);
}
inline unsigned short eflip(unsigned short val) {
return (val & 0xff) * 0xFF + (val >> 8);
}
#endif /* INIT_H_ */
-98
View File
@@ -1,98 +0,0 @@
#ifndef KERNEL_H_
#define KERNEL_H_
#include <windows.h>
#define DLL_INTERNAL __declspec( dllexport )
#define u8 unsigned char
#define u16 unsigned short
#define u32 unsigned int
#define u64 unsigned long
#define __u8 unsigned char
#define __u16 unsigned short
#define __u32 unsigned int
#define __u64 unsigned long
#define uint8_t unsigned char
#define uint16_t unsigned short
#define uint32_t unsigned int
#define uint64_t unsigned long
#define __le8 unsigned char
#define __le16 unsigned short
#define __le32 unsigned int
#define __le64 unsigned long
#define __s8 signed char
#define __s16 signed short
#define __s32 signed int
#define __s64 signed long
#define uint unsigned int
#define ulong unsigned long
#define socklen_t int
#define bool int
#define true 1
#define false 0
#define size_t SIZE_T
#define ssize_t SSIZE_T
struct mutex {
CRITICAL_SECTION lock;
};
inline void mutex_init(struct mutex* mutex) {
InitializeCriticalSection(&mutex->lock);
}
inline void mutex_lock(struct mutex* mutex) {
EnterCriticalSection(&mutex->lock);
}
inline void mutex_unlock(struct mutex* mutex) {
LeaveCriticalSection(&mutex->lock);
}
inline int mutex_trylock(struct mutex* mutex) {
return TryEnterCriticalSection(&mutex->lock);
}
inline int mutex_is_locked(struct mutex* mutex) {
if (mutex_trylock(mutex)) {
mutex_unlock(mutex);
return 0;
}
else
return 1;
}
inline void set_bit(int nr, volatile unsigned long *addr) {
int *a = (int *)addr;
int mask;
a += nr >> 5;
mask = 1 << (nr & 0x1f);
*a |= mask;
}
#define __set_bit set_bit
inline void clear_bit(int nr, volatile unsigned long *addr) {
int *a = (int *)addr;
int mask;
a += nr >> 5;
mask = 1 << (nr & 0x1f);
*a &= ~mask;
}
inline int test_bit(int nr, const void *addr) {
int *a = (int *)addr;
int mask;
a += nr >> 5;
mask = 1 << (nr & 0x1f);
return ((mask & *a) != 0);
}
#endif /* KERNEL_H_ */
-146
View File
@@ -1,146 +0,0 @@
#ifndef MODULE_H_
#define MODULE_H_
#include <stdio.h>
#include <Winusb.h>
#define MODULE_AUTHOR( __Declaration__ )
#define MODULE_DESCRIPTION( __Declaration__ )
#define MODULE_VERSION( __Declaration__ )
#define MODULE_LICENSE( __Declaration__ )
#define USB_CTRL_SET_TIMEOUT 5000
#define USB_DIR_OUT 0
#define USB_DIR_IN 0x80
#define USB_TYPE_CLASS (0x01 << 5)
#define USB_RECIP_INTERFACE 0x01
#define usb_sndctrlpipe(u,d) 0
#define usb_rcvctrlpipe(u,d) 0
#define PATH_MAX 512
struct usb_interface_descriptor {
unsigned char bInterfaceProtocol;
};
struct usb_host_interface {
struct usb_interface_descriptor desc;
};
struct device {
struct device *parent;
void *p;
const char *init_name;
void *driver_data;
struct usb_interface *parent_usb_interface;
};
struct usb_interface {
struct device* dev;
int num_altsetting;
struct usb_host_interface *cur_altsetting;
struct usb_device *parent_usb_device;
};
struct usb_device_descriptor {
unsigned short idVendor;
unsigned short idProduct;
};
struct usb_device {
struct device* dev;
struct usb_device_descriptor descriptor;
};
inline int usb_control_msg(
struct usb_device *usb_dev
, int usb_pipe
, unsigned int request
, unsigned int request_type
, unsigned int value
, unsigned int report_index
, unsigned char* buf, unsigned int size
, unsigned int timeout)
{
WINUSB_SETUP_PACKET packet;
packet.RequestType = request_type;
packet.Request = request;
packet.Value = value;
packet.Index = report_index;
packet.Length = size;
ULONG cbSent = 0;
if (!WinUsb_ControlTransfer(usb_dev->dev->p, packet, buf, size, &cbSent, 0))
printf("WinUsb_ControlTransfer failed\n");
return cbSent;
}
inline struct usb_interface *to_usb_interface(struct device *dev) {
return dev->parent_usb_interface;
}
inline struct usb_device *to_usb_device(struct device *dev) {
return dev->parent_usb_interface->parent_usb_device;
}
inline struct usb_device *interface_to_usbdev(struct usb_interface *intf) {
return to_usb_device(intf->dev->parent);
}
inline void usb_disable_autosuspend(struct usb_device *usb_dev) {
printf("usb_disable_autosuspend\n");
}
struct device_attribute {
const char* name;
ssize_t(*show)(struct device *dev, struct device_attribute *attr, char *buf);
ssize_t(*store)(struct device *dev, struct device_attribute *attr, const char *buf, size_t count);
};
inline int device_create_file(struct device *device, struct device_attribute *entry) {
printf("device_create_file %s\n", entry->name);
return 0;
}
inline void device_remove_file(struct device *device, struct device_attribute *entry) {
printf("device_remove_file %s\n", entry->name);
}
#define HID_USB_DEVICE(ven, prod) \
.vendor = (ven) \
, .product = (prod)
#define __stringify(x) #x
// Hack to turn Linux device macros into API calls
#define DEVICE_ATTR1(_device,_name, _mode, _show, _store) \
struct device_attribute dev_attr_##_name; \
DLL_INTERNAL struct device_attribute dev##_device##_attr_##_name = { \
.name = __stringify(_name) \
, .show = _show \
, .store = _store \
};
#define MODULE_DEVICE_TABLE(type, name)
/*typedef struct hid_device_array_tag {
unsigned int count;
struct hid_device* hdev[];
} hid_device_array;*/
#define module_hid_driver(hdr) \
DLL_INTERNAL unsigned int init_##hdr## (struct hid_device** hdevo) { \
unsigned int numHdevs = 0; \
struct hid_device* hdev = NULL; \
openChromaDevice(&hdev, &numHdevs, hdr); \
*hdevo = hdev; \
return numHdevs; \
}
#endif /* MODULE_H_ */
-16
View File
@@ -1,16 +0,0 @@
#ifndef RANDOM_H_
#define RANDOM_H_
static inline void get_random_bytes(void* rand_ptr, unsigned int rand_size) {
char failed = 0;
static HCRYPTPROV prov = 0;
if (prov == 0) {
if (!CryptAcquireContext(&prov, NULL, NULL, PROV_RSA_FULL, 0))
failed = 1;
}
if (!failed && !CryptGenRandom(prov, rand_size, (unsigned char*)rand_ptr))
printf("get_random_bytes failed\n");
}
#endif /* RANDOM_H_ */
-31
View File
@@ -1,31 +0,0 @@
#ifndef SLAB_H_
#define SLAB_H_
typedef enum {
GFP_KERNEL,
GFP_ATOMIC,
__GFP_HIGHMEM,
__GFP_HIGH
} gfp_t;
static inline void *kzalloc(size_t s, gfp_t gfp) {
void *p = malloc(s);
memset(p, 0, s);
return p;
}
inline void *kmemdup(const void *src, size_t len, gfp_t gfp) {
void *p;
p = malloc(len);
if (p)
memcpy(p, src, len);
return p;
}
static inline void kfree(const void* p) {
free((void*)p);
}
#endif /* SLAB_H_ */
-539
View File
@@ -1,539 +0,0 @@
#ifndef INPUT_H_
#define INPUT_H_
#include <stdio.h>
#include <windows.h>
#define uint unsigned int
#define ulong unsigned long
#define u8 unsigned char
#define u16 unsigned short
#define u32 unsigned int
#define u64 unsigned long
#define ABS_VOLUME 0x20
//input-event-codes.h
#define KEY_RESERVED 0
#define KEY_ESC 1
#define KEY_1 2
#define KEY_2 3
#define KEY_3 4
#define KEY_4 5
#define KEY_5 6
#define KEY_6 7
#define KEY_7 8
#define KEY_8 9
#define KEY_9 10
#define KEY_0 11
#define KEY_MINUS 12
#define KEY_EQUAL 13
#define KEY_BACKSPACE 14
#define KEY_TAB 15
#define KEY_Q 16
#define KEY_W 17
#define KEY_E 18
#define KEY_R 19
#define KEY_T 20
#define KEY_Y 21
#define KEY_U 22
#define KEY_I 23
#define KEY_O 24
#define KEY_P 25
#define KEY_LEFTBRACE 26
#define KEY_RIGHTBRACE 27
#define KEY_ENTER 28
#define KEY_LEFTCTRL 29
#define KEY_A 30
#define KEY_S 31
#define KEY_D 32
#define KEY_F 33
#define KEY_G 34
#define KEY_H 35
#define KEY_J 36
#define KEY_K 37
#define KEY_L 38
#define KEY_SEMICOLON 39
#define KEY_APOSTROPHE 40
#define KEY_GRAVE 41
#define KEY_LEFTSHIFT 42
#define KEY_BACKSLASH 43
#define KEY_Z 44
#define KEY_X 45
#define KEY_C 46
#define KEY_V 47
#define KEY_B 48
#define KEY_N 49
#define KEY_M 50
#define KEY_COMMA 51
#define KEY_DOT 52
#define KEY_SLASH 53
#define KEY_RIGHTSHIFT 54
#define KEY_KPASTERISK 55
#define KEY_LEFTALT 56
#define KEY_SPACE 57
#define KEY_CAPSLOCK 58
#define KEY_F1 59
#define KEY_F2 60
#define KEY_F3 61
#define KEY_F4 62
#define KEY_F5 63
#define KEY_F6 64
#define KEY_F7 65
#define KEY_F8 66
#define KEY_F9 67
#define KEY_F10 68
#define KEY_NUMLOCK 69
#define KEY_SCROLLLOCK 70
#define KEY_KP7 71
#define KEY_KP8 72
#define KEY_KP9 73
#define KEY_KPMINUS 74
#define KEY_KP4 75
#define KEY_KP5 76
#define KEY_KP6 77
#define KEY_KPPLUS 78
#define KEY_KP1 79
#define KEY_KP2 80
#define KEY_KP3 81
#define KEY_KP0 82
#define KEY_KPDOT 83
#define KEY_ZENKAKUHANKAKU 85
#define KEY_102ND 86
#define KEY_F11 87
#define KEY_F12 88
#define KEY_RO 89
#define KEY_KATAKANA 90
#define KEY_HIRAGANA 91
#define KEY_HENKAN 92
#define KEY_KATAKANAHIRAGANA 93
#define KEY_MUHENKAN 94
#define KEY_KPJPCOMMA 95
#define KEY_KPENTER 96
#define KEY_RIGHTCTRL 97
#define KEY_KPSLASH 98
#define KEY_SYSRQ 99
#define KEY_RIGHTALT 100
#define KEY_LINEFEED 101
#define KEY_HOME 102
#define KEY_UP 103
#define KEY_PAGEUP 104
#define KEY_LEFT 105
#define KEY_RIGHT 106
#define KEY_END 107
#define KEY_DOWN 108
#define KEY_PAGEDOWN 109
#define KEY_INSERT 110
#define KEY_DELETE 111
#define KEY_MACRO 112
#define KEY_MUTE 113
#define KEY_VOLUMEDOWN 114
#define KEY_VOLUMEUP 115
#define KEY_POWER 116 /* SC System Power Down */
#define KEY_KPEQUAL 117
#define KEY_KPPLUSMINUS 118
#define KEY_PAUSE 119
#define KEY_SCALE 120 /* AL Compiz Scale (Expose) */
#define KEY_KPCOMMA 121
#define KEY_HANGEUL 122
#define KEY_HANGUEL KEY_HANGEUL
#define KEY_HANJA 123
#define KEY_YEN 124
#define KEY_LEFTMETA 125
#define KEY_RIGHTMETA 126
#define KEY_COMPOSE 127
#define KEY_STOP 128 /* AC Stop */
#define KEY_AGAIN 129
#define KEY_PROPS 130 /* AC Properties */
#define KEY_UNDO 131 /* AC Undo */
#define KEY_FRONT 132
#define KEY_COPY 133 /* AC Copy */
#define KEY_OPEN 134 /* AC Open */
#define KEY_PASTE 135 /* AC Paste */
#define KEY_FIND 136 /* AC Search */
#define KEY_CUT 137 /* AC Cut */
#define KEY_HELP 138 /* AL Integrated Help Center */
#define KEY_MENU 139 /* Menu (show menu) */
#define KEY_CALC 140 /* AL Calculator */
#define KEY_SETUP 141
#define KEY_SLEEP 142 /* SC System Sleep */
#define KEY_WAKEUP 143 /* System Wake Up */
#define KEY_FILE 144 /* AL Local Machine Browser */
#define KEY_SENDFILE 145
#define KEY_DELETEFILE 146
#define KEY_XFER 147
#define KEY_PROG1 148
#define KEY_PROG2 149
#define KEY_WWW 150 /* AL Internet Browser */
#define KEY_MSDOS 151
#define KEY_COFFEE 152 /* AL Terminal Lock/Screensaver */
#define KEY_SCREENLOCK KEY_COFFEE
#define KEY_DIRECTION 153
#define KEY_CYCLEWINDOWS 154
#define KEY_MAIL 155
#define KEY_BOOKMARKS 156 /* AC Bookmarks */
#define KEY_COMPUTER 157
#define KEY_BACK 158 /* AC Back */
#define KEY_FORWARD 159 /* AC Forward */
#define KEY_CLOSECD 160
#define KEY_EJECTCD 161
#define KEY_EJECTCLOSECD 162
#define KEY_NEXTSONG 163
#define KEY_PLAYPAUSE 164
#define KEY_PREVIOUSSONG 165
#define KEY_STOPCD 166
#define KEY_RECORD 167
#define KEY_REWIND 168
#define KEY_PHONE 169 /* Media Select Telephone */
#define KEY_ISO 170
#define KEY_CONFIG 171 /* AL Consumer Control Configuration */
#define KEY_HOMEPAGE 172 /* AC Home */
#define KEY_REFRESH 173 /* AC Refresh */
#define KEY_EXIT 174 /* AC Exit */
#define KEY_MOVE 175
#define KEY_EDIT 176
#define KEY_SCROLLUP 177
#define KEY_SCROLLDOWN 178
#define KEY_KPLEFTPAREN 179
#define KEY_KPRIGHTPAREN 180
#define KEY_NEW 181 /* AC New */
#define KEY_REDO 182 /* AC Redo/Repeat */
#define KEY_F13 183
#define KEY_F14 184
#define KEY_F15 185
#define KEY_F16 186
#define KEY_F17 187
#define KEY_F18 188
#define KEY_F19 189
#define KEY_F20 190
#define KEY_F21 191
#define KEY_F22 192
#define KEY_F23 193
#define KEY_F24 194
#define KEY_PLAYCD 200
#define KEY_PAUSECD 201
#define KEY_PROG3 202
#define KEY_PROG4 203
#define KEY_DASHBOARD 204 /* AL Dashboard */
#define KEY_SUSPEND 205
#define KEY_CLOSE 206 /* AC Close */
#define KEY_PLAY 207
#define KEY_FASTFORWARD 208
#define KEY_BASSBOOST 209
#define KEY_PRINT 210 /* AC Print */
#define KEY_HP 211
#define KEY_CAMERA 212
#define KEY_SOUND 213
#define KEY_QUESTION 214
#define KEY_EMAIL 215
#define KEY_CHAT 216
#define KEY_SEARCH 217
#define KEY_CONNECT 218
#define KEY_FINANCE 219 /* AL Checkbook/Finance */
#define KEY_SPORT 220
#define KEY_SHOP 221
#define KEY_ALTERASE 222
#define KEY_CANCEL 223 /* AC Cancel */
#define KEY_BRIGHTNESSDOWN 224
#define KEY_BRIGHTNESSUP 225
#define KEY_MEDIA 226
#define KEY_SWITCHVIDEOMODE 227 /* Cycle between available video
outputs (Monitor/LCD/TV-out/etc) */
#define KEY_KBDILLUMTOGGLE 228
#define KEY_KBDILLUMDOWN 229
#define KEY_KBDILLUMUP 230
#define KEY_SEND 231 /* AC Send */
#define KEY_REPLY 232 /* AC Reply */
#define KEY_FORWARDMAIL 233 /* AC Forward Msg */
#define KEY_SAVE 234 /* AC Save */
#define KEY_DOCUMENTS 235
#define KEY_BATTERY 236
#define KEY_BLUETOOTH 237
#define KEY_WLAN 238
#define KEY_UWB 239
#define KEY_UNKNOWN 240
#define KEY_VIDEO_NEXT 241 /* drive next video source */
#define KEY_VIDEO_PREV 242 /* drive previous video source */
#define KEY_BRIGHTNESS_CYCLE 243 /* brightness up, after max is min */
#define KEY_BRIGHTNESS_ZERO 244 /* brightness off, use ambient */
#define KEY_DISPLAY_OFF 245 /* display device to off state */
#define KEY_WIMAX 246
/* Range 248 - 255 is reserved for special needs of AT keyboard driver */
#define BTN_MISC 0x100
#define BTN_0 0x100
#define BTN_1 0x101
#define BTN_2 0x102
#define BTN_3 0x103
#define BTN_4 0x104
#define BTN_5 0x105
#define BTN_6 0x106
#define BTN_7 0x107
#define BTN_8 0x108
#define BTN_9 0x109
#define BTN_MOUSE 0x110
#define BTN_LEFT 0x110
#define BTN_RIGHT 0x111
#define BTN_MIDDLE 0x112
#define BTN_SIDE 0x113
#define BTN_EXTRA 0x114
#define BTN_FORWARD 0x115
#define BTN_BACK 0x116
#define BTN_TASK 0x117
#define BTN_JOYSTICK 0x120
#define BTN_TRIGGER 0x120
#define BTN_THUMB 0x121
#define BTN_THUMB2 0x122
#define BTN_TOP 0x123
#define BTN_TOP2 0x124
#define BTN_PINKIE 0x125
#define BTN_BASE 0x126
#define BTN_BASE2 0x127
#define BTN_BASE3 0x128
#define BTN_BASE4 0x129
#define BTN_BASE5 0x12a
#define BTN_BASE6 0x12b
#define BTN_DEAD 0x12f
#define BTN_GAMEPAD 0x130
#define BTN_A 0x130
#define BTN_B 0x131
#define BTN_C 0x132
#define BTN_X 0x133
#define BTN_Y 0x134
#define BTN_Z 0x135
#define BTN_TL 0x136
#define BTN_TR 0x137
#define BTN_TL2 0x138
#define BTN_TR2 0x139
#define BTN_SELECT 0x13a
#define BTN_START 0x13b
#define BTN_MODE 0x13c
#define BTN_THUMBL 0x13d
#define BTN_THUMBR 0x13e
#define BTN_DIGI 0x140
#define BTN_TOOL_PEN 0x140
#define BTN_TOOL_RUBBER 0x141
#define BTN_TOOL_BRUSH 0x142
#define BTN_TOOL_PENCIL 0x143
#define BTN_TOOL_AIRBRUSH 0x144
#define BTN_TOOL_FINGER 0x145
#define BTN_TOOL_MOUSE 0x146
#define BTN_TOOL_LENS 0x147
#define BTN_TOUCH 0x14a
#define BTN_STYLUS 0x14b
#define BTN_STYLUS2 0x14c
#define BTN_TOOL_DOUBLETAP 0x14d
#define BTN_TOOL_TRIPLETAP 0x14e
#define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */
#define BTN_WHEEL 0x150
#define BTN_GEAR_DOWN 0x150
#define BTN_GEAR_UP 0x151
#define KEY_OK 0x160
#define KEY_SELECT 0x161
#define KEY_GOTO 0x162
#define KEY_CLEAR 0x163
#define KEY_POWER2 0x164
#define KEY_OPTION 0x165
#define KEY_INFO 0x166 /* AL OEM Features/Tips/Tutorial */
#define KEY_TIME 0x167
#define KEY_VENDOR 0x168
#define KEY_ARCHIVE 0x169
#define KEY_PROGRAM 0x16a /* Media Select Program Guide */
#define KEY_CHANNEL 0x16b
#define KEY_FAVORITES 0x16c
#define KEY_EPG 0x16d
#define KEY_PVR 0x16e /* Media Select Home */
#define KEY_MHP 0x16f
#define KEY_LANGUAGE 0x170
#define KEY_TITLE 0x171
#define KEY_SUBTITLE 0x172
#define KEY_ANGLE 0x173
#define KEY_ZOOM 0x174
#define KEY_MODE 0x175
#define KEY_KEYBOARD 0x176
#define KEY_SCREEN 0x177
#define KEY_PC 0x178 /* Media Select Computer */
#define KEY_TV 0x179 /* Media Select TV */
#define KEY_TV2 0x17a /* Media Select Cable */
#define KEY_VCR 0x17b /* Media Select VCR */
#define KEY_VCR2 0x17c /* VCR Plus */
#define KEY_SAT 0x17d /* Media Select Satellite */
#define KEY_SAT2 0x17e
#define KEY_CD 0x17f /* Media Select CD */
#define KEY_TAPE 0x180 /* Media Select Tape */
#define KEY_RADIO 0x181
#define KEY_TUNER 0x182 /* Media Select Tuner */
#define KEY_PLAYER 0x183
#define KEY_TEXT 0x184
#define KEY_DVD 0x185 /* Media Select DVD */
#define KEY_AUX 0x186
#define KEY_MP3 0x187
#define KEY_AUDIO 0x188
#define KEY_VIDEO 0x189
#define KEY_DIRECTORY 0x18a
#define KEY_LIST 0x18b
#define KEY_MEMO 0x18c /* Media Select Messages */
#define KEY_CALENDAR 0x18d
#define KEY_RED 0x18e
#define KEY_GREEN 0x18f
#define KEY_YELLOW 0x190
#define KEY_BLUE 0x191
#define KEY_CHANNELUP 0x192 /* Channel Increment */
#define KEY_CHANNELDOWN 0x193 /* Channel Decrement */
#define KEY_FIRST 0x194
#define KEY_LAST 0x195 /* Recall Last */
#define KEY_AB 0x196
#define KEY_NEXT 0x197
#define KEY_RESTART 0x198
#define KEY_SLOW 0x199
#define KEY_SHUFFLE 0x19a
#define KEY_BREAK 0x19b
#define KEY_PREVIOUS 0x19c
#define KEY_DIGITS 0x19d
#define KEY_TEEN 0x19e
#define KEY_TWEN 0x19f
#define KEY_VIDEOPHONE 0x1a0 /* Media Select Video Phone */
#define KEY_GAMES 0x1a1 /* Media Select Games */
#define KEY_ZOOMIN 0x1a2 /* AC Zoom In */
#define KEY_ZOOMOUT 0x1a3 /* AC Zoom Out */
#define KEY_ZOOMRESET 0x1a4 /* AC Zoom */
#define KEY_WORDPROCESSOR 0x1a5 /* AL Word Processor */
#define KEY_EDITOR 0x1a6 /* AL Text Editor */
#define KEY_SPREADSHEET 0x1a7 /* AL Spreadsheet */
#define KEY_GRAPHICSEDITOR 0x1a8 /* AL Graphics Editor */
#define KEY_PRESENTATION 0x1a9 /* AL Presentation App */
#define KEY_DATABASE 0x1aa /* AL Database App */
#define KEY_NEWS 0x1ab /* AL Newsreader */
#define KEY_VOICEMAIL 0x1ac /* AL Voicemail */
#define KEY_ADDRESSBOOK 0x1ad /* AL Contacts/Address Book */
#define KEY_MESSENGER 0x1ae /* AL Instant Messaging */
#define KEY_DISPLAYTOGGLE 0x1af /* Turn display (LCD) on and off */
#define KEY_SPELLCHECK 0x1b0 /* AL Spell Check */
#define KEY_LOGOFF 0x1b1 /* AL Logoff */
#define KEY_DOLLAR 0x1b2
#define KEY_EURO 0x1b3
#define KEY_FRAMEBACK 0x1b4 /* Consumer - transport controls */
#define KEY_FRAMEFORWARD 0x1b5
#define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */
#define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */
#define KEY_DEL_EOL 0x1c0
#define KEY_DEL_EOS 0x1c1
#define KEY_INS_LINE 0x1c2
#define KEY_DEL_LINE 0x1c3
#define KEY_FN 0x1d0
#define KEY_FN_ESC 0x1d1
#define KEY_FN_F1 0x1d2
#define KEY_FN_F2 0x1d3
#define KEY_FN_F3 0x1d4
#define KEY_FN_F4 0x1d5
#define KEY_FN_F5 0x1d6
#define KEY_FN_F6 0x1d7
#define KEY_FN_F7 0x1d8
#define KEY_FN_F8 0x1d9
#define KEY_FN_F9 0x1da
#define KEY_FN_F10 0x1db
#define KEY_FN_F11 0x1dc
#define KEY_FN_F12 0x1dd
#define KEY_FN_1 0x1de
#define KEY_FN_2 0x1df
#define KEY_FN_D 0x1e0
#define KEY_FN_E 0x1e1
#define KEY_FN_F 0x1e2
#define KEY_FN_S 0x1e3
#define KEY_FN_B 0x1e4
#define KEY_BRL_DOT1 0x1f1
#define KEY_BRL_DOT2 0x1f2
#define KEY_BRL_DOT3 0x1f3
#define KEY_BRL_DOT4 0x1f4
#define KEY_BRL_DOT5 0x1f5
#define KEY_BRL_DOT6 0x1f6
#define KEY_BRL_DOT7 0x1f7
#define KEY_BRL_DOT8 0x1f8
#define KEY_BRL_DOT9 0x1f9
#define KEY_BRL_DOT10 0x1fa
#define KEY_NUMERIC_0 0x200 /* used by phones, remote controls, */
#define KEY_NUMERIC_1 0x201 /* and other keypads */
#define KEY_NUMERIC_2 0x202
#define KEY_NUMERIC_3 0x203
#define KEY_NUMERIC_4 0x204
#define KEY_NUMERIC_5 0x205
#define KEY_NUMERIC_6 0x206
#define KEY_NUMERIC_7 0x207
#define KEY_NUMERIC_8 0x208
#define KEY_NUMERIC_9 0x209
#define KEY_NUMERIC_STAR 0x20a
#define KEY_NUMERIC_POUND 0x20b
/* We avoid low common keys in module aliases so they don't get huge. */
#define KEY_MIN_INTERESTING KEY_MUTE
#define KEY_MAX 0x2ff
#define KEY_CNT (KEY_MAX+1)
#define EV_SYN 0x00
#define EV_KEY 0x01
#define EV_REL 0x02
#define EV_ABS 0x03
#define EV_MSC 0x04
#define EV_SW 0x05
#define EV_LED 0x11
#define EV_SND 0x12
#define EV_REP 0x14
#define EV_FF 0x15
#define EV_PWR 0x16
#define EV_FF_STATUS 0x17
#define EV_MAX 0x1f
#define EV_CNT (EV_MAX+1)
#define SYN_REPORT 0
#define BITS_PER_BYTE 8
#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
#define DECLARE_BITMAP(name,bits) unsigned long name[BITS_TO_LONGS(bits)]
struct input_dev {
const char *name;
const char *phys;
unsigned long evbit[BITS_TO_LONGS(EV_CNT)];
unsigned long keybit[BITS_TO_LONGS(KEY_CNT)];
};
static inline void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) {
printf("input_event\n");
}
static inline void input_report_key(struct input_dev *dev, unsigned int code, int value) {
input_event(dev, EV_KEY, code, value);
}
static inline void input_sync(struct input_dev *dev) {
input_event(dev, EV_SYN, SYN_REPORT, 0);
}
#endif /* INPUT_H_ */
+156 -86
View File
@@ -13,92 +13,162 @@
<property name="windowTitle">
<string>Frame</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="NameLabel">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="1" column="0" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="TypeLabel">
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="DescriptionValue">
<property name="text">
<string>Description Value</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="VersionValue">
<property name="text">
<string>Version Value</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="LocationValue">
<property name="text">
<string>Location Value</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="TypeValue">
<property name="text">
<string>Type Value</string>
</property>
</widget>
</item>
<item row="3" column="0" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="VersionLabel">
<property name="text">
<string>Version:</string>
</property>
</widget>
</item>
<item row="5" column="0" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="SerialLabel">
<property name="text">
<string>Serial:</string>
</property>
</widget>
</item>
<item row="4" column="0" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="LocationLabel">
<property name="text">
<string>Location:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="SerialValue">
<property name="text">
<string>Serial Value</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="NameValue">
<property name="text">
<string>Name Value</string>
</property>
</widget>
</item>
<item row="2" column="0" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="DescriptionLabel">
<property name="text">
<string>Description:</string>
</property>
</widget>
</item>
</layout>
<widget class="QLabel" name="TypeLabel">
<property name="geometry">
<rect>
<x>100</x>
<y>80</y>
<width>60</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>Type:</string>
</property>
</widget>
<widget class="QLabel" name="TypeValue">
<property name="geometry">
<rect>
<x>180</x>
<y>80</y>
<width>240</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>Type Value</string>
</property>
</widget>
<widget class="QLabel" name="DescriptionValue">
<property name="geometry">
<rect>
<x>180</x>
<y>100</y>
<width>240</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>Description Value</string>
</property>
</widget>
<widget class="QLabel" name="DescriptionLabel">
<property name="geometry">
<rect>
<x>100</x>
<y>100</y>
<width>60</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>Description:</string>
</property>
</widget>
<widget class="QLabel" name="VersionValue">
<property name="geometry">
<rect>
<x>180</x>
<y>120</y>
<width>240</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>Version Value</string>
</property>
</widget>
<widget class="QLabel" name="VersionLabel">
<property name="geometry">
<rect>
<x>100</x>
<y>120</y>
<width>60</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>Version:</string>
</property>
</widget>
<widget class="QLabel" name="LocationLabel">
<property name="geometry">
<rect>
<x>100</x>
<y>140</y>
<width>60</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>Location:</string>
</property>
</widget>
<widget class="QLabel" name="LocationValue">
<property name="geometry">
<rect>
<x>180</x>
<y>140</y>
<width>240</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>Location Value</string>
</property>
</widget>
<widget class="QLabel" name="NameValue">
<property name="geometry">
<rect>
<x>180</x>
<y>60</y>
<width>240</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>Name Value</string>
</property>
</widget>
<widget class="QLabel" name="NameLabel">
<property name="geometry">
<rect>
<x>100</x>
<y>60</y>
<width>60</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>Name:</string>
</property>
</widget>
<widget class="QLabel" name="SerialValue">
<property name="geometry">
<rect>
<x>180</x>
<y>160</y>
<width>240</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>Serial Value</string>
</property>
</widget>
<widget class="QLabel" name="SerialLabel">
<property name="geometry">
<rect>
<x>100</x>
<y>160</y>
<width>60</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>Serial:</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
+82 -187
View File
@@ -83,8 +83,6 @@ OpenRGBDevicePage::OpenRGBDevicePage(RGBController *dev, QWidget *parent) :
ui->ZoneBox->blockSignals(true);
ui->ZoneBox->clear();
ui->ZoneBox->addItem("All Zones");
for (std::size_t i = 0; i < device->zones.size(); i++)
{
ui->ZoneBox->addItem(device->zones[i].name.c_str());
@@ -93,10 +91,16 @@ OpenRGBDevicePage::OpenRGBDevicePage(RGBController *dev, QWidget *parent) :
ui->ZoneBox->setCurrentIndex(0);
ui->ZoneBox->blockSignals(false);
/*-----------------------------------------------------*\
| Update LED box |
\*-----------------------------------------------------*/
on_ZoneBox_currentIndexChanged(0);
ui->LEDBox->blockSignals(true);
ui->LEDBox->clear();
for (std::size_t i = 0; i < device->leds.size(); i++)
{
ui->LEDBox->addItem(device->leds[i].name.c_str());
}
ui->LEDBox->setCurrentIndex(0);
ui->LEDBox->blockSignals(false);
/*-----------------------------------------------------*\
| Update color picker with color of first LED |
@@ -111,63 +115,11 @@ OpenRGBDevicePage::~OpenRGBDevicePage()
void Ui::OpenRGBDevicePage::on_ZoneBox_currentIndexChanged(int /*index*/)
{
unsigned int selected_zone = ui->ZoneBox->currentIndex();
ui->LEDBox->blockSignals(true);
ui->LEDBox->clear();
if(selected_zone == 0)
{
for (std::size_t i = 0; i < device->leds.size(); i++)
{
ui->LEDBox->addItem(device->leds[i].name.c_str());
}
}
else
{
selected_zone = selected_zone - 1;
for (std::size_t y = 0; y < device->zones[selected_zone].map.size(); y++)
{
for(std::size_t x = 0; x < device->zones[selected_zone].map[y].size(); x++)
{
ui->LEDBox->addItem(device->leds[device->zones[selected_zone].map[y][x]].name.c_str());
}
}
}
ui->LEDBox->setCurrentIndex(0);
on_LEDBox_currentIndexChanged(0);
ui->LEDBox->blockSignals(false);
}
void Ui::OpenRGBDevicePage::on_LEDBox_currentIndexChanged(int index)
{
unsigned int selected_zone = ui->ZoneBox->currentIndex();
if(selected_zone > 0)
{
selected_zone = selected_zone - 1;
unsigned int count = 0;
for (std::size_t y = 0; y < device->zones[selected_zone].map.size(); y++)
{
for(std::size_t x = 0; x < device->zones[selected_zone].map[y].size(); x++)
{
if(count == index)
{
index = device->zones[selected_zone].map[y][x];
break;
}
else
{
count++;
}
}
}
}
/*-----------------------------------------------------*\
| Update color picker with color of selected LED |
\*-----------------------------------------------------*/
@@ -240,8 +192,6 @@ void Ui::OpenRGBDevicePage::UpdateModeUi()
if(supports_speed)
{
ui->SpeedSlider->blockSignals(true);
if(device->modes[selected_mode].speed_min > device->modes[selected_mode].speed_max)
{
InvertedSpeed = true;
@@ -257,13 +207,10 @@ void Ui::OpenRGBDevicePage::UpdateModeUi()
ui->SpeedSlider->setValue(device->modes[selected_mode].speed);
ui->SpeedSlider->setEnabled(true);
ui->SpeedSlider->blockSignals(false);
}
else
{
ui->SpeedSlider->blockSignals(true);
ui->SpeedSlider->setEnabled(false);
ui->SpeedSlider->blockSignals(false);
}
ui->DirectionBox->clear();
@@ -353,88 +300,76 @@ void Ui::OpenRGBDevicePage::UpdateMode()
| Read user interface |
\*-----------------------------------------------------*/
int current_mode = ui->ModeBox->currentIndex();
int current_speed = ui->SpeedSlider->value();
bool current_random = ui->RandomCheck->checkState();
int current_dir_idx = ui->DirectionBox->currentIndex();
int current_direction = 0;
bool supports_dir_lr = ( device->modes[current_mode].flags & MODE_FLAG_HAS_DIRECTION_LR );
bool supports_dir_ud = ( device->modes[current_mode].flags & MODE_FLAG_HAS_DIRECTION_UD );
bool supports_dir_hv = ( device->modes[current_mode].flags & MODE_FLAG_HAS_DIRECTION_HV );
if(current_mode >= 0)
/*-----------------------------------------------------*\
| Set the direction value |
\*-----------------------------------------------------*/
if(supports_dir_hv)
{
int current_speed = 0;
bool current_random = ui->RandomCheck->checkState();
int current_dir_idx = ui->DirectionBox->currentIndex();
int current_direction = 0;
bool supports_dir_lr = ( device->modes[current_mode].flags & MODE_FLAG_HAS_DIRECTION_LR );
bool supports_dir_ud = ( device->modes[current_mode].flags & MODE_FLAG_HAS_DIRECTION_UD );
bool supports_dir_hv = ( device->modes[current_mode].flags & MODE_FLAG_HAS_DIRECTION_HV );
/*-----------------------------------------------------*\
| Set the direction value |
\*-----------------------------------------------------*/
if(supports_dir_hv)
{
if(supports_dir_lr && supports_dir_ud)
{
current_direction = current_dir_idx;
}
else if(supports_dir_lr || supports_dir_ud)
{
current_direction = current_dir_idx + 2;
}
else
{
current_direction = current_dir_idx + 4;
}
}
if(supports_dir_ud)
{
if(supports_dir_lr)
{
current_direction = current_dir_idx;
}
else
{
current_direction = current_dir_idx + 2;
}
}
if((supports_dir_lr)
&&(current_dir_idx < 2))
if(supports_dir_lr && supports_dir_ud)
{
current_direction = current_dir_idx;
}
else if(supports_dir_lr || supports_dir_ud)
{
current_direction = current_dir_idx + 2;
}
else
{
current_direction = current_dir_idx + 4;
}
}
device->modes[current_mode].direction = current_direction;
if(supports_dir_ud)
{
if(supports_dir_lr)
{
current_direction = current_dir_idx;
}
else
{
current_direction = current_dir_idx + 2;
}
}
if((supports_dir_lr)
&&(current_dir_idx < 2))
{
current_direction = current_dir_idx;
}
device->modes[current_mode].direction = current_direction;
/*-----------------------------------------------------*\
| If Speed Slider is inverted, invert value |
\*-----------------------------------------------------*/
if(InvertedSpeed)
{
current_speed = device->modes[current_mode].speed_min - current_speed + device->modes[current_mode].speed_max;
}
/*-----------------------------------------------------*\
| Don't set the mode if the current mode is invalid |
\*-----------------------------------------------------*/
if(current_mode < device->modes.size())
{
/*-----------------------------------------------------*\
| Update mode parameters |
\*-----------------------------------------------------*/
device->modes[current_mode].speed = current_speed;
device->modes[current_mode].random = current_random;
/*-----------------------------------------------------*\
| If Speed Slider is enabled, read the speed value |
| Change device mode |
\*-----------------------------------------------------*/
if(ui->SpeedSlider->isEnabled())
{
current_speed = ui->SpeedSlider->value();
/*-----------------------------------------------------*\
| If Speed Slider is inverted, invert value |
\*-----------------------------------------------------*/
if(InvertedSpeed)
{
current_speed = device->modes[current_mode].speed_min - current_speed + device->modes[current_mode].speed_max;
}
}
/*-----------------------------------------------------*\
| Don't set the mode if the current mode is invalid |
\*-----------------------------------------------------*/
if(current_mode < device->modes.size())
{
/*-----------------------------------------------------*\
| Update mode parameters |
\*-----------------------------------------------------*/
device->modes[current_mode].speed = current_speed;
device->modes[current_mode].random = current_random;
/*-----------------------------------------------------*\
| Change device mode |
\*-----------------------------------------------------*/
device->SetMode(current_mode);
}
device->SetMode(current_mode);
}
}
@@ -453,11 +388,8 @@ void Ui::OpenRGBDevicePage::SetDevice(unsigned char red, unsigned char green, un
void Ui::OpenRGBDevicePage::SetCustomMode()
{
device->SetCustomMode();
ui->ModeBox->blockSignals(true);
ui->ModeBox->setCurrentIndex(device->active_mode);
ui->ModeBox->blockSignals(false);
ui->ModeBox->setCurrentIndex(0);//device->active_mode);
UpdateModeUi();
UpdateMode();
}
void Ui::OpenRGBDevicePage::on_SetDeviceButton_clicked()
@@ -476,57 +408,20 @@ void Ui::OpenRGBDevicePage::on_SetDeviceButton_clicked()
void Ui::OpenRGBDevicePage::on_SetZoneButton_clicked()
{
unsigned int index = ui->ZoneBox->currentIndex();
/*-----------------------------------------------------*\
| Set all LEDs in the selected zone to the current color|
\*-----------------------------------------------------*/
RGBColor color = ToRGBColor(
ui->RedSpinBox->text().toInt(),
ui->GreenSpinBox->text().toInt(),
ui->BlueSpinBox->text().toInt()
);
if(index == 0)
{
on_SetDeviceButton_clicked();
}
else
{
index = index - 1;
/*-----------------------------------------------------*\
| Set all LEDs in the selected zone to the current color|
\*-----------------------------------------------------*/
RGBColor color = ToRGBColor(
ui->RedSpinBox->text().toInt(),
ui->GreenSpinBox->text().toInt(),
ui->BlueSpinBox->text().toInt()
);
device->SetAllZoneLEDs(index, color);
}
device->SetAllZoneLEDs(ui->ZoneBox->currentIndex(), color);
}
void Ui::OpenRGBDevicePage::on_SetLEDButton_clicked()
{
unsigned int index = ui->LEDBox->currentIndex();
unsigned int selected_zone = ui->ZoneBox->currentIndex();
if(selected_zone > 0)
{
selected_zone = selected_zone - 1;
unsigned int count = 0;
for (std::size_t y = 0; y < device->zones[selected_zone].map.size(); y++)
{
for(std::size_t x = 0; x < device->zones[selected_zone].map[y].size(); x++)
{
if(count == index)
{
index = device->zones[selected_zone].map[y][x];
break;
}
else
{
count++;
}
}
}
}
/*-----------------------------------------------------*\
| Set the selected LED to the current color |
\*-----------------------------------------------------*/
@@ -536,7 +431,7 @@ void Ui::OpenRGBDevicePage::on_SetLEDButton_clicked()
ui->BlueSpinBox->text().toInt()
);
device->SetLED(index, color);
device->SetLED(ui->LEDBox->currentIndex(), color);
}
void Ui::OpenRGBDevicePage::on_ButtonRed_clicked()
+431 -225
View File
@@ -6,237 +6,443 @@
<rect>
<x>0</x>
<y>0</y>
<width>550</width>
<width>500</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Frame</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1" colspan="3">
<widget class="QComboBox" name="ZoneBox"/>
</item>
<item row="2" column="5" colspan="2">
<widget class="QSpinBox" name="RedSpinBox">
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item row="6" column="6">
<widget class="QPushButton" name="ButtonGreen">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="6" column="7">
<widget class="QPushButton" name="ButtonCyan">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="7">
<widget class="QLabel" name="SatLabel">
<property name="text">
<string>S:</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="ModeLabel">
<property name="text">
<string>Mode:</string>
</property>
</widget>
</item>
<item row="4" column="8" colspan="2">
<widget class="QSpinBox" name="ValSpinBox">
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="LEDLabel">
<property name="text">
<string>LED:</string>
</property>
</widget>
</item>
<item row="3" column="8" colspan="2">
<widget class="QSpinBox" name="SatSpinBox">
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="QLabel" name="RedLabel">
<property name="text">
<string>R:</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="DirectionLabel">
<property name="text">
<string>Dir:</string>
</property>
</widget>
</item>
<item row="7" column="1" colspan="3">
<widget class="QSlider" name="SpeedSlider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="ZoneLabel">
<property name="text">
<string>Zone:</string>
</property>
</widget>
</item>
<item row="4" column="4">
<widget class="QLabel" name="BlueLabel">
<property name="text">
<string>B:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="SetLabel">
<property name="text">
<string>Set:</string>
</property>
</widget>
</item>
<item row="4" column="7">
<widget class="QLabel" name="ValLabel">
<property name="text">
<string>V:</string>
</property>
</widget>
</item>
<item row="6" column="1" colspan="3">
<widget class="QCheckBox" name="RandomCheck">
<property name="text">
<string>Random Color</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QComboBox" name="LEDBox"/>
</item>
<item row="3" column="5" colspan="2">
<widget class="QSpinBox" name="GreenSpinBox">
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item row="2" column="8" colspan="2">
<widget class="QSpinBox" name="HueSpinBox">
<property name="maximum">
<number>359</number>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="SetDeviceButton">
<property name="text">
<string>Device</string>
</property>
</widget>
</item>
<item row="4" column="5" colspan="2">
<widget class="QSpinBox" name="BlueSpinBox">
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item row="6" column="8">
<widget class="QPushButton" name="ButtonBlue">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="6" column="9">
<widget class="QPushButton" name="ButtonMagenta">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="5" column="1" colspan="3">
<widget class="QComboBox" name="ModeBox"/>
</item>
<item row="7" column="0">
<widget class="QLabel" name="SpeedLabel">
<property name="text">
<string>Speed:</string>
</property>
</widget>
</item>
<item row="8" column="1" colspan="3">
<widget class="QComboBox" name="DirectionBox"/>
</item>
<item row="2" column="7">
<widget class="QLabel" name="HueLabel">
<property name="text">
<string>H:</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="SetZoneButton">
<property name="text">
<string>Zone</string>
</property>
</widget>
</item>
<item row="6" column="5">
<widget class="QPushButton" name="ButtonYellow">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="1" colspan="3">
<widget class="QPushButton" name="SetAllButton">
<property name="text">
<string>Set All Devices</string>
</property>
</widget>
</item>
<item row="3" column="4">
<widget class="QLabel" name="GreenLabel">
<property name="text">
<string>G:</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="SetLEDButton">
<property name="text">
<string>LED</string>
</property>
</widget>
</item>
<item row="6" column="4">
<widget class="QPushButton" name="ButtonRed">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
<widget class="QComboBox" name="ZoneBox">
<property name="geometry">
<rect>
<x>71</x>
<y>30</y>
<width>160</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="ZoneLabel">
<property name="geometry">
<rect>
<x>31</x>
<y>30</y>
<width>40</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Zone:</string>
</property>
</widget>
<widget class="QLabel" name="LEDLabel">
<property name="geometry">
<rect>
<x>31</x>
<y>70</y>
<width>40</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>LED:</string>
</property>
</widget>
<widget class="QComboBox" name="LEDBox">
<property name="geometry">
<rect>
<x>71</x>
<y>70</y>
<width>160</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="ModeLabel">
<property name="geometry">
<rect>
<x>31</x>
<y>190</y>
<width>40</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Mode:</string>
</property>
</widget>
<widget class="QComboBox" name="ModeBox">
<property name="geometry">
<rect>
<x>71</x>
<y>190</y>
<width>160</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="SetLEDButton">
<property name="geometry">
<rect>
<x>190</x>
<y>120</y>
<width>41</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>LED</string>
</property>
</widget>
<widget class="QPushButton" name="SetZoneButton">
<property name="geometry">
<rect>
<x>130</x>
<y>120</y>
<width>41</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Zone</string>
</property>
</widget>
<widget class="QSpinBox" name="RedSpinBox">
<property name="geometry">
<rect>
<x>310</x>
<y>120</y>
<width>50</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
<widget class="QSpinBox" name="GreenSpinBox">
<property name="geometry">
<rect>
<x>310</x>
<y>160</y>
<width>50</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
<widget class="QSpinBox" name="BlueSpinBox">
<property name="geometry">
<rect>
<x>310</x>
<y>200</y>
<width>50</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
<widget class="QLabel" name="RedLabel">
<property name="geometry">
<rect>
<x>290</x>
<y>120</y>
<width>20</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>R:</string>
</property>
</widget>
<widget class="QLabel" name="GreenLabel">
<property name="geometry">
<rect>
<x>290</x>
<y>160</y>
<width>20</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>G:</string>
</property>
</widget>
<widget class="QLabel" name="BlueLabel">
<property name="geometry">
<rect>
<x>290</x>
<y>200</y>
<width>20</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>B:</string>
</property>
</widget>
<widget class="QPushButton" name="ButtonGreen">
<property name="geometry">
<rect>
<x>350</x>
<y>250</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="ButtonBlue">
<property name="geometry">
<rect>
<x>410</x>
<y>250</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="ButtonCyan">
<property name="geometry">
<rect>
<x>380</x>
<y>250</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="ButtonMagenta">
<property name="geometry">
<rect>
<x>440</x>
<y>250</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="ButtonRed">
<property name="geometry">
<rect>
<x>290</x>
<y>250</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="ButtonYellow">
<property name="geometry">
<rect>
<x>320</x>
<y>250</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QSpinBox" name="HueSpinBox">
<property name="geometry">
<rect>
<x>410</x>
<y>120</y>
<width>50</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>359</number>
</property>
</widget>
<widget class="QLabel" name="HueLabel">
<property name="geometry">
<rect>
<x>390</x>
<y>120</y>
<width>20</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>H:</string>
</property>
</widget>
<widget class="QLabel" name="SatLabel">
<property name="geometry">
<rect>
<x>390</x>
<y>160</y>
<width>20</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>S:</string>
</property>
</widget>
<widget class="QSpinBox" name="SatSpinBox">
<property name="geometry">
<rect>
<x>410</x>
<y>160</y>
<width>50</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
<widget class="QSpinBox" name="ValSpinBox">
<property name="geometry">
<rect>
<x>410</x>
<y>200</y>
<width>50</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
<widget class="QLabel" name="ValLabel">
<property name="geometry">
<rect>
<x>390</x>
<y>200</y>
<width>20</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>V:</string>
</property>
</widget>
<widget class="QPushButton" name="SetDeviceButton">
<property name="geometry">
<rect>
<x>70</x>
<y>120</y>
<width>41</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Device</string>
</property>
</widget>
<widget class="QLabel" name="SetLabel">
<property name="geometry">
<rect>
<x>30</x>
<y>120</y>
<width>40</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Set:</string>
</property>
</widget>
<widget class="QPushButton" name="SetAllButton">
<property name="geometry">
<rect>
<x>110</x>
<y>150</y>
<width>80</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Set All Devices</string>
</property>
</widget>
<widget class="QCheckBox" name="RandomCheck">
<property name="geometry">
<rect>
<x>100</x>
<y>220</y>
<width>100</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Random Color</string>
</property>
</widget>
<widget class="QSlider" name="SpeedSlider">
<property name="geometry">
<rect>
<x>70</x>
<y>240</y>
<width>160</width>
<height>22</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLabel" name="SpeedLabel">
<property name="geometry">
<rect>
<x>30</x>
<y>240</y>
<width>40</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Speed:</string>
</property>
</widget>
<widget class="QComboBox" name="DirectionBox">
<property name="geometry">
<rect>
<x>70</x>
<y>270</y>
<width>160</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="DirectionLabel">
<property name="geometry">
<rect>
<x>30</x>
<y>270</y>
<width>40</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Dir:</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
+291 -142
View File
@@ -14,148 +14,297 @@
<string>OpenRGB</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QPushButton" name="ButtonRed">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="ButtonYellow">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="ButtonGreen">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="ButtonCyan">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="ButtonBlue">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QPushButton" name="ButtonMagenta">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="6">
<widget class="QLabel" name="LabelAuraDevice">
<property name="text">
<string>Device</string>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="QComboBox" name="ComboDevices"/>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="LabelRed">
<property name="text">
<string>Red</string>
</property>
</widget>
</item>
<item row="1" column="2" colspan="2">
<widget class="QLabel" name="LabelGreen">
<property name="text">
<string>Green</string>
</property>
</widget>
</item>
<item row="1" column="4" colspan="2">
<widget class="QLabel" name="LabelBlue">
<property name="text">
<string>Blue</string>
</property>
</widget>
</item>
<item row="1" column="6" rowspan="2">
<widget class="QLabel" name="LabelMode">
<property name="text">
<string>Mode</string>
</property>
</widget>
</item>
<item row="1" column="7" rowspan="2">
<widget class="QComboBox" name="ComboModes"/>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLineEdit" name="EditLED0R"/>
</item>
<item row="2" column="2" colspan="2">
<widget class="QLineEdit" name="EditLED0G"/>
</item>
<item row="2" column="4" colspan="2">
<widget class="QLineEdit" name="EditLED0B"/>
</item>
<item row="3" column="0" colspan="3">
<widget class="QPushButton" name="ButtonSetAll">
<property name="text">
<string>Set All</string>
</property>
</widget>
</item>
<item row="3" column="3" colspan="3">
<widget class="QPushButton" name="ButtonSetDevice">
<property name="text">
<string>Set Device</string>
</property>
</widget>
</item>
<item row="3" column="6">
<widget class="QLabel" name="LabelZone">
<property name="text">
<string>Zone</string>
</property>
</widget>
</item>
<item row="3" column="7">
<widget class="QComboBox" name="ComboZones"/>
</item>
<item row="4" column="0" colspan="3">
<widget class="QPushButton" name="ButtonSetZone">
<property name="text">
<string>Set Zone</string>
</property>
</widget>
</item>
<item row="4" column="3" colspan="3">
<widget class="QPushButton" name="ButtonSetLED">
<property name="text">
<string>Set LED</string>
</property>
</widget>
</item>
<item row="4" column="6">
<widget class="QLabel" name="LabelLED">
<property name="text">
<string>LED</string>
</property>
</widget>
</item>
<item row="4" column="7">
<widget class="QComboBox" name="ComboLEDs"/>
</item>
</layout>
<widget class="QPushButton" name="ButtonSetAll">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>80</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Set All</string>
</property>
</widget>
<widget class="QPushButton" name="ButtonSetZone">
<property name="geometry">
<rect>
<x>10</x>
<y>110</y>
<width>80</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Set Zone</string>
</property>
</widget>
<widget class="QLineEdit" name="EditLED0R">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>50</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="EditLED0G">
<property name="geometry">
<rect>
<x>70</x>
<y>50</y>
<width>50</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="EditLED0B">
<property name="geometry">
<rect>
<x>130</x>
<y>50</y>
<width>50</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="LabelRed">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>50</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Red</string>
</property>
</widget>
<widget class="QLabel" name="LabelGreen">
<property name="geometry">
<rect>
<x>70</x>
<y>30</y>
<width>50</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Green</string>
</property>
</widget>
<widget class="QLabel" name="LabelBlue">
<property name="geometry">
<rect>
<x>130</x>
<y>30</y>
<width>50</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Blue</string>
</property>
</widget>
<widget class="QComboBox" name="ComboDevices">
<property name="geometry">
<rect>
<x>290</x>
<y>10</y>
<width>200</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="LabelAuraDevice">
<property name="geometry">
<rect>
<x>200</x>
<y>10</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Device</string>
</property>
</widget>
<widget class="QComboBox" name="ComboModes">
<property name="geometry">
<rect>
<x>290</x>
<y>40</y>
<width>200</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="LabelMode">
<property name="geometry">
<rect>
<x>200</x>
<y>40</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Mode</string>
</property>
</widget>
<widget class="QComboBox" name="ComboZones">
<property name="geometry">
<rect>
<x>290</x>
<y>70</y>
<width>200</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="LabelZone">
<property name="geometry">
<rect>
<x>200</x>
<y>70</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Zone</string>
</property>
</widget>
<widget class="QComboBox" name="ComboLEDs">
<property name="geometry">
<rect>
<x>290</x>
<y>100</y>
<width>200</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="LabelLED">
<property name="geometry">
<rect>
<x>200</x>
<y>100</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>LED</string>
</property>
</widget>
<widget class="QPushButton" name="ButtonSetLED">
<property name="geometry">
<rect>
<x>100</x>
<y>110</y>
<width>80</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Set LED</string>
</property>
</widget>
<widget class="QPushButton" name="ButtonSetDevice">
<property name="geometry">
<rect>
<x>100</x>
<y>80</y>
<width>80</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Set Device</string>
</property>
</widget>
<widget class="QPushButton" name="ButtonRed">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="ButtonYellow">
<property name="geometry">
<rect>
<x>40</x>
<y>10</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="ButtonGreen">
<property name="geometry">
<rect>
<x>70</x>
<y>10</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="ButtonCyan">
<property name="geometry">
<rect>
<x>100</x>
<y>10</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="ButtonBlue">
<property name="geometry">
<rect>
<x>130</x>
<y>10</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="ButtonMagenta">
<property name="geometry">
<rect>
<x>160</x>
<y>10</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
</widget>
</widget>
<resources/>
+78 -62
View File
@@ -14,72 +14,88 @@
<string>OpenRGB</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTabWidget" name="MainTabBar">
<property name="tabShape">
<enum>QTabWidget::Rounded</enum>
<widget class="QTabWidget" name="MainTabBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>700</width>
<height>351</height>
</rect>
</property>
<property name="tabShape">
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<widget class="QWidget" name="TabDevices">
<attribute name="title">
<string>Devices</string>
</attribute>
<widget class="QTabWidget" name="DevicesTabBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>700</width>
<height>320</height>
</rect>
</property>
<property name="tabPosition">
<enum>QTabWidget::West</enum>
</property>
</widget>
</widget>
<widget class="QWidget" name="TabEffects">
<attribute name="title">
<string>Synchronized Effects</string>
</attribute>
<widget class="QTabWidget" name="EffectsTabBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>700</width>
<height>321</height>
</rect>
</property>
<property name="tabPosition">
<enum>QTabWidget::West</enum>
</property>
<property name="currentIndex">
<number>0</number>
<number>-1</number>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<widget class="QWidget" name="TabDevices">
<attribute name="title">
<string>Devices</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QTabWidget" name="DevicesTabBar">
<property name="tabPosition">
<enum>QTabWidget::West</enum>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="TabEffects">
<attribute name="title">
<string>Synchronized Effects</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QTabWidget" name="EffectsTabBar">
<property name="tabPosition">
<enum>QTabWidget::West</enum>
</property>
<property name="currentIndex">
<number>-1</number>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="TabInformation">
<attribute name="title">
<string>Information</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QTabWidget" name="InformationTabBar">
<property name="tabPosition">
<enum>QTabWidget::West</enum>
</property>
<property name="currentIndex">
<number>-1</number>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="TabInformation">
<attribute name="title">
<string>Information</string>
</attribute>
<widget class="QTabWidget" name="InformationTabBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>700</width>
<height>321</height>
</rect>
</property>
<property name="tabPosition">
<enum>QTabWidget::West</enum>
</property>
<property name="currentIndex">
<number>-1</number>
</property>
</widget>
</widget>
</widget>
</widget>
</widget>
<resources/>
+107 -59
View File
@@ -13,65 +13,113 @@
<property name="windowTitle">
<string>Frame</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="SMBusAdaptersLabel">
<property name="text">
<string>SMBus Adapters:</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QComboBox" name="SMBusAdaptersBox"/>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="DetectButton">
<property name="text">
<string>Detect Devices</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="SMBusDumpLabel">
<property name="text">
<string>SMBus Dumper:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="DumpAddressLabel">
<property name="text">
<string>Address:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="DumpAddressBox">
<property name="suffix">
<string/>
</property>
<property name="prefix">
<string>0x</string>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="displayIntegerBase">
<number>16</number>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="DumpButton">
<property name="text">
<string>Dump Device</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="4">
<widget class="QPlainTextEdit" name="SMBusDataText"/>
</item>
</layout>
<widget class="QLabel" name="SMBusAdaptersLabel">
<property name="geometry">
<rect>
<x>50</x>
<y>10</y>
<width>100</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>SMBus Adapters:</string>
</property>
</widget>
<widget class="QComboBox" name="SMBusAdaptersBox">
<property name="geometry">
<rect>
<x>160</x>
<y>10</y>
<width>200</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QPlainTextEdit" name="SMBusDataText">
<property name="geometry">
<rect>
<x>50</x>
<y>80</y>
<width>400</width>
<height>210</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="DetectButton">
<property name="geometry">
<rect>
<x>370</x>
<y>10</y>
<width>80</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Detect Devices</string>
</property>
</widget>
<widget class="QPushButton" name="DumpButton">
<property name="geometry">
<rect>
<x>370</x>
<y>40</y>
<width>80</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Dump Device</string>
</property>
</widget>
<widget class="QLabel" name="SMBusDumpLabel">
<property name="geometry">
<rect>
<x>50</x>
<y>40</y>
<width>100</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>SMBus Dumper:</string>
</property>
</widget>
<widget class="QLabel" name="DumpAddressLabel">
<property name="geometry">
<rect>
<x>220</x>
<y>40</y>
<width>51</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Address:</string>
</property>
</widget>
<widget class="QSpinBox" name="DumpAddressBox">
<property name="geometry">
<rect>
<x>280</x>
<y>40</y>
<width>80</width>
<height>22</height>
</rect>
</property>
<property name="suffix">
<string/>
</property>
<property name="prefix">
<string>0x</string>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="displayIntegerBase">
<number>16</number>
</property>
</widget>
</widget>
<resources/>
<connections/>
-94
View File
@@ -1,94 +0,0 @@
/*-----------------------------------------*\
| super_io.cpp |
| |
| Functions for interfacing with Super-IO |
| |
| Adam Honse (CalcProgrammer1) 2/11/2020 |
\*-----------------------------------------*/
#include "super_io.h"
#ifdef WIN32
#include <Windows.h>
#include "inpout32.h"
#pragma comment(lib, "inpout32.lib")
#else
#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
int dev_port_fd;
#endif
/******************************************************************************************\
* *
* superio_enter *
* *
* Put the Super IO chip into Extended Function Mode *
* *
\******************************************************************************************/
void superio_enter(int ioreg)
{
#ifdef WIN32
Out32(ioreg, 0x87);
Out32(ioreg, 0x87);
#else
unsigned char temp = 0x87;
dev_port_fd = open("/dev/port", O_RDWR, "rw");
lseek(dev_port_fd, ioreg, SEEK_CUR);
write(dev_port_fd, &temp, 1);
lseek(dev_port_fd, ioreg, SEEK_CUR);
write(dev_port_fd, &temp, 1);
close(dev_port_fd);
#endif
}
/******************************************************************************************\
* *
* superio_outb *
* *
* Write a byte to the Super IO configuration register *
* *
\******************************************************************************************/
void superio_outb(int ioreg, int reg, int val)
{
#ifdef WIN32
Out32(ioreg, reg);
Out32(ioreg + 1, val);
#else
dev_port_fd = open("/dev/port", O_RDWR, "rw");
lseek(dev_port_fd, ioreg, SEEK_CUR);
write(dev_port_fd, &reg, 1);
write(dev_port_fd, &val, 1);
close(dev_port_fd);
#endif
}
/******************************************************************************************\
* *
* superio_inb *
* *
* Read a byte to the Super IO configuration register *
* *
\******************************************************************************************/
int superio_inb(int ioreg, int reg)
{
#ifdef WIN32
Out32(ioreg, reg);
return Inp32(ioreg + 1);
#else
unsigned char temp;
dev_port_fd = open("/dev/port", O_RDWR, "rw");
lseek(dev_port_fd, ioreg, SEEK_CUR);
write(dev_port_fd, &reg, 1);
read(dev_port_fd, &temp, 1);
close(dev_port_fd);
return((int)temp);
#endif
}
-31
View File
@@ -1,31 +0,0 @@
/*-----------------------------------------*\
| super_io.h |
| |
| Functions for interfacing with Super-IO |
| |
| Adam Honse (CalcProgrammer1) 2/11/2020 |
\*-----------------------------------------*/
/******************************************************************************************\
* *
* Nuvoton Super IO constants *
* *
\******************************************************************************************/
#define SIO_NCT5577_ID 0xC330 /* Device ID for NCT5577D (C333) */
#define SIO_NCT6102_ID 0x1060 /* Device ID for NCT6102D/6106D (1061) */
#define SIO_NCT6793_ID 0xd120 /* Device ID for NCT6793D (D121) */
#define SIO_NCT6795_ID 0xd350 /* Device ID for NCT6795D (D350) */
#define SIO_NCT6796_ID 0xd420 /* Device ID for NCT6796D (D421) */
#define SIO_NCT6797_ID 0xd450 /* Device ID for NCT6797D (D450) */
#define SIO_REG_LOGDEV 0x07 /* Logical Device Register */
#define SIO_REG_DEVID 0x20 /* Device ID Register */
#define SIO_REG_SMBA 0x62 /* SMBus Base Address Register */
#define SIO_LOGDEV_SMBUS 0x0B /* Logical Device for SMBus */
#define SIO_ID_MASK 0xFFF8 /* Device ID mask */
void superio_enter(int ioreg);
void superio_outb(int ioreg, int reg, int val);
int superio_inb(int ioreg, int reg);