Compare commits
79
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c1ec2f187 | ||
|
|
7dadc8d9ee | ||
|
|
cd7146d611 | ||
|
|
853833d18a | ||
|
|
c500803d95 | ||
|
|
68a92d0219 | ||
|
|
5221d93fc0 | ||
|
|
22deb13ac0 | ||
|
|
58b875d5ed | ||
|
|
12f5d6070f | ||
|
|
5e0b1fa3cc | ||
|
|
1ee3a7c3e2 | ||
|
|
43c13db970 | ||
|
|
b5818d22af | ||
|
|
fd7a5fc057 | ||
|
|
5af1ca9363 | ||
|
|
c4d096e60c | ||
|
|
174b0743a9 | ||
|
|
4b50533560 | ||
|
|
1555dae1c8 | ||
|
|
8b5717470a | ||
|
|
38b2cf03b0 | ||
|
|
1293b07c9e | ||
|
|
aa4c41ddf7 | ||
|
|
628f423171 | ||
|
|
a9d179f93a | ||
|
|
4955dc0844 | ||
|
|
3f66f0d67a | ||
|
|
bc7ab5170a | ||
|
|
d61649f748 | ||
|
|
9a33a78574 | ||
|
|
030c0c60f3 | ||
|
|
19ff834d99 | ||
|
|
400a078a05 | ||
|
|
618bebc46b | ||
|
|
dee23ec52e | ||
|
|
baca85b8cd | ||
|
|
00b1cfcb3b | ||
|
|
a9dbf5ef70 | ||
|
|
a0b1153ec3 | ||
|
|
39a5e0eba0 | ||
|
|
308bb6f9b8 | ||
|
|
86d96848a2 | ||
|
|
98100a9bad | ||
|
|
e66562bb25 | ||
|
|
902ebc2e83 | ||
|
|
403d60e214 | ||
|
|
1c5130e78a | ||
|
|
481a5dea2e | ||
|
|
320129633d | ||
|
|
0dea21a53e | ||
|
|
79625e9c8a | ||
|
|
0cff1734ce | ||
|
|
e1d8f48cb9 | ||
|
|
752737034b | ||
|
|
ecf1d2ce98 | ||
|
|
bb743c6b62 | ||
|
|
f02223d6ba | ||
|
|
b87980965d | ||
|
|
2255eea14e | ||
|
|
0ccf2d0c33 | ||
|
|
5ce6ec9ea7 | ||
|
|
97e1c3e913 | ||
|
|
9937731ad8 | ||
|
|
bd4f3728f6 | ||
|
|
009a6ccd2a | ||
|
|
6606ab92bd | ||
|
|
595248cc10 | ||
|
|
ffc02e6c98 | ||
|
|
ac2d911566 | ||
|
|
633dfdbddd | ||
|
|
54cd8408e8 | ||
|
|
384011aab3 | ||
|
|
95ded7b871 | ||
|
|
607d83b795 | ||
|
|
f4872c52bd | ||
|
|
505e2d2aa4 | ||
|
|
77ecfc3b46 | ||
|
|
8107288838 |
@@ -133,6 +133,51 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c084", TAG+="uacces
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c083", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c08f", TAG+="uaccess"
|
||||
|
||||
#---------------------------------------------------------------#
|
||||
# MSI Mysticlight #
|
||||
#---------------------------------------------------------------#
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="3EA4", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="4559", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7B10", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7B93", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7B94", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7B96", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C34", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C35", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C36", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C37", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C42", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C56", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C59", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C60", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C67", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C70", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C71", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C73", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C75", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C76", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C77", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C79", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C80", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C81", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C82", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C83", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C84", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C85", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C86", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C87", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C88", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C89", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C90", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C91", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C92", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C94", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C95", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C96", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C98", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="7C99", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1462", ATTR{idProduct}=="905D", TAG+="uaccess"
|
||||
|
||||
#---------------------------------------------------------------#
|
||||
# MSI/SteelSeries 3-Zone Laptop Keyboard #
|
||||
#---------------------------------------------------------------#
|
||||
@@ -177,6 +222,7 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="04d9", ATTR{idProduct}=="fc39", TAG+="uacces
|
||||
# Gigabyte/Aorus RGB Fusion 2 USB #
|
||||
#---------------------------------------------------------------#
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="048d", ATTR{idProduct}=="8297", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="048d", ATTR{idProduct}=="5702", TAG+="uaccess"
|
||||
|
||||
#---------------------------------------------------------------#
|
||||
# SteelSeries Peripheral Devices #
|
||||
|
||||
@@ -49,6 +49,7 @@ std::string AMDWraithPrismController::GetEffectChannelString(unsigned char chann
|
||||
|
||||
unsigned char usb_buf[] =
|
||||
{
|
||||
0x00,
|
||||
0x40, 0x21, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
@@ -67,9 +68,9 @@ std::string AMDWraithPrismController::GetEffectChannelString(unsigned char chann
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
usb_buf[0x02] = channel;
|
||||
usb_buf[0x03] = channel;
|
||||
|
||||
hid_write(dev, usb_buf, 64);
|
||||
hid_write(dev, usb_buf, 65);
|
||||
hid_read(dev, usb_buf, 64);
|
||||
|
||||
ret_string.append((char *)&usb_buf[0x08]);
|
||||
@@ -83,6 +84,7 @@ std::string AMDWraithPrismController::GetFirmwareVersionString()
|
||||
|
||||
unsigned char usb_buf[] =
|
||||
{
|
||||
0x00,
|
||||
0x12, 0x20, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
@@ -103,7 +105,7 @@ std::string AMDWraithPrismController::GetFirmwareVersionString()
|
||||
|
||||
unsigned char fw_buf[16] = {0x00};
|
||||
|
||||
hid_write(dev, usb_buf, 64);
|
||||
hid_write(dev, usb_buf, 65);
|
||||
hid_read(dev, usb_buf, 64);
|
||||
|
||||
for(int char_idx = 0; char_idx < 16; char_idx+=2)
|
||||
@@ -206,6 +208,7 @@ void AMDWraithPrismController::SendEnableCommand()
|
||||
{
|
||||
unsigned char usb_buf[] =
|
||||
{
|
||||
0x00,
|
||||
0x41, 0x80, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
@@ -224,7 +227,7 @@ void AMDWraithPrismController::SendEnableCommand()
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
hid_write(dev, usb_buf, 64);
|
||||
hid_write(dev, usb_buf, 65);
|
||||
hid_read(dev, usb_buf, 64);
|
||||
}
|
||||
|
||||
@@ -232,6 +235,7 @@ void AMDWraithPrismController::SendApplyCommand()
|
||||
{
|
||||
unsigned char usb_buf[] =
|
||||
{
|
||||
0x00,
|
||||
0x51, 0x28, 0x00, 0x00,
|
||||
0xE0, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
@@ -250,7 +254,7 @@ void AMDWraithPrismController::SendApplyCommand()
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
hid_write(dev, usb_buf, 64);
|
||||
hid_write(dev, usb_buf, 65);
|
||||
hid_read(dev, usb_buf, 64);
|
||||
}
|
||||
|
||||
@@ -269,6 +273,7 @@ void AMDWraithPrismController::SendEffectChannelUpdate
|
||||
{
|
||||
unsigned char usb_buf[] =
|
||||
{
|
||||
0x00,
|
||||
0x51, 0x2C, 0x01, 0x00,
|
||||
0x05, 0xFF, 0x00, 0x01,
|
||||
0xFF, 0xFF, 0x00, 0xFF,
|
||||
@@ -287,18 +292,18 @@ void AMDWraithPrismController::SendEffectChannelUpdate
|
||||
0xFF, 0xFF, 0xFF, 0xFF
|
||||
};
|
||||
|
||||
usb_buf[0x04] = effect_channel;
|
||||
usb_buf[0x05] = speed;
|
||||
usb_buf[0x06] = (direction ? 0x01 : 0x00) | (random_color ? 0x80 : 0x00);
|
||||
usb_buf[0x07] = mode;
|
||||
usb_buf[0x05] = effect_channel;
|
||||
usb_buf[0x06] = speed;
|
||||
usb_buf[0x07] = (direction ? 0x01 : 0x00) | (random_color ? 0x80 : 0x00);
|
||||
usb_buf[0x08] = mode;
|
||||
|
||||
usb_buf[0x09] = brightness;
|
||||
usb_buf[0x0A] = brightness;
|
||||
|
||||
usb_buf[0x0A] = red;
|
||||
usb_buf[0x0B] = green;
|
||||
usb_buf[0x0C] = blue;
|
||||
usb_buf[0x0B] = red;
|
||||
usb_buf[0x0C] = green;
|
||||
usb_buf[0x0D] = blue;
|
||||
|
||||
hid_write(dev, usb_buf, 64);
|
||||
hid_write(dev, usb_buf, 65);
|
||||
hid_read(dev, usb_buf, 64);
|
||||
}
|
||||
|
||||
@@ -306,6 +311,7 @@ void AMDWraithPrismController::SendChannelRemap(unsigned char ring_channel, unsi
|
||||
{
|
||||
unsigned char usb_buf[] =
|
||||
{
|
||||
0x00,
|
||||
0x51, 0xA0, 0x01, 0x00,
|
||||
0x00, 0x03, 0x00, 0x00,
|
||||
0x05, 0x06, 0x07, 0x07,
|
||||
@@ -324,14 +330,14 @@ void AMDWraithPrismController::SendChannelRemap(unsigned char ring_channel, unsi
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
usb_buf[0x08] = logo_channel;
|
||||
usb_buf[0x09] = fan_channel;
|
||||
usb_buf[0x09] = logo_channel;
|
||||
usb_buf[0x0A] = fan_channel;
|
||||
|
||||
for(int led = 0x0A; led <= 0x18; led++)
|
||||
for(int led = 0x0B; led <= 0x19; led++)
|
||||
{
|
||||
usb_buf[led] = ring_channel;
|
||||
}
|
||||
|
||||
hid_write(dev, usb_buf, 64);
|
||||
hid_write(dev, usb_buf, 65);
|
||||
hid_read(dev, usb_buf, 64);
|
||||
}
|
||||
|
||||
@@ -28,23 +28,24 @@ void DetectAMDWraithPrismControllers(std::vector<RGBController*>& rgb_controller
|
||||
{
|
||||
if((info->vendor_id == AMD_WRAITH_PRISM_VID)
|
||||
&&(info->product_id == AMD_WRAITH_PRISM_PID)
|
||||
#if USE_HID_USAGE
|
||||
&&(info->interface_number == 1)
|
||||
&&(info->usage_page == 0xFF00))
|
||||
#else
|
||||
&&(info->interface_number == 1))
|
||||
#endif
|
||||
{
|
||||
dev = hid_open_path(info->path);
|
||||
break;
|
||||
|
||||
if( dev )
|
||||
{
|
||||
AMDWraithPrismController* controller = new AMDWraithPrismController(dev);
|
||||
|
||||
RGBController_AMDWraithPrism* rgb_controller = new RGBController_AMDWraithPrism(controller);
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
info = info->next;
|
||||
}
|
||||
}
|
||||
|
||||
if( dev )
|
||||
{
|
||||
AMDWraithPrismController* controller = new AMDWraithPrismController(dev);
|
||||
|
||||
RGBController_AMDWraithPrism* rgb_controller = new RGBController_AMDWraithPrism(controller);
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
info = info->next;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ using namespace std::chrono_literals;
|
||||
/*----------------------------------------------------------------------*\
|
||||
| This list contains the available SMBus addresses for mapping Aura RAM |
|
||||
\*----------------------------------------------------------------------*/
|
||||
#define AURA_RAM_ADDRESS_COUNT 22
|
||||
#define AURA_RAM_ADDRESS_COUNT 23
|
||||
|
||||
static const unsigned char aura_ram_addresses[] =
|
||||
{
|
||||
@@ -34,6 +34,7 @@ static const unsigned char aura_ram_addresses[] =
|
||||
0x66,
|
||||
0x67,
|
||||
0x39,
|
||||
0x3A,
|
||||
0x3B,
|
||||
0x3C,
|
||||
0x3D
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
CMMP750Controller::CMMP750Controller(hid_device* dev_handle, wchar_t *_vendor, wchar_t *_device_name, char *_path)
|
||||
{
|
||||
int tmp_size = wcslen(_vendor);
|
||||
|
||||
dev = dev_handle;
|
||||
int tmp_size = wcslen(_vendor);
|
||||
dev = dev_handle;
|
||||
location = _path;
|
||||
|
||||
for (int i=0; ( i<tmp_size && i<CM_DEVICE_NAME_SIZE); i++)
|
||||
{
|
||||
@@ -22,10 +22,7 @@ CMMP750Controller::CMMP750Controller(hid_device* dev_handle, wchar_t *_vendor, w
|
||||
for (int j=0; ( j<wcslen(_vendor) && tmp_size+j<CM_DEVICE_NAME_SIZE); j++)
|
||||
device_name[tmp_size+j] = (char)_device_name[j];
|
||||
|
||||
location = _path;
|
||||
|
||||
current_mode = MP750_MODE_STATIC;
|
||||
current_speed = MP750_SPEED_NORMAL;
|
||||
GetStatus(); //When setting up device get current status
|
||||
}
|
||||
|
||||
CMMP750Controller::~CMMP750Controller()
|
||||
@@ -33,6 +30,36 @@ CMMP750Controller::~CMMP750Controller()
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
void CMMP750Controller::GetStatus()
|
||||
{
|
||||
unsigned char buffer[0x40] = { 0x00 };
|
||||
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
|
||||
buffer[0] = 0x07;
|
||||
|
||||
hid_write(dev, buffer, buffer_size);
|
||||
hid_read(dev, buffer, buffer_size);
|
||||
|
||||
if( buffer[0] == 0x80 && buffer[1] == 0x05 )
|
||||
{
|
||||
current_mode = buffer[2] - 1;
|
||||
current_red = buffer[3];
|
||||
current_green = buffer[4];
|
||||
current_blue = buffer[5];
|
||||
|
||||
for( int i = 0; speed_mode_data[current_mode][i] >= buffer[6]; i++)
|
||||
current_speed = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Code should never reach here however just in case there is a failure set something
|
||||
current_mode = MP750_MODE_COLOR_CYCLE; //Unicorn Spew
|
||||
current_red = 0xFF;
|
||||
current_green = 0xFF;
|
||||
current_blue = 0xFF;
|
||||
current_speed = MP750_SPEED_NORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
char* CMMP750Controller::GetDeviceName()
|
||||
{
|
||||
return device_name;
|
||||
@@ -48,6 +75,31 @@ std::string CMMP750Controller::GetLocation()
|
||||
return location;
|
||||
}
|
||||
|
||||
unsigned char CMMP750Controller::GetMode()
|
||||
{
|
||||
return current_mode;
|
||||
}
|
||||
|
||||
unsigned char CMMP750Controller::GetLedRed()
|
||||
{
|
||||
return current_red;
|
||||
}
|
||||
|
||||
unsigned char CMMP750Controller::GetLedGreen()
|
||||
{
|
||||
return current_green;
|
||||
}
|
||||
|
||||
unsigned char CMMP750Controller::GetLedBlue()
|
||||
{
|
||||
return current_blue;
|
||||
}
|
||||
|
||||
unsigned char CMMP750Controller::GetLedSpeed()
|
||||
{
|
||||
return current_speed;
|
||||
}
|
||||
|
||||
void CMMP750Controller::SetMode(unsigned char mode, unsigned char speed)
|
||||
{
|
||||
current_mode = mode;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define CM_COLOUR_MODE_DATA_SIZE (sizeof(colour_mode_data) / sizeof(colour_mode_data[0]))
|
||||
#define CM_COLOUR_MODE_DATA_SIZE (sizeof(colour_mode_data[0]) / sizeof(colour_mode_data[0][0]))
|
||||
#define CM_INTERRUPT_TIMEOUT 250
|
||||
#define CM_DEVICE_NAME_SIZE (sizeof(device_name) / sizeof(device_name[ 0 ]))
|
||||
#define CM_SERIAL_SIZE (sizeof(serial) / sizeof(serial[ 0 ]))
|
||||
@@ -85,6 +85,11 @@ public:
|
||||
char* GetSerial();
|
||||
std::string GetLocation();
|
||||
|
||||
unsigned char GetMode();
|
||||
unsigned char GetLedRed();
|
||||
unsigned char GetLedGreen();
|
||||
unsigned char GetLedBlue();
|
||||
unsigned char GetLedSpeed();
|
||||
void SetMode(unsigned char mode, unsigned char speed);
|
||||
void SetColor(unsigned char red, unsigned char green, unsigned char blue);
|
||||
|
||||
@@ -101,5 +106,6 @@ private:
|
||||
unsigned char current_green;
|
||||
unsigned char current_blue;
|
||||
|
||||
void GetStatus();
|
||||
void SendUpdate();
|
||||
};
|
||||
|
||||
@@ -36,7 +36,7 @@ void DetectCoolerMasterControllers(std::vector<RGBController*>& rgb_controllers)
|
||||
|
||||
//Look for the passed in cm_pids
|
||||
hid_init();
|
||||
info = hid_enumerate(0x0, 0x0);
|
||||
info = hid_enumerate(COOLERMASTER_VID, 0x0);
|
||||
|
||||
while(info)
|
||||
{
|
||||
@@ -56,7 +56,7 @@ void DetectCoolerMasterControllers(std::vector<RGBController*>& rgb_controllers)
|
||||
|
||||
if(dev)
|
||||
{
|
||||
CMMP750Controller* controller = new CMMP750Controller(dev, info->manufacturer_string, info->product_string, info->path);
|
||||
CMMP750Controller* controller = new CMMP750Controller(dev, info->manufacturer_string, info->product_string, info->path);
|
||||
RGBController_CMMP750Controller* rgb_controller = new RGBController_CMMP750Controller(controller);
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ void CorsairLightingNodeController::SetChannelLEDs(unsigned char channel, RGBCol
|
||||
void CorsairLightingNodeController::SendFirmwareRequest()
|
||||
{
|
||||
int actual;
|
||||
unsigned char usb_buf[64];
|
||||
unsigned char usb_buf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
@@ -208,13 +208,14 @@ void CorsairLightingNodeController::SendFirmwareRequest()
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Firmware Version Request packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = CORSAIR_LIGHTING_NODE_PACKET_ID_FIRMWARE;
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = CORSAIR_LIGHTING_NODE_PACKET_ID_FIRMWARE;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 64);
|
||||
actual = hid_read(dev, usb_buf, 16);
|
||||
hid_write(dev, usb_buf, 65);
|
||||
actual = hid_read(dev, usb_buf, 17);
|
||||
|
||||
if(actual > 0)
|
||||
{
|
||||
@@ -231,7 +232,7 @@ void CorsairLightingNodeController::SendDirect
|
||||
unsigned char* color_data
|
||||
)
|
||||
{
|
||||
unsigned char usb_buf[64];
|
||||
unsigned char usb_buf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
@@ -241,27 +242,28 @@ void CorsairLightingNodeController::SendDirect
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Direct packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = CORSAIR_LIGHTING_NODE_PACKET_ID_DIRECT;
|
||||
usb_buf[0x01] = channel;
|
||||
usb_buf[0x02] = start;
|
||||
usb_buf[0x03] = count;
|
||||
usb_buf[0x04] = color_channel;
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = CORSAIR_LIGHTING_NODE_PACKET_ID_DIRECT;
|
||||
usb_buf[0x02] = channel;
|
||||
usb_buf[0x03] = start;
|
||||
usb_buf[0x04] = count;
|
||||
usb_buf[0x05] = color_channel;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Copy in color data bytes |
|
||||
\*-----------------------------------------------------*/
|
||||
memcpy(&usb_buf[0x05], color_data, count);
|
||||
memcpy(&usb_buf[0x06], color_data, count);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 64);
|
||||
hid_read(dev, usb_buf, 16);
|
||||
hid_write(dev, usb_buf, 65);
|
||||
hid_read(dev, usb_buf, 17);
|
||||
}
|
||||
|
||||
void CorsairLightingNodeController::SendCommit()
|
||||
{
|
||||
unsigned char usb_buf[64];
|
||||
unsigned char usb_buf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
@@ -276,14 +278,15 @@ void CorsairLightingNodeController::SendCommit()
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Commit packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = CORSAIR_LIGHTING_NODE_PACKET_ID_COMMIT;
|
||||
usb_buf[0x01] = 0xFF;
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = CORSAIR_LIGHTING_NODE_PACKET_ID_COMMIT;
|
||||
usb_buf[0x02] = 0xFF;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 64);
|
||||
hid_read(dev, usb_buf, 16);
|
||||
hid_write(dev, usb_buf, 65);
|
||||
hid_read(dev, usb_buf, 17);
|
||||
}
|
||||
|
||||
void CorsairLightingNodeController::SendBegin
|
||||
@@ -291,7 +294,7 @@ void CorsairLightingNodeController::SendBegin
|
||||
unsigned char channel
|
||||
)
|
||||
{
|
||||
unsigned char usb_buf[64];
|
||||
unsigned char usb_buf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
@@ -301,14 +304,15 @@ void CorsairLightingNodeController::SendBegin
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Begin packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = CORSAIR_LIGHTING_NODE_PACKET_ID_BEGIN;
|
||||
usb_buf[0x01] = channel;
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = CORSAIR_LIGHTING_NODE_PACKET_ID_BEGIN;
|
||||
usb_buf[0x02] = channel;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 64);
|
||||
hid_read(dev, usb_buf, 16);
|
||||
hid_write(dev, usb_buf, 65);
|
||||
hid_read(dev, usb_buf, 17);
|
||||
}
|
||||
|
||||
void CorsairLightingNodeController::SendEffectConfig
|
||||
@@ -334,7 +338,7 @@ void CorsairLightingNodeController::SendEffectConfig
|
||||
unsigned short temperature_2
|
||||
)
|
||||
{
|
||||
unsigned char usb_buf[64];
|
||||
unsigned char usb_buf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
@@ -344,48 +348,49 @@ void CorsairLightingNodeController::SendEffectConfig
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Effect Config packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = CORSAIR_LIGHTING_NODE_PACKET_ID_EFFECT_CONFIG;
|
||||
usb_buf[0x01] = channel;
|
||||
usb_buf[0x02] = count;
|
||||
usb_buf[0x03] = led_type;
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = CORSAIR_LIGHTING_NODE_PACKET_ID_EFFECT_CONFIG;
|
||||
usb_buf[0x02] = channel;
|
||||
usb_buf[0x03] = count;
|
||||
usb_buf[0x04] = led_type;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up mode parameters |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x04] = mode;
|
||||
usb_buf[0x05] = speed;
|
||||
usb_buf[0x06] = direction;
|
||||
usb_buf[0x07] = change_style;
|
||||
usb_buf[0x08] = 0;
|
||||
usb_buf[0x05] = mode;
|
||||
usb_buf[0x06] = speed;
|
||||
usb_buf[0x07] = direction;
|
||||
usb_buf[0x08] = change_style;
|
||||
usb_buf[0x09] = 0;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up mode colors |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x09] = color_0_red;
|
||||
usb_buf[0x0A] = color_0_green;
|
||||
usb_buf[0x0B] = color_0_blue;
|
||||
usb_buf[0x0C] = color_1_red;
|
||||
usb_buf[0x0D] = color_1_green;
|
||||
usb_buf[0x0E] = color_1_blue;
|
||||
usb_buf[0x0F] = color_2_red;
|
||||
usb_buf[0x10] = color_2_green;
|
||||
usb_buf[0x11] = color_2_blue;
|
||||
usb_buf[0x0A] = color_0_red;
|
||||
usb_buf[0x0B] = color_0_green;
|
||||
usb_buf[0x0C] = color_0_blue;
|
||||
usb_buf[0x0D] = color_1_red;
|
||||
usb_buf[0x0E] = color_1_green;
|
||||
usb_buf[0x0F] = color_1_blue;
|
||||
usb_buf[0x10] = color_2_red;
|
||||
usb_buf[0x11] = color_2_green;
|
||||
usb_buf[0x12] = color_2_blue;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up temperatures |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x12] = (temperature_0 >> 8);
|
||||
usb_buf[0x13] = (temperature_0 & 0xFF);
|
||||
usb_buf[0x14] = (temperature_1 >> 8);
|
||||
usb_buf[0x15] = (temperature_1 & 0xFF);
|
||||
usb_buf[0x16] = (temperature_2 >> 8);
|
||||
usb_buf[0x17] = (temperature_2 & 0xFF);
|
||||
usb_buf[0x13] = (temperature_0 >> 8);
|
||||
usb_buf[0x14] = (temperature_0 & 0xFF);
|
||||
usb_buf[0x15] = (temperature_1 >> 8);
|
||||
usb_buf[0x16] = (temperature_1 & 0xFF);
|
||||
usb_buf[0x17] = (temperature_2 >> 8);
|
||||
usb_buf[0x18] = (temperature_2 & 0xFF);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 64);
|
||||
hid_read(dev, usb_buf, 16);
|
||||
hid_write(dev, usb_buf, 65);
|
||||
hid_read(dev, usb_buf, 17);
|
||||
}
|
||||
|
||||
void CorsairLightingNodeController::SendTemperature()
|
||||
@@ -398,7 +403,7 @@ void CorsairLightingNodeController::SendReset
|
||||
unsigned char channel
|
||||
)
|
||||
{
|
||||
unsigned char usb_buf[64];
|
||||
unsigned char usb_buf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
@@ -408,14 +413,15 @@ void CorsairLightingNodeController::SendReset
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Reset packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = CORSAIR_LIGHTING_NODE_PACKET_ID_RESET;
|
||||
usb_buf[0x01] = channel;
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = CORSAIR_LIGHTING_NODE_PACKET_ID_RESET;
|
||||
usb_buf[0x02] = channel;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 64);
|
||||
hid_read(dev, usb_buf, 16);
|
||||
hid_write(dev, usb_buf, 65);
|
||||
hid_read(dev, usb_buf, 17);
|
||||
}
|
||||
|
||||
void CorsairLightingNodeController::SendPortState
|
||||
@@ -424,7 +430,7 @@ void CorsairLightingNodeController::SendPortState
|
||||
unsigned char state
|
||||
)
|
||||
{
|
||||
unsigned char usb_buf[64];
|
||||
unsigned char usb_buf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
@@ -434,15 +440,16 @@ void CorsairLightingNodeController::SendPortState
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Port State packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = CORSAIR_LIGHTING_NODE_PACKET_ID_PORT_STATE;
|
||||
usb_buf[0x01] = channel;
|
||||
usb_buf[0x02] = state;
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = CORSAIR_LIGHTING_NODE_PACKET_ID_PORT_STATE;
|
||||
usb_buf[0x02] = channel;
|
||||
usb_buf[0x03] = state;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 64);
|
||||
hid_read(dev, usb_buf, 16);
|
||||
hid_write(dev, usb_buf, 65);
|
||||
hid_read(dev, usb_buf, 17);
|
||||
}
|
||||
|
||||
void CorsairLightingNodeController::SendBrightness()
|
||||
|
||||
@@ -24,27 +24,12 @@ static unsigned int keys[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x
|
||||
|
||||
static unsigned int st100[] = { 0x00, 0x01, 0x02, 0x03, 0x05, 0x06, 0x07, 0x08, 0x04 };
|
||||
|
||||
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++;
|
||||
|
||||
std::this_thread::sleep_for(1ms);
|
||||
}
|
||||
|
||||
CorsairPeripheralController::CorsairPeripheralController(hid_device* dev_handle)
|
||||
{
|
||||
dev = dev_handle;
|
||||
|
||||
ReadFirmwareInfo();
|
||||
|
||||
SpecialFunctionControl();
|
||||
LightingControl();
|
||||
}
|
||||
|
||||
@@ -233,7 +218,7 @@ void CorsairPeripheralController::SetLEDsKeyboardLimited(std::vector<RGBColor> c
|
||||
|
||||
void CorsairPeripheralController::LightingControl()
|
||||
{
|
||||
char usb_buf[64];
|
||||
char usb_buf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
@@ -243,9 +228,10 @@ void CorsairPeripheralController::LightingControl()
|
||||
/*-----------------------------------------------------*\
|
||||
| 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[0x00] = 0x00;
|
||||
usb_buf[0x01] = CORSAIR_COMMAND_WRITE;
|
||||
usb_buf[0x02] = CORSAIR_PROPERTY_LIGHTING_CONTROL;
|
||||
usb_buf[0x03] = CORSAIR_LIGHTING_CONTROL_SOFTWARE;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Lighting control byte needs to be 3 for keyboards and |
|
||||
@@ -255,31 +241,31 @@ void CorsairPeripheralController::LightingControl()
|
||||
{
|
||||
default:
|
||||
case DEVICE_TYPE_KEYBOARD:
|
||||
usb_buf[0x04] = 0x03;
|
||||
usb_buf[0x05] = 0x03;
|
||||
break;
|
||||
|
||||
case DEVICE_TYPE_MOUSE:
|
||||
usb_buf[0x04] = 0x01;
|
||||
usb_buf[0x05] = 0x01;
|
||||
break;
|
||||
|
||||
case DEVICE_TYPE_MOUSEMAT:
|
||||
usb_buf[0x04] = 0x04;
|
||||
usb_buf[0x05] = 0x04;
|
||||
break;
|
||||
|
||||
case DEVICE_TYPE_HEADSET_STAND:
|
||||
usb_buf[0x04] = 0x03;
|
||||
usb_buf[0x05] = 0x03;
|
||||
break;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
send_usb_msg(dev, usb_buf);
|
||||
hid_write(dev, (unsigned char *)usb_buf, 65);
|
||||
}
|
||||
|
||||
void CorsairPeripheralController::SpecialFunctionControl()
|
||||
{
|
||||
char usb_buf[64];
|
||||
char usb_buf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
@@ -289,20 +275,22 @@ void CorsairPeripheralController::SpecialFunctionControl()
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Lighting Control packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = CORSAIR_COMMAND_WRITE;
|
||||
usb_buf[0x01] = CORSAIR_PROPERTY_SPECIAL_FUNCTION;
|
||||
usb_buf[0x02] = CORSAIR_LIGHTING_CONTROL_SOFTWARE;
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = CORSAIR_COMMAND_WRITE;
|
||||
usb_buf[0x02] = CORSAIR_PROPERTY_SPECIAL_FUNCTION;
|
||||
usb_buf[0x03] = CORSAIR_LIGHTING_CONTROL_SOFTWARE;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
send_usb_msg(dev, usb_buf);
|
||||
hid_write(dev, (unsigned char *)usb_buf, 65);
|
||||
}
|
||||
|
||||
void CorsairPeripheralController::ReadFirmwareInfo()
|
||||
{
|
||||
int actual;
|
||||
char usb_buf[64];
|
||||
char usb_buf[65];
|
||||
char offset = 0;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
@@ -312,16 +300,17 @@ void CorsairPeripheralController::ReadFirmwareInfo()
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Read Firmware Info packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = CORSAIR_COMMAND_READ;
|
||||
usb_buf[0x01] = CORSAIR_PROPERTY_FIRMWARE_INFO;
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = CORSAIR_COMMAND_READ;
|
||||
usb_buf[0x02] = CORSAIR_PROPERTY_FIRMWARE_INFO;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet and try reading it using an HID read |
|
||||
| If that fails, repeat the send and read the reply as |
|
||||
| a feature report. |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, (unsigned char*)usb_buf, 64);
|
||||
actual = hid_read_timeout(dev, (unsigned char*)usb_buf, 64, 1000);
|
||||
hid_write(dev, (unsigned char*)usb_buf, 65);
|
||||
actual = hid_read_timeout(dev, (unsigned char*)usb_buf, 65, 1000);
|
||||
|
||||
if(actual == 0)
|
||||
{
|
||||
@@ -333,11 +322,13 @@ void CorsairPeripheralController::ReadFirmwareInfo()
|
||||
/*-------------------------------------------------*\
|
||||
| Set up Read Firmware Info packet |
|
||||
\*-------------------------------------------------*/
|
||||
usb_buf[0x00] = CORSAIR_COMMAND_READ;
|
||||
usb_buf[0x01] = CORSAIR_PROPERTY_FIRMWARE_INFO;
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = CORSAIR_COMMAND_READ;
|
||||
usb_buf[0x02] = CORSAIR_PROPERTY_FIRMWARE_INFO;
|
||||
|
||||
hid_write(dev, (unsigned char*)usb_buf, 64);
|
||||
actual = hid_get_feature_report(dev, (unsigned char*)usb_buf, 64);
|
||||
hid_send_feature_report(dev, (unsigned char*)usb_buf, 65);
|
||||
actual = hid_get_feature_report(dev, (unsigned char*)usb_buf, 65);
|
||||
offset = 1;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
@@ -346,7 +337,7 @@ void CorsairPeripheralController::ReadFirmwareInfo()
|
||||
| 0xC1 Device is a mouse |
|
||||
| 0xC2 Device is a mousepad or headset stand |
|
||||
\*-----------------------------------------------------*/
|
||||
switch((unsigned char)usb_buf[0x14])
|
||||
switch((unsigned char)usb_buf[0x14 + offset])
|
||||
{
|
||||
case 0xC0:
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
@@ -354,6 +345,7 @@ void CorsairPeripheralController::ReadFirmwareInfo()
|
||||
|
||||
case 0xC1:
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
SpecialFunctionControl();
|
||||
break;
|
||||
|
||||
case 0xC2:
|
||||
@@ -364,10 +356,12 @@ void CorsairPeripheralController::ReadFirmwareInfo()
|
||||
{
|
||||
case 0x0A34:
|
||||
type = DEVICE_TYPE_HEADSET_STAND;
|
||||
SpecialFunctionControl();
|
||||
break;
|
||||
|
||||
default:
|
||||
type = DEVICE_TYPE_MOUSEMAT;
|
||||
SpecialFunctionControl();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -383,7 +377,7 @@ void CorsairPeripheralController::ReadFirmwareInfo()
|
||||
\*-----------------------------------------------------*/
|
||||
if(type != DEVICE_TYPE_UNKNOWN)
|
||||
{
|
||||
firmware_version = std::to_string(usb_buf[0x09]) + "." + std::to_string(usb_buf[0x08]);
|
||||
firmware_version = std::to_string(usb_buf[0x09 + offset]) + "." + std::to_string(usb_buf[0x08 + offset]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,7 +388,7 @@ void CorsairPeripheralController::StreamPacket
|
||||
unsigned char* data_ptr
|
||||
)
|
||||
{
|
||||
char usb_buf[64];
|
||||
char usb_buf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
@@ -404,19 +398,20 @@ void CorsairPeripheralController::StreamPacket
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Stream packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = CORSAIR_COMMAND_STREAM;
|
||||
usb_buf[0x01] = packet_id;
|
||||
usb_buf[0x02] = data_sz;
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = CORSAIR_COMMAND_STREAM;
|
||||
usb_buf[0x02] = packet_id;
|
||||
usb_buf[0x03] = data_sz;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Copy in data bytes |
|
||||
\*-----------------------------------------------------*/
|
||||
memcpy(&usb_buf[0x04], data_ptr, data_sz);
|
||||
memcpy(&usb_buf[0x05], data_ptr, data_sz);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, (unsigned char *)usb_buf, 64);
|
||||
hid_write(dev, (unsigned char *)usb_buf, 65);
|
||||
}
|
||||
|
||||
void CorsairPeripheralController::SubmitKeyboardFullColors
|
||||
@@ -426,7 +421,7 @@ void CorsairPeripheralController::SubmitKeyboardFullColors
|
||||
unsigned char finish_val
|
||||
)
|
||||
{
|
||||
char usb_buf[64];
|
||||
char usb_buf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
@@ -436,16 +431,17 @@ void CorsairPeripheralController::SubmitKeyboardFullColors
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Submit Keyboard 24-Bit Colors packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = CORSAIR_COMMAND_WRITE;
|
||||
usb_buf[0x01] = CORSAIR_PROPERTY_SUBMIT_KEYBOARD_COLOR_24;
|
||||
usb_buf[0x02] = color_channel;
|
||||
usb_buf[0x03] = packet_count;
|
||||
usb_buf[0x04] = finish_val;
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = CORSAIR_COMMAND_WRITE;
|
||||
usb_buf[0x02] = CORSAIR_PROPERTY_SUBMIT_KEYBOARD_COLOR_24;
|
||||
usb_buf[0x03] = color_channel;
|
||||
usb_buf[0x04] = packet_count;
|
||||
usb_buf[0x05] = finish_val;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, (unsigned char *)usb_buf, 64);
|
||||
hid_write(dev, (unsigned char *)usb_buf, 65);
|
||||
}
|
||||
|
||||
void CorsairPeripheralController::SubmitKeyboardLimitedColors
|
||||
@@ -453,7 +449,7 @@ void CorsairPeripheralController::SubmitKeyboardLimitedColors
|
||||
unsigned char byte_count
|
||||
)
|
||||
{
|
||||
char usb_buf[64];
|
||||
char usb_buf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
@@ -463,14 +459,15 @@ void CorsairPeripheralController::SubmitKeyboardLimitedColors
|
||||
/*-----------------------------------------------------*\
|
||||
| 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;
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = CORSAIR_COMMAND_WRITE;
|
||||
usb_buf[0x02] = CORSAIR_PROPERTY_SUBMIT_KEYBOARD_COLOR_9;
|
||||
usb_buf[0x05] = byte_count;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, (unsigned char *)usb_buf, 64);
|
||||
hid_write(dev, (unsigned char *)usb_buf, 65);
|
||||
}
|
||||
|
||||
void CorsairPeripheralController::SubmitMouseColors
|
||||
@@ -479,7 +476,7 @@ void CorsairPeripheralController::SubmitMouseColors
|
||||
RGBColor * color_data
|
||||
)
|
||||
{
|
||||
char usb_buf[64];
|
||||
char usb_buf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
@@ -489,26 +486,27 @@ void CorsairPeripheralController::SubmitMouseColors
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Submit Mouse Colors packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = CORSAIR_COMMAND_WRITE;
|
||||
usb_buf[0x01] = CORSAIR_PROPERTY_SUBMIT_MOUSE_COLOR;
|
||||
usb_buf[0x02] = num_zones;
|
||||
usb_buf[0x03] = 0x00;
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = CORSAIR_COMMAND_WRITE;
|
||||
usb_buf[0x02] = CORSAIR_PROPERTY_SUBMIT_MOUSE_COLOR;
|
||||
usb_buf[0x03] = num_zones;
|
||||
usb_buf[0x04] = 0x00;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Copy in colors in <ZONE> <RED> <GREEN> <BLUE> order |
|
||||
\*-----------------------------------------------------*/
|
||||
for(unsigned int zone_idx = 0; zone_idx < num_zones; zone_idx++)
|
||||
{
|
||||
usb_buf[(zone_idx * 4) + 4] = zone_idx;
|
||||
usb_buf[(zone_idx * 4) + 5] = RGBGetRValue(color_data[zone_idx]);
|
||||
usb_buf[(zone_idx * 4) + 6] = RGBGetGValue(color_data[zone_idx]);
|
||||
usb_buf[(zone_idx * 4) + 7] = RGBGetBValue(color_data[zone_idx]);
|
||||
usb_buf[(zone_idx * 4) + 5] = zone_idx;
|
||||
usb_buf[(zone_idx * 4) + 6] = RGBGetRValue(color_data[zone_idx]);
|
||||
usb_buf[(zone_idx * 4) + 7] = RGBGetGValue(color_data[zone_idx]);
|
||||
usb_buf[(zone_idx * 4) + 8] = RGBGetBValue(color_data[zone_idx]);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, (unsigned char *)usb_buf, 64);
|
||||
hid_write(dev, (unsigned char *)usb_buf, 65);
|
||||
}
|
||||
|
||||
void CorsairPeripheralController::SubmitMousematColors
|
||||
@@ -517,7 +515,7 @@ void CorsairPeripheralController::SubmitMousematColors
|
||||
RGBColor * color_data
|
||||
)
|
||||
{
|
||||
char usb_buf[64];
|
||||
char usb_buf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
@@ -527,24 +525,25 @@ void CorsairPeripheralController::SubmitMousematColors
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Submit Mouse Colors packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = CORSAIR_COMMAND_WRITE;
|
||||
usb_buf[0x01] = CORSAIR_PROPERTY_SUBMIT_MOUSE_COLOR;
|
||||
usb_buf[0x02] = num_zones;
|
||||
usb_buf[0x03] = 0x00;
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = CORSAIR_COMMAND_WRITE;
|
||||
usb_buf[0x02] = CORSAIR_PROPERTY_SUBMIT_MOUSE_COLOR;
|
||||
usb_buf[0x03] = num_zones;
|
||||
usb_buf[0x04] = 0x00;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Copy in colors in <RED> <GREEN> <BLUE> order |
|
||||
\*-----------------------------------------------------*/
|
||||
for(unsigned int zone_idx = 0; zone_idx < num_zones; zone_idx++)
|
||||
{
|
||||
usb_buf[(zone_idx * 3) + 4] = RGBGetRValue(color_data[zone_idx]);
|
||||
usb_buf[(zone_idx * 3) + 5] = RGBGetGValue(color_data[zone_idx]);
|
||||
usb_buf[(zone_idx * 3) + 6] = RGBGetBValue(color_data[zone_idx]);
|
||||
usb_buf[(zone_idx * 3) + 5] = RGBGetRValue(color_data[zone_idx]);
|
||||
usb_buf[(zone_idx * 3) + 6] = RGBGetGValue(color_data[zone_idx]);
|
||||
usb_buf[(zone_idx * 3) + 7] = RGBGetBValue(color_data[zone_idx]);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet using feature reports, as headset stand |
|
||||
| seems to not update completely using HID writes |
|
||||
\*-----------------------------------------------------*/
|
||||
send_usb_msg(dev, usb_buf);
|
||||
hid_write(dev, (unsigned char *)usb_buf, 65);
|
||||
}
|
||||
|
||||
@@ -130,30 +130,31 @@ void DetectCorsairPeripheralControllers(std::vector<RGBController*>& rgb_control
|
||||
while(info)
|
||||
{
|
||||
if((info->vendor_id == device_list[device_idx].usb_vid)
|
||||
#ifdef USE_HID_USAGE
|
||||
&&(info->product_id == device_list[device_idx].usb_pid)
|
||||
&&(info->usage_page == 0xFFC2))
|
||||
#else
|
||||
&&(info->product_id == device_list[device_idx].usb_pid)
|
||||
&&(info->interface_number == device_list[device_idx].usb_interface))
|
||||
#endif
|
||||
{
|
||||
dev = hid_open_path(info->path);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
info = info->next;
|
||||
}
|
||||
}
|
||||
|
||||
if( dev )
|
||||
{
|
||||
CorsairPeripheralController* controller = new CorsairPeripheralController(dev);
|
||||
if( dev )
|
||||
{
|
||||
CorsairPeripheralController* controller = new CorsairPeripheralController(dev);
|
||||
|
||||
if(controller->GetDeviceType() != DEVICE_TYPE_UNKNOWN)
|
||||
{
|
||||
RGBController_CorsairPeripheral* rgb_controller = new RGBController_CorsairPeripheral(controller);
|
||||
if(controller->GetDeviceType() != DEVICE_TYPE_UNKNOWN)
|
||||
{
|
||||
RGBController_CorsairPeripheral* rgb_controller = new RGBController_CorsairPeripheral(controller);
|
||||
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
}
|
||||
info = info->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
/*-------------------------------------------------------------------*\
|
||||
| EKController.cpp |
|
||||
| |
|
||||
| Driver for EK Loop Connect |
|
||||
| |
|
||||
| Chris M (Dr_No) 16th Jul 2020 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#include "EKController.h"
|
||||
|
||||
EKController::EKController(hid_device* dev_handle, wchar_t *_vendor, wchar_t *_device_name, char *_path)
|
||||
{
|
||||
int tmp_size = wcslen(_vendor);
|
||||
|
||||
dev = dev_handle;
|
||||
|
||||
for(int i=0; (i < tmp_size) && (i < EK_DEVICE_NAME_SIZE); i++)
|
||||
{
|
||||
device_name[i] = (char)_vendor[i];
|
||||
}
|
||||
|
||||
for(int j=0; (j < wcslen(_vendor)) && ((tmp_size + j) < EK_DEVICE_NAME_SIZE); j++)
|
||||
{
|
||||
device_name[tmp_size+j] = (char)_device_name[j];
|
||||
}
|
||||
|
||||
location = _path;
|
||||
|
||||
current_mode = EK_MODE_STATIC;
|
||||
current_speed = EK_SPEED_NORMAL;
|
||||
}
|
||||
|
||||
EKController::~EKController()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
char* EKController::GetDeviceName()
|
||||
{
|
||||
return device_name;
|
||||
}
|
||||
|
||||
char* EKController::GetSerial()
|
||||
{
|
||||
return serial;
|
||||
}
|
||||
|
||||
std::string EKController::GetLocation()
|
||||
{
|
||||
return location;
|
||||
}
|
||||
|
||||
void EKController::SetMode(unsigned char mode, unsigned char speed)
|
||||
{
|
||||
current_mode = mode;
|
||||
current_speed = speed;
|
||||
|
||||
SendUpdate();
|
||||
}
|
||||
|
||||
void EKController::SetColor(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
current_red = red;
|
||||
current_green = green;
|
||||
current_blue = blue;
|
||||
|
||||
SendUpdate();
|
||||
}
|
||||
|
||||
void EKController::SendUpdate()
|
||||
{
|
||||
unsigned char buffer[EK_PACKET_LENGTH] = { 0x00 };
|
||||
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
|
||||
|
||||
for(int i = 0; i < EK_COLOUR_MODE_DATA_SIZE; i++)
|
||||
{
|
||||
buffer[i] = colour_mode_data[current_mode][i];
|
||||
}
|
||||
|
||||
//Set the relevant colour info
|
||||
buffer[EK_RED_BYTE] = current_red;
|
||||
buffer[EK_GREEN_BYTE] = current_green;
|
||||
buffer[EK_BLUE_BYTE] = current_blue;
|
||||
buffer[EK_SPEED_BYTE] = speed_mode_data[current_mode][current_speed];
|
||||
|
||||
buffer[10] = 0x10;
|
||||
buffer[47] = 0xFF;
|
||||
buffer[48] = 0x00;
|
||||
|
||||
hid_write(dev, buffer, buffer_size);
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
/*-------------------------------------------------------------------*\
|
||||
| EKController.h |
|
||||
| |
|
||||
| Driver for EK Loop Connect |
|
||||
| |
|
||||
| Chris M (Dr_No) 16th Jul 2020 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#ifndef EKCONTROLLER_H
|
||||
#define EKCONTROLLER_H
|
||||
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#define EK_COLOUR_MODE_DATA_SIZE (sizeof(colour_mode_data[0]) / sizeof(colour_mode_data[0][0]))
|
||||
#define EK_DEVICE_NAME_SIZE (sizeof(device_name) / sizeof(device_name[ 0 ]))
|
||||
#define EK_PACKET_LENGTH 0x3F
|
||||
|
||||
enum
|
||||
{
|
||||
EK_MODE_BYTE = 12,
|
||||
EK_SPEED_BYTE = 14,
|
||||
EK_RED_BYTE = 16,
|
||||
EK_GREEN_BYTE = 17,
|
||||
EK_BLUE_BYTE = 18
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
EK_MODE_STATIC = 0x00, //Static Mode
|
||||
EK_MODE_BREATHING = 0x01, //Breathing Mode
|
||||
EK_MODE_FADING = 0x02, //Fading Mode
|
||||
EK_MODE_MARQUEE = 0x03, //Marquee Mode
|
||||
EK_MODE_COVERING_MARQUEE = 0x04, //Covering Marquee Mode
|
||||
EK_MODE_PULSE = 0x05, //Pulse Mode
|
||||
EK_MODE_SPECTRUM_WAVE = 0x06, //Spectrum Wave Mode
|
||||
EK_MODE_ALTERNATING = 0x07, //Alternating Mode
|
||||
EK_MODE_CANDLE = 0x08 //Candle Mode
|
||||
};
|
||||
|
||||
static unsigned char colour_mode_data[][16] =
|
||||
{
|
||||
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
|
||||
0x00, 0x10, 0x20, 0x01, 0x01, 0x00, 0xFF, 0x64}, // Static
|
||||
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
|
||||
0x00, 0x10, 0x20, 0x01, 0x02, 0x00, 0xFF, 0x64}, // Breathing
|
||||
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
|
||||
0x00, 0x10, 0x20, 0x01, 0x03, 0xFF, 0xFF, 0x64}, // Fading
|
||||
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
|
||||
0x00, 0x10, 0x20, 0x01, 0x04, 0x00, 0xFF, 0x64}, // Marquee
|
||||
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
|
||||
0x00, 0x10, 0x20, 0x01, 0x05, 0x00, 0xFF, 0x64}, // Covering Marquee
|
||||
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
|
||||
0x00, 0x10, 0x20, 0x01, 0x06, 0x00, 0xFF, 0x64}, // Pulse
|
||||
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
|
||||
0x00, 0x10, 0x20, 0x01, 0x07, 0x00, 0xFF, 0x64}, // Wave
|
||||
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
|
||||
0x00, 0x10, 0x20, 0x01, 0x08, 0x00, 0xFF, 0x64}, // Alternating
|
||||
{ 0x10, 0x12, 0x29, 0xAA, 0x01, 0x10, 0xA2, 0x60,
|
||||
0x00, 0x10, 0x20, 0x01, 0x09, 0x00, 0xFF, 0x64}, // Candle
|
||||
};
|
||||
|
||||
static unsigned char speed_mode_data[][9] =
|
||||
{
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // Static
|
||||
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Breathing
|
||||
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Fading
|
||||
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Marquee
|
||||
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Covering Marquee
|
||||
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Pulse
|
||||
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Wave
|
||||
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 }, // Alternating
|
||||
{ 0x00, 0x0C, 0x19, 0x25, 0x32, 0x3E, 0x4B, 0x57, 0x64 } // Candle
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
EK_SPEED_SLOWEST = 0x00, // Slowest speed
|
||||
EK_SPEED_SLOWER = 0x01, // Slower speed
|
||||
EK_SPEED_SLOW = 0x02, // Slow speed
|
||||
EK_SPEED_SLOWISH = 0x03, // Slowish speed
|
||||
EK_SPEED_NORMAL = 0x04, // Normal speed
|
||||
EK_SPEED_FASTISH = 0x05, // Fastish speed
|
||||
EK_SPEED_FAST = 0x06, // Fast speed
|
||||
EK_SPEED_FASTER = 0x07, // Faster speed
|
||||
EK_SPEED_FASTEST = 0x08, // Fastest speed
|
||||
};
|
||||
|
||||
class EKController
|
||||
{
|
||||
public:
|
||||
EKController(hid_device* dev_handle, wchar_t *_vendor, wchar_t *_device_name, char *_path);
|
||||
~EKController();
|
||||
|
||||
char* GetDeviceName();
|
||||
char* GetSerial();
|
||||
std::string GetLocation();
|
||||
|
||||
void SetMode(unsigned char mode, unsigned char speed);
|
||||
void SetColor(unsigned char red, unsigned char green, unsigned char blue);
|
||||
|
||||
private:
|
||||
char device_name[32];
|
||||
char serial[32];
|
||||
std::string location;
|
||||
hid_device* dev;
|
||||
|
||||
unsigned char current_mode;
|
||||
unsigned char current_speed;
|
||||
|
||||
unsigned char current_red;
|
||||
unsigned char current_green;
|
||||
unsigned char current_blue;
|
||||
|
||||
void SendUpdate();
|
||||
};
|
||||
|
||||
#endif // EKCONTROLLER_H
|
||||
@@ -0,0 +1,64 @@
|
||||
#include "EKController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_EKController.h"
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#define EK_VID 0x0483
|
||||
|
||||
#define EK_LOOP_CONNECT 0x5750
|
||||
|
||||
#define EK_NUM_DEVICES (sizeof(ek_pids) / sizeof(ek_pids[ 0 ]))
|
||||
|
||||
enum
|
||||
{
|
||||
EK_PID = 0,
|
||||
EK_INTERFACE = 1
|
||||
};
|
||||
|
||||
static const unsigned int ek_pids[][2] =
|
||||
{ // PID, Interface
|
||||
{ EK_LOOP_CONNECT, 0x00 } //EK Loop Connect
|
||||
};
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectEKControllers *
|
||||
* *
|
||||
* Tests the USB address to see if any EK Controllers exists there. *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectEKControllers(std::vector<RGBController*>& rgb_controllers)
|
||||
{
|
||||
hid_device_info* info;
|
||||
|
||||
//Look for the passed in cm_pids
|
||||
hid_init();
|
||||
info = hid_enumerate(0x0, 0x0);
|
||||
|
||||
while(info)
|
||||
{
|
||||
hid_device* dev = NULL;
|
||||
if(info->vendor_id == EK_VID)
|
||||
{
|
||||
for(int ek_pid_idx = 0; ek_pid_idx < EK_NUM_DEVICES; ek_pid_idx++)
|
||||
{
|
||||
if((info->product_id == ek_pids[ek_pid_idx][EK_PID])
|
||||
&&(info->interface_number == ek_pids[ek_pid_idx][EK_INTERFACE]))
|
||||
{
|
||||
dev = hid_open_path(info->path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(dev)
|
||||
{
|
||||
EKController* controller = new EKController(dev, info->manufacturer_string, info->product_string, info->path);
|
||||
RGBController_EKController* rgb_controller = new RGBController_EKController(controller);
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
info = info->next;
|
||||
}
|
||||
hid_free_enumeration(info);
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
/*-----------------------------------------*\
|
||||
| GalaxGPUController.cpp |
|
||||
| |
|
||||
| Driver for Galax / KFA2 RGB on GPUs |
|
||||
| |
|
||||
| Niels Westphal (crashniels) 12.07.2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "GalaxGPUController.h"
|
||||
#include <cstring>
|
||||
|
||||
GalaxGPUController::GalaxGPUController(i2c_smbus_interface* bus, galax_gpu_dev_id dev)
|
||||
{
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
|
||||
strcpy(device_name, "Galax RTX GPU"); // Would be nice to get the actual GPU name. Using this as a placeholder.
|
||||
}
|
||||
|
||||
GalaxGPUController::~GalaxGPUController()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string GalaxGPUController::GetDeviceName()
|
||||
{
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
std::string GalaxGPUController::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 char GalaxGPUController::GetLEDRed()
|
||||
{
|
||||
return(GalaxGPURegisterRead(GALAX_RED_REGISTER));
|
||||
}
|
||||
|
||||
unsigned char GalaxGPUController::GetLEDGreen()
|
||||
{
|
||||
return(GalaxGPURegisterRead(GALAX_GREEN_REGISTER));
|
||||
}
|
||||
|
||||
unsigned char GalaxGPUController::GetLEDBlue()
|
||||
{
|
||||
return(GalaxGPURegisterRead(GALAX_BLUE_REGISTER));
|
||||
}
|
||||
|
||||
void GalaxGPUController::SetLEDColorsDirect(unsigned char red, unsigned char green, unsigned char blue) // Direct Mode is just Static Mode without applying color changes
|
||||
{
|
||||
GalaxGPURegisterWrite(GALAX_RED_REGISTER, red);
|
||||
GalaxGPURegisterWrite(GALAX_GREEN_REGISTER, green);
|
||||
GalaxGPURegisterWrite(GALAX_BLUE_REGISTER, blue);
|
||||
}
|
||||
|
||||
void GalaxGPUController::SetLEDColorsEffect(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
GalaxGPURegisterWrite(GALAX_RED_REGISTER, red);
|
||||
GalaxGPURegisterWrite(GALAX_GREEN_REGISTER, green);
|
||||
GalaxGPURegisterWrite(GALAX_BLUE_REGISTER, blue);
|
||||
}
|
||||
|
||||
void GalaxGPUController::SetMode(unsigned char mode)
|
||||
{
|
||||
switch(mode)
|
||||
{
|
||||
case 1:
|
||||
GalaxGPURegisterWrite(GALAX_MODE_REGISTER_1, GALAX_MODE_STATIC_VALUE_1);
|
||||
GalaxGPURegisterWrite(GALAX_MODE_REGISTER_2, GALAX_MODE_STATIC_VALUE_2);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
GalaxGPURegisterWrite(GALAX_MODE_REGISTER_1, GALAX_MODE_BREATHING_VALUE_1);
|
||||
GalaxGPURegisterWrite(GALAX_MODE_REGISTER_2, GALAX_MODE_BREATHING_VALUE_2);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
GalaxGPURegisterWrite(GALAX_MODE_REGISTER_1, GALAX_MODE_RAINBOW_VALUE_1);
|
||||
GalaxGPURegisterWrite(GALAX_MODE_REGISTER_2, GALAX_MODE_RAINBOW_VALUE_2);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
GalaxGPURegisterWrite(GALAX_MODE_REGISTER_1, GALAX_MODE_CYCLE_BREATHING_VALUE_1);
|
||||
GalaxGPURegisterWrite(GALAX_MODE_REGISTER_2, GALAX_MODE_CYCLE_BREATHING_VALUE_2);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char GalaxGPUController::GalaxGPURegisterRead(unsigned char reg)
|
||||
{
|
||||
return(bus->i2c_smbus_read_byte_data(dev, reg));
|
||||
}
|
||||
|
||||
void GalaxGPUController::GalaxGPURegisterWrite(unsigned char reg, unsigned char val)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, reg, val);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/*-----------------------------------------*\
|
||||
| GalaxGPUController.h |
|
||||
| |
|
||||
| Driver for Galax / KFA2 RGB on GPUs |
|
||||
| |
|
||||
| Niels Westphal (crashniels) 12.07.2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef unsigned char galax_gpu_dev_id;
|
||||
|
||||
enum
|
||||
{
|
||||
/* RGB Registers */
|
||||
GALAX_RED_REGISTER = 0x02, /* Red Register */
|
||||
GALAX_GREEN_REGISTER = 0x03, /* Green Register */
|
||||
GALAX_BLUE_REGISTER = 0x04, /* Blue Register */
|
||||
/* MODE Registers */
|
||||
GALAX_MODE_REGISTER_1 = 0x05, /* Mode Register 1 */
|
||||
GALAX_MODE_REGISTER_2 = 0x06, /* Mode Register 2 */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
/* Static Mode Values */
|
||||
GALAX_MODE_STATIC_VALUE_1 = 0x00,
|
||||
GALAX_MODE_STATIC_VALUE_2 = 0x01,
|
||||
/* Breathing Mode Values */
|
||||
GALAX_MODE_BREATHING_VALUE_1 = 0x04,
|
||||
GALAX_MODE_BREATHING_VALUE_2 = 0x00,
|
||||
/* Rainbow Mode Values */
|
||||
GALAX_MODE_RAINBOW_VALUE_1 = 0x84,
|
||||
GALAX_MODE_RAINBOW_VALUE_2 = 0x02,
|
||||
/* Cycle Breathing Mode Values */
|
||||
GALAX_MODE_CYCLE_BREATHING_VALUE_1 = 0x84,
|
||||
GALAX_MODE_CYCLE_BREATHING_VALUE_2 = 0x40,
|
||||
};
|
||||
|
||||
class GalaxGPUController
|
||||
{
|
||||
public:
|
||||
GalaxGPUController(i2c_smbus_interface* bus, galax_gpu_dev_id);
|
||||
~GalaxGPUController();
|
||||
|
||||
std::string GetDeviceName();
|
||||
std::string GetDeviceLocation();
|
||||
unsigned char GetLEDRed();
|
||||
unsigned char GetLEDGreen();
|
||||
unsigned char GetLEDBlue();
|
||||
void SetLEDColorsDirect(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetLEDColorsEffect(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetMode(unsigned char mode);
|
||||
|
||||
unsigned char GalaxGPURegisterRead(unsigned char reg);
|
||||
void GalaxGPURegisterWrite(unsigned char reg, unsigned char val);
|
||||
|
||||
bool direct = false; // Temporary solution to check if we are in "Direct" mode
|
||||
|
||||
private:
|
||||
char device_name[16];
|
||||
i2c_smbus_interface * bus;
|
||||
galax_gpu_dev_id dev;
|
||||
};
|
||||
@@ -0,0 +1,68 @@
|
||||
/*-----------------------------------------*\
|
||||
| GalaxGPUControllerDetect.cpp |
|
||||
| |
|
||||
| Driver for Galax / KFA2 RGB on GPUs |
|
||||
| |
|
||||
| Niels Westphal (crashniels) 12.07.2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "GalaxGPUController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_GalaxGPU.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* TestForGalaxGPUController *
|
||||
* *
|
||||
* Tests the given address to see if a Galax GPU controller exists there. *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
bool TestForGalaxGPUController(i2c_smbus_interface* bus, unsigned char address)
|
||||
{
|
||||
bool pass = false;
|
||||
|
||||
unsigned char res = bus->i2c_smbus_read_byte_data(address, 0x00);
|
||||
unsigned char res2 = bus->i2c_smbus_read_byte_data(address, 0x01);
|
||||
if(res == 0x27 && res2 == 0x10)
|
||||
{
|
||||
pass = true;
|
||||
}
|
||||
|
||||
return(pass);
|
||||
|
||||
} /* TestForGalaxGPUController() */
|
||||
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectGalaxGPUControllers *
|
||||
* *
|
||||
* Detect Galax GPU controllers on the enumerated I2C busses. *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectGalaxGPUControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers)
|
||||
{
|
||||
GalaxGPUController* new_GalaxGPU;
|
||||
RGBController_GalaxGPU* new_controller;
|
||||
|
||||
for (unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
{
|
||||
// Check for GALAX controller at 0x23
|
||||
if (TestForGalaxGPUController(busses[bus], 0x23))
|
||||
{
|
||||
new_GalaxGPU = new GalaxGPUController(busses[bus], 0x23);
|
||||
new_controller = new RGBController_GalaxGPU(new_GalaxGPU);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectGalaxGPUControllers() */
|
||||
@@ -29,9 +29,14 @@ void DetectGloriousModelOControllers(std::vector<RGBController*>& rgb_controller
|
||||
//Look for Glorious Model O
|
||||
while(info)
|
||||
{
|
||||
if((info->vendor_id == Glorious_Model_O_VID)
|
||||
&&(info->product_id == Glorious_Model_O_PID)
|
||||
if((info->vendor_id == Glorious_Model_O_VID)
|
||||
&&(info->product_id == Glorious_Model_O_PID)
|
||||
#ifdef USE_HID_USAGE
|
||||
&&(info->interface_number == 1)
|
||||
&&(info->usage_page == 0xFF00))
|
||||
#else
|
||||
&&(info->interface_number == 1))
|
||||
#endif
|
||||
{
|
||||
dev = hid_open_path(info->path);
|
||||
break;
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
|
||||
#include <cstring>
|
||||
|
||||
// Skip these indices in the color output
|
||||
static unsigned int skip_idx[] = { 6, 23, 29, 41, 47, 59, 70, 71, 75, 76, 87, 88, 93, 99, 100, 102, 108, 113, 114, 120, 123, 124 };
|
||||
|
||||
HyperXAlloyOriginsController::HyperXAlloyOriginsController(hid_device* dev_handle)
|
||||
{
|
||||
dev = dev_handle;
|
||||
@@ -23,6 +26,18 @@ HyperXAlloyOriginsController::~HyperXAlloyOriginsController()
|
||||
|
||||
void HyperXAlloyOriginsController::SetLEDsDirect(std::vector<RGBColor> colors)
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Insert color data for unused positions |
|
||||
\*-----------------------------------------------------*/
|
||||
for(unsigned int skip_cnt = 0; skip_cnt < (sizeof(skip_idx) / sizeof(skip_idx[0])); skip_cnt++)
|
||||
{
|
||||
colors.insert(colors.begin() + skip_idx[skip_cnt], 0x00000000);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up variables to track progress of color transmit |
|
||||
| Do this after inserting blanks |
|
||||
\*-----------------------------------------------------*/
|
||||
int colors_to_send = colors.size();
|
||||
int colors_sent = 0;
|
||||
|
||||
@@ -69,7 +84,7 @@ void HyperXAlloyOriginsController::SendDirectInitialization()
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_send_feature_report(dev, &buf[1], 64);
|
||||
hid_send_feature_report(dev, buf, 65);
|
||||
}
|
||||
|
||||
void HyperXAlloyOriginsController::SendDirectColorPacket
|
||||
@@ -112,5 +127,5 @@ void HyperXAlloyOriginsController::SendDirectColorPacket
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_send_feature_report(dev, &buf[1], 64);
|
||||
hid_send_feature_report(dev, buf, 65);
|
||||
}
|
||||
@@ -58,41 +58,50 @@ void DetectHyperXKeyboardControllers(std::vector<RGBController*>& rgb_controller
|
||||
//Look for HyperX RGB Peripheral
|
||||
while(info)
|
||||
{
|
||||
if((info->vendor_id == device_list[device_idx].usb_vid)
|
||||
if((device_list[device_idx].usb_pid != HYPERX_ALLOY_ORIGINS_PID)
|
||||
&&(info->vendor_id == device_list[device_idx].usb_vid)
|
||||
&&(info->product_id == device_list[device_idx].usb_pid)
|
||||
#ifdef USE_HID_USAGE
|
||||
&&(info->interface_number == device_list[device_idx].usb_interface)
|
||||
&&(info->usage_page == 0xFF01))
|
||||
#else
|
||||
&&(info->interface_number == device_list[device_idx].usb_interface))
|
||||
#endif
|
||||
{
|
||||
dev = hid_open_path(info->path);
|
||||
|
||||
if( dev )
|
||||
{
|
||||
HyperXKeyboardController* controller = new HyperXKeyboardController(dev);
|
||||
|
||||
RGBController_HyperXKeyboard* rgb_controller = new RGBController_HyperXKeyboard(controller);
|
||||
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
if((device_list[device_idx].usb_pid == HYPERX_ALLOY_ORIGINS_PID)
|
||||
&&(info->vendor_id == device_list[device_idx].usb_vid)
|
||||
&&(info->product_id == device_list[device_idx].usb_pid)
|
||||
&&(info->interface_number == device_list[device_idx].usb_interface))
|
||||
{
|
||||
dev = hid_open_path(info->path);
|
||||
break;
|
||||
|
||||
if( dev )
|
||||
{
|
||||
HyperXAlloyOriginsController* controller = new HyperXAlloyOriginsController(dev);
|
||||
|
||||
RGBController_HyperXAlloyOrigins* rgb_controller = new RGBController_HyperXAlloyOrigins(controller);
|
||||
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
info = info->next;
|
||||
}
|
||||
}
|
||||
|
||||
if( dev )
|
||||
{
|
||||
if(device_list[device_idx].usb_pid == HYPERX_ALLOY_ORIGINS_PID)
|
||||
{
|
||||
HyperXAlloyOriginsController* controller = new HyperXAlloyOriginsController(dev);
|
||||
|
||||
RGBController_HyperXAlloyOrigins* rgb_controller = new RGBController_HyperXAlloyOrigins(controller);
|
||||
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
else
|
||||
{
|
||||
HyperXKeyboardController* controller = new HyperXKeyboardController(dev);
|
||||
|
||||
RGBController_HyperXKeyboard* rgb_controller = new RGBController_HyperXKeyboard(controller);
|
||||
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
info = info->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
#include "HyperXPulsefireSurgeController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_HyperXPulsefireSurge.h"
|
||||
#include <vector>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| HyperX keyboard vendor IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define HYPERX_VID 0x0951
|
||||
#define HYPERX_PULSEFIRE_SURGE_PID 0x16D3
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short usb_vid;
|
||||
unsigned short usb_pid;
|
||||
unsigned char usb_interface;
|
||||
const char * name;
|
||||
} hyperx_device;
|
||||
|
||||
#define HYPERX_NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
|
||||
|
||||
static const hyperx_device device_list[] =
|
||||
{
|
||||
/*-----------------------------------------------------------------------------------------------------*\
|
||||
| Mice |
|
||||
\*-----------------------------------------------------------------------------------------------------*/
|
||||
{ HYPERX_VID, HYPERX_PULSEFIRE_SURGE_PID, 1, "HyperX Pulsefire Surge" },
|
||||
};
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectHyperXMouseControllers *
|
||||
* *
|
||||
* Tests the USB address to see if a HyperX Mouse controller exists there. *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectHyperXMouseControllers(std::vector<RGBController*>& rgb_controllers)
|
||||
{
|
||||
hid_device_info* info;
|
||||
hid_device* dev = NULL;
|
||||
|
||||
hid_init();
|
||||
|
||||
for(std::size_t device_idx = 0; device_idx < HYPERX_NUM_DEVICES; device_idx++)
|
||||
{
|
||||
dev = NULL;
|
||||
|
||||
info = hid_enumerate(device_list[device_idx].usb_vid, device_list[device_idx].usb_pid);
|
||||
|
||||
//Look for HyperX RGB Peripheral
|
||||
while(info)
|
||||
{
|
||||
if((info->vendor_id == device_list[device_idx].usb_vid)
|
||||
&&(info->product_id == device_list[device_idx].usb_pid)
|
||||
&&(info->interface_number == device_list[device_idx].usb_interface))
|
||||
{
|
||||
dev = hid_open_path(info->path);
|
||||
|
||||
if( dev )
|
||||
{
|
||||
HyperXPulsefireSurgeController* controller = new HyperXPulsefireSurgeController(dev);
|
||||
|
||||
RGBController_HyperXPulsefireSurge* rgb_controller = new RGBController_HyperXPulsefireSurge(controller);
|
||||
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
info = info->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*-----------------------------------------*\
|
||||
| HyperXPulsefireSurgeController.cpp |
|
||||
| |
|
||||
| Driver for HyperX Pulsefire Surge |
|
||||
| lighting controller |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 7/25/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "HyperXPulsefireSurgeController.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
HyperXPulsefireSurgeController::HyperXPulsefireSurgeController(hid_device* dev_handle)
|
||||
{
|
||||
dev = dev_handle;
|
||||
}
|
||||
|
||||
HyperXPulsefireSurgeController::~HyperXPulsefireSurgeController()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*-----------------------------------------*\
|
||||
| HyperXPulsefireSurgeController.h |
|
||||
| |
|
||||
| Definitions and types for HyperX |
|
||||
| Pulsefire Surge lighting controller |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 7/25/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController.h"
|
||||
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
class HyperXPulsefireSurgeController
|
||||
{
|
||||
public:
|
||||
HyperXPulsefireSurgeController(hid_device* dev_handle);
|
||||
~HyperXPulsefireSurgeController();
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
};
|
||||
@@ -65,78 +65,132 @@ static const logitech_device device_list[] =
|
||||
|
||||
void DetectLogitechControllers(std::vector<RGBController*>& rgb_controllers)
|
||||
{
|
||||
hid_device_info* info;
|
||||
hid_device* dev;
|
||||
|
||||
hid_init();
|
||||
|
||||
for(int device_idx = 0; device_idx < LOGITECH_NUM_DEVICES; device_idx++)
|
||||
{
|
||||
dev = NULL;
|
||||
|
||||
info = hid_enumerate(device_list[device_idx].usb_vid, device_list[device_idx].usb_pid);
|
||||
|
||||
//Look for Logitech RGB Peripheral
|
||||
while(info)
|
||||
switch(device_list[device_idx].type)
|
||||
{
|
||||
if((info->vendor_id == device_list[device_idx].usb_vid)
|
||||
&&(info->product_id == device_list[device_idx].usb_pid)
|
||||
&&(info->interface_number == device_list[device_idx].usb_interface))
|
||||
/*-------------------------------------------------------------------------------------------------*\
|
||||
| Logitech keyboards use two different usages, one for 20-byte packets and one for 64-byte packets |
|
||||
| Usage 0x0602 for 20 byte, usage 0x0604 for 64 byte, both are on usage page 0xFF43 |
|
||||
\*-------------------------------------------------------------------------------------------------*/
|
||||
case DEVICE_TYPE_KEYBOARD:
|
||||
{
|
||||
dev = hid_open_path(info->path);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
info = info->next;
|
||||
}
|
||||
}
|
||||
hid_device_info* info = hid_enumerate(device_list[device_idx].usb_vid, device_list[device_idx].usb_pid);
|
||||
|
||||
if( dev )
|
||||
{
|
||||
switch(device_list[device_idx].type)
|
||||
{
|
||||
case DEVICE_TYPE_KEYBOARD:
|
||||
while(info)
|
||||
{
|
||||
if((info->vendor_id == device_list[device_idx].usb_vid)
|
||||
&&(info->product_id == device_list[device_idx].usb_pid)
|
||||
#ifdef USE_HID_USAGE
|
||||
&&(info->interface_number == device_list[device_idx].usb_interface)
|
||||
&&(info->usage_page == 0xFF43)
|
||||
&&(info->usage == 0x0602))
|
||||
#else
|
||||
&&(info->interface_number == device_list[device_idx].usb_interface))
|
||||
#endif
|
||||
{
|
||||
LogitechG810Controller* controller = new LogitechG810Controller(dev);
|
||||
hid_device* dev_usage_0x0602 = hid_open_path(info->path);
|
||||
|
||||
RGBController_LogitechG810* rgb_controller = new RGBController_LogitechG810(controller);
|
||||
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
break;
|
||||
|
||||
case DEVICE_TYPE_MOUSE:
|
||||
{
|
||||
switch(device_list[device_idx].usb_pid)
|
||||
{
|
||||
case LOGITECH_G203_PID:
|
||||
if(dev_usage_0x0602)
|
||||
{
|
||||
LogitechG203Controller* controller = new LogitechG203Controller(dev);
|
||||
#ifdef USE_HID_USAGE
|
||||
hid_device_info* tmp_info_0x0604 = info;
|
||||
|
||||
RGBController_LogitechG203* rgb_controller = new RGBController_LogitechG203(controller);
|
||||
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
break;
|
||||
case LOGITECH_G403_PID:
|
||||
case LOGITECH_G403H_PID:
|
||||
{
|
||||
LogitechG403Controller* controller = new LogitechG403Controller(dev);
|
||||
|
||||
RGBController_LogitechG403* rgb_controller = new RGBController_LogitechG403(controller);
|
||||
while(tmp_info_0x0604)
|
||||
{
|
||||
if((tmp_info_0x0604->vendor_id == device_list[device_idx].usb_vid)
|
||||
&&(tmp_info_0x0604->product_id == device_list[device_idx].usb_pid)
|
||||
&&(tmp_info_0x0604->interface_number == device_list[device_idx].usb_interface)
|
||||
&&(tmp_info_0x0604->usage_page == 0xFF43)
|
||||
&&(tmp_info_0x0604->usage == 0x0604))
|
||||
{
|
||||
hid_device* dev_usage_0x0604 = hid_open_path(tmp_info_0x0604->path);
|
||||
|
||||
if(dev_usage_0x0604)
|
||||
{
|
||||
LogitechG810Controller* controller = new LogitechG810Controller(dev_usage_0x0602, dev_usage_0x0604);
|
||||
|
||||
RGBController_LogitechG810* rgb_controller = new RGBController_LogitechG810(controller);
|
||||
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
tmp_info_0x0604 = tmp_info_0x0604->next;
|
||||
}
|
||||
#else
|
||||
LogitechG810Controller* controller = new LogitechG810Controller(dev_usage_0x0602, dev_usage_0x0602);
|
||||
|
||||
RGBController_LogitechG810* rgb_controller = new RGBController_LogitechG810(controller);
|
||||
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
info = info->next;
|
||||
}
|
||||
hid_free_enumeration(info);
|
||||
}
|
||||
break;
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------*\
|
||||
| Logitech mice use a single usage on page 0xFF00 |
|
||||
\*-------------------------------------------------------------------------------------------------*/
|
||||
case DEVICE_TYPE_MOUSE:
|
||||
{
|
||||
hid_device_info* info = hid_enumerate(device_list[device_idx].usb_vid, device_list[device_idx].usb_pid);
|
||||
|
||||
while(info)
|
||||
{
|
||||
if((info->vendor_id == device_list[device_idx].usb_vid)
|
||||
&&(info->product_id == device_list[device_idx].usb_pid)
|
||||
#ifdef USE_HID_USAGE
|
||||
&&(info->interface_number == device_list[device_idx].usb_interface)
|
||||
&&(info->usage_page == 0xFF00)
|
||||
&&(info->usage == 2))
|
||||
#else
|
||||
&&(info->interface_number == device_list[device_idx].usb_interface))
|
||||
#endif
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
switch(device_list[device_idx].usb_pid)
|
||||
{
|
||||
case LOGITECH_G203_PID:
|
||||
{
|
||||
LogitechG203Controller* controller = new LogitechG203Controller(dev);
|
||||
|
||||
RGBController_LogitechG203* rgb_controller = new RGBController_LogitechG203(controller);
|
||||
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
break;
|
||||
|
||||
case LOGITECH_G403_PID:
|
||||
case LOGITECH_G403H_PID:
|
||||
{
|
||||
LogitechG403Controller* controller = new LogitechG403Controller(dev);
|
||||
|
||||
RGBController_LogitechG403* rgb_controller = new RGBController_LogitechG403(controller);
|
||||
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
info = info->next;
|
||||
}
|
||||
hid_free_enumeration(info);
|
||||
}
|
||||
break;
|
||||
}
|
||||
hid_free_enumeration(info);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,9 +10,10 @@
|
||||
#include "LogitechG810Controller.h"
|
||||
#include <cstring>
|
||||
|
||||
LogitechG810Controller::LogitechG810Controller(hid_device* dev_handle)
|
||||
LogitechG810Controller::LogitechG810Controller(hid_device* dev_handle_0x11, hid_device* dev_handle_0x12)
|
||||
{
|
||||
dev = dev_handle;
|
||||
dev_pkt_0x11 = dev_handle_0x11;
|
||||
dev_pkt_0x12 = dev_handle_0x12;
|
||||
}
|
||||
|
||||
LogitechG810Controller::~LogitechG810Controller()
|
||||
@@ -74,8 +75,8 @@ void LogitechG810Controller::SendCommit()
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, (unsigned char *)usb_buf, 20);
|
||||
hid_read(dev, (unsigned char *)usb_buf, 20);
|
||||
hid_write(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
|
||||
hid_read(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
|
||||
}
|
||||
|
||||
void LogitechG810Controller::SendDirectFrame
|
||||
@@ -110,8 +111,8 @@ void LogitechG810Controller::SendDirectFrame
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, (unsigned char *)usb_buf, 64);
|
||||
hid_read(dev, (unsigned char *)usb_buf, 20);
|
||||
hid_write(dev_pkt_0x12, (unsigned char *)usb_buf, 64);
|
||||
hid_read(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
|
||||
}
|
||||
|
||||
void LogitechG810Controller::SendMode
|
||||
@@ -163,6 +164,6 @@ void LogitechG810Controller::SendMode
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, (unsigned char *)usb_buf, 20);
|
||||
hid_read(dev, (unsigned char *)usb_buf, 20);
|
||||
hid_write(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
|
||||
hid_read(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ enum
|
||||
class LogitechG810Controller
|
||||
{
|
||||
public:
|
||||
LogitechG810Controller(hid_device* dev_handle);
|
||||
LogitechG810Controller(hid_device* dev_handle_0x11, hid_device* dev_handle_0x12);
|
||||
~LogitechG810Controller();
|
||||
|
||||
void Commit();
|
||||
@@ -71,7 +71,8 @@ public:
|
||||
);
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
hid_device* dev_pkt_0x11;
|
||||
hid_device* dev_pkt_0x12;
|
||||
|
||||
void SendDirectFrame
|
||||
(
|
||||
|
||||
@@ -12,8 +12,6 @@ MSIGPUController::MSIGPUController(i2c_smbus_interface* bus)
|
||||
{
|
||||
this->bus = bus;
|
||||
this->dev = 0x68;
|
||||
|
||||
strcpy(device_name, "MSI RTX GPU");
|
||||
}
|
||||
|
||||
MSIGPUController::~MSIGPUController()
|
||||
@@ -21,11 +19,6 @@ MSIGPUController::~MSIGPUController()
|
||||
|
||||
}
|
||||
|
||||
std::string MSIGPUController::GetDeviceName()
|
||||
{
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
std::string MSIGPUController::GetDeviceLocation()
|
||||
{
|
||||
std::string return_string(bus->device_name);
|
||||
|
||||
@@ -60,7 +60,6 @@ public:
|
||||
MSIGPUController(i2c_smbus_interface* bus);
|
||||
~MSIGPUController();
|
||||
|
||||
std::string GetDeviceName();
|
||||
std::string GetDeviceLocation();
|
||||
|
||||
void SetRGB1(unsigned char red, unsigned char green, unsigned char blue);
|
||||
@@ -73,7 +72,6 @@ public:
|
||||
void MSIGPURegisterWrite(unsigned char reg, unsigned char val);
|
||||
|
||||
private:
|
||||
char device_name[16];
|
||||
i2c_smbus_interface * bus;
|
||||
msi_gpu_dev_id dev;
|
||||
};
|
||||
|
||||
@@ -13,52 +13,67 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* IsMSIGPUController *
|
||||
* *
|
||||
* Compare PCI IDs *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
/*-----------------------------------------------------*\
|
||||
| NVidia vendor ID |
|
||||
\*-----------------------------------------------------*/
|
||||
#define NVIDIA_VEN 0x10DE
|
||||
|
||||
bool IsMSIGPUController(i2c_smbus_interface* bus)
|
||||
/*-----------------------------------------------------*\
|
||||
| NVidia device IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define NVIDIA_RTX2060_DEV 0x1F08
|
||||
#define NVIDIA_RTX2060S_DEV 0x1F06
|
||||
#define NVIDIA_RTX2070_DEV 0x1F02
|
||||
#define NVIDIA_RTX2070S_DEV 0x1E84
|
||||
#define NVIDIA_RTX2080_DEV 0x1E87
|
||||
#define NVIDIA_RTX2080S_DEV 0x1E81
|
||||
#define NVIDIA_RTX2080TI_DEV 0x1E07
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| MSI sub-vendor ID |
|
||||
\*-----------------------------------------------------*/
|
||||
#define MSI_SUB_VEN 0x1462
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| MSI sub-device IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define MSI_RTX2060S_GAMING_X_SUB_DEV 0xC752
|
||||
#define MSI_RTX2070S_GAMING_X_SUB_DEV 0x373e
|
||||
#define MSI_RTX2070S_GAMING_X_TRIO_SUB_DEV 0xC726
|
||||
#define MSI_RTX2080_GAMING_X_TRIO_SUB_DEV 0x3726
|
||||
#define MSI_RTX2080S_GAMING_X_TRIO_SUB_DEV 0xC724
|
||||
#define MSI_RTX2080TI_GAMING_X_TRIO_SUB_DEV 0x3715
|
||||
#define MSI_RTX2060_GAMING_Z_6G_SUB_DEV 0x3754
|
||||
#define MSI_RTX2070_ARMOR_SUB_DEV 0x3734
|
||||
#define MSI_RTX2060S_ARMOR_OC_SUB_DEV 0xC754
|
||||
#define MSI_RTX2080_SEA_HAWK_EK_X_SUB_DEV 0x3728
|
||||
#define MSI_RTX2080TI_SEA_HAWK_EK_X_SUB_DEV 0x3717
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool pass = false;
|
||||
int pci_vendor;
|
||||
int pci_device;
|
||||
int pci_subsystem_vendor;
|
||||
int pci_subsystem_device;
|
||||
const char * name;
|
||||
} msi_gpu_pci_device;
|
||||
|
||||
if (bus->port_id != 1)
|
||||
{
|
||||
return(pass);
|
||||
}
|
||||
#define MSI_GPU_NUM_DEVICES (sizeof(device_list) / sizeof(device_list[ 0 ]))
|
||||
|
||||
// MSI RTX 2080S Gaming X Trio
|
||||
if (bus->pci_device == 0x1e81 &&
|
||||
bus->pci_vendor == 0x10de &&
|
||||
bus->pci_subsystem_device == 0xc724 &&
|
||||
bus->pci_subsystem_vendor == 0x1462)
|
||||
{
|
||||
pass = true;
|
||||
}
|
||||
|
||||
// MSI RTX 2070S Gaming X Trio
|
||||
if (bus->pci_device == 0x1e84 &&
|
||||
bus->pci_vendor == 0x10de &&
|
||||
bus->pci_subsystem_device == 0xc726 &&
|
||||
bus->pci_subsystem_vendor == 0x1462)
|
||||
{
|
||||
pass = true;
|
||||
}
|
||||
|
||||
// MSI RTX 2080 Ti Sea Hawk EK X
|
||||
if (bus->pci_device == 0x1e07 &&
|
||||
bus->pci_vendor == 0x10de &&
|
||||
bus->pci_subsystem_device == 0x3717 &&
|
||||
bus->pci_subsystem_vendor == 0x1462)
|
||||
{
|
||||
pass = true;
|
||||
}
|
||||
|
||||
return(pass);
|
||||
} /* IsMSIGPUController() */
|
||||
static const msi_gpu_pci_device device_list[] =
|
||||
{
|
||||
{ NVIDIA_VEN, NVIDIA_RTX2060S_DEV, MSI_SUB_VEN, MSI_RTX2060S_GAMING_X_SUB_DEV, "MSI GeForce RTX 2060 Super Gaming X" },
|
||||
{ NVIDIA_VEN, NVIDIA_RTX2070S_DEV, MSI_SUB_VEN, MSI_RTX2070S_GAMING_X_SUB_DEV, "MSI GeForce RTX 2070 Super Gaming X" },
|
||||
{ NVIDIA_VEN, NVIDIA_RTX2070S_DEV, MSI_SUB_VEN, MSI_RTX2070S_GAMING_X_TRIO_SUB_DEV, "MSI GeForce RTX 2070 Super Gaming X Trio" },
|
||||
{ NVIDIA_VEN, NVIDIA_RTX2080_DEV, MSI_SUB_VEN, MSI_RTX2080_GAMING_X_TRIO_SUB_DEV, "MSI GeForce RTX 2080 Gaming X Trio" },
|
||||
{ NVIDIA_VEN, NVIDIA_RTX2080S_DEV, MSI_SUB_VEN, MSI_RTX2080S_GAMING_X_TRIO_SUB_DEV, "MSI GeForce RTX 2080 Super Gaming X Trio" },
|
||||
{ NVIDIA_VEN, NVIDIA_RTX2080TI_DEV, MSI_SUB_VEN, MSI_RTX2080TI_GAMING_X_TRIO_SUB_DEV, "MSI GeForce RTX 2080Ti Gaming X Trio" },
|
||||
{ NVIDIA_VEN, NVIDIA_RTX2060_DEV, MSI_SUB_VEN, MSI_RTX2060_GAMING_Z_6G_SUB_DEV, "MSI GeForce RTX 2060 Gaming Z 6G" },
|
||||
{ NVIDIA_VEN, NVIDIA_RTX2060S_DEV, MSI_SUB_VEN, MSI_RTX2060S_ARMOR_OC_SUB_DEV, "MSI GeForce RTX 2060 Super ARMOR OC" },
|
||||
{ NVIDIA_VEN, NVIDIA_RTX2070_DEV, MSI_SUB_VEN, MSI_RTX2070_ARMOR_SUB_DEV, "MSI GeForce RTX 2070 ARMOR" },
|
||||
{ NVIDIA_VEN, NVIDIA_RTX2080_DEV, MSI_SUB_VEN, MSI_RTX2080_SEA_HAWK_EK_X_SUB_DEV, "MSI GeForce RTX 2080 Sea Hawk EK X" },
|
||||
{ NVIDIA_VEN, NVIDIA_RTX2080TI_DEV, MSI_SUB_VEN, MSI_RTX2080TI_SEA_HAWK_EK_X_SUB_DEV, "MSI GeForce RTX 2080Ti Sea Hawk EK X" },
|
||||
};
|
||||
|
||||
|
||||
/******************************************************************************************\
|
||||
@@ -76,11 +91,23 @@ void DetectMSIGPUControllers(std::vector<i2c_smbus_interface*> &busses, std::vec
|
||||
|
||||
for (unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
{
|
||||
if (IsMSIGPUController(busses[bus]))
|
||||
for(unsigned int dev_idx = 0; dev_idx < MSI_GPU_NUM_DEVICES; dev_idx++)
|
||||
{
|
||||
new_msi_gpu = new MSIGPUController(busses[bus]);
|
||||
new_controller = new RGBController_MSIGPU(new_msi_gpu);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
if (busses[bus]->port_id != 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if(busses[bus]->pci_vendor == device_list[dev_idx].pci_vendor &&
|
||||
busses[bus]->pci_device == device_list[dev_idx].pci_device &&
|
||||
busses[bus]->pci_subsystem_vendor == device_list[dev_idx].pci_subsystem_vendor &&
|
||||
busses[bus]->pci_subsystem_device == device_list[dev_idx].pci_subsystem_device)
|
||||
{
|
||||
new_msi_gpu = new MSIGPUController(busses[bus]);
|
||||
new_controller = new RGBController_MSIGPU(new_msi_gpu);
|
||||
new_controller->name = device_list[dev_idx].name;
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* DetectMSIGPUControllers() */
|
||||
|
||||
@@ -7,20 +7,23 @@
|
||||
|
||||
static const unsigned short msi_pid_table[] =
|
||||
{
|
||||
0x7C67, // MS_7C67
|
||||
0x3EA4, // MS_3EA4
|
||||
0x4559, // MS_4459
|
||||
|
||||
0x7B10, // MS_7B10
|
||||
0x7C87, // MS_7C87
|
||||
0x7B93, // MS_7B93
|
||||
0x7B93, // MSI B450 Gaming Pro Carbon AC
|
||||
0x7B94, // MS_7B94
|
||||
0x7B96, // MS_7B96
|
||||
|
||||
0x7C34, // MS_7C34
|
||||
0x7C35, // MS_7C35
|
||||
0x7C36, // MS_7C36
|
||||
0x7C37, // MS_7C37
|
||||
0x7C42, // MS_7C42
|
||||
0x7C84, // MS_7C84
|
||||
0x7B94, // MS_7B94
|
||||
0x7B96, // MS_7B96
|
||||
0x7C56, // MS_7C56
|
||||
0x7C59, // MS_7C59
|
||||
0x7C60, // MS_7C60
|
||||
0x7C67, // MS_7C67
|
||||
0x7C70, // MS_7C70
|
||||
0x7C71, // MS_7C71
|
||||
0x7C73, // MS_7C73
|
||||
@@ -29,25 +32,25 @@ static const unsigned short msi_pid_table[] =
|
||||
0x7C77, // MS_7C77
|
||||
0x7C79, // MS_7C79
|
||||
0x7C80, // MS_7C80
|
||||
0x7C98, // MS_7C98
|
||||
0x7C99, // MS_7C99
|
||||
0x7C81, // MS_7C81
|
||||
0x7C82, // MS_7C82
|
||||
0x7C83, // MS_7C83
|
||||
0x7C84, // MS_7C84
|
||||
0x7C85, // MS_7C85
|
||||
0x7C86, // MS_7C86
|
||||
0x7C87, // MS_7C87
|
||||
0x7C88, // MS_7C88
|
||||
0x7C89, // MS_7C89
|
||||
0x4559, // MS_4459
|
||||
0x3EA4, // MS_3EA4
|
||||
0x905D, // MS_905D
|
||||
0x7C90, // MS_7C90
|
||||
0x7C91, // MS_7C91
|
||||
0x7C92, // MS_7C92
|
||||
0x7C94, // MS_7C94
|
||||
0x7C95, // MS_7C95
|
||||
0x7C96, // MS_7C96
|
||||
0x7C56 // MS_7C56
|
||||
0x7C98, // MS_7C98
|
||||
0x7C99, // MS_7C99
|
||||
|
||||
0x905D // MS_905D
|
||||
};
|
||||
|
||||
/******************************************************************************************\
|
||||
|
||||
@@ -30,23 +30,25 @@ void DetectPoseidonZRGBControllers(std::vector<RGBController*>& rgb_controllers)
|
||||
{
|
||||
if((info->vendor_id == TT_POSEIDON_Z_RGB_VID)
|
||||
&&(info->product_id == TT_POSEIDON_Z_RGB_PID)
|
||||
&&(info->interface_number == 2))
|
||||
#ifdef USE_HID_USAGE
|
||||
&&(info->interface_number == 1)
|
||||
&&(info->usage_page == 0xFF01))
|
||||
#else
|
||||
&&(info->interface_number == 1))
|
||||
#endif
|
||||
{
|
||||
dev = hid_open_path(info->path);
|
||||
break;
|
||||
if( dev )
|
||||
{
|
||||
PoseidonZRGBController* controller = new PoseidonZRGBController(dev);
|
||||
|
||||
RGBController_PoseidonZRGB* rgb_controller = new RGBController_PoseidonZRGB(controller);
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
info = info->next;
|
||||
}
|
||||
}
|
||||
|
||||
if( dev )
|
||||
{
|
||||
PoseidonZRGBController* controller = new PoseidonZRGBController(dev);
|
||||
|
||||
RGBController_PoseidonZRGB* rgb_controller = new RGBController_PoseidonZRGB(controller);
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,14 +29,15 @@ static LEDCount LedCountToEnum(unsigned int c)
|
||||
|
||||
RGBFusion2USBController::RGBFusion2USBController(hid_device* handle, const char *path, std::string mb_name) : dev(handle)
|
||||
{
|
||||
int res = 0;
|
||||
char text[64] {};
|
||||
unsigned char buffer[64] {};
|
||||
|
||||
if( dev ) {
|
||||
int res = 0;
|
||||
char text[64] = { 0x00 };
|
||||
unsigned char buffer[64] = { 0x00 };
|
||||
|
||||
if( dev )
|
||||
{
|
||||
SetCalibration();
|
||||
|
||||
name = mb_name;
|
||||
// hid report read needs 0x60 packet or it gives IO error
|
||||
SendPacket(0x60, 0x00);
|
||||
|
||||
@@ -46,9 +47,8 @@ RGBFusion2USBController::RGBFusion2USBController(hid_device* handle, const char
|
||||
{
|
||||
report = *reinterpret_cast<IT8297Report*>(buffer);
|
||||
|
||||
name = mb_name;
|
||||
description = std::string(report.str_product, 32);
|
||||
description.erase(std::find(name.begin(), name.end(), '\0'), name.end());
|
||||
//description.erase(std::find(description.begin(), description.end(), '\0'), name.end());
|
||||
|
||||
snprintf(text, 11, "0x%08X", report.fw_ver);
|
||||
version = text;
|
||||
@@ -56,7 +56,6 @@ RGBFusion2USBController::RGBFusion2USBController(hid_device* handle, const char
|
||||
snprintf(text, 11, "0x%08X", report.chip_id);
|
||||
chip_id = text;
|
||||
}
|
||||
|
||||
loc = path;
|
||||
|
||||
EnableBeat(false);
|
||||
@@ -85,13 +84,13 @@ void RGBFusion2USBController::SetCalibration()
|
||||
buffer[0] = report_id;
|
||||
buffer[1] = 0x33;
|
||||
|
||||
// D_LED1 WS2812 GRB, 0x00RRGGBB to 0x00GGRRBB
|
||||
// D_LED1 WS2812 GRB, 0x00RRGGBB to 0x00GGRRBB
|
||||
buffer[2] = 0x02; // B
|
||||
buffer[3] = 0x00; // G
|
||||
buffer[4] = 0x01; // R
|
||||
buffer[5] = 0x00;
|
||||
|
||||
// D_LED2 WS2812 GRB
|
||||
// D_LED2 WS2812 GRB
|
||||
buffer[6] = 0x02;
|
||||
buffer[7] = 0x00;
|
||||
buffer[8] = 0x01;
|
||||
@@ -103,6 +102,12 @@ void RGBFusion2USBController::SetCalibration()
|
||||
buffer[12] = 0x02;
|
||||
buffer[13] = 0x00;
|
||||
|
||||
// Spare set seen in some Motherboard models
|
||||
buffer[14] = 0x00;
|
||||
buffer[15] = 0x01;
|
||||
buffer[16] = 0x02;
|
||||
buffer[17] = 0x00;
|
||||
|
||||
SendPacket(buffer);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#define IT8297_VID 0x048D
|
||||
#define IT8297_IFC 0
|
||||
#define IT8297_U 0xCC
|
||||
#define IT8297_UPG 0xFF89
|
||||
#define COUNT_RGBFUSION2_PIDS (sizeof(RGBFusion2_pids) / sizeof(RGBFusion2_pids[ 0 ]))
|
||||
|
||||
@@ -42,9 +43,15 @@ void DetectRGBFusion2USBControllers(std::vector<RGBController*> &rgb_controllers
|
||||
|
||||
while(info)
|
||||
{
|
||||
if((info->vendor_id == IT8297_VID)
|
||||
&&(info->interface_number == IT8297_IFC)
|
||||
&&(info->product_id == tmpPID))
|
||||
if((info->vendor_id == IT8297_VID)
|
||||
#ifdef USE_HID_USAGE
|
||||
&&(info->product_id == tmpPID)
|
||||
&&(info->usage == IT8297_U) //Usage and usage page required to get the correct interface
|
||||
&&(info->usage_page == IT8297_UPG))
|
||||
#else
|
||||
&&(info->interface_number == IT8297_IFC) //Interface is only valid on Windows where there is > 1 interface
|
||||
&&(info->product_id == tmpPID))
|
||||
#endif
|
||||
{
|
||||
hid_device * dev = hid_open_path(info->path);
|
||||
if (dev)
|
||||
@@ -52,6 +59,7 @@ void DetectRGBFusion2USBControllers(std::vector<RGBController*> &rgb_controllers
|
||||
RGBFusion2USBController * controller = new RGBFusion2USBController(dev, info->path, MB_info.getMainboard());
|
||||
RGBController_RGBFusion2USB * rgb_controller = new RGBController_RGBFusion2USB(controller);
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
break;
|
||||
}
|
||||
}
|
||||
info = info->next;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
| Keyboard product IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define REDRAGON_KEYBOARD_VID 0x0C45
|
||||
#define REDRAGON_KEYBOARD_USAGE_PAGE 0xFF1C
|
||||
#define REDRAGON_K550_PID 0x5204
|
||||
#define REDRAGON_K552_PID 0x5104
|
||||
#define REDRAGON_K556_PID 0x5004
|
||||
@@ -20,6 +21,7 @@
|
||||
| Mouse product IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define REDRAGON_MOUSE_VID 0x04D9
|
||||
#define REDRAGON_MOUSE_USAGE_PAGE 0xFFA0
|
||||
#define REDRAGON_M711_PID 0xFC30
|
||||
#define REDRAGON_M715_PID 0xFC39
|
||||
|
||||
@@ -28,6 +30,7 @@ typedef struct
|
||||
unsigned short usb_vid;
|
||||
unsigned short usb_pid;
|
||||
unsigned char usb_interface;
|
||||
unsigned short usb_usage_page;
|
||||
device_type type;
|
||||
const char * name;
|
||||
} redragon_device;
|
||||
@@ -36,22 +39,22 @@ typedef struct
|
||||
|
||||
static const redragon_device device_list[] =
|
||||
{
|
||||
/*-------------------------------------------------------------------------------------------------------------*\
|
||||
| Keyboards |
|
||||
\*-------------------------------------------------------------------------------------------------------------*/
|
||||
{ REDRAGON_KEYBOARD_VID, REDRAGON_K550_PID, 1, DEVICE_TYPE_KEYBOARD, "Redragon K550 Yama" },
|
||||
{ REDRAGON_KEYBOARD_VID, REDRAGON_K552_PID, 1, DEVICE_TYPE_KEYBOARD, "Redragon K552 Kumara" },
|
||||
{ REDRAGON_KEYBOARD_VID, REDRAGON_K556_PID, 1, DEVICE_TYPE_KEYBOARD, "Redragon K556 Devarajas" },
|
||||
{ REDRAGON_KEYBOARD_VID, TECWARE_PHANTOM_ELITE_PID, 1, DEVICE_TYPE_KEYBOARD, "Tecware Phantom Elite" },
|
||||
{ REDRAGON_KEYBOARD_VID, WARRIOR_KANE_TC235, 1, DEVICE_TYPE_KEYBOARD, "Warrior Kane TC235" },
|
||||
/*-------------------------------------------------------------------------------------------------------------*\
|
||||
| Mice |
|
||||
\*-------------------------------------------------------------------------------------------------------------*/
|
||||
{ REDRAGON_MOUSE_VID, REDRAGON_M711_PID, 2, DEVICE_TYPE_MOUSE, "Redragon M711 Cobra" },
|
||||
{ REDRAGON_MOUSE_VID, REDRAGON_M715_PID, 2, DEVICE_TYPE_MOUSE, "Redragon M715 Dagger" },
|
||||
/*-------------------------------------------------------------------------------------------------------------*\
|
||||
| Mousemats |
|
||||
\*-------------------------------------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------------*\
|
||||
| Keyboards |
|
||||
\*---------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
{ REDRAGON_KEYBOARD_VID, REDRAGON_K550_PID, 1, REDRAGON_KEYBOARD_USAGE_PAGE, DEVICE_TYPE_KEYBOARD, "Redragon K550 Yama" },
|
||||
{ REDRAGON_KEYBOARD_VID, REDRAGON_K552_PID, 1, REDRAGON_KEYBOARD_USAGE_PAGE, DEVICE_TYPE_KEYBOARD, "Redragon K552 Kumara" },
|
||||
{ REDRAGON_KEYBOARD_VID, REDRAGON_K556_PID, 1, REDRAGON_KEYBOARD_USAGE_PAGE, DEVICE_TYPE_KEYBOARD, "Redragon K556 Devarajas" },
|
||||
{ REDRAGON_KEYBOARD_VID, TECWARE_PHANTOM_ELITE_PID, 1, REDRAGON_KEYBOARD_USAGE_PAGE, DEVICE_TYPE_KEYBOARD, "Tecware Phantom Elite" },
|
||||
{ REDRAGON_KEYBOARD_VID, WARRIOR_KANE_TC235, 1, REDRAGON_KEYBOARD_USAGE_PAGE, DEVICE_TYPE_KEYBOARD, "Warrior Kane TC235" },
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------------*\
|
||||
| Mice |
|
||||
\*---------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
{ REDRAGON_MOUSE_VID, REDRAGON_M711_PID, 2, REDRAGON_MOUSE_USAGE_PAGE, DEVICE_TYPE_MOUSE, "Redragon M711 Cobra" },
|
||||
{ REDRAGON_MOUSE_VID, REDRAGON_M715_PID, 2, REDRAGON_MOUSE_USAGE_PAGE, DEVICE_TYPE_MOUSE, "Redragon M715 Dagger" },
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------------*\
|
||||
| Mousemats |
|
||||
\*---------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
};
|
||||
|
||||
/******************************************************************************************\
|
||||
@@ -78,45 +81,46 @@ void DetectRedragonControllers(std::vector<RGBController*>& rgb_controllers)
|
||||
//Look for Redragon RGB Peripheral
|
||||
while(info)
|
||||
{
|
||||
if((info->vendor_id == device_list[device_idx].usb_vid)
|
||||
&&(info->product_id == device_list[device_idx].usb_pid)
|
||||
if((info->vendor_id == device_list[device_idx].usb_vid)
|
||||
&&(info->product_id == device_list[device_idx].usb_pid)
|
||||
#ifdef USE_HID_USAGE
|
||||
&&(info->interface_number == device_list[device_idx].usb_interface)
|
||||
&&(info->usage_page == device_list[device_idx].usb_usage_page))
|
||||
#else
|
||||
&&(info->interface_number == device_list[device_idx].usb_interface))
|
||||
#endif
|
||||
{
|
||||
dev = hid_open_path(info->path);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
info = info->next;
|
||||
}
|
||||
}
|
||||
|
||||
if( dev )
|
||||
{
|
||||
switch(device_list[device_idx].type)
|
||||
{
|
||||
case DEVICE_TYPE_KEYBOARD:
|
||||
if( dev )
|
||||
{
|
||||
switch(device_list[device_idx].type)
|
||||
{
|
||||
RedragonK556Controller* controller = new RedragonK556Controller(dev);
|
||||
case DEVICE_TYPE_KEYBOARD:
|
||||
{
|
||||
RedragonK556Controller* controller = new RedragonK556Controller(dev);
|
||||
|
||||
RGBController_RedragonK556* rgb_controller = new RGBController_RedragonK556(controller);
|
||||
RGBController_RedragonK556* rgb_controller = new RGBController_RedragonK556(controller);
|
||||
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
break;
|
||||
|
||||
case DEVICE_TYPE_MOUSE:
|
||||
{
|
||||
RedragonM711Controller* controller = new RedragonM711Controller(dev);
|
||||
|
||||
RGBController_RedragonM711* rgb_controller = new RGBController_RedragonM711(controller);
|
||||
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case DEVICE_TYPE_MOUSE:
|
||||
{
|
||||
RedragonM711Controller* controller = new RedragonM711Controller(dev);
|
||||
|
||||
RGBController_RedragonM711* rgb_controller = new RGBController_RedragonM711(controller);
|
||||
|
||||
rgb_controller->name = device_list[device_idx].name;
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
info = info->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ enum
|
||||
enum
|
||||
{
|
||||
REDRAGON_K556_BRIGHTNESS_LOWEST = 0x00, /* Lowest brightness (off) */
|
||||
REDRAGON_K556_BRIGHTNESS_HIGHEST = 0x05, /* Highest brightness */
|
||||
REDRAGON_K556_BRIGHTNESS_HIGHEST = 0x04, /* Highest brightness */
|
||||
};
|
||||
|
||||
enum
|
||||
|
||||
@@ -2,21 +2,6 @@
|
||||
|
||||
#include <cstring>
|
||||
|
||||
static void send_usb_msg(hid_device* dev, char * data_pkt, unsigned int size)
|
||||
{
|
||||
char* usb_pkt = new char[size + 1];
|
||||
|
||||
usb_pkt[0] = 0x00;
|
||||
for(int i = 1; i < size + 1; i++)
|
||||
{
|
||||
usb_pkt[i] = data_pkt[i-1];
|
||||
}
|
||||
|
||||
hid_send_feature_report(dev, (unsigned char *)usb_pkt, size + 1);
|
||||
|
||||
delete usb_pkt;
|
||||
}
|
||||
|
||||
RedragonM711Controller::RedragonM711Controller(hid_device* dev_handle)
|
||||
{
|
||||
dev = dev_handle;
|
||||
@@ -103,7 +88,7 @@ void RedragonM711Controller::SendMouseApply()
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
send_usb_msg(dev, usb_buf, 16);
|
||||
hid_send_feature_report(dev, (unsigned char *)usb_buf, 16);
|
||||
}
|
||||
|
||||
void RedragonM711Controller::SendWritePacket
|
||||
@@ -137,5 +122,5 @@ void RedragonM711Controller::SendWritePacket
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
send_usb_msg(dev, usb_buf, 16);
|
||||
hid_send_feature_report(dev, (unsigned char *)usb_buf, 16);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*-----------------------------------------*\
|
||||
| SapphireGPUController.cpp |
|
||||
| |
|
||||
| Driver for Sapphire Nitro Glow GPU RGB |
|
||||
| lighting controller |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 7/15/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "SapphireGPUController.h"
|
||||
|
||||
SapphireGPUController::SapphireGPUController(i2c_smbus_interface* bus, sapphire_dev_id dev)
|
||||
{
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
}
|
||||
|
||||
SapphireGPUController::~SapphireGPUController()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string SapphireGPUController::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 char SapphireGPUController::GetRed()
|
||||
{
|
||||
return(bus->i2c_smbus_read_byte_data(dev, SAPPHIRE_GPU_REG_RED));
|
||||
}
|
||||
|
||||
unsigned char SapphireGPUController::GetGreen()
|
||||
{
|
||||
return(bus->i2c_smbus_read_byte_data(dev, SAPPHIRE_GPU_REG_GREEN));
|
||||
}
|
||||
|
||||
unsigned char SapphireGPUController::GetBlue()
|
||||
{
|
||||
return(bus->i2c_smbus_read_byte_data(dev, SAPPHIRE_GPU_REG_BLUE));
|
||||
}
|
||||
|
||||
void SapphireGPUController::SetColor(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, SAPPHIRE_GPU_REG_RED, red);
|
||||
bus->i2c_smbus_write_byte_data(dev, SAPPHIRE_GPU_REG_GREEN, green);
|
||||
bus->i2c_smbus_write_byte_data(dev, SAPPHIRE_GPU_REG_BLUE, blue);
|
||||
}
|
||||
|
||||
void SapphireGPUController::SetMode(unsigned char mode, unsigned char speed)
|
||||
{
|
||||
bus->i2c_smbus_write_byte_data(dev, SAPPHIRE_GPU_REG_MODE, mode);
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*-----------------------------------------*\
|
||||
| SapphireGPUController.h |
|
||||
| |
|
||||
| Definitions and types for Sapphire Nitro |
|
||||
| Glow GPU RGB lighting controller |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 7/15/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef unsigned char sapphire_dev_id;
|
||||
|
||||
enum
|
||||
{
|
||||
SAPPHIRE_GPU_REG_MODE = 0x00,
|
||||
SAPPHIRE_GPU_REG_BRIGHTNESS = 0x01,
|
||||
SAPPHIRE_GPU_REG_RED = 0x03,
|
||||
SAPPHIRE_GPU_REG_GREEN = 0x04,
|
||||
SAPPHIRE_GPU_REG_BLUE = 0x05,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
SAPPHIRE_GPU_MODE_SAPPHIRE_BLUE = 0x00,
|
||||
SAPPHIRE_GPU_MODE_RAINBOW = 0x01,
|
||||
SAPPHIRE_GPU_MODE_BOARD_TEMPERATURE = 0x02,
|
||||
SAPPHIRE_GPU_MODE_FAN_SPEED = 0x03,
|
||||
SAPPHIRE_GPU_MODE_CUSTOM = 0x04,
|
||||
SAPPHIRE_GPU_MODE_OFF = 0x05,
|
||||
};
|
||||
|
||||
class SapphireGPUController
|
||||
{
|
||||
public:
|
||||
SapphireGPUController(i2c_smbus_interface* bus, sapphire_dev_id dev);
|
||||
~SapphireGPUController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
|
||||
unsigned char GetRed();
|
||||
unsigned char GetGreen();
|
||||
unsigned char GetBlue();
|
||||
|
||||
void SetColor(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetMode(unsigned char mode, unsigned char speed);
|
||||
|
||||
private:
|
||||
i2c_smbus_interface* bus;
|
||||
sapphire_dev_id dev;
|
||||
|
||||
};
|
||||
@@ -0,0 +1,59 @@
|
||||
#include "SapphireGPUController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_SapphireGPU.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* TestForSapphireGPUController *
|
||||
* *
|
||||
* Tests the given address to see if a Sapphire GPU controller exists there. First *
|
||||
* does a quick write to test for a response *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
bool TestForSapphireGPUController(i2c_smbus_interface* bus, unsigned char address)
|
||||
{
|
||||
bool pass = false;
|
||||
int res;
|
||||
|
||||
if(bus->i2c_smbus_read_byte_data(address, 0x06) == 0xCC)
|
||||
{
|
||||
pass = true;
|
||||
}
|
||||
|
||||
return(false); //TODO - better detection, leaving disabled for now
|
||||
|
||||
} /* TestForSapphireGPUController() */
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectSapphireGPUControllers *
|
||||
* *
|
||||
* Detect Sapphire GPU controllers on the enumerated I2C busses at address 0x55. *
|
||||
* *
|
||||
* bus - pointer to i2c_smbus_interface where Sapphire GPU device is connected *
|
||||
* dev - I2C address of Sapphire GPU device *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectSapphireGPUControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers)
|
||||
{
|
||||
SapphireGPUController* new_sapphire;
|
||||
RGBController_SapphireGPU* new_controller;
|
||||
|
||||
for (unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
{
|
||||
// Check for Sapphire GPU controller at 0x55
|
||||
if (TestForSapphireGPUController(busses[bus], 0x55))
|
||||
{
|
||||
new_sapphire = new SapphireGPUController(busses[bus], 0x55);
|
||||
new_controller = new RGBController_SapphireGPU(new_sapphire);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectSapphireGPUControllers() */
|
||||
@@ -39,7 +39,6 @@ void SteelSeriesApexController::SetMode
|
||||
std::vector<RGBColor> colors
|
||||
)
|
||||
{
|
||||
unsigned char color_mode;
|
||||
unsigned char mode_colors[9];
|
||||
|
||||
active_mode = mode;
|
||||
@@ -50,7 +49,7 @@ void SteelSeriesApexController::SetMode
|
||||
|
||||
void SteelSeriesApexController::SetLEDsDirect(std::vector<RGBColor> colors)
|
||||
{
|
||||
unsigned char buf[642];
|
||||
unsigned char buf[643];
|
||||
int num_keys = sizeof(keys)/sizeof(*keys);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
@@ -61,24 +60,25 @@ void SteelSeriesApexController::SetLEDsDirect(std::vector<RGBColor> colors)
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Direct packet |
|
||||
\*-----------------------------------------------------*/
|
||||
buf[0x00] = APEX7_PACKET_ID_DIRECT;
|
||||
buf[0x01] = num_keys;
|
||||
buf[0x00] = 0;
|
||||
buf[0x01] = APEX7_PACKET_ID_DIRECT;
|
||||
buf[0x02] = num_keys;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Fill in color data |
|
||||
\*-----------------------------------------------------*/
|
||||
for(int i = 0; i < num_keys; i++)
|
||||
{
|
||||
buf[(i*4)+2] = keys[i];
|
||||
buf[(i*4)+3] = RGBGetRValue(colors[i]);
|
||||
buf[(i*4)+4] = RGBGetGValue(colors[i]);
|
||||
buf[(i*4)+5] = RGBGetBValue(colors[i]);
|
||||
buf[(i*4)+3] = keys[i];
|
||||
buf[(i*4)+4] = RGBGetRValue(colors[i]);
|
||||
buf[(i*4)+5] = RGBGetGValue(colors[i]);
|
||||
buf[(i*4)+6] = RGBGetBValue(colors[i]);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_send_feature_report(dev, buf, 642);
|
||||
hid_send_feature_report(dev, buf, 643);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------*\
|
||||
@@ -90,28 +90,15 @@ void SteelSeriesApexController::SelectProfile
|
||||
unsigned char profile
|
||||
)
|
||||
{
|
||||
unsigned char buf[64];
|
||||
unsigned char buf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer, set up first packet and send |
|
||||
| Zero out buffer, set up packet and send |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(buf, 0x00, sizeof(buf));
|
||||
buf[0x00] = 0x69;
|
||||
hid_send_feature_report(dev, buf, 64);
|
||||
buf[0x00] = 0;
|
||||
buf[0x01] = 0x89;
|
||||
buf[0x02] = profile;
|
||||
hid_send_feature_report(dev, buf, 65);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer, set up second packet and send |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(buf, 0x00, sizeof(buf));
|
||||
buf[0x00] = 0x89;
|
||||
buf[0x01] = profile;
|
||||
hid_send_feature_report(dev, buf, 64);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer, set up third packet and send |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(buf, 0x00, sizeof(buf));
|
||||
buf[0x00] = 0x41;
|
||||
hid_send_feature_report(dev, buf, 64);
|
||||
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ void ThermaltakeRiingController::SetMode(unsigned char mode, unsigned char speed
|
||||
|
||||
void ThermaltakeRiingController::SendInit()
|
||||
{
|
||||
unsigned char usb_buf[64];
|
||||
unsigned char usb_buf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
@@ -62,14 +62,15 @@ void ThermaltakeRiingController::SendInit()
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Init packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0xFE;
|
||||
usb_buf[0x01] = 0x33;
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = 0xFE;
|
||||
usb_buf[0x02] = 0x33;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 64);
|
||||
hid_read(dev, usb_buf, 64);
|
||||
hid_write(dev, usb_buf, 65);
|
||||
hid_read(dev, usb_buf, 65);
|
||||
}
|
||||
|
||||
void ThermaltakeRiingController::SendRGB
|
||||
@@ -81,7 +82,7 @@ void ThermaltakeRiingController::SendRGB
|
||||
unsigned char* color_data
|
||||
)
|
||||
{
|
||||
unsigned char usb_buf[64];
|
||||
unsigned char usb_buf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
@@ -91,19 +92,20 @@ void ThermaltakeRiingController::SendRGB
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up RGB packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x32;
|
||||
usb_buf[0x01] = 0x52;
|
||||
usb_buf[0x02] = port;
|
||||
usb_buf[0x03] = mode + ( speed & 0x03 );
|
||||
usb_buf[0x00] = 0x00;
|
||||
usb_buf[0x01] = 0x32;
|
||||
usb_buf[0x02] = 0x52;
|
||||
usb_buf[0x03] = port;
|
||||
usb_buf[0x04] = mode + ( speed & 0x03 );
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Copy in GRB color data |
|
||||
\*-----------------------------------------------------*/
|
||||
memcpy(&usb_buf[0x04], color_data, (num_colors * 3));
|
||||
memcpy(&usb_buf[0x05], color_data, (num_colors * 3));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 64);
|
||||
hid_read(dev, usb_buf, 64);
|
||||
hid_write(dev, usb_buf, 65);
|
||||
hid_read(dev, usb_buf, 65);
|
||||
}
|
||||
|
||||
+25
-12
@@ -352,8 +352,6 @@ void NetworkClient::ListenThreadFunction()
|
||||
|
||||
} while(bytes_read != sizeof(header) - sizeof(header.pkt_magic));
|
||||
|
||||
//printf( "Client: Received header, now receiving data of size %d\r\n", header.pkt_size);
|
||||
|
||||
//Header received, now receive the data
|
||||
if(header.pkt_size > 0)
|
||||
{
|
||||
@@ -376,21 +374,14 @@ void NetworkClient::ListenThreadFunction()
|
||||
} while (bytes_read < header.pkt_size);
|
||||
}
|
||||
|
||||
//printf( "Client: Received header and data\r\n" );
|
||||
//printf( "Client: Packet ID: %d \r\n", header.pkt_id);
|
||||
|
||||
//Entire request received, select functionality based on request ID
|
||||
switch(header.pkt_id)
|
||||
{
|
||||
case NET_PACKET_ID_REQUEST_CONTROLLER_COUNT:
|
||||
printf( "Client: NET_PACKET_ID_REQUEST_CONTROLLER_COUNT\r\n" );
|
||||
|
||||
ProcessReply_ControllerCount(header.pkt_size, data);
|
||||
break;
|
||||
|
||||
case NET_PACKET_ID_REQUEST_CONTROLLER_DATA:
|
||||
printf( "Client: NET_PACKET_ID_REQUEST_CONTROLLER_DATA\r\n");
|
||||
|
||||
ProcessReply_ControllerData(header.pkt_size, data, header.pkt_dev_idx);
|
||||
break;
|
||||
}
|
||||
@@ -425,6 +416,20 @@ listen_done:
|
||||
ClientInfoChanged();
|
||||
}
|
||||
|
||||
void NetworkClient::WaitOnControllerData()
|
||||
{
|
||||
for(int i = 0; i < 1000; i++)
|
||||
{
|
||||
if(controller_data_received)
|
||||
{
|
||||
break;
|
||||
}
|
||||
std::this_thread::sleep_for(1ms);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void NetworkClient::ProcessReply_ControllerCount(unsigned int data_size, char * data)
|
||||
{
|
||||
if(data_size == sizeof(unsigned int))
|
||||
@@ -439,9 +444,15 @@ void NetworkClient::ProcessReply_ControllerData(unsigned int data_size, char * d
|
||||
|
||||
new_controller->ReadDeviceDescription((unsigned char *)data);
|
||||
|
||||
printf("Received controller: %s\r\n", new_controller->name.c_str());
|
||||
|
||||
server_controllers.push_back(new_controller);
|
||||
if(dev_idx >= server_controllers.size())
|
||||
{
|
||||
server_controllers.push_back(new_controller);
|
||||
}
|
||||
else
|
||||
{
|
||||
server_controllers[dev_idx]->active_mode = new_controller->active_mode;
|
||||
delete new_controller;
|
||||
}
|
||||
|
||||
controller_data_received = true;
|
||||
}
|
||||
@@ -483,6 +494,8 @@ void NetworkClient::SendRequest_ControllerData(unsigned int dev_idx)
|
||||
{
|
||||
NetPacketHeader reply_hdr;
|
||||
|
||||
controller_data_received = false;
|
||||
|
||||
reply_hdr.pkt_magic[0] = 'O';
|
||||
reply_hdr.pkt_magic[1] = 'R';
|
||||
reply_hdr.pkt_magic[2] = 'G';
|
||||
|
||||
@@ -41,6 +41,8 @@ public:
|
||||
void ConnectionThreadFunction();
|
||||
void ListenThreadFunction();
|
||||
|
||||
void WaitOnControllerData();
|
||||
|
||||
void ProcessReply_ControllerCount(unsigned int data_size, char * data);
|
||||
void ProcessReply_ControllerData(unsigned int data_size, char * data, unsigned int dev_idx);
|
||||
|
||||
|
||||
+25
-15
@@ -427,8 +427,6 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
||||
|
||||
} while(bytes_read != sizeof(header) - sizeof(header.pkt_magic));
|
||||
|
||||
//printf( "Server: Received header, now receiving data of size %d\r\n", header.pkt_size);
|
||||
|
||||
//Header received, now receive the data
|
||||
if(header.pkt_size > 0)
|
||||
{
|
||||
@@ -451,29 +449,31 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
||||
} while (bytes_read < header.pkt_size);
|
||||
}
|
||||
|
||||
//printf( "Server: Received header and data\r\n" );
|
||||
//printf( "Server: Packet ID: %d \r\n", header.pkt_id);
|
||||
|
||||
//Entire request received, select functionality based on request ID
|
||||
switch(header.pkt_id)
|
||||
{
|
||||
case NET_PACKET_ID_REQUEST_CONTROLLER_COUNT:
|
||||
//printf( "NET_PACKET_ID_REQUEST_CONTROLLER_COUNT\r\n" );
|
||||
SendReply_ControllerCount(client_sock);
|
||||
break;
|
||||
|
||||
case NET_PACKET_ID_REQUEST_CONTROLLER_DATA:
|
||||
//printf( "NET_PACKET_ID_REQUEST_CONTROLLER_DATA\r\n" );
|
||||
SendReply_ControllerData(client_sock, header.pkt_dev_idx);
|
||||
break;
|
||||
|
||||
case NET_PACKET_ID_SET_CLIENT_NAME:
|
||||
printf( "NET_PACKET_ID_SET_CLIENT_NAME\r\n" );
|
||||
if(data == NULL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
ProcessRequest_ClientString(client_sock, header.pkt_size, data);
|
||||
break;
|
||||
|
||||
case NET_PACKET_ID_RGBCONTROLLER_RESIZEZONE:
|
||||
//printf( "NET_PACKET_ID_RGBCONTROLLER_RESIZEZONE\r\n" );
|
||||
if(data == NULL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if((header.pkt_dev_idx < controllers.size()) && (header.pkt_size == (2 * sizeof(int))))
|
||||
{
|
||||
@@ -488,7 +488,10 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
||||
break;
|
||||
|
||||
case NET_PACKET_ID_RGBCONTROLLER_UPDATELEDS:
|
||||
//printf( "NET_PACKET_ID_RGBCONTROLLER_UPDATELEDS\r\n" );
|
||||
if(data == NULL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if(header.pkt_dev_idx < controllers.size())
|
||||
{
|
||||
@@ -498,7 +501,10 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
||||
break;
|
||||
|
||||
case NET_PACKET_ID_RGBCONTROLLER_UPDATEZONELEDS:
|
||||
//printf( "NET_PACKET_ID_RGBCONTROLLER_UPDATEZONELEDS\r\n" );
|
||||
if(data == NULL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if(header.pkt_dev_idx < controllers.size())
|
||||
{
|
||||
@@ -512,7 +518,10 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
||||
break;
|
||||
|
||||
case NET_PACKET_ID_RGBCONTROLLER_UPDATESINGLELED:
|
||||
//printf( "NET_PACKET_ID_RGBCONTROLLER_UPDATESINGLELED\r\n" );
|
||||
if(data == NULL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if(header.pkt_dev_idx < controllers.size())
|
||||
{
|
||||
@@ -526,8 +535,6 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
||||
break;
|
||||
|
||||
case NET_PACKET_ID_RGBCONTROLLER_SETCUSTOMMODE:
|
||||
//printf( "NET_PACKET_ID_RGBCONTROLLER_SETCUSTOMMODE\r\n" );
|
||||
|
||||
if(header.pkt_dev_idx < controllers.size())
|
||||
{
|
||||
controllers[header.pkt_dev_idx]->SetCustomMode();
|
||||
@@ -535,7 +542,10 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
||||
break;
|
||||
|
||||
case NET_PACKET_ID_RGBCONTROLLER_UPDATEMODE:
|
||||
//printf( "NET_PACKET_ID_RGBCONTROLLER_UPDATEMODE\r\n" );
|
||||
if(data == NULL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if(header.pkt_dev_idx < controllers.size())
|
||||
{
|
||||
|
||||
+9
-1
@@ -424,6 +424,8 @@ void DetectRGBFusionGPUControllers(std::vector<i2c_smbus_interface*>& busses, st
|
||||
void DetectRGBFusion2SMBusControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
|
||||
void DetectRGBFusion2DRAMControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
|
||||
void DetectMSIGPUControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
|
||||
void DetectSapphireGPUControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
|
||||
void DetectGalaxGPUControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
|
||||
void DetectMSIMysticLightControllers(std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectMSIRGBControllers(std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectAuraUSBControllers(std::vector<RGBController*> &rgb_controllers);
|
||||
@@ -441,6 +443,7 @@ void DetectCorsairPeripheralControllers(std::vector<RGBController*>& rgb_control
|
||||
void DetectCorsairLightingNodeControllers(std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectFaustusControllers(std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectHyperXKeyboardControllers(std::vector<RGBController*>& rgb_controllers);
|
||||
void DetectHyperXMouseControllers(std::vector<RGBController*>& rgb_controllers);
|
||||
void DetectThermaltakeRiingControllers(std::vector<RGBController*>& rgb_controllers);
|
||||
void DetectRGBFusion2USBControllers(std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectRedragonControllers(std::vector<RGBController*>& rgb_controllers);
|
||||
@@ -449,6 +452,7 @@ void DetectNZXTKrakenControllers(std::vector<RGBController*>& rgb_controllers);
|
||||
void DetectSteelSeriesControllers(std::vector<RGBController*>& rgb_controllers);
|
||||
void DetectGloriousModelOControllers(std::vector<RGBController*>& rgb_controllers);
|
||||
void DetectDuckyKeyboardControllers(std::vector<RGBController*>& rgb_controllers);
|
||||
void DetectEKControllers(std::vector<RGBController*>& rgb_controllers);
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
@@ -467,18 +471,20 @@ void DetectRGBControllers(void)
|
||||
DetectCorsairVengeanceControllers(busses, rgb_controllers);
|
||||
DetectCorsairVengeanceProControllers(busses, rgb_controllers);
|
||||
DetectCrucialControllers(busses, rgb_controllers);
|
||||
DetectGalaxGPUControllers(busses, rgb_controllers);
|
||||
DetectHyperXDRAMControllers(busses, rgb_controllers);
|
||||
DetectPatriotViperControllers(busses, rgb_controllers);
|
||||
DetectPolychromeControllers(busses, rgb_controllers);
|
||||
DetectRGBFusionGPUControllers(busses, rgb_controllers);
|
||||
DetectMSIGPUControllers(busses, rgb_controllers);
|
||||
DetectSapphireGPUControllers(busses, rgb_controllers);
|
||||
|
||||
//TODO: Implement better detection before enabling these controllers
|
||||
//DetectRGBFusion2SMBusControllers(busses, rgb_controllers);
|
||||
//DetectRGBFusion2DRAMControllers(busses, rgb_controllers);
|
||||
|
||||
DetectRGBFusionControllers(busses, rgb_controllers);
|
||||
DetectMSIMysticLightControllers(rgb_controllers);
|
||||
//DetectMSIMysticLightControllers(rgb_controllers);
|
||||
DetectMSIRGBControllers(rgb_controllers);
|
||||
|
||||
DetectAuraUSBControllers(rgb_controllers);
|
||||
@@ -492,6 +498,7 @@ void DetectRGBControllers(void)
|
||||
DetectMSI3ZoneControllers(rgb_controllers);
|
||||
DetectPoseidonZRGBControllers(rgb_controllers);
|
||||
DetectHyperXKeyboardControllers(rgb_controllers);
|
||||
//DetectHyperXMouseControllers(rgb_controllers);
|
||||
DetectCorsairPeripheralControllers(rgb_controllers);
|
||||
DetectCorsairLightingNodeControllers(rgb_controllers);
|
||||
DetectThermaltakeRiingControllers(rgb_controllers);
|
||||
@@ -502,6 +509,7 @@ void DetectRGBControllers(void)
|
||||
DetectSteelSeriesControllers(rgb_controllers);
|
||||
DetectGloriousModelOControllers(rgb_controllers);
|
||||
DetectDuckyKeyboardControllers(rgb_controllers);
|
||||
DetectEKControllers(rgb_controllers);
|
||||
|
||||
DetectE131Controllers(rgb_controllers);
|
||||
|
||||
|
||||
+40
-3
@@ -16,7 +16,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
#-----------------------------------------------------------------------#
|
||||
# Application Configuration #
|
||||
#-----------------------------------------------------------------------#
|
||||
VERSION = 0.21
|
||||
VERSION = 0.31
|
||||
TARGET = OpenRGB
|
||||
TEMPLATE = app
|
||||
|
||||
@@ -59,10 +59,12 @@ INCLUDEPATH += \
|
||||
Controllers/CorsairVengeanceProController/ \
|
||||
Controllers/CrucialController/ \
|
||||
Controllers/DuckyKeyboardController/ \
|
||||
Controllers/GalaxGPUController/ \
|
||||
Controllers/GloriousModelOController/ \
|
||||
Controllers/HuePlusController/ \
|
||||
Controllers/HyperXDRAMController/ \
|
||||
Controllers/HyperXKeyboardController/ \
|
||||
Controllers/HyperXMouseController/ \
|
||||
Controllers/LEDStripController/ \
|
||||
Controllers/LogitechController/ \
|
||||
Controllers/MSI3ZoneController/ \
|
||||
@@ -80,6 +82,7 @@ INCLUDEPATH += \
|
||||
Controllers/RGBFusion2SMBusController/ \
|
||||
Controllers/RGBFusion2USBController/ \
|
||||
Controllers/RGBFusionGPUController/ \
|
||||
Controllers/SapphireGPUController/ \
|
||||
Controllers/SteelSeriesController/ \
|
||||
Controllers/ThermaltakeRiingController/ \
|
||||
RGBController/ \
|
||||
@@ -98,6 +101,7 @@ HEADERS += \
|
||||
i2c_smbus/i2c_smbus.h \
|
||||
i2c_tools/i2c_tools.h \
|
||||
net_port/net_port.h \
|
||||
qt/DeviceView.h \
|
||||
qt/OpenRGBDialog2.h \
|
||||
qt/OpenRGBProfileSaveDialog.h \
|
||||
qt/OpenRGBServerInfoPage.h \
|
||||
@@ -121,11 +125,14 @@ HEADERS += \
|
||||
Controllers/CorsairVengeanceProController/CorsairVengeanceProController.h \
|
||||
Controllers/CrucialController/CrucialController.h \
|
||||
Controllers/DuckyKeyboardController/DuckyKeyboardController.h \
|
||||
Controllers/EKController/EKController.h \
|
||||
Controllers/GalaxGPUController/GalaxGPUController.h \
|
||||
Controllers/GloriousModelOController/GloriousModelOController.h \
|
||||
Controllers/HuePlusController/HuePlusController.h \
|
||||
Controllers/HyperXDRAMController/HyperXDRAMController.h \
|
||||
Controllers/HyperXKeyboardController/HyperXAlloyOriginsController.h \
|
||||
Controllers/HyperXKeyboardController/HyperXKeyboardController.h \
|
||||
Controllers/HyperXMouseController/HyperXPulsefireSurgeController..h \
|
||||
Controllers/LEDStripController/LEDStripController.h \
|
||||
Controllers/LogitechController/LogitechG203Controller.h \
|
||||
Controllers/LogitechController/LogitechG403Controller.h \
|
||||
@@ -146,6 +153,7 @@ HEADERS += \
|
||||
Controllers/RGBFusionGPUController/RGBFusionGPUController.h \
|
||||
Controllers/RedragonController/RedragonK556Controller.h \
|
||||
Controllers/RedragonController/RedragonM711Controller.h \
|
||||
Controllers/SapphireGPUController/SapphireGPUController.h \
|
||||
Controllers/SteelSeriesController/SteelSeriesRivalController.h \
|
||||
Controllers/SteelSeriesController/SteelSeriesSiberiaController.h \
|
||||
Controllers/SteelSeriesController/SteelSeriesApexController.h \
|
||||
@@ -164,12 +172,15 @@ HEADERS += \
|
||||
RGBController/RGBController_Crucial.h \
|
||||
RGBController/RGBController_DuckyKeyboard.h \
|
||||
RGBController/RGBController_Dummy.h \
|
||||
RGBController/RGBController_EKController.h \
|
||||
RGBController/RGBController_E131.h \
|
||||
RGBController/RGBController_GalaxGPU.h \
|
||||
RGBController/RGBController_GloriousModelO.h \
|
||||
RGBController/RGBController_HuePlus.h \
|
||||
RGBController/RGBController_HyperXAlloyOrigins.h \
|
||||
RGBController/RGBController_HyperXDRAM.h \
|
||||
RGBController/RGBController_HyperXKeyboard.h \
|
||||
RGBController/RGBController_HyperXPulsefireSurge.h \
|
||||
RGBController/RGBController_LEDStrip.h \
|
||||
RGBController/RGBController_LogitechG203.h \
|
||||
RGBController/RGBController_LogitechG403.h \
|
||||
@@ -192,6 +203,7 @@ HEADERS += \
|
||||
RGBController/RGBController_RGBFusion2SMBus.h \
|
||||
RGBController/RGBController_RGBFusion2USB.h \
|
||||
RGBController/RGBController_RGBFusionGPU.h \
|
||||
RGBController/RGBController_SapphireGPU.h \
|
||||
RGBController/RGBController_SteelSeriesRival.h \
|
||||
RGBController/RGBController_SteelSeriesSiberia.h \
|
||||
RGBController/RGBController_SteelSeriesApex.h \
|
||||
@@ -214,6 +226,7 @@ SOURCES += \
|
||||
i2c_smbus/i2c_smbus.cpp \
|
||||
i2c_tools/i2c_tools.cpp \
|
||||
net_port/net_port.cpp \
|
||||
qt/DeviceView.cpp \
|
||||
qt/OpenRGBDialog2.cpp \
|
||||
qt/OpenRGBProfileSaveDialog.cpp \
|
||||
qt/OpenRGBServerInfoPage.cpp \
|
||||
@@ -249,6 +262,10 @@ SOURCES += \
|
||||
Controllers/CrucialController/CrucialControllerDetect.cpp \
|
||||
Controllers/DuckyKeyboardController/DuckyKeyboardController.cpp \
|
||||
Controllers/DuckyKeyboardController/DuckyKeyboardControllerDetect.cpp \
|
||||
Controllers/EKController/EKControllerDetect.cpp \
|
||||
Controllers/EKController/EKController.cpp \
|
||||
Controllers/GalaxGPUController/GalaxGPUController.cpp \
|
||||
Controllers/GalaxGPUController/GalaxGPUControllerDetect.cpp \
|
||||
Controllers/GloriousModelOController/GloriousModelOController.cpp \
|
||||
Controllers/GloriousModelOController/GloriousModelOControllerDetect.cpp \
|
||||
Controllers/HuePlusController/HuePlusController.cpp \
|
||||
@@ -258,6 +275,8 @@ SOURCES += \
|
||||
Controllers/HyperXKeyboardController/HyperXAlloyOriginsController.cpp \
|
||||
Controllers/HyperXKeyboardController/HyperXKeyboardController.cpp \
|
||||
Controllers/HyperXKeyboardController/HyperXKeyboardControllerDetect.cpp \
|
||||
Controllers/HyperXMouseController/HyperXMouseControllerDetect.cpp \
|
||||
Controllers/HyperXMouseController/HyperXPulsefireSurgeController.cpp \
|
||||
Controllers/LEDStripController/LEDStripController.cpp \
|
||||
Controllers/LEDStripController/LEDStripControllerDetect.cpp \
|
||||
Controllers/LogitechController/LogitechControllerDetect.cpp \
|
||||
@@ -295,6 +314,8 @@ SOURCES += \
|
||||
Controllers/RedragonController/RedragonK556Controller.cpp \
|
||||
Controllers/RedragonController/RedragonM711Controller.cpp \
|
||||
Controllers/RedragonController/RedragonControllerDetect.cpp \
|
||||
Controllers/SapphireGPUController/SapphireGPUController.cpp \
|
||||
Controllers/SapphireGPUController/SapphireGPUControllerDetect.cpp \
|
||||
Controllers/SteelSeriesController/SteelSeriesRivalController.cpp \
|
||||
Controllers/SteelSeriesController/SteelSeriesSiberiaController.cpp \
|
||||
Controllers/SteelSeriesController/SteelSeriesApexController.cpp \
|
||||
@@ -316,11 +337,14 @@ SOURCES += \
|
||||
RGBController/RGBController_Crucial.cpp \
|
||||
RGBController/RGBController_DuckyKeyboard.cpp \
|
||||
RGBController/RGBController_Dummy.cpp \
|
||||
RGBController/RGBController_EKController.cpp \
|
||||
RGBController/RGBController_GalaxGPU.cpp \
|
||||
RGBController/RGBController_GloriousModelO.cpp \
|
||||
RGBController/RGBController_HuePlus.cpp \
|
||||
RGBController/RGBController_HyperXAlloyOrigins.cpp \
|
||||
RGBController/RGBController_HyperXDRAM.cpp \
|
||||
RGBController/RGBController_HyperXKeyboard.cpp \
|
||||
RGBController/RGBController_HyperXPulsefireSurge.cpp \
|
||||
RGBController/RGBController_E131.cpp \
|
||||
RGBController/RGBController_LEDStrip.cpp \
|
||||
RGBController/RGBController_LogitechG203.cpp \
|
||||
@@ -343,6 +367,7 @@ SOURCES += \
|
||||
RGBController/RGBController_RGBFusion2SMBus.cpp \
|
||||
RGBController/RGBController_RGBFusion2USB.cpp \
|
||||
RGBController/RGBController_RGBFusionGPU.cpp \
|
||||
RGBController/RGBController_SapphireGPU.cpp \
|
||||
RGBController/RGBController_SteelSeriesRival.cpp \
|
||||
RGBController/RGBController_SteelSeriesSiberia.cpp \
|
||||
RGBController/RGBController_SteelSeriesApex.cpp \
|
||||
@@ -376,7 +401,7 @@ win32:INCLUDEPATH += \
|
||||
wmi/ \
|
||||
|
||||
win32:SOURCES += \
|
||||
dependencies/hidapi/hidapi.c \
|
||||
# dependencies/hidapi/hidapi.c \
|
||||
dependencies/NVFC/nvapi.cpp \
|
||||
i2c_smbus/i2c_smbus_amdadl.cpp \
|
||||
i2c_smbus/i2c_smbus_i801.cpp \
|
||||
@@ -406,6 +431,7 @@ win32:contains(QMAKE_TARGET.arch, x86_64) {
|
||||
-lws2_32 \
|
||||
-L"$$PWD/dependencies/inpout32_1501/x64/" -linpoutx64 \
|
||||
-L"$$PWD/dependencies/libusb-1.0.22/MS64/dll" -llibusb-1.0 \
|
||||
-L"$$PWD/dependencies/hidapi-win/x64/" -lhidapi \
|
||||
}
|
||||
|
||||
win32:contains(QMAKE_TARGET.arch, x86) {
|
||||
@@ -413,17 +439,19 @@ win32:contains(QMAKE_TARGET.arch, x86) {
|
||||
-lws2_32 \
|
||||
-L"$$PWD/dependencies/inpout32_1501/Win32/" -linpout32 \
|
||||
-L"$$PWD/dependencies/libusb-1.0.22/MS32/dll" -llibusb-1.0 \
|
||||
-L"$$PWD/dependencies/hidapi-win/x86/" -lhidapi \
|
||||
}
|
||||
|
||||
win32:DEFINES -= \
|
||||
UNICODE
|
||||
|
||||
win32:DEFINES += \
|
||||
USE_HID_USAGE \
|
||||
_MBCS \
|
||||
WIN32 \
|
||||
_CRT_SECURE_NO_WARNINGS \
|
||||
_WINSOCK_DEPRECATED_NO_WARNINGS \
|
||||
WIN32_LEAN_AND_MEAN
|
||||
WIN32_LEAN_AND_MEAN \
|
||||
|
||||
win32:RC_ICONS += \
|
||||
qt/OpenRGB.ico
|
||||
@@ -452,6 +480,7 @@ win32:contains(QMAKE_TARGET.arch, x86_64) {
|
||||
copydata.commands = $(COPY_FILE) \"$$shell_path($$PWD/dependencies/openrazer-win32/OpenRazer64.dll )\" \"$$shell_path($$DESTDIR)\" $$escape_expand(\n\t)
|
||||
copydata.commands += $(COPY_FILE) \"$$shell_path($$PWD/dependencies/inpout32_1501/x64/inpoutx64.dll )\" \"$$shell_path($$DESTDIR)\" $$escape_expand(\n\t)
|
||||
copydata.commands += $(COPY_FILE) \"$$shell_path($$PWD/dependencies/libusb-1.0.22/MS64/dll/libusb-1.0.dll)\" \"$$shell_path($$DESTDIR)\" $$escape_expand(\n\t)
|
||||
copydata.commands += $(COPY_FILE) \"$$shell_path($$PWD/dependencies/hidapi-win/x64/hidapi.dll )\" \"$$shell_path($$DESTDIR)\" $$escape_expand(\n\t)
|
||||
first.depends = $(first) copydata
|
||||
export(first.depends)
|
||||
export(copydata.commands)
|
||||
@@ -462,6 +491,7 @@ win32:contains(QMAKE_TARGET.arch, x86) {
|
||||
copydata.commands = $(COPY_FILE) \"$$shell_path($$PWD/dependencies/openrazer-win32/OpenRazer.dll )\" \"$$shell_path($$DESTDIR)\" $$escape_expand(\n\t)
|
||||
copydata.commands += $(COPY_FILE) \"$$shell_path($$PWD/dependencies/inpout32_1501/Win32/inpout32.dll )\" \"$$shell_path($$DESTDIR)\" $$escape_expand(\n\t)
|
||||
copydata.commands += $(COPY_FILE) \"$$shell_path($$PWD/dependencies/libusb-1.0.22/MS32/dll/libusb-1.0.dll)\" \"$$shell_path($$DESTDIR)\" $$escape_expand(\n\t)
|
||||
copydata.commands += $(COPY_FILE) \"$$shell_path($$PWD/dependencies/hidapi-win/x86/hidapi.dll )\" \"$$shell_path($$DESTDIR)\" $$escape_expand(\n\t)
|
||||
|
||||
first.depends = $(first) copydata
|
||||
export(first.depends)
|
||||
@@ -520,6 +550,13 @@ unix:!macx {
|
||||
INSTALLS += target desktop pixmap
|
||||
}
|
||||
|
||||
unix:!macx:CONFIG(asan) {
|
||||
message("ASan Mode")
|
||||
QMAKE_CFLAGS=-fsanitize=address
|
||||
QMAKE_CXXFLAGS=-fsanitize=address
|
||||
QMAKE_LFLAGS=-fsanitize=address
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------#
|
||||
# MacOS-specific Configuration #
|
||||
#-----------------------------------------------------------------------#
|
||||
|
||||
@@ -19,9 +19,13 @@ See the [Project Wiki](https://gitlab.com/CalcProgrammer1/OpenRGB/-/wikis/home)
|
||||
|
||||
## WARNING!
|
||||
|
||||
This project provides a tool to probe the SMBus. This is a potentially dangerous operation if you don't know what you're doing. Exercise caution when clicking the Detect Devices or Dump Device buttons. There have been reports of Gigabyte motherboards having serious issues (bricking the RGB or bricking the entire board) when dumping certain devices. On the same lines, exercise the same caution when using the i2cdump and i2cdetect commands on Linux, as they perform the same functionality. OpenRGB is not liable for damage caused by improper SMBus access.
|
||||
This project interacts directly with hardware using reverse engineered protocols. While we do our best to make sure we're sending the right data, there is always some risk in sending data to hardware when we don't understand exactly how that hardware works.
|
||||
|
||||
As of now, only Gigabyte RGB Fusion 2.0 boards have been reported to have issues.
|
||||
There have been two instances of hardware damage in OpenRGB's development and we've taken precautions to prevent it from happening again.
|
||||
|
||||
* The MSI Mystic Light code reportedly bricked the RGB on certain MSI boards when sending certain modes. This code has been disabled and MSI Mystic Light motherboards will not work with OpenRGB at this time.
|
||||
* There were reports of bricked Gigabyte Aorus Z390 motherboards caused by dumping SMBus address 0x68 in an attempt to reverse engineer the RGB. Due to this, the SMBus Tools page on OpenRGB is hidden by default now as it has no real use to non-developers. Additionally, the RGB Fusion 2 SMBus code is disabled by default because, although it works on boards it is meant for, probing this address (0x68) could damage Gigabyte Z390 boards.
|
||||
* To enable the MSI Mystic Light or Gigabyte RGB Fusion 2 SMBus code, you must uncomment the functions in main.cpp and recompile.
|
||||
|
||||

|
||||
|
||||
@@ -37,11 +41,7 @@ As of now, only Gigabyte RGB Fusion 2.0 boards have been reported to have issues
|
||||
|
||||
### USB Access
|
||||
|
||||
* Some USB devices (especially keyboards and mice) require installation of the WinUSB driver. You can do this with Zadig:
|
||||
- Download Zadig: https://zadig.akeo.ie/
|
||||
- Select "list all devices" from the menu
|
||||
- Select the last interface (highest number) of your device
|
||||
- With "WinUSB" selected, click Install
|
||||
* Previous versions of OpenRGB used the WinUSB driver, installed using Zadig. This is no longer required, and you need to uninstall the WinUSB driver if you previously installed it. You can uninstall the WinUSB driver by following [this guide](https://gitlab.com/CalcProgrammer1/OpenRGB/-/wikis/Frequently-Asked-Questions#i-installed-the-winusb-driver-for-a-device-and-i-wish-to-uninstall-it).
|
||||
|
||||
## Linux
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -894,6 +894,14 @@ void RGBController::SetModeDescription(unsigned char* data_buf)
|
||||
memcpy(&mode_idx, &data_buf[data_ptr], sizeof(int));
|
||||
data_ptr += sizeof(int);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Check if we aren't reading beyond the list of modes. |
|
||||
\*---------------------------------------------------------*/
|
||||
if(((size_t) mode_idx) > modes.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Get pointer to target mode |
|
||||
\*---------------------------------------------------------*/
|
||||
@@ -990,8 +998,6 @@ void RGBController::SetModeDescription(unsigned char* data_buf)
|
||||
|
||||
new_mode->colors.push_back(new_color);
|
||||
}
|
||||
|
||||
printf("read data ptr %d\r\n", data_ptr);
|
||||
}
|
||||
|
||||
unsigned char * RGBController::GetColorDescription()
|
||||
@@ -1051,6 +1057,14 @@ void RGBController::SetColorDescription(unsigned char* data_buf)
|
||||
memcpy(&num_colors, &data_buf[data_ptr], sizeof(unsigned short));
|
||||
data_ptr += sizeof(unsigned short);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Check if we aren't reading beyond the list of colors. |
|
||||
\*---------------------------------------------------------*/
|
||||
if(((size_t) num_colors) > colors.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Copy in colors |
|
||||
\*---------------------------------------------------------*/
|
||||
@@ -1132,6 +1146,14 @@ void RGBController::SetZoneColorDescription(unsigned char* data_buf)
|
||||
memcpy(&zone_idx, &data_buf[data_ptr], sizeof(zone_idx));
|
||||
data_ptr += sizeof(zone_idx);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Check if we aren't reading beyond the list of zones. |
|
||||
\*---------------------------------------------------------*/
|
||||
if(((size_t) zone_idx) > zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Copy in number of colors (data) |
|
||||
\*---------------------------------------------------------*/
|
||||
@@ -1186,12 +1208,20 @@ void RGBController::SetSingleLEDColorDescription(unsigned char* data_buf)
|
||||
| RGBColor: LED color |
|
||||
\*---------------------------------------------------------*/
|
||||
int led_idx;
|
||||
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Copy in LED index |
|
||||
\*---------------------------------------------------------*/
|
||||
memcpy(&led_idx, &data_buf[0], sizeof(led_idx));
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Check if we aren't reading beyond the list of leds. |
|
||||
\*---------------------------------------------------------*/
|
||||
if(((size_t) led_idx) > leds.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Copy in LED color |
|
||||
\*---------------------------------------------------------*/
|
||||
@@ -1297,9 +1327,36 @@ void RGBController::SetMode(int mode)
|
||||
UpdateMode();
|
||||
}
|
||||
|
||||
void RGBController::RegisterUpdateCallback(RGBControllerCallback new_callback, void * new_callback_arg)
|
||||
{
|
||||
UpdateCallbacks.push_back(new_callback);
|
||||
UpdateCallbackArgs.push_back(new_callback_arg);
|
||||
}
|
||||
|
||||
void RGBController::SignalUpdate()
|
||||
{
|
||||
UpdateMutex.lock();
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Client info has changed, call the callbacks |
|
||||
\*-------------------------------------------------*/
|
||||
for(unsigned int callback_idx = 0; callback_idx < UpdateCallbacks.size(); callback_idx++)
|
||||
{
|
||||
UpdateCallbacks[callback_idx](UpdateCallbackArgs[callback_idx]);
|
||||
}
|
||||
|
||||
UpdateMutex.unlock();
|
||||
}
|
||||
void RGBController::UpdateLEDs()
|
||||
{
|
||||
CallFlag_UpdateLEDs = true;
|
||||
|
||||
SignalUpdate();
|
||||
}
|
||||
|
||||
void RGBController::UpdateMode()
|
||||
{
|
||||
CallFlag_UpdateMode = true;
|
||||
}
|
||||
|
||||
void RGBController::DeviceUpdateLEDs()
|
||||
@@ -1307,12 +1364,23 @@ void RGBController::DeviceUpdateLEDs()
|
||||
|
||||
}
|
||||
|
||||
void RGBController::DeviceUpdateMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController::DeviceCallThreadFunction()
|
||||
{
|
||||
CallFlag_UpdateLEDs = false;
|
||||
CallFlag_UpdateMode = false;
|
||||
|
||||
while(DeviceThreadRunning.load() == true)
|
||||
{
|
||||
if(CallFlag_UpdateMode.load() == true)
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
CallFlag_UpdateMode = false;
|
||||
}
|
||||
if(CallFlag_UpdateLEDs.load() == true)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
#include <mutex>
|
||||
|
||||
typedef unsigned int RGBColor;
|
||||
|
||||
@@ -139,6 +140,8 @@ typedef struct
|
||||
matrix_map_type * matrix_map; /* Matrix map pointer */
|
||||
} zone;
|
||||
|
||||
typedef void (*RGBControllerCallback)(void *);
|
||||
|
||||
class RGBController
|
||||
{
|
||||
public:
|
||||
@@ -188,11 +191,14 @@ public:
|
||||
unsigned char * GetSingleLEDColorDescription(int led);
|
||||
void SetSingleLEDColorDescription(unsigned char* data_buf);
|
||||
|
||||
void RegisterUpdateCallback(RGBControllerCallback new_callback, void * new_callback_arg);
|
||||
void SignalUpdate();
|
||||
|
||||
void UpdateLEDs();
|
||||
//void UpdateZoneLEDs(int zone);
|
||||
//void UpdateSingleLED(int led);
|
||||
|
||||
//void UpdateMode();
|
||||
void UpdateMode();
|
||||
|
||||
void DeviceCallThreadFunction();
|
||||
|
||||
@@ -207,15 +213,20 @@ public:
|
||||
virtual void UpdateZoneLEDs(int zone) = 0;
|
||||
virtual void UpdateSingleLED(int led) = 0;
|
||||
|
||||
virtual void UpdateMode() = 0;
|
||||
virtual void DeviceUpdateMode() = 0;
|
||||
|
||||
virtual void SetCustomMode() = 0;
|
||||
|
||||
private:
|
||||
std::thread* DeviceCallThread;
|
||||
std::atomic<bool> CallFlag_UpdateLEDs;
|
||||
std::atomic<bool> CallFlag_UpdateMode;
|
||||
std::atomic<bool> DeviceThreadRunning;
|
||||
//bool CallFlag_UpdateZoneLEDs = false;
|
||||
//bool CallFlag_UpdateSingleLED = false;
|
||||
//bool CallFlag_UpdateMode = false;
|
||||
|
||||
std::mutex UpdateMutex;
|
||||
std::vector<RGBControllerCallback> UpdateCallbacks;
|
||||
std::vector<void *> UpdateCallbackArgs;
|
||||
};
|
||||
|
||||
@@ -199,7 +199,7 @@ void RGBController_AMDWraithPrism::SetCustomMode()
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_AMDWraithPrism::UpdateMode()
|
||||
void RGBController_AMDWraithPrism::DeviceUpdateMode()
|
||||
{
|
||||
bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void UpdateMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
AMDWraithPrismController* wraith;
|
||||
|
||||
@@ -102,7 +102,7 @@ void RGBController_AuraCore::SetCustomMode()
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_AuraCore::UpdateMode()
|
||||
void RGBController_AuraCore::DeviceUpdateMode()
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void UpdateMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
AuraCoreController* aura;
|
||||
|
||||
@@ -173,7 +173,7 @@ void RGBController_AuraGPU::SetCustomMode()
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_AuraGPU::UpdateMode()
|
||||
void RGBController_AuraGPU::DeviceUpdateMode()
|
||||
{
|
||||
int new_mode = modes[active_mode].value;
|
||||
aura_gpu->direct = false;
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void UpdateMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
AuraGPUController* aura_gpu;
|
||||
|
||||
@@ -330,7 +330,7 @@ void RGBController_AuraSMBus::SetCustomMode()
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_AuraSMBus::UpdateMode()
|
||||
void RGBController_AuraSMBus::DeviceUpdateMode()
|
||||
{
|
||||
if (modes[active_mode].value == 0xFFFF)
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void UpdateMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
AuraSMBusController* aura;
|
||||
|
||||
@@ -175,6 +175,11 @@ void RGBController_AuraUSB::SetupZones()
|
||||
|
||||
void RGBController_AuraUSB::ResizeZone(int zone, int new_size)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
@@ -208,7 +213,7 @@ void RGBController_AuraUSB::SetCustomMode()
|
||||
|
||||
}
|
||||
|
||||
void RGBController_AuraUSB::UpdateMode()
|
||||
void RGBController_AuraUSB::DeviceUpdateMode()
|
||||
{
|
||||
unsigned char red = 0;
|
||||
unsigned char grn = 0;
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void UpdateMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
AuraUSBController* aura;
|
||||
|
||||
@@ -11,14 +11,15 @@
|
||||
|
||||
RGBController_CMMP750Controller::RGBController_CMMP750Controller(CMMP750Controller* cmmp_ptr)
|
||||
{
|
||||
cmmp750 = cmmp_ptr;
|
||||
cmmp750 = cmmp_ptr;
|
||||
unsigned char speed = cmmp750->GetLedSpeed();
|
||||
|
||||
name = cmmp750->GetDeviceName();
|
||||
type = DEVICE_TYPE_MOUSEMAT;
|
||||
description = cmmp750->GetDeviceName();
|
||||
version = "1.0";
|
||||
serial = "";
|
||||
location = cmmp750->GetLocation();
|
||||
name = cmmp750->GetDeviceName();
|
||||
type = DEVICE_TYPE_MOUSEMAT;
|
||||
description = cmmp750->GetDeviceName();
|
||||
version = "1.0";
|
||||
serial = "";
|
||||
location = cmmp750->GetLocation();
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
@@ -34,7 +35,7 @@ RGBController_CMMP750Controller::RGBController_CMMP750Controller(CMMP750Controll
|
||||
Blink.speed_min = MP750_SPEED_SLOWEST;
|
||||
Blink.speed_max = MP750_SPEED_FASTEST;
|
||||
Blink.color_mode = MODE_COLORS_PER_LED;
|
||||
Blink.speed = MP750_SPEED_NORMAL;
|
||||
Blink.speed = speed;
|
||||
modes.push_back(Blink);
|
||||
|
||||
mode Breathing;
|
||||
@@ -44,7 +45,7 @@ RGBController_CMMP750Controller::RGBController_CMMP750Controller(CMMP750Controll
|
||||
Breathing.speed_min = MP750_SPEED_SLOWEST;
|
||||
Breathing.speed_max = MP750_SPEED_FASTEST;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.speed = MP750_SPEED_NORMAL;
|
||||
Breathing.speed = speed;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode ColorCycle;
|
||||
@@ -54,7 +55,7 @@ RGBController_CMMP750Controller::RGBController_CMMP750Controller(CMMP750Controll
|
||||
ColorCycle.speed_min = MP750_SPEED_SLOWEST;
|
||||
ColorCycle.speed_max = MP750_SPEED_FASTEST;
|
||||
ColorCycle.color_mode = MODE_COLORS_NONE;
|
||||
ColorCycle.speed = MP750_SPEED_NORMAL;
|
||||
ColorCycle.speed = speed;
|
||||
modes.push_back(ColorCycle);
|
||||
|
||||
mode BreathCycle;
|
||||
@@ -64,10 +65,11 @@ RGBController_CMMP750Controller::RGBController_CMMP750Controller(CMMP750Controll
|
||||
BreathCycle.speed_min = MP750_SPEED_SLOWEST;
|
||||
BreathCycle.speed_max = MP750_SPEED_FASTEST;
|
||||
BreathCycle.color_mode = MODE_COLORS_NONE;
|
||||
BreathCycle.speed = MP750_SPEED_NORMAL;
|
||||
BreathCycle.speed = speed;
|
||||
modes.push_back(BreathCycle);
|
||||
|
||||
SetupZones();
|
||||
active_mode = cmmp750->GetMode();
|
||||
}
|
||||
|
||||
RGBController_CMMP750Controller::~RGBController_CMMP750Controller()
|
||||
@@ -91,6 +93,18 @@ void RGBController_CMMP750Controller::SetupZones()
|
||||
leds.push_back(MP_led);
|
||||
|
||||
SetupColors();
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Initialize colors for each LED |
|
||||
\*---------------------------------------------------------*/
|
||||
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
|
||||
{
|
||||
unsigned char red = cmmp750->GetLedRed();
|
||||
unsigned char grn = cmmp750->GetLedGreen();
|
||||
unsigned char blu = cmmp750->GetLedBlue();
|
||||
|
||||
colors[led_idx] = ToRGBColor(red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_CMMP750Controller::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
@@ -127,7 +141,7 @@ void RGBController_CMMP750Controller::SetCustomMode()
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_CMMP750Controller::UpdateMode()
|
||||
void RGBController_CMMP750Controller::DeviceUpdateMode()
|
||||
{
|
||||
switch(modes[active_mode].value)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,9 @@ public:
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void UpdateMode();
|
||||
void DeviceUpdateMode();
|
||||
private:
|
||||
CMMP750Controller* cmmp750;
|
||||
|
||||
int GetDeviceMode();
|
||||
};
|
||||
|
||||
@@ -231,6 +231,11 @@ void RGBController_CorsairLightingNode::SetupZones()
|
||||
|
||||
void RGBController_CorsairLightingNode::ResizeZone(int zone, int new_size)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
@@ -264,7 +269,7 @@ void RGBController_CorsairLightingNode::SetCustomMode()
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_CorsairLightingNode::UpdateMode()
|
||||
void RGBController_CorsairLightingNode::DeviceUpdateMode()
|
||||
{
|
||||
if(modes[active_mode].value == 0xFFFF)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void UpdateMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CorsairLightingNodeController* corsair;
|
||||
|
||||
@@ -53,7 +53,7 @@ static const char* led_names[] =
|
||||
"Key: A", //15
|
||||
"Key: Left Windows", //17
|
||||
"Key: Print Screen", //18
|
||||
"Media Mute", //20
|
||||
"Key: Media Mute", //20
|
||||
"Key: Number Pad 8", //21
|
||||
"Key: F2", //24
|
||||
"Key: 2", //25
|
||||
@@ -63,7 +63,7 @@ static const char* led_names[] =
|
||||
"Key: Left Alt", //29
|
||||
"Key: Scroll Lock", //30
|
||||
"Key: Backspace", //31
|
||||
"Media Stop", //32
|
||||
"Key: Media Stop", //32
|
||||
"Key: Number Pad 9", //33
|
||||
"Key: F3", //36
|
||||
"Key: 3", //37
|
||||
@@ -72,7 +72,7 @@ static const char* led_names[] =
|
||||
"Key: X", //40
|
||||
"Key: Pause/Break", //42
|
||||
"Key: Delete", //43
|
||||
"Media Previous", //44
|
||||
"Key: Media Previous", //44
|
||||
"Key: F4", //48
|
||||
"Key: 4", //49
|
||||
"Key: R", //50
|
||||
@@ -81,7 +81,7 @@ static const char* led_names[] =
|
||||
"Key: Space", //53
|
||||
"Key: Insert", //54
|
||||
"Key: End", //55
|
||||
"Media Play/Pause", //56
|
||||
"Key: Media Play/Pause",//56
|
||||
"Key: Number Pad 4", //57
|
||||
"Key: F5", //60
|
||||
"Key: 5", //61
|
||||
@@ -90,7 +90,7 @@ static const char* led_names[] =
|
||||
"Key: V", //64
|
||||
"Key: Home", //66
|
||||
"Key: Page Down", //67
|
||||
"Media Next", //68
|
||||
"Key: Media Next", //68
|
||||
"Key: Number Pad 5", //69
|
||||
"Key: F6", //72
|
||||
"Key: 6", //73
|
||||
@@ -117,7 +117,7 @@ static const char* led_names[] =
|
||||
"Key: K", //99
|
||||
"Key: M", //100
|
||||
"Key: Right Windows", //101
|
||||
"Key: \\", //102
|
||||
"Key: \\ (ANSI)", //102
|
||||
"Key: Up Arrow", //103
|
||||
"Key: Number Pad *", //104
|
||||
"Key: Number Pad 2", //105
|
||||
@@ -323,7 +323,7 @@ void RGBController_CorsairPeripheral::SetCustomMode()
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_CorsairPeripheral::UpdateMode()
|
||||
void RGBController_CorsairPeripheral::DeviceUpdateMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void UpdateMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CorsairPeripheralController* corsair;
|
||||
|
||||
@@ -101,7 +101,7 @@ void RGBController_CorsairVengeance::SetCustomMode()
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeance::UpdateMode()
|
||||
void RGBController_CorsairVengeance::DeviceUpdateMode()
|
||||
{
|
||||
corsair->SetMode(modes[active_mode].value);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void UpdateMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CorsairVengeanceController* corsair;
|
||||
|
||||
@@ -219,7 +219,7 @@ void RGBController_CorsairVengeancePro::SetCustomMode()
|
||||
active_mode = 9;
|
||||
}
|
||||
|
||||
void RGBController_CorsairVengeancePro::UpdateMode()
|
||||
void RGBController_CorsairVengeancePro::DeviceUpdateMode()
|
||||
{
|
||||
unsigned int corsair_direction = 0;
|
||||
bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void UpdateMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CorsairVengeanceProController* corsair;
|
||||
|
||||
@@ -177,7 +177,7 @@ void RGBController_Crucial::SetCustomMode()
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_Crucial::UpdateMode()
|
||||
void RGBController_Crucial::DeviceUpdateMode()
|
||||
{
|
||||
crucial->SetMode(modes[active_mode].value);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void UpdateMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CrucialController* crucial;
|
||||
|
||||
@@ -106,7 +106,7 @@ void RGBController_DuckyKeyboard::SetCustomMode()
|
||||
|
||||
}
|
||||
|
||||
void RGBController_DuckyKeyboard::UpdateMode()
|
||||
void RGBController_DuckyKeyboard::DeviceUpdateMode()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void UpdateMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
DuckyKeyboardController* ducky;
|
||||
|
||||
@@ -43,7 +43,7 @@ void RGBController_Dummy::SetCustomMode()
|
||||
|
||||
}
|
||||
|
||||
void RGBController_Dummy::UpdateMode()
|
||||
void RGBController_Dummy::DeviceUpdateMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -24,5 +24,5 @@ public:
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void UpdateMode();
|
||||
void DeviceUpdateMode();
|
||||
};
|
||||
|
||||
@@ -186,7 +186,7 @@ void RGBController_E131::SetCustomMode()
|
||||
|
||||
}
|
||||
|
||||
void RGBController_E131::UpdateMode()
|
||||
void RGBController_E131::DeviceUpdateMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void UpdateMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
std::vector<E131Device> devices;
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
/*-------------------------------------------------------------------*\
|
||||
| RGBController_EKController.cpp |
|
||||
| |
|
||||
| Driver for EK Loop Connect |
|
||||
| |
|
||||
| Chris M (Dr_No) 16th Jul 2020 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include "RGBController_EKController.h"
|
||||
|
||||
RGBController_EKController::RGBController_EKController(EKController* _dev)
|
||||
{
|
||||
EK_dev = _dev;
|
||||
|
||||
name = EK_dev->GetDeviceName();
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
description = EK_dev->GetDeviceName();
|
||||
version = "1.0";
|
||||
serial = EK_dev->GetSerial();
|
||||
location = EK_dev->GetLocation();
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = EK_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = EK_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Breathing.speed_min = EK_SPEED_SLOWEST;
|
||||
Breathing.speed_max = EK_SPEED_FASTEST;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.speed = EK_SPEED_NORMAL;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Fading;
|
||||
Fading.name = "Fading";
|
||||
Fading.value = EK_MODE_FADING;
|
||||
Fading.flags = MODE_FLAG_HAS_SPEED;
|
||||
Fading.speed_min = EK_SPEED_SLOWEST;
|
||||
Fading.speed_max = EK_SPEED_FASTEST;
|
||||
Fading.color_mode = MODE_COLORS_NONE;
|
||||
Fading.speed = EK_SPEED_NORMAL;
|
||||
modes.push_back(Fading);
|
||||
|
||||
mode Marquee;
|
||||
Marquee.name = "Marquee";
|
||||
Marquee.value = EK_MODE_MARQUEE;
|
||||
Marquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Marquee.speed_min = EK_SPEED_SLOWEST;
|
||||
Marquee.speed_max = EK_SPEED_FASTEST;
|
||||
Marquee.color_mode = MODE_COLORS_PER_LED;
|
||||
Marquee.speed = EK_SPEED_NORMAL;
|
||||
modes.push_back(Marquee);
|
||||
|
||||
mode Covering_Marquee;
|
||||
Covering_Marquee.name = "Covering Marquee";
|
||||
Covering_Marquee.value = EK_MODE_COVERING_MARQUEE;
|
||||
Covering_Marquee.flags = MODE_FLAG_HAS_SPEED;
|
||||
Covering_Marquee.speed_min = EK_SPEED_SLOWEST;
|
||||
Covering_Marquee.speed_max = EK_SPEED_FASTEST;
|
||||
Covering_Marquee.color_mode = MODE_COLORS_NONE;
|
||||
Covering_Marquee.speed = EK_SPEED_NORMAL;
|
||||
modes.push_back(Covering_Marquee);
|
||||
|
||||
mode Pulse;
|
||||
Pulse.name = "Pulse";
|
||||
Pulse.value = EK_MODE_PULSE;
|
||||
Pulse.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Pulse.speed_min = EK_SPEED_SLOWEST;
|
||||
Pulse.speed_max = EK_SPEED_FASTEST;
|
||||
Pulse.color_mode = MODE_COLORS_PER_LED;
|
||||
Pulse.speed = EK_SPEED_NORMAL;
|
||||
modes.push_back(Pulse);
|
||||
|
||||
mode Spectrum_Wave;
|
||||
Spectrum_Wave.name = "Spectrum_Wave";
|
||||
Spectrum_Wave.value = EK_MODE_SPECTRUM_WAVE;
|
||||
Spectrum_Wave.flags = MODE_FLAG_HAS_SPEED;
|
||||
Spectrum_Wave.speed_min = EK_SPEED_SLOWEST;
|
||||
Spectrum_Wave.speed_max = EK_SPEED_FASTEST;
|
||||
Spectrum_Wave.color_mode = MODE_COLORS_NONE;
|
||||
Spectrum_Wave.speed = EK_SPEED_NORMAL;
|
||||
modes.push_back(Spectrum_Wave);
|
||||
|
||||
mode Alternating;
|
||||
Alternating.name = "Alternating";
|
||||
Alternating.value = EK_MODE_ALTERNATING;
|
||||
Alternating.flags = MODE_FLAG_HAS_SPEED;
|
||||
Alternating.speed_min = EK_SPEED_SLOWEST;
|
||||
Alternating.speed_max = EK_SPEED_FASTEST;
|
||||
Alternating.color_mode = MODE_COLORS_PER_LED;
|
||||
Alternating.speed = EK_SPEED_NORMAL;
|
||||
modes.push_back(Alternating);
|
||||
|
||||
mode Candle;
|
||||
Candle.name = "Candle";
|
||||
Candle.value = EK_MODE_CANDLE;
|
||||
Candle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Candle.speed_min = EK_SPEED_SLOWEST;
|
||||
Candle.speed_max = EK_SPEED_FASTEST;
|
||||
Candle.color_mode = MODE_COLORS_PER_LED;
|
||||
Candle.speed = EK_SPEED_NORMAL;
|
||||
modes.push_back(Candle);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_EKController::~RGBController_EKController()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_EKController::SetupZones()
|
||||
{
|
||||
zone EK_zone;
|
||||
EK_zone.name = "Loop Connect";
|
||||
EK_zone.type = ZONE_TYPE_SINGLE;
|
||||
EK_zone.leds_min = 1;
|
||||
EK_zone.leds_max = 1;
|
||||
EK_zone.leds_count = 1;
|
||||
EK_zone.matrix_map = NULL;
|
||||
zones.push_back(EK_zone);
|
||||
|
||||
led EK_led;
|
||||
EK_led.name = "EK LED";
|
||||
leds.push_back(EK_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_EKController::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| ToDo |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_EKController::DeviceUpdateLEDs()
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[0]);
|
||||
unsigned char grn = RGBGetGValue(colors[0]);
|
||||
unsigned char blu = RGBGetBValue(colors[0]);
|
||||
EK_dev->SetColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_EKController::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
RGBColor color = colors[zone];
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
EK_dev->SetColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_EKController::UpdateSingleLED(int led)
|
||||
{
|
||||
UpdateZoneLEDs(led);
|
||||
}
|
||||
|
||||
void RGBController_EKController::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_EKController::DeviceUpdateMode()
|
||||
{
|
||||
EK_dev->SetMode(modes[active_mode].value, modes[active_mode].speed);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*-------------------------------------------------------------------*\
|
||||
| RGBController_EKController.h |
|
||||
| |
|
||||
| Driver for EK Loop Connect |
|
||||
| |
|
||||
| Chris M (Dr_No) 16th Jul 2020 |
|
||||
| |
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
#ifndef RGBCONTROLLER_EKCONTROLLER_H
|
||||
#define RGBCONTROLLER_EKCONTROLLER_H
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "Controllers/EKController/EKController.h"
|
||||
|
||||
class RGBController_EKController : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_EKController(EKController *_dev);
|
||||
~RGBController_EKController();
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
private:
|
||||
EKController* EK_dev;
|
||||
};
|
||||
|
||||
#endif // RGBCONTROLLER_EKCONTROLLER_H
|
||||
@@ -144,7 +144,7 @@ void RGBController_Faustus::SetCustomMode()
|
||||
SetMode(0);
|
||||
}
|
||||
|
||||
void RGBController_Faustus::UpdateMode()
|
||||
void RGBController_Faustus::DeviceUpdateMode()
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class RGBController_Faustus : public RGBController
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void UpdateMode();
|
||||
void DeviceUpdateMode();
|
||||
};
|
||||
|
||||
#endif // RGBCONTROLLER_FAUSTUS_H
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_GalaxGPU.cpp |
|
||||
| |
|
||||
| Driver for Galax / KFA2 RGB on GPUs |
|
||||
| |
|
||||
| Niels Westphal (crashniels) 12.07.2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_GalaxGPU.h"
|
||||
|
||||
int RGBController_GalaxGPU::GetDeviceMode()
|
||||
{
|
||||
int modereg1 = galax_gpu->GalaxGPURegisterRead(GALAX_MODE_REGISTER_1);
|
||||
int modereg2 = galax_gpu->GalaxGPURegisterRead(GALAX_MODE_REGISTER_2);
|
||||
int color_mode = MODE_COLORS_PER_LED;
|
||||
|
||||
if (modereg1 == GALAX_MODE_STATIC_VALUE_1 && modereg2 == GALAX_MODE_STATIC_VALUE_2)
|
||||
{
|
||||
active_mode = 1;
|
||||
modes[active_mode].color_mode = MODE_COLORS_PER_LED;
|
||||
}
|
||||
|
||||
if (modereg1 == GALAX_MODE_BREATHING_VALUE_1 && modereg2 == GALAX_MODE_BREATHING_VALUE_2)
|
||||
{
|
||||
active_mode = 2;
|
||||
modes[active_mode].color_mode = MODE_COLORS_PER_LED;
|
||||
}
|
||||
|
||||
if (modereg1 == GALAX_MODE_RAINBOW_VALUE_1 && modereg2 == GALAX_MODE_RAINBOW_VALUE_2)
|
||||
{
|
||||
active_mode = 3;
|
||||
modes[active_mode].color_mode = MODE_COLORS_NONE;
|
||||
}
|
||||
|
||||
if (modereg1 == GALAX_MODE_CYCLE_BREATHING_VALUE_1 && modereg2 == GALAX_MODE_CYCLE_BREATHING_VALUE_2)
|
||||
{
|
||||
active_mode = 4;
|
||||
modes[active_mode].color_mode = MODE_COLORS_NONE;
|
||||
}
|
||||
|
||||
|
||||
return(active_mode);
|
||||
}
|
||||
|
||||
RGBController_GalaxGPU::RGBController_GalaxGPU(GalaxGPUController * galax_gpu_ptr)
|
||||
{
|
||||
galax_gpu = galax_gpu_ptr;
|
||||
|
||||
|
||||
name = galax_gpu->GetDeviceName();
|
||||
type = DEVICE_TYPE_GPU;
|
||||
description = "GALAX / KFA2 RTX GPU";
|
||||
version = "1.0";
|
||||
location = galax_gpu->GetDeviceLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 1;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = 2;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Rainbow;
|
||||
Rainbow.name = "Rainbow";
|
||||
Rainbow.value = 3;
|
||||
Rainbow.flags = 0;
|
||||
Rainbow.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Rainbow);
|
||||
|
||||
mode Cycle_Breathing;
|
||||
Cycle_Breathing.name = "Cycle Breathing";
|
||||
Cycle_Breathing.value = 4;
|
||||
Cycle_Breathing.flags = 0;
|
||||
Cycle_Breathing.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Cycle_Breathing);
|
||||
|
||||
SetupZones();
|
||||
|
||||
active_mode = GetDeviceMode();
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPU::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zone |
|
||||
\*---------------------------------------------------------*/
|
||||
zone galax_gpu_zone;
|
||||
galax_gpu_zone.name = "GPU";
|
||||
galax_gpu_zone.type = ZONE_TYPE_SINGLE;
|
||||
galax_gpu_zone.leds_min = 1;
|
||||
galax_gpu_zone.leds_max = 1;
|
||||
galax_gpu_zone.leds_count = 1;
|
||||
galax_gpu_zone.matrix_map = NULL;
|
||||
zones.push_back(galax_gpu_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up LED |
|
||||
\*---------------------------------------------------------*/
|
||||
led galax_gpu_led;
|
||||
galax_gpu_led.name = "GPU";
|
||||
leds.push_back(galax_gpu_led);
|
||||
|
||||
SetupColors();
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Initialize color |
|
||||
\*---------------------------------------------------------*/
|
||||
unsigned char red = galax_gpu->GetLEDRed();
|
||||
unsigned char grn = galax_gpu->GetLEDGreen();
|
||||
unsigned char blu = galax_gpu->GetLEDBlue();
|
||||
|
||||
colors[0] = ToRGBColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPU::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPU::DeviceUpdateLEDs()
|
||||
{
|
||||
for(std::size_t led = 0; led < colors.size(); led++)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[led]);
|
||||
unsigned char grn = RGBGetGValue(colors[led]);
|
||||
unsigned char blu = RGBGetBValue(colors[led]);
|
||||
|
||||
if (GetMode() == 1)
|
||||
{
|
||||
galax_gpu->SetLEDColorsDirect(red, grn, blu);
|
||||
}
|
||||
else
|
||||
{
|
||||
galax_gpu->SetLEDColorsEffect(red, grn, blu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPU::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPU::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPU::SetCustomMode()
|
||||
{
|
||||
active_mode = 1;
|
||||
}
|
||||
|
||||
void RGBController_GalaxGPU::DeviceUpdateMode()
|
||||
{
|
||||
int new_mode = modes[active_mode].value;
|
||||
|
||||
galax_gpu->SetMode(new_mode);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_GalaxGPU.h |
|
||||
| |
|
||||
| Driver for Galax / KFA2 RGB on GPUs |
|
||||
| |
|
||||
| Niels Westphal (crashniels) 12.07.2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "GalaxGPUController.h"
|
||||
|
||||
class RGBController_GalaxGPU : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_GalaxGPU(GalaxGPUController* galax_gpu_ptr);
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
GalaxGPUController* galax_gpu;
|
||||
|
||||
int GetDeviceMode();
|
||||
};
|
||||
@@ -174,7 +174,7 @@ void RGBController_GloriousModelO::SetCustomMode()
|
||||
//active_mode = 2;
|
||||
}
|
||||
|
||||
void RGBController_GloriousModelO::UpdateMode()
|
||||
void RGBController_GloriousModelO::DeviceUpdateMode()
|
||||
{
|
||||
unsigned int direction = 0;
|
||||
unsigned int speed = GLORIOUS_SPEED_NORMAL;
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void UpdateMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
GloriousModelOController* gmo;
|
||||
|
||||
@@ -220,6 +220,11 @@ void RGBController_HuePlus::SetupZones()
|
||||
|
||||
void RGBController_HuePlus::ResizeZone(int zone, int new_size)
|
||||
{
|
||||
if((size_t) zone >= zones.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
zones[zone].leds_count = new_size;
|
||||
@@ -253,7 +258,7 @@ void RGBController_HuePlus::SetCustomMode()
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_HuePlus::UpdateMode()
|
||||
void RGBController_HuePlus::DeviceUpdateMode()
|
||||
{
|
||||
if(modes[active_mode].value == HUE_PLUS_MODE_FIXED)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void UpdateMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
HuePlusController* hueplus;
|
||||
|
||||
@@ -39,12 +39,157 @@ THREAD keepalive_thread(void *param)
|
||||
#define NA 0xFFFFFFFF
|
||||
|
||||
static unsigned int matrix_map[6][23] =
|
||||
{ { 0, NA, 12, 18, 24, 30, NA, 42, 48, 54, 60, NA, 66, 72, 78, 84, 90, 96, 102, NA, NA, NA, NA },
|
||||
{ 1, 7, 13, 19, 25, 31, 37, 43, 49, 55, 61, NA, 67, 73, 85, NA, 91, 97, 103, NA, NA, NA, NA },
|
||||
{ 2, NA, 8, 14, 20, 26, NA, 32, 38, 44, 50, 56, 62, 68, 74, 86, 92, 98, 104, NA, NA, NA, NA },
|
||||
{ 3, NA, 9, 15, 21, 27, NA, 33, 39, 45, 51, 57, 63, 69, 87, NA, NA, NA, NA, NA, NA, NA, NA },
|
||||
{ 4, NA, 16, 22, 28, 34, NA, 40, NA, 46, 52, 58, 64, 70, 82, NA, NA, 100, NA, NA, NA, NA, NA },
|
||||
{ 5, 11, 17, NA, NA, NA, NA, 41, NA, NA, NA, NA, 65, 77, 83, 89, 95, 101, 107, NA, NA, NA, NA } };
|
||||
{ { 0, NA, 11, 17, 22, 27, NA, 33, 38, 43, 49, NA, 54, 60, 64, 68, 74, 78, 83, NA, NA, NA, NA },
|
||||
{ 1, 6, 12, 18, 23, 28, 34, 39, 44, 50, 55, NA, 61, 65, 69, NA, 75, 79, 84, 87, 92, 96, 101 },
|
||||
{ 2, NA, 7, 13, 19, 24, NA, 29, 35, 40, 45, 51, 56, 62, 66, 70, 76, 80, 85, 88, 93, 97, 102 },
|
||||
{ 3, NA, 8, 14, 20, 25, NA, 30, 36, 41, 46, 52, 57, 63, 71, NA, NA, NA, NA, 89, 94, 98, NA },
|
||||
{ 4, NA, 9, 15, 21, 26, NA, 31, NA, 37, 42, 47, 53, 58, 72, NA, NA, 81, NA, 90, 95, 99, 103 },
|
||||
{ 5, 10, 16, NA, NA, NA, NA, 32, NA, NA, NA, NA, 48, 59, 67, 73, 77, 82, 86, 91, NA, 100, NA } };
|
||||
|
||||
static const char* zone_names[] =
|
||||
{
|
||||
"Keyboard",
|
||||
};
|
||||
|
||||
static zone_type zone_types[] =
|
||||
{
|
||||
ZONE_TYPE_MATRIX,
|
||||
};
|
||||
|
||||
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",
|
||||
// Skip index 6
|
||||
"Key: 1",
|
||||
"Key: Q",
|
||||
"Key: A",
|
||||
"Key: Z",
|
||||
"Key: Left Windows",
|
||||
"Key: F1",
|
||||
"Key: 2",
|
||||
"Key: W",
|
||||
"Key: S",
|
||||
"Key: X",
|
||||
"Key: Left Alt",
|
||||
"Key: F2",
|
||||
"Key: 3",
|
||||
"Key: E",
|
||||
"Key: D",
|
||||
"Key: C",
|
||||
// Skip index 23
|
||||
"Key: F3",
|
||||
"Key: 4",
|
||||
"Key: R",
|
||||
"Key: F",
|
||||
"Key: V",
|
||||
// Skip index 29
|
||||
"Key: F4",
|
||||
"Key: 5",
|
||||
"Key: T",
|
||||
"Key: G",
|
||||
"Key: B",
|
||||
"Key: Space",
|
||||
"Key: F5",
|
||||
"Key: 6",
|
||||
"Key: Y",
|
||||
"Key: H",
|
||||
"Key: N",
|
||||
// Skip index 41
|
||||
"Key: F6",
|
||||
"Key: 7",
|
||||
"Key: U",
|
||||
"Key: J",
|
||||
"Key: M",
|
||||
// Skip index 47
|
||||
"Key: F7",
|
||||
"Key: 8",
|
||||
"Key: I",
|
||||
"Key: K",
|
||||
"Key: ,",
|
||||
"Key: Right Alt",
|
||||
"Key: F8",
|
||||
"Key: 9",
|
||||
"Key: O",
|
||||
"Key: L",
|
||||
"Key: .",
|
||||
// Skip index 59
|
||||
"Key: F9",
|
||||
"Key: 0",
|
||||
"Key: P",
|
||||
"Key: ;",
|
||||
"Key: /",
|
||||
"Key: Fn",
|
||||
"Key: F10",
|
||||
"Key: -",
|
||||
"Key: [",
|
||||
"Key: '",
|
||||
// Skip index 70
|
||||
// Skip index 71
|
||||
"Key: F11",
|
||||
"Key: =",
|
||||
"Key: ]",
|
||||
// Skip index 75
|
||||
// Skip index 76
|
||||
"Key: Context",
|
||||
"Key: F12",
|
||||
"Key: Backspace",
|
||||
"Key: \\ (ANSI)",
|
||||
"Key: Enter",
|
||||
"Key: Right Shift",
|
||||
"Key: Right Control",
|
||||
"Key: Print Screen",
|
||||
"Key: Insert",
|
||||
"Key: Delete",
|
||||
// Skip index 87
|
||||
// Skip index 88
|
||||
"Key: Left Arrow",
|
||||
"Key: Scroll Lock",
|
||||
"Key: Home",
|
||||
"Key: End",
|
||||
// Skip index 93
|
||||
"Key: Up Arrow",
|
||||
"Key: Down Arrow",
|
||||
"Key: Pause/Break",
|
||||
"Key: Page Up",
|
||||
"Key: Page Down",
|
||||
// Skip index 99
|
||||
// Skip index 100
|
||||
"Key: Right Arrow",
|
||||
// Skip index 102
|
||||
"Key: Num Lock",
|
||||
"Key: Number Pad 7",
|
||||
"Key: Number Pad 4",
|
||||
"Key: Number Pad 1",
|
||||
"Key: Number Pad 0",
|
||||
// Skip index 108
|
||||
"Key: Number Pad /",
|
||||
"Key: Number Pad 8",
|
||||
"Key: Number Pad 5",
|
||||
"Key: Number Pad 2",
|
||||
// Skip index 113
|
||||
// Skip index 114
|
||||
"Key: Number Pad *",
|
||||
"Key: Number Pad 9",
|
||||
"Key: Number Pad 6",
|
||||
"Key: Number Pad 3",
|
||||
"Key: Number Pad .",
|
||||
// Skip index 120
|
||||
"Key: Number Pad -",
|
||||
"Key: Number Pad +",
|
||||
// Skip index 123
|
||||
// Skip index 124
|
||||
"Key: Number Pad Enter",
|
||||
};
|
||||
|
||||
RGBController_HyperXAlloyOrigins::RGBController_HyperXAlloyOrigins(HyperXAlloyOriginsController* hyperx_ptr)
|
||||
{
|
||||
@@ -84,27 +229,40 @@ RGBController_HyperXAlloyOrigins::~RGBController_HyperXAlloyOrigins()
|
||||
|
||||
void RGBController_HyperXAlloyOrigins::SetupZones()
|
||||
{
|
||||
zone new_zone;
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up zones |
|
||||
\*---------------------------------------------------------*/
|
||||
unsigned int total_led_count = 0;
|
||||
for(unsigned int zone_idx = 0; zone_idx < 1; zone_idx++)
|
||||
{
|
||||
zone new_zone;
|
||||
new_zone.name = zone_names[zone_idx];
|
||||
new_zone.type = zone_types[zone_idx];
|
||||
new_zone.leds_min = zone_sizes[zone_idx];
|
||||
new_zone.leds_max = zone_sizes[zone_idx];
|
||||
new_zone.leds_count = zone_sizes[zone_idx];
|
||||
|
||||
new_zone.name = "Keyboard";
|
||||
new_zone.type = ZONE_TYPE_MATRIX;
|
||||
new_zone.leds_min = 155;
|
||||
new_zone.leds_max = 155;
|
||||
new_zone.leds_count = 155;
|
||||
new_zone.matrix_map = new matrix_map_type;
|
||||
new_zone.matrix_map->height = 6;
|
||||
new_zone.matrix_map->width = 23;
|
||||
new_zone.matrix_map->map = (unsigned int *)&matrix_map;
|
||||
|
||||
zones.push_back(new_zone);
|
||||
if(zone_types[zone_idx] == ZONE_TYPE_MATRIX)
|
||||
{
|
||||
new_zone.matrix_map = new matrix_map_type;
|
||||
new_zone.matrix_map->height = 6;
|
||||
new_zone.matrix_map->width = 23;
|
||||
new_zone.matrix_map->map = (unsigned int *)&matrix_map;
|
||||
}
|
||||
else
|
||||
{
|
||||
new_zone.matrix_map = NULL;
|
||||
}
|
||||
|
||||
for(int led_idx = 0; led_idx < 155; led_idx++)
|
||||
zones.push_back(new_zone);
|
||||
|
||||
total_led_count += zone_sizes[zone_idx];
|
||||
}
|
||||
|
||||
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
|
||||
new_led.name = "Keyboard LED ";
|
||||
new_led.name.append(std::to_string(led_idx));
|
||||
|
||||
new_led.name = led_names[led_idx];
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
@@ -136,7 +294,7 @@ void RGBController_HyperXAlloyOrigins::SetCustomMode()
|
||||
|
||||
}
|
||||
|
||||
void RGBController_HyperXAlloyOrigins::UpdateMode()
|
||||
void RGBController_HyperXAlloyOrigins::DeviceUpdateMode()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -154,4 +312,4 @@ void RGBController_HyperXAlloyOrigins::KeepaliveThread()
|
||||
}
|
||||
std::this_thread::sleep_for(10ms);;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void UpdateMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
void KeepaliveThread();
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ void RGBController_HyperXDRAM::SetCustomMode()
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_HyperXDRAM::UpdateMode()
|
||||
void RGBController_HyperXDRAM::DeviceUpdateMode()
|
||||
{
|
||||
bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void UpdateMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
HyperXDRAMController* hyperx;
|
||||
|
||||
@@ -83,13 +83,13 @@ static const char *led_names[] =
|
||||
"Key: L",
|
||||
"Key: ,",
|
||||
"Key: Context",
|
||||
"Key: UK Enter",
|
||||
"Key: Enter (ISO)",
|
||||
"Key: Left Arrow",
|
||||
"Key: F1",
|
||||
"Key: 1",
|
||||
"Key: Q",
|
||||
"Key: A",
|
||||
"Key: UK Backslash",
|
||||
"Key: \\ (ISO)",
|
||||
"Key: Left Windows",
|
||||
"Key: Print Screen",
|
||||
"Key: F10",
|
||||
@@ -170,7 +170,7 @@ static const char *led_names[] =
|
||||
"Key: K",
|
||||
"Key: M",
|
||||
"Key: Right Windows",
|
||||
"Key: \\",
|
||||
"Key: \\ (ANSI)",
|
||||
"Key: Up Arrow",
|
||||
"Key: Number Pad 5",
|
||||
"Key: Number Pad Enter",
|
||||
@@ -193,10 +193,10 @@ static const char *led_names[] =
|
||||
"RGB Strip 16",
|
||||
"RGB Strip 17",
|
||||
"RGB Strip 18",
|
||||
"Media Previous",
|
||||
"Media Play/Pause",
|
||||
"Media Next",
|
||||
"Media Mute"
|
||||
"Key: Media Previous",
|
||||
"Key: Media Play/Pause",
|
||||
"Key: Media Next",
|
||||
"Key: Media Mute"
|
||||
};
|
||||
|
||||
RGBController_HyperXKeyboard::RGBController_HyperXKeyboard(HyperXKeyboardController* hyperx_ptr)
|
||||
@@ -344,7 +344,7 @@ void RGBController_HyperXKeyboard::SetCustomMode()
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_HyperXKeyboard::UpdateMode()
|
||||
void RGBController_HyperXKeyboard::DeviceUpdateMode()
|
||||
{
|
||||
if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void UpdateMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
void KeepaliveThread();
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_HyperXPulsefireSurge.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for HyperX |
|
||||
| Pulsefire Surge |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 2/2/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_HyperXPulsefireSurge.h"
|
||||
|
||||
RGBController_HyperXPulsefireSurge::RGBController_HyperXPulsefireSurge(HyperXPulsefireSurgeController* hyperx_ptr)
|
||||
{
|
||||
hyperx = hyperx_ptr;
|
||||
|
||||
name = "HyperX Pulsefire Surge Device";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = "HyperX Pulsefire Surge Device";
|
||||
|
||||
SetupZones();
|
||||
};
|
||||
|
||||
RGBController_HyperXPulsefireSurge::~RGBController_HyperXPulsefireSurge()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireSurge::SetupZones()
|
||||
{
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireSurge::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireSurge::DeviceUpdateLEDs()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireSurge::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireSurge::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireSurge::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireSurge::DeviceUpdateMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_HyperXPulsefireSurge::KeepaliveThread()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_HyperXPulsefireSurge.h |
|
||||
| |
|
||||
| Generic RGB Interface for HyperX |
|
||||
| Pulsefire Surge |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 7/25/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include <chrono>
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "HyperXPulsefireSurgeController.h"
|
||||
|
||||
class RGBController_HyperXPulsefireSurge : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HyperXPulsefireSurge(HyperXPulsefireSurgeController* hyperx_ptr);
|
||||
~RGBController_HyperXPulsefireSurge();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
void KeepaliveThread();
|
||||
|
||||
private:
|
||||
HyperXPulsefireSurgeController* hyperx;
|
||||
};
|
||||
@@ -78,7 +78,7 @@ void RGBController_LEDStrip::SetCustomMode()
|
||||
|
||||
}
|
||||
|
||||
void RGBController_LEDStrip::UpdateMode()
|
||||
void RGBController_LEDStrip::DeviceUpdateMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void UpdateMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
LEDStripController* strip;
|
||||
|
||||
@@ -103,7 +103,7 @@ void RGBController_LogitechG203::SetCustomMode()
|
||||
|
||||
}
|
||||
|
||||
void RGBController_LogitechG203::UpdateMode()
|
||||
void RGBController_LogitechG203::DeviceUpdateMode()
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void UpdateMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
LogitechG203Controller* logitech;
|
||||
|
||||
@@ -117,7 +117,7 @@ void RGBController_LogitechG403::SetCustomMode()
|
||||
|
||||
}
|
||||
|
||||
void RGBController_LogitechG403::UpdateMode()
|
||||
void RGBController_LogitechG403::DeviceUpdateMode()
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user