Compare commits
75
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13414ec9b8 | ||
|
|
74faee0f73 | ||
|
|
3f0027aa90 | ||
|
|
d22aa1ed6c | ||
|
|
23d51f65d0 | ||
|
|
cad356efca | ||
|
|
70e83c13cc | ||
|
|
7ca0a1b6ab | ||
|
|
9bd5536d07 | ||
|
|
eaa3b9a368 | ||
|
|
599c468de8 | ||
|
|
9f21814395 | ||
|
|
cb8a551683 | ||
|
|
7f1156d81c | ||
|
|
5beee08166 | ||
|
|
1334129078 | ||
|
|
216b492f24 | ||
|
|
1b65bb9cc3 | ||
|
|
0f4ddd164f | ||
|
|
e6aadc414b | ||
|
|
883a78ad9d | ||
|
|
15d23d3009 | ||
|
|
e2c2b8c1df | ||
|
|
5133c30242 | ||
|
|
69e1e19bf9 | ||
|
|
46f08f7423 | ||
|
|
352b9928ca | ||
|
|
87854d5781 | ||
|
|
1b3f8f9eb4 | ||
|
|
6438c15dd3 | ||
|
|
dbe29991f0 | ||
|
|
a5e9a3de05 | ||
|
|
edf1b251c0 | ||
|
|
9ff4314840 | ||
|
|
3ad0986ae7 | ||
|
|
6bfc9dd9db | ||
|
|
9b8a0d465e | ||
|
|
119741b736 | ||
|
|
2fe958783c | ||
|
|
1c59ef6b80 | ||
|
|
9e44e4ba4f | ||
|
|
b8e14ea067 | ||
|
|
525071c205 | ||
|
|
bfe03b0564 | ||
|
|
04b87ce2eb | ||
|
|
81acc47cd6 | ||
|
|
6e426b1403 | ||
|
|
6509e53a9b | ||
|
|
5b42b3d11d | ||
|
|
8bd515296d | ||
|
|
2bbf66c0ee | ||
|
|
d716973642 | ||
|
|
25f7a87a79 | ||
|
|
0619a16be2 | ||
|
|
4a3802f344 | ||
|
|
105f5642ef | ||
|
|
54ab57cea6 | ||
|
|
e3e6c0347e | ||
|
|
4d6706ce61 | ||
|
|
39c5aff864 | ||
|
|
450f438538 | ||
|
|
0270c745ce | ||
|
|
e2dfcd5b0f | ||
|
|
68fa3c2def | ||
|
|
cde7469191 | ||
|
|
7c1a1396ca | ||
|
|
7f052f21aa | ||
|
|
dff667751b | ||
|
|
2625807c1a | ||
|
|
7af283fdbf | ||
|
|
c7ffe3b926 | ||
|
|
46339c5f86 | ||
|
|
cf69598fd1 | ||
|
|
594f66ab23 | ||
|
|
01e0808e41 |
@@ -1,47 +0,0 @@
|
||||
#include "AuraAddressableController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_AuraAddressable.h"
|
||||
#include <vector>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#define AURA_ADDRESSABLE_VID 0x0B05
|
||||
|
||||
#define NUM_PIDS 4
|
||||
static const unsigned short pid_table[] =
|
||||
{
|
||||
0x1867,
|
||||
0x1872,
|
||||
0x1889,
|
||||
0x18A3
|
||||
};
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectAuraAddressableControllers *
|
||||
* *
|
||||
* Tests the USB address to see if an Asus Aura addressable RGB header controller *
|
||||
* exists there. *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectAuraAddressableControllers(std::vector<RGBController*>& rgb_controllers)
|
||||
{
|
||||
hid_device* dev;
|
||||
|
||||
//Look for Asus Aura addressable RGB header controller
|
||||
hid_init();
|
||||
|
||||
for(int pid_idx = 0; pid_idx < NUM_PIDS; pid_idx++)
|
||||
{
|
||||
dev = hid_open(AURA_ADDRESSABLE_VID, pid_table[pid_idx], 0);
|
||||
|
||||
if( dev )
|
||||
{
|
||||
AuraAddressableController* controller = new AuraAddressableController(dev);
|
||||
|
||||
RGBController_AuraAddressable* rgb_controller = new RGBController_AuraAddressable(controller);
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
-114
@@ -10,23 +10,9 @@
|
||||
#include "AuraAddressableController.h"
|
||||
#include <cstring>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
|
||||
static void Sleep(unsigned int milliseconds)
|
||||
AuraAddressableController::AuraAddressableController(hid_device* dev_handle) : AuraUSBController(dev_handle)
|
||||
{
|
||||
usleep(1000 * milliseconds);
|
||||
}
|
||||
#endif
|
||||
|
||||
AuraAddressableController::AuraAddressableController(hid_device* dev_handle)
|
||||
{
|
||||
dev = dev_handle;
|
||||
|
||||
GetFirmwareVersion();
|
||||
GetConfigTable();
|
||||
channel_count = config_table[2];
|
||||
}
|
||||
|
||||
AuraAddressableController::~AuraAddressableController()
|
||||
@@ -34,16 +20,6 @@ AuraAddressableController::~AuraAddressableController()
|
||||
|
||||
}
|
||||
|
||||
unsigned int AuraAddressableController::GetChannelCount()
|
||||
{
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
std::string AuraAddressableController::GetDeviceName()
|
||||
{
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
void AuraAddressableController::SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors)
|
||||
{
|
||||
unsigned char led_data[60];
|
||||
@@ -81,93 +57,21 @@ void AuraAddressableController::SetChannelLEDs(unsigned char channel, RGBColor *
|
||||
|
||||
void AuraAddressableController::SetMode
|
||||
(
|
||||
unsigned char mode,
|
||||
unsigned char red,
|
||||
unsigned char grn,
|
||||
unsigned char blu
|
||||
unsigned char channel,
|
||||
unsigned char mode,
|
||||
unsigned char red,
|
||||
unsigned char grn,
|
||||
unsigned char blu
|
||||
)
|
||||
{
|
||||
for(int channel_idx = 0; channel_idx < GetChannelCount(); channel_idx++)
|
||||
{
|
||||
SendEffect
|
||||
(
|
||||
channel_idx,
|
||||
mode,
|
||||
red,
|
||||
grn,
|
||||
blu
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void AuraAddressableController::GetConfigTable()
|
||||
{
|
||||
unsigned char usb_buf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up config table request packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0xEC;
|
||||
usb_buf[0x01] = AURA_REQUEST_CONFIG_TABLE;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 65);
|
||||
hid_read(dev, usb_buf, 65);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Copy the firmware string if the reply ID is correct |
|
||||
\*-----------------------------------------------------*/
|
||||
if(usb_buf[1] == 0x30)
|
||||
{
|
||||
memcpy(config_table, &usb_buf[4], 60);
|
||||
|
||||
for(int i = 0; i < 60; i+=6)
|
||||
{
|
||||
printf("%02X %02X %02X %02X %02X %02X\r\n", config_table[i + 0],
|
||||
config_table[i + 1],
|
||||
config_table[i + 2],
|
||||
config_table[i + 3],
|
||||
config_table[i + 4],
|
||||
config_table[i + 5]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AuraAddressableController::GetFirmwareVersion()
|
||||
{
|
||||
unsigned char usb_buf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up firmware version request packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0xEC;
|
||||
usb_buf[0x01] = AURA_REQUEST_FIRMWARE_VERSION;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 65);
|
||||
hid_read(dev, usb_buf, 65);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Copy the firmware string if the reply ID is correct |
|
||||
\*-----------------------------------------------------*/
|
||||
if(usb_buf[1] == 0x02)
|
||||
{
|
||||
memcpy(device_name, &usb_buf[2], 16);
|
||||
}
|
||||
SendEffect
|
||||
(
|
||||
channel,
|
||||
mode,
|
||||
red,
|
||||
grn,
|
||||
blu
|
||||
);
|
||||
}
|
||||
|
||||
void AuraAddressableController::SendEffect
|
||||
@@ -190,7 +94,7 @@ void AuraAddressableController::SendEffect
|
||||
| Set up message packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0xEC;
|
||||
usb_buf[0x01] = AURA_CONTROL_MODE_EFFECT;
|
||||
usb_buf[0x01] = AURA_ADDRESSABLE_CONTROL_MODE_EFFECT;
|
||||
usb_buf[0x02] = channel;
|
||||
usb_buf[0x03] = 0x00;
|
||||
usb_buf[0x04] = mode;
|
||||
@@ -227,7 +131,7 @@ void AuraAddressableController::SendDirect
|
||||
| Set up message packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0xEC;
|
||||
usb_buf[0x01] = AURA_CONTROL_MODE_DIRECT;
|
||||
usb_buf[0x01] = AURA_ADDRESSABLE_CONTROL_MODE_DIRECT;
|
||||
usb_buf[0x02] = device;
|
||||
usb_buf[0x03] = start_led;
|
||||
usb_buf[0x04] = led_count;
|
||||
@@ -259,7 +163,7 @@ void AuraAddressableController::SendDirectApply
|
||||
| Set up message packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0xEC;
|
||||
usb_buf[0x01] = AURA_CONTROL_MODE_DIRECT;
|
||||
usb_buf[0x01] = AURA_ADDRESSABLE_CONTROL_MODE_DIRECT;
|
||||
usb_buf[0x02] = 0x80 | channel;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
@@ -0,0 +1,69 @@
|
||||
/*-----------------------------------------*\
|
||||
| AuraAddressableController.h |
|
||||
| |
|
||||
| Definitions and types for ASUS Aura |
|
||||
| Addressable RGB lighting controller |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 1/18/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "AuraUSBController.h"
|
||||
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
enum
|
||||
{
|
||||
AURA_ADDRESSABLE_CONTROL_MODE_EFFECT = 0x3B, /* Effect control mode */
|
||||
AURA_ADDRESSABLE_CONTROL_MODE_DIRECT = 0x40, /* Direct control mode */
|
||||
};
|
||||
|
||||
class AuraAddressableController : public AuraUSBController
|
||||
{
|
||||
public:
|
||||
AuraAddressableController(hid_device* dev_handle);
|
||||
~AuraAddressableController();
|
||||
|
||||
void SetChannelLEDs
|
||||
(
|
||||
unsigned char channel,
|
||||
RGBColor * colors,
|
||||
unsigned int num_colors
|
||||
);
|
||||
|
||||
void SetMode
|
||||
(
|
||||
unsigned char channel,
|
||||
unsigned char mode,
|
||||
unsigned char red,
|
||||
unsigned char grn,
|
||||
unsigned char blu
|
||||
);
|
||||
|
||||
private:
|
||||
|
||||
void SendEffect
|
||||
(
|
||||
unsigned char channel,
|
||||
unsigned char mode,
|
||||
unsigned char red,
|
||||
unsigned char grn,
|
||||
unsigned char blu
|
||||
);
|
||||
|
||||
void SendDirect
|
||||
(
|
||||
unsigned char device,
|
||||
unsigned char start_led,
|
||||
unsigned char led_count,
|
||||
unsigned char* led_data
|
||||
);
|
||||
|
||||
void SendDirectApply
|
||||
(
|
||||
unsigned char channel
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,176 @@
|
||||
/*-----------------------------------------*\
|
||||
| AuraMainboardController.cpp |
|
||||
| |
|
||||
| Driver for ASUS Aura RGB USB mainboard |
|
||||
| lighting controller |
|
||||
| |
|
||||
| Martin Hartl (inlart) 4/25/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "AuraMainboardController.h"
|
||||
#include <cstring>
|
||||
|
||||
AuraMainboardController::AuraMainboardController(hid_device* dev_handle) : AuraUSBController(dev_handle), mode(AURA_MODE_DIRECT)
|
||||
{
|
||||
channel_count = 5;
|
||||
}
|
||||
|
||||
AuraMainboardController::~AuraMainboardController()
|
||||
{
|
||||
}
|
||||
|
||||
void AuraMainboardController::SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors)
|
||||
{
|
||||
unsigned char led_data[60];
|
||||
unsigned int leds_sent = 0;
|
||||
|
||||
SendEffect(channel, mode);
|
||||
|
||||
while(leds_sent < num_colors)
|
||||
{
|
||||
unsigned int leds_to_send = 20;
|
||||
|
||||
if((num_colors - leds_sent) < leds_to_send)
|
||||
{
|
||||
leds_to_send = num_colors - leds_sent;
|
||||
}
|
||||
|
||||
for(int led_idx = 0; led_idx < leds_to_send; led_idx++)
|
||||
{
|
||||
led_data[(led_idx * 3) + 0] = RGBGetRValue(colors[led_idx + leds_sent]);
|
||||
led_data[(led_idx * 3) + 1] = RGBGetGValue(colors[led_idx + leds_sent]);
|
||||
led_data[(led_idx * 3) + 2] = RGBGetBValue(colors[led_idx + leds_sent]);
|
||||
}
|
||||
|
||||
SendDirect
|
||||
(
|
||||
channel,
|
||||
leds_sent,
|
||||
leds_to_send,
|
||||
led_data
|
||||
);
|
||||
|
||||
leds_sent += leds_to_send;
|
||||
}
|
||||
|
||||
SendCommit();
|
||||
}
|
||||
|
||||
void AuraMainboardController::SetMode
|
||||
(
|
||||
unsigned char channel,
|
||||
unsigned char mode,
|
||||
unsigned char red,
|
||||
unsigned char grn,
|
||||
unsigned char blu
|
||||
)
|
||||
{
|
||||
this->mode = mode;
|
||||
unsigned char led_data[3];
|
||||
led_data[0] = red;
|
||||
led_data[1] = grn;
|
||||
led_data[2] = blu;
|
||||
|
||||
SendEffect
|
||||
(
|
||||
channel,
|
||||
mode
|
||||
);
|
||||
SendDirect
|
||||
(
|
||||
channel,
|
||||
0,
|
||||
1,
|
||||
led_data
|
||||
);
|
||||
SendCommit();
|
||||
}
|
||||
|
||||
void AuraMainboardController::SendEffect
|
||||
(
|
||||
unsigned char channel,
|
||||
unsigned char mode
|
||||
)
|
||||
{
|
||||
unsigned char usb_buf[65];
|
||||
|
||||
if(mode == AURA_MODE_DIRECT) {
|
||||
mode = AURA_MODE_STATIC;
|
||||
}
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up message packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0xEC;
|
||||
usb_buf[0x01] = AURA_MAINBOARD_CONTROL_MODE_EFFECT;
|
||||
usb_buf[0x02] = 0x00;
|
||||
usb_buf[0x03] = 0x00;
|
||||
usb_buf[0x04] = channel;
|
||||
usb_buf[0x05] = mode;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 65);
|
||||
}
|
||||
|
||||
void AuraMainboardController::SendDirect
|
||||
(
|
||||
unsigned char device,
|
||||
unsigned char start_led,
|
||||
unsigned char led_count,
|
||||
unsigned char* led_data
|
||||
)
|
||||
{
|
||||
unsigned char usb_buf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up message packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0xEC;
|
||||
usb_buf[0x01] = AURA_MAINBOARD_CONTROL_MODE_DIRECT;
|
||||
usb_buf[0x02] = start_led;
|
||||
usb_buf[0x03] = 0xff;
|
||||
usb_buf[0x04] = 0x00;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Copy in color data bytes |
|
||||
\*-----------------------------------------------------*/
|
||||
memcpy(&usb_buf[0x05], led_data, led_count * 3);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 65);
|
||||
}
|
||||
|
||||
void AuraMainboardController::SendCommit()
|
||||
{
|
||||
unsigned char usb_buf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up message packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0xEC;
|
||||
usb_buf[0x01] = AURA_MAINBOARD_CONTROL_MODE_COMMIT;
|
||||
usb_buf[0x02] = 0x55;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 65);
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*-----------------------------------------*\
|
||||
| AuraMainboardController.h |
|
||||
| |
|
||||
| Definitions and types for ASUS Aura |
|
||||
| USB Mainboard RGB lighting controller |
|
||||
| |
|
||||
| Martin Hartl (inlart) 4/25/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "AuraUSBController.h"
|
||||
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
enum
|
||||
{
|
||||
AURA_MAINBOARD_CONTROL_MODE_EFFECT = 0x35, /* Effect control mode */
|
||||
AURA_MAINBOARD_CONTROL_MODE_DIRECT = 0x36, /* Direct control mode */
|
||||
AURA_MAINBOARD_CONTROL_MODE_COMMIT = 0x3F, /* Direct control mode */
|
||||
};
|
||||
|
||||
class AuraMainboardController : public AuraUSBController
|
||||
{
|
||||
public:
|
||||
AuraMainboardController(hid_device* dev_handle);
|
||||
~AuraMainboardController();
|
||||
|
||||
void SetChannelLEDs
|
||||
(
|
||||
unsigned char channel,
|
||||
RGBColor * colors,
|
||||
unsigned int num_colors
|
||||
);
|
||||
|
||||
void SetMode
|
||||
(
|
||||
unsigned char channel,
|
||||
unsigned char mode,
|
||||
unsigned char red,
|
||||
unsigned char grn,
|
||||
unsigned char blu
|
||||
);
|
||||
|
||||
private:
|
||||
unsigned int mode;
|
||||
|
||||
void SendEffect
|
||||
(
|
||||
unsigned char channel,
|
||||
unsigned char mode
|
||||
);
|
||||
|
||||
void SendDirect
|
||||
(
|
||||
unsigned char device,
|
||||
unsigned char start_led,
|
||||
unsigned char led_count,
|
||||
unsigned char* led_data
|
||||
);
|
||||
|
||||
void SendCommit();
|
||||
};
|
||||
@@ -0,0 +1,104 @@
|
||||
/*-----------------------------------------*\
|
||||
| AuraUSBController.cpp |
|
||||
| |
|
||||
| Driver for ASUS Aura RGB USB |
|
||||
| lighting controller |
|
||||
| |
|
||||
| Martin Hartl (inlart) 4/25/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "AuraUSBController.h"
|
||||
#include <cstring>
|
||||
|
||||
AuraUSBController::AuraUSBController(hid_device* dev_handle)
|
||||
{
|
||||
dev = dev_handle;
|
||||
|
||||
GetFirmwareVersion();
|
||||
GetConfigTable();
|
||||
}
|
||||
|
||||
AuraUSBController::~AuraUSBController()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
unsigned int AuraUSBController::GetChannelCount()
|
||||
{
|
||||
return( channel_count );
|
||||
}
|
||||
|
||||
std::string AuraUSBController::GetDeviceName()
|
||||
{
|
||||
return(device_name);
|
||||
}
|
||||
|
||||
void AuraUSBController::GetConfigTable()
|
||||
{
|
||||
unsigned char usb_buf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up config table request packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0xEC;
|
||||
usb_buf[0x01] = AURA_REQUEST_CONFIG_TABLE;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 65);
|
||||
hid_read(dev, usb_buf, 65);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Copy the firmware string if the reply ID is correct |
|
||||
\*-----------------------------------------------------*/
|
||||
if(usb_buf[1] == 0x30)
|
||||
{
|
||||
memcpy(config_table, &usb_buf[4], 60);
|
||||
|
||||
for(int i = 0; i < 60; i+=6)
|
||||
{
|
||||
printf("%02X %02X %02X %02X %02X %02X\r\n", config_table[i + 0],
|
||||
config_table[i + 1],
|
||||
config_table[i + 2],
|
||||
config_table[i + 3],
|
||||
config_table[i + 4],
|
||||
config_table[i + 5]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AuraUSBController::GetFirmwareVersion()
|
||||
{
|
||||
unsigned char usb_buf[65];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up firmware version request packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0xEC;
|
||||
usb_buf[0x01] = AURA_REQUEST_FIRMWARE_VERSION;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 65);
|
||||
hid_read(dev, usb_buf, 65);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Copy the firmware string if the reply ID is correct |
|
||||
\*-----------------------------------------------------*/
|
||||
if(usb_buf[1] == 0x02)
|
||||
{
|
||||
memcpy(device_name, &usb_buf[2], 16);
|
||||
}
|
||||
}
|
||||
+21
-41
@@ -1,10 +1,10 @@
|
||||
/*-----------------------------------------*\
|
||||
| AuraAddressableController.h |
|
||||
| AuraUSBController.h |
|
||||
| |
|
||||
| Definitions and types for ASUS Aura |
|
||||
| Addressable RGB lighting controller |
|
||||
| USB RGB lighting controller |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 1/18/2020 |
|
||||
| Martin Hartl (inlart) 4/25/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController.h"
|
||||
@@ -36,66 +36,46 @@ enum
|
||||
|
||||
enum
|
||||
{
|
||||
AURA_CONTROL_MODE_EFFECT = 0x3B, /* Effect control mode */
|
||||
AURA_CONTROL_MODE_DIRECT = 0x40, /* Direct control mode */
|
||||
AURA_REQUEST_FIRMWARE_VERSION = 0x82, /* Request firmware string */
|
||||
AURA_REQUEST_CONFIG_TABLE = 0xB0, /* Request configuration table */
|
||||
};
|
||||
|
||||
class AuraAddressableController
|
||||
class AuraUSBController
|
||||
{
|
||||
public:
|
||||
AuraAddressableController(hid_device* dev_handle);
|
||||
~AuraAddressableController();
|
||||
AuraUSBController(hid_device* dev_handle);
|
||||
virtual ~AuraUSBController();
|
||||
|
||||
unsigned int GetChannelCount();
|
||||
|
||||
std::string GetDeviceName();
|
||||
|
||||
void SetChannelLEDs
|
||||
virtual void SetChannelLEDs
|
||||
(
|
||||
unsigned char channel,
|
||||
RGBColor * colors,
|
||||
unsigned int num_colors
|
||||
);
|
||||
) = 0;
|
||||
|
||||
void SetMode
|
||||
(
|
||||
unsigned char mode,
|
||||
unsigned char red,
|
||||
unsigned char grn,
|
||||
unsigned char blu
|
||||
);
|
||||
|
||||
private:
|
||||
char device_name[16];
|
||||
unsigned char config_table[60];
|
||||
hid_device* dev;
|
||||
unsigned int led_count;
|
||||
|
||||
void GetConfigTable();
|
||||
|
||||
void GetFirmwareVersion();
|
||||
|
||||
void SendEffect
|
||||
virtual void SetMode
|
||||
(
|
||||
unsigned char channel,
|
||||
unsigned char mode,
|
||||
unsigned char red,
|
||||
unsigned char grn,
|
||||
unsigned char blu
|
||||
);
|
||||
) = 0;
|
||||
|
||||
void SendDirect
|
||||
(
|
||||
unsigned char device,
|
||||
unsigned char start_led,
|
||||
unsigned char led_count,
|
||||
unsigned char* led_data
|
||||
);
|
||||
protected:
|
||||
hid_device* dev;
|
||||
unsigned int channel_count;
|
||||
unsigned char config_table[60];
|
||||
|
||||
void SendDirectApply
|
||||
(
|
||||
unsigned char channel
|
||||
);
|
||||
private:
|
||||
char device_name[16];
|
||||
unsigned int led_count;
|
||||
|
||||
void GetConfigTable();
|
||||
|
||||
void GetFirmwareVersion();
|
||||
};
|
||||
@@ -0,0 +1,68 @@
|
||||
#include "AuraAddressableController.h"
|
||||
#include "AuraMainboardController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_AuraUSB.h"
|
||||
#include <vector>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#define AURA_USB_VID 0x0B05
|
||||
|
||||
#define NUM_ADDRESSABLE_PIDS 4
|
||||
static const unsigned short addressable_pid_table[] =
|
||||
{
|
||||
0x1867,
|
||||
0x1872,
|
||||
0x1889,
|
||||
0x18A3
|
||||
};
|
||||
|
||||
#define NUM_MAINBOARD_PIDS 1
|
||||
static const unsigned short mainboard_pid_table[] =
|
||||
{
|
||||
0x18f3
|
||||
};
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectAuraUSBControllers *
|
||||
* *
|
||||
* Tests the USB address to see if an Asus Aura USB RGB header controller *
|
||||
* exists there. *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectAuraUSBControllers(std::vector<RGBController*>& rgb_controllers)
|
||||
{
|
||||
hid_device* dev;
|
||||
|
||||
//Look for Asus Aura addressable RGB header controller
|
||||
hid_init();
|
||||
|
||||
for(int pid_idx = 0; pid_idx < NUM_ADDRESSABLE_PIDS; pid_idx++)
|
||||
{
|
||||
dev = hid_open(AURA_USB_VID, addressable_pid_table[pid_idx], 0);
|
||||
|
||||
if( dev )
|
||||
{
|
||||
AuraAddressableController* controller = new AuraAddressableController(dev);
|
||||
|
||||
RGBController_AuraUSB* rgb_controller = new RGBController_AuraUSB(controller);
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
for(int pid_idx = 0; pid_idx < NUM_MAINBOARD_PIDS; pid_idx++)
|
||||
{
|
||||
dev = hid_open(AURA_USB_VID, mainboard_pid_table[pid_idx], 0);
|
||||
|
||||
if( dev )
|
||||
{
|
||||
AuraMainboardController* controller = new AuraMainboardController(dev);
|
||||
|
||||
RGBController_AuraUSB* rgb_controller = new RGBController_AuraUSB(controller);
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,17 @@
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
|
||||
static void Sleep(unsigned int milliseconds)
|
||||
{
|
||||
usleep(1000 * milliseconds);
|
||||
}
|
||||
#endif
|
||||
|
||||
static unsigned int keys[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0C, 0x0D, 0x0E, 0x0F, 0x11, 0x12,
|
||||
0x14, 0x15, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x24, 0x25, 0x26,
|
||||
0x27, 0x28, 0x2A, 0x2B, 0x2C, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
|
||||
@@ -30,6 +41,8 @@ static void send_usb_msg(hid_device* dev, char * data_pkt)
|
||||
}
|
||||
int bytes = hid_send_feature_report(dev, (unsigned char *)usb_pkt, 65);
|
||||
bytes++;
|
||||
|
||||
Sleep(2);
|
||||
}
|
||||
|
||||
CorsairPeripheralController::CorsairPeripheralController(hid_device* dev_handle)
|
||||
|
||||
@@ -15,49 +15,31 @@ PolychromeController::PolychromeController(i2c_smbus_interface* bus, polychrome_
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
|
||||
switch (GetFirmwareVersion())
|
||||
unsigned short fw_version = GetFirmwareVersion();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Determine whether the device uses ASR LED or |
|
||||
| Polychrome protocol by checking firmware version. |
|
||||
| Versions 1.xx and 2.xx use ASR LED, 3.xx uses |
|
||||
| Polychrome |
|
||||
\*-----------------------------------------------------*/
|
||||
if(((fw_version >> 8) < 0x03) && ((fw_version >> 8) > 0x00))
|
||||
{
|
||||
case FIRMWARE_VER_1_PT_10:
|
||||
led_count = 1;
|
||||
asr_led = true;
|
||||
strcpy(device_name, "ASRock ASR LED FW 1.10");
|
||||
break;
|
||||
|
||||
case FIRMWARE_VER_2_PT_00:
|
||||
led_count = 1;
|
||||
asr_led = true;
|
||||
strcpy(device_name, "ASRock ASR LED FW 2.00");
|
||||
break;
|
||||
|
||||
case FIRMWARE_VER_2_PT_08:
|
||||
led_count = 1;
|
||||
asr_led = true;
|
||||
strcpy(device_name, "ASRock ASR LED FW 2.08");
|
||||
break;
|
||||
|
||||
case FIRMWARE_VER_2_PT_10:
|
||||
led_count = 1;
|
||||
asr_led = true;
|
||||
strcpy(device_name, "ASRock ASR LED FW 2.10");
|
||||
break;
|
||||
|
||||
case FIRMWARE_VER_3_PT_00:
|
||||
led_count = 1;
|
||||
asr_led = false;
|
||||
strcpy(device_name, "ASRock Polychrome FW 3.00");
|
||||
break;
|
||||
|
||||
case FIRMWARE_VER_3_PT_04:
|
||||
led_count = 1;
|
||||
asr_led = false;
|
||||
strcpy(device_name, "ASRock Polychrome FW 3.04");
|
||||
break;
|
||||
|
||||
default:
|
||||
led_count = 0;
|
||||
strcpy(device_name, "");
|
||||
break;
|
||||
snprintf(device_name, 32, "ASRock ASR LED FW %d.%02d", (fw_version >> 8), (fw_version & 0xFF));
|
||||
led_count = 1;
|
||||
asr_led = true;
|
||||
}
|
||||
else if(fw_version == 0x03)
|
||||
{
|
||||
snprintf(device_name, 32, "ASRock Polychrome FW %d.%02d", (fw_version >> 8), (fw_version & 0xFF));
|
||||
led_count = 1;
|
||||
asr_led = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
led_count = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PolychromeController::~PolychromeController()
|
||||
|
||||
@@ -14,16 +14,6 @@
|
||||
|
||||
typedef unsigned char polychrome_dev_id;
|
||||
|
||||
enum
|
||||
{
|
||||
FIRMWARE_VER_1_PT_10 = 0x010A, /* Firmware nu51_1.10 */
|
||||
FIRMWARE_VER_2_PT_00 = 0x0200, /* Firmware nu51_2.00 */
|
||||
FIRMWARE_VER_2_PT_08 = 0x0208, /* Firmware nu51_2.08 */
|
||||
FIRMWARE_VER_2_PT_10 = 0x020A, /* Firmware nu51_2.10 */
|
||||
FIRMWARE_VER_3_PT_00 = 0x0300, /* Firmware nu51_3.00 */
|
||||
FIRMWARE_VER_3_PT_04 = 0x0304, /* Firmware nu51_3.04 */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ASRLED_REG_FIRMWARE_VER = 0x00, /* Firmware version Major.Minor */
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBFusion2SMBusController.cpp |
|
||||
| |
|
||||
| Driver for Gigabyte Aorus RGB Fusion 2 |
|
||||
| SMBus lighting controller |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 3/12/2020 |
|
||||
| Matt Harper 5/5/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBFusion2SMBusController.h"
|
||||
#include <cstring>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef DEBUG
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#endif
|
||||
|
||||
RGBFusion2SMBusController::RGBFusion2SMBusController(i2c_smbus_interface* bus, rgb_fusion_dev_id dev)
|
||||
{
|
||||
this->bus = bus;
|
||||
this->dev = dev;
|
||||
|
||||
memset(led_data, 0, 10*16);
|
||||
|
||||
led_count = 10; // Protocol supports 10 'slots'
|
||||
}
|
||||
|
||||
unsigned int RGBFusion2SMBusController::GetLEDCount()
|
||||
{
|
||||
return(led_count);
|
||||
}
|
||||
|
||||
std::string RGBFusion2SMBusController::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);
|
||||
}
|
||||
|
||||
/* Writes are performed in 32 byte chunks. If we need to write the second 16 bytes,
|
||||
* we must necessarily write the first 16 as well. Given that reading the existing state
|
||||
* from the device is not yet possible, unfortunately we may overwrite existing device
|
||||
* states if the state transition did not occur within in the same OpenRGB instance.
|
||||
* That is to say, the current behavior is non-deal but the best we have
|
||||
*/
|
||||
void RGBFusion2SMBusController::WriteLED(int led)
|
||||
{
|
||||
unsigned short register_offset = led / 2; // Relying on integer division to truncate
|
||||
unsigned short write_register = RGB_FUSION_2_LED_START_ADDR + 2*register_offset;
|
||||
|
||||
// Adjust if we are writing the second 16 bytes
|
||||
if(led % 2)
|
||||
{
|
||||
led -= 1;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
std::cout << std::hex << write_register << "\t";
|
||||
for(int i = 0; i < 2; i++)
|
||||
{
|
||||
for(int j = 0; j < 16; j++)
|
||||
{
|
||||
std::cout << std::setw(2) << std::setfill('0') << std::hex << (int)led_data[led+i][j] << " ";
|
||||
}
|
||||
std::cout << " ";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
#endif
|
||||
|
||||
bus->i2c_smbus_write_block_data(RGB_FUSION_2_SMBUS_ADDR, write_register, 32, led_data[led]);
|
||||
}
|
||||
|
||||
void RGBFusion2SMBusController::Apply()
|
||||
{
|
||||
// Protocol expects terminating sequence 0x01ff written to register 0x17
|
||||
bus->i2c_smbus_write_word_data(RGB_FUSION_2_SMBUS_ADDR,
|
||||
RGB_FUSION_2_APPLY_ADDR,
|
||||
RGB_FUSION_2_ACTION_APPLY);
|
||||
}
|
||||
|
||||
void RGBFusion2SMBusController::SetLEDEffect
|
||||
(
|
||||
unsigned int led,
|
||||
int mode,
|
||||
unsigned int speed,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
)
|
||||
{
|
||||
led_data[led][RGB_FUSION_2_IDX_MODE] = mode;
|
||||
led_data[led][RGB_FUSION_2_IDX_RED] = red;
|
||||
led_data[led][RGB_FUSION_2_IDX_GREEN] = green;
|
||||
led_data[led][RGB_FUSION_2_IDX_BLUE] = blue;
|
||||
led_data[led][RGB_FUSION_2_IDX_BRIGHTNESS] = 0x64;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case RGB_FUSION_2_MODE_PULSE:
|
||||
// Timer 1: On time
|
||||
// Timer 2: Off time
|
||||
led_data[led][RGB_FUSION_2_TIMER_1_LSB] = 0x20 * speed;
|
||||
led_data[led][RGB_FUSION_2_TIMER_1_MSB] = 0x03 * speed;
|
||||
led_data[led][RGB_FUSION_2_TIMER_2_LSB] = 0x20 * speed;
|
||||
led_data[led][RGB_FUSION_2_TIMER_2_MSB] = 0x03 * speed;
|
||||
break;
|
||||
|
||||
case RGB_FUSION_2_MODE_COLOR_CYCLE:
|
||||
// Timer 1: Cycle time
|
||||
led_data[led][RGB_FUSION_2_TIMER_1_LSB] = 0x00;
|
||||
led_data[led][RGB_FUSION_2_TIMER_1_MSB] = 0x03 * speed;
|
||||
led_data[led][RGB_FUSION_2_IDX_OPT_1] = 0x07; // Number of colors to cycle through. Valid range [1-7]
|
||||
led_data[led][RGB_FUSION_2_IDX_OPT_2] = 0x00; // Color cycle, or color cycle and pulse. [0,1]
|
||||
break;
|
||||
|
||||
case RGB_FUSION_2_MODE_FLASHING:
|
||||
/* Timer 1: On time
|
||||
* Timer 2: Interval
|
||||
* Timer 3: Cycle time */
|
||||
led_data[led][RGB_FUSION_2_TIMER_1_LSB] = 0x64;
|
||||
led_data[led][RGB_FUSION_2_TIMER_1_MSB] = 0;
|
||||
led_data[led][RGB_FUSION_2_TIMER_2_LSB] = 0xc8;
|
||||
led_data[led][RGB_FUSION_2_TIMER_2_MSB] = 0;
|
||||
led_data[led][RGB_FUSION_2_TIMER_3_LSB] = 0xd0;
|
||||
led_data[led][RGB_FUSION_2_TIMER_3_MSB] = 0x07;
|
||||
|
||||
led_data[led][RGB_FUSION_2_IDX_OPT_1] = speed; // Controls number of flashes
|
||||
break;
|
||||
}
|
||||
|
||||
WriteLED(led);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBFusion2SMBusController.h |
|
||||
| |
|
||||
| Definitions and types for Gigabyte Aorus |
|
||||
| RGB Fusion 2 SMBus lighting controller |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 3/12/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include <string>
|
||||
#include "i2c_smbus.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef unsigned char rgb_fusion_dev_id;
|
||||
|
||||
enum
|
||||
{
|
||||
RGB_FUSION_2_IDX_MODE = 0x01, /* Mode index */
|
||||
RGB_FUSION_2_IDX_BRIGHTNESS = 0x02, /* Brightness index */
|
||||
RGB_FUSION_2_IDX_MAX_BRIGHTNESS = 0x02, /* Max brightness index */
|
||||
RGB_FUSION_2_IDX_MIN_BRIGHTNESS = 0x03, /* Minimum brightness index */
|
||||
RGB_FUSION_2_IDX_BLUE = 0x04, /* Blue index */
|
||||
RGB_FUSION_2_IDX_GREEN = 0x05, /* Green index */
|
||||
RGB_FUSION_2_IDX_RED = 0x06, /* Red index */
|
||||
RGB_FUSION_2_IDX_WHITE = 0x07, /* White index */
|
||||
RGB_FUSION_2_TIMER_1_LSB = 0x08, /* Timer 1 LSB. Valid timer values [0-65535] */
|
||||
RGB_FUSION_2_TIMER_1_MSB = 0x09, /* Timer 1 MSB. Timer unis are milliseconds */
|
||||
RGB_FUSION_2_TIMER_2_LSB = 0x0A, /* Timer 2 LSB */
|
||||
RGB_FUSION_2_TIMER_2_MSB = 0x0B, /* Timer 2 MSB */
|
||||
RGB_FUSION_2_TIMER_3_LSB = 0x0C, /* Timer 3 LSB */
|
||||
RGB_FUSION_2_TIMER_3_MSB = 0x0D, /* Timer 3 MSB */
|
||||
RGB_FUSION_2_IDX_OPT_1 = 0x0E, /* Option 1. Use case varies by mode */
|
||||
RGB_FUSION_2_IDX_OPT_2 = 0x0F, /* Option 2. Use case varies by mode */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RGB_FUSION_2_APPLY_ADDR = 0x17,
|
||||
RGB_FUSION_2_LED_START_ADDR = 0x20,
|
||||
RGB_FUSION_2_SMBUS_ADDR = 0x68,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RGB_FUSION_2_ACTION_APPLY = 0x01ff,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RGB_FUSION_2_MODE_PULSE = 0x01, /* Pulse mode */
|
||||
RGB_FUSION_2_MODE_MUSIC = 0x02, /* Music mode */
|
||||
RGB_FUSION_2_MODE_COLOR_CYCLE = 0x03, /* Color cycle mode */
|
||||
RGB_FUSION_2_MODE_STATIC = 0x04, /* Static color mode */
|
||||
RGB_FUSION_2_MODE_FLASHING = 0x05, /* Flashing / Double Flashing mode */
|
||||
RGB_FUSION_2_MODE_TRANSITION = 0x09, /* Gradual transition from current */
|
||||
RGB_FUSION_2_MODE_DIGITAL_A = 0x0A, /* Wave mode */
|
||||
RGB_FUSION_2_MODE_DIGITAL_B = 0x0B, /* */
|
||||
RGB_FUSION_2_MODE_DIGITAL_C = 0x0C, /* */
|
||||
RGB_FUSION_2_MODE_DIGITAL_D = 0x0D, /* */
|
||||
RGB_FUSION_2_MODE_DIGITAL_E = 0x0E, /* */
|
||||
RGB_FUSION_2_MODE_DIGITAL_F = 0x0F, /* */
|
||||
RGB_FUSION_2_MODE_DIGITAL_G = 0x10, /* */
|
||||
RGB_FUSION_2_MODE_DIGITAL_H = 0x11, /* */
|
||||
RGB_FUSION_2_MODE_DIGITAL_I = 0x12, /* */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RGB_FUSION_2_SPEED_FAST = 0x01,
|
||||
RGB_FUSION_2_SPEED_NORMAL = 0x02,
|
||||
RGB_FUSION_2_SPEED_SLOW = 0x04,
|
||||
};
|
||||
|
||||
class RGBFusion2SMBusController
|
||||
{
|
||||
public:
|
||||
RGBFusion2SMBusController(i2c_smbus_interface* bus, rgb_fusion_dev_id dev);
|
||||
~RGBFusion2SMBusController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
unsigned int GetLEDCount();
|
||||
void Apply();
|
||||
|
||||
void SetLEDEffect
|
||||
(
|
||||
unsigned int led,
|
||||
int mode,
|
||||
unsigned int speed,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
);
|
||||
|
||||
private:
|
||||
unsigned int led_count;
|
||||
i2c_smbus_interface* bus;
|
||||
rgb_fusion_dev_id dev;
|
||||
|
||||
unsigned char led_data[10][16];
|
||||
|
||||
void WriteLED(int);
|
||||
};
|
||||
@@ -0,0 +1,73 @@
|
||||
#include "RGBFusion2SMBusController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_RGBFusion2SMBus.h"
|
||||
#include "i2c_smbus.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* TestForRGBFusion2SMBusController *
|
||||
* *
|
||||
* Tests the given address to see if an RGB 2 Fusion controller exists there. First *
|
||||
* does a quick write to test for a response *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
bool TestForRGBFusion2SMBusController(i2c_smbus_interface* bus, unsigned char address)
|
||||
{
|
||||
bool pass = false;
|
||||
|
||||
int res = bus->i2c_smbus_write_quick(address, I2C_SMBUS_WRITE);
|
||||
if (res >= 0)
|
||||
{
|
||||
pass = true;
|
||||
|
||||
// res = bus->i2c_smbus_read_byte_data(address, 0xF2);
|
||||
|
||||
// if (res != 0xC4)
|
||||
// {
|
||||
// pass = false;
|
||||
// }
|
||||
}
|
||||
|
||||
return(pass);
|
||||
|
||||
} /* TestForRGBFusion2SMBusController() */
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectRGBFusion2SMBusControllers *
|
||||
* *
|
||||
* Detect RGB Fusion 2 controllers on the enumerated I2C busses at address 0x68. *
|
||||
* *
|
||||
* bus - pointer to i2c_smbus_interface where RGB Fusion device is connected *
|
||||
* dev - I2C address of RGB Fusion device *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectRGBFusion2SMBusControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers)
|
||||
{
|
||||
RGBFusion2SMBusController* new_rgb_fusion;
|
||||
RGBController_RGBFusion2SMBus* new_controller;
|
||||
|
||||
for (unsigned int bus = 0; bus < busses.size(); bus++)
|
||||
{
|
||||
// TODO - Is this necessary? Or an artifact of my own system?
|
||||
// Skip dmcd devices
|
||||
std::string device_name = std::string(busses[bus]->device_name);
|
||||
if (device_name.find("dmdc") == std::string::npos)
|
||||
{
|
||||
// Check for RGB Fusion 2 controller at 0x68
|
||||
if (TestForRGBFusion2SMBusController(busses[bus], 0x68))
|
||||
{
|
||||
new_rgb_fusion = new RGBFusion2SMBusController(busses[bus], 0x68);
|
||||
new_controller = new RGBController_RGBFusion2SMBus(new_rgb_fusion);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectRGBFusion2SMBusControllers() */
|
||||
+240
-100
@@ -12,6 +12,7 @@
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Windows.h>
|
||||
#define MSG_NOSIGNAL 0
|
||||
#else
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -29,6 +30,26 @@ NetworkClient::NetworkClient(std::vector<RGBController *>& control) : controller
|
||||
server_controller_count = 0;
|
||||
}
|
||||
|
||||
void NetworkClient::ClientInfoChanged()
|
||||
{
|
||||
ClientInfoChangeMutex.lock();
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Client info has changed, call the callbacks |
|
||||
\*-------------------------------------------------*/
|
||||
for(unsigned int callback_idx = 0; callback_idx < ClientInfoChangeCallbacks.size(); callback_idx++)
|
||||
{
|
||||
ClientInfoChangeCallbacks[callback_idx](ClientInfoChangeCallbackArgs[callback_idx]);
|
||||
}
|
||||
|
||||
ClientInfoChangeMutex.unlock();
|
||||
}
|
||||
|
||||
const char * NetworkClient::GetIP()
|
||||
{
|
||||
return(port_ip);
|
||||
}
|
||||
|
||||
unsigned short NetworkClient::GetPort()
|
||||
{
|
||||
return port_num;
|
||||
@@ -39,6 +60,12 @@ bool NetworkClient::GetOnline()
|
||||
return server_connected;
|
||||
}
|
||||
|
||||
void NetworkClient::RegisterClientInfoChangeCallback(NetClientCallback new_callback, void * new_callback_arg)
|
||||
{
|
||||
ClientInfoChangeCallbacks.push_back(new_callback);
|
||||
ClientInfoChangeCallbackArgs.push_back(new_callback_arg);
|
||||
}
|
||||
|
||||
void NetworkClient::SetIP(const char *new_ip)
|
||||
{
|
||||
if(server_connected == false)
|
||||
@@ -67,64 +94,19 @@ void NetworkClient::SetPort(unsigned short new_port)
|
||||
|
||||
void NetworkClient::StartClient()
|
||||
{
|
||||
unsigned int requested_controllers;
|
||||
|
||||
//Start a TCP server and launch threads
|
||||
char port_str[6];
|
||||
snprintf(port_str, 6, "%d", port_num);
|
||||
|
||||
port.tcp_client(port_ip, port_str);
|
||||
|
||||
requested_controllers = 0;
|
||||
|
||||
//Start the connection thread
|
||||
ConnectionThread = new std::thread(&NetworkClient::ConnectionThreadFunction, this);
|
||||
|
||||
//Start the listener thread
|
||||
ListenThread = new std::thread(&NetworkClient::ListenThreadFunction, this);
|
||||
|
||||
//Wait for server to connect
|
||||
while(!server_connected)
|
||||
{
|
||||
Sleep(100);
|
||||
}
|
||||
|
||||
//Once server is connected, send client string
|
||||
SendData_ClientString();
|
||||
|
||||
//Request number of controllers
|
||||
SendRequest_ControllerCount();
|
||||
|
||||
//Wait for server controller count
|
||||
while(server_controller_count == 0)
|
||||
{
|
||||
Sleep(100);
|
||||
}
|
||||
|
||||
printf("Client: Received controller count from server: %d\r\n", server_controller_count);
|
||||
|
||||
//Once count is received, request controllers
|
||||
while(requested_controllers < server_controller_count)
|
||||
{
|
||||
printf("Client: Requesting controller %d\r\n", requested_controllers);
|
||||
|
||||
SendRequest_ControllerData(requested_controllers);
|
||||
|
||||
//Wait until controller is received
|
||||
while(server_controllers.size() == requested_controllers)
|
||||
{
|
||||
Sleep(100);
|
||||
}
|
||||
|
||||
requested_controllers++;
|
||||
}
|
||||
|
||||
//All controllers received, add them to master list
|
||||
printf("Client: All controllers received, adding them to master list\r\n");
|
||||
for(std::size_t controller_idx = 0; controller_idx < server_controllers.size(); controller_idx++)
|
||||
{
|
||||
controllers.push_back(server_controllers[controller_idx]);
|
||||
}
|
||||
/*-------------------------------------------------*\
|
||||
| Client info has changed, call the callbacks |
|
||||
\*-------------------------------------------------*/
|
||||
ClientInfoChanged();
|
||||
}
|
||||
|
||||
void NetworkClient::StopClient()
|
||||
@@ -134,39 +116,146 @@ void NetworkClient::StopClient()
|
||||
|
||||
void NetworkClient::ConnectionThreadFunction()
|
||||
{
|
||||
unsigned int requested_controllers;
|
||||
|
||||
//This thread manages the connection to the server
|
||||
while(1)
|
||||
{
|
||||
//Connect to server and reconnect if the connection is lost
|
||||
if(server_connected == false)
|
||||
{
|
||||
//Connect to server and reconnect if the connection is lost
|
||||
server_initialized = false;
|
||||
|
||||
//Try to connect to server
|
||||
port.tcp_client_connect();
|
||||
//Try to connect to server
|
||||
if(port.tcp_client_connect() == true)
|
||||
{
|
||||
client_sock = port.sock;
|
||||
printf( "Connected to server\n" );
|
||||
|
||||
printf( "Connected to server\n" );
|
||||
//Server is now connected
|
||||
server_connected = true;
|
||||
|
||||
server_connected = true;
|
||||
break;
|
||||
//Start the listener thread
|
||||
ListenThread = new std::thread(&NetworkClient::ListenThreadFunction, this);
|
||||
|
||||
//Server is not initialized
|
||||
server_initialized = false;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Client info has changed, call the callbacks |
|
||||
\*-------------------------------------------------*/
|
||||
ClientInfoChanged();
|
||||
}
|
||||
else
|
||||
{
|
||||
printf( "Connection attempt failed\n" );
|
||||
}
|
||||
}
|
||||
|
||||
if(server_initialized == false && server_connected == true)
|
||||
{
|
||||
requested_controllers = 0;
|
||||
server_controller_count = 0;
|
||||
|
||||
//Wait for server to connect
|
||||
Sleep(100);
|
||||
|
||||
//Once server is connected, send client string
|
||||
SendData_ClientString();
|
||||
|
||||
//Request number of controllers
|
||||
SendRequest_ControllerCount();
|
||||
|
||||
//Wait for server controller count
|
||||
while(server_controller_count == 0)
|
||||
{
|
||||
Sleep(100);
|
||||
}
|
||||
|
||||
printf("Client: Received controller count from server: %d\r\n", server_controller_count);
|
||||
|
||||
//Once count is received, request controllers
|
||||
while(requested_controllers < server_controller_count)
|
||||
{
|
||||
printf("Client: Requesting controller %d\r\n", requested_controllers);
|
||||
|
||||
SendRequest_ControllerData(requested_controllers);
|
||||
|
||||
//Wait until controller is received
|
||||
while(server_controllers.size() == requested_controllers)
|
||||
{
|
||||
Sleep(100);
|
||||
}
|
||||
|
||||
requested_controllers++;
|
||||
}
|
||||
|
||||
//All controllers received, add them to master list
|
||||
printf("Client: All controllers received, adding them to master list\r\n");
|
||||
for(std::size_t controller_idx = 0; controller_idx < server_controllers.size(); controller_idx++)
|
||||
{
|
||||
controllers.push_back(server_controllers[controller_idx]);
|
||||
}
|
||||
|
||||
server_initialized = true;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Client info has changed, call the callbacks |
|
||||
\*-------------------------------------------------*/
|
||||
ClientInfoChanged();
|
||||
}
|
||||
|
||||
//Wait 1 second between tries;
|
||||
Sleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
int NetworkClient::recv_select(SOCKET s, char *buf, int len, int flags)
|
||||
{
|
||||
fd_set set;
|
||||
struct timeval timeout;
|
||||
timeout.tv_sec = 5;
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
while(1)
|
||||
{
|
||||
FD_ZERO(&set); /* clear the set */
|
||||
FD_SET(s, &set); /* add our file descriptor to the set */
|
||||
|
||||
int rv = select(s + 1, &set, NULL, NULL, &timeout);
|
||||
|
||||
if(rv == SOCKET_ERROR || server_connected == false)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if(rv == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// socket has something to read
|
||||
return(recv(s, buf, len, flags));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkClient::ListenThreadFunction()
|
||||
{
|
||||
printf("Network client listener started\n");
|
||||
//This thread handles messages received from the server
|
||||
while(1)
|
||||
while(server_connected = true)
|
||||
{
|
||||
NetPacketHeader header;
|
||||
char * data = NULL;
|
||||
int bytes_read = 0;
|
||||
char * data = NULL;
|
||||
|
||||
//Read first byte of magic
|
||||
do
|
||||
bytes_read = recv_select(client_sock, &header.pkt_magic[0], 1, 0);
|
||||
|
||||
if(bytes_read <= 0)
|
||||
{
|
||||
bytes_read = port.tcp_listen(&header.pkt_magic[0], 1);
|
||||
} while(bytes_read == 0);
|
||||
goto listen_done;
|
||||
}
|
||||
|
||||
//Test first character of magic - 'O'
|
||||
if(header.pkt_magic[0] != 'O')
|
||||
@@ -175,10 +264,12 @@ void NetworkClient::ListenThreadFunction()
|
||||
}
|
||||
|
||||
//Read second byte of magic
|
||||
do
|
||||
bytes_read = recv_select(client_sock, &header.pkt_magic[1], 1, 0);
|
||||
|
||||
if(bytes_read <= 0)
|
||||
{
|
||||
bytes_read = port.tcp_listen(&header.pkt_magic[1], 1);
|
||||
} while(bytes_read == 0);
|
||||
goto listen_done;
|
||||
}
|
||||
|
||||
//Test second character of magic - 'R'
|
||||
if(header.pkt_magic[1] != 'R')
|
||||
@@ -187,10 +278,12 @@ void NetworkClient::ListenThreadFunction()
|
||||
}
|
||||
|
||||
//Read third byte of magic
|
||||
do
|
||||
bytes_read = recv_select(client_sock, &header.pkt_magic[2], 1, 0);
|
||||
|
||||
if(bytes_read <= 0)
|
||||
{
|
||||
bytes_read = port.tcp_listen(&header.pkt_magic[2], 1);
|
||||
} while(bytes_read == 0);
|
||||
goto listen_done;
|
||||
}
|
||||
|
||||
//Test third character of magic - 'G'
|
||||
if(header.pkt_magic[2] != 'G')
|
||||
@@ -199,10 +292,12 @@ void NetworkClient::ListenThreadFunction()
|
||||
}
|
||||
|
||||
//Read fourth byte of magic
|
||||
do
|
||||
bytes_read = recv_select(client_sock, &header.pkt_magic[3], 1, 0);
|
||||
|
||||
if(bytes_read <= 0)
|
||||
{
|
||||
bytes_read = port.tcp_listen(&header.pkt_magic[3], 1);
|
||||
} while(bytes_read == 0);
|
||||
goto listen_done;
|
||||
}
|
||||
|
||||
//Test fourth character of magic - 'B'
|
||||
if(header.pkt_magic[3] != 'B')
|
||||
@@ -214,45 +309,90 @@ void NetworkClient::ListenThreadFunction()
|
||||
bytes_read = 0;
|
||||
do
|
||||
{
|
||||
bytes_read += port.tcp_listen((char *)&header.pkt_dev_idx + bytes_read, sizeof(header) - sizeof(header.pkt_magic) - bytes_read);
|
||||
int tmp_bytes_read = 0;
|
||||
|
||||
tmp_bytes_read = recv_select(client_sock, (char *)&header.pkt_dev_idx + bytes_read, sizeof(header) - sizeof(header.pkt_magic) - bytes_read, 0);
|
||||
|
||||
bytes_read += tmp_bytes_read;
|
||||
|
||||
if(tmp_bytes_read <= 0)
|
||||
{
|
||||
goto listen_done;
|
||||
}
|
||||
|
||||
} while(bytes_read != sizeof(header) - sizeof(header.pkt_magic));
|
||||
|
||||
printf( "Client: Received header, now receiving data of size %d\r\n", header.pkt_size);
|
||||
//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)
|
||||
{
|
||||
unsigned int bytes_read = 0;
|
||||
bytes_read = 0;
|
||||
|
||||
data = new char[header.pkt_size];
|
||||
|
||||
do
|
||||
{
|
||||
bytes_read += port.tcp_listen(&data[bytes_read], header.pkt_size - bytes_read);
|
||||
int tmp_bytes_read = 0;
|
||||
|
||||
tmp_bytes_read = recv_select(client_sock, &data[bytes_read], header.pkt_size - bytes_read, 0);
|
||||
|
||||
if(tmp_bytes_read <= 0)
|
||||
{
|
||||
goto listen_done;
|
||||
}
|
||||
bytes_read += tmp_bytes_read;
|
||||
|
||||
} while (bytes_read < header.pkt_size);
|
||||
}
|
||||
|
||||
printf( "Client: Received header and data\r\n" );
|
||||
printf( "Client: Packet ID: %d \r\n", header.pkt_id);
|
||||
//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;
|
||||
}
|
||||
|
||||
delete[] data;
|
||||
}
|
||||
|
||||
listen_done:
|
||||
printf( "Client socket has been closed");
|
||||
server_initialized = false;
|
||||
server_connected = false;
|
||||
|
||||
for(int server_controller_idx = 0; server_controller_idx < server_controllers.size(); server_controller_idx++)
|
||||
{
|
||||
for(int controller_idx = 0; controller_idx < controllers.size(); controller_idx++)
|
||||
{
|
||||
if(controllers[controller_idx] == server_controllers[server_controller_idx])
|
||||
{
|
||||
controllers.erase(controllers.begin() + controller_idx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
delete server_controllers[server_controller_idx];
|
||||
}
|
||||
|
||||
server_controllers.clear();
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Client info has changed, call the callbacks |
|
||||
\*-------------------------------------------------*/
|
||||
ClientInfoChanged();
|
||||
}
|
||||
|
||||
void NetworkClient::ProcessReply_ControllerCount(unsigned int data_size, char * data)
|
||||
@@ -287,8 +427,8 @@ void NetworkClient::SendData_ClientString()
|
||||
reply_hdr.pkt_id = NET_PACKET_ID_SET_CLIENT_NAME;
|
||||
reply_hdr.pkt_size = strlen(client_name.c_str()) + 1;
|
||||
|
||||
port.tcp_client_write((char *)&reply_hdr, sizeof(NetPacketHeader));
|
||||
port.tcp_client_write((char *)client_name.c_str(), reply_hdr.pkt_size);
|
||||
send(client_sock, (char *)&reply_hdr, sizeof(NetPacketHeader), MSG_NOSIGNAL);
|
||||
send(client_sock, (char *)client_name.c_str(), reply_hdr.pkt_size, MSG_NOSIGNAL);
|
||||
}
|
||||
|
||||
void NetworkClient::SendRequest_ControllerCount()
|
||||
@@ -304,13 +444,13 @@ void NetworkClient::SendRequest_ControllerCount()
|
||||
reply_hdr.pkt_id = NET_PACKET_ID_REQUEST_CONTROLLER_COUNT;
|
||||
reply_hdr.pkt_size = 0;
|
||||
|
||||
port.tcp_client_write((char *)&reply_hdr, sizeof(NetPacketHeader));
|
||||
send(client_sock, (char *)&reply_hdr, sizeof(NetPacketHeader), MSG_NOSIGNAL);
|
||||
}
|
||||
|
||||
void NetworkClient::SendRequest_ControllerData(unsigned int dev_idx)
|
||||
{
|
||||
NetPacketHeader reply_hdr;
|
||||
|
||||
|
||||
reply_hdr.pkt_magic[0] = 'O';
|
||||
reply_hdr.pkt_magic[1] = 'R';
|
||||
reply_hdr.pkt_magic[2] = 'G';
|
||||
@@ -320,14 +460,14 @@ void NetworkClient::SendRequest_ControllerData(unsigned int dev_idx)
|
||||
reply_hdr.pkt_id = NET_PACKET_ID_REQUEST_CONTROLLER_DATA;
|
||||
reply_hdr.pkt_size = 0;
|
||||
|
||||
port.tcp_client_write((char *)&reply_hdr, sizeof(NetPacketHeader));
|
||||
send(client_sock, (char *)&reply_hdr, sizeof(NetPacketHeader), MSG_NOSIGNAL);
|
||||
}
|
||||
|
||||
void NetworkClient::SendRequest_RGBController_ResizeZone(unsigned int dev_idx, int zone, int new_size)
|
||||
{
|
||||
NetPacketHeader reply_hdr;
|
||||
int reply_data[2];
|
||||
|
||||
|
||||
reply_hdr.pkt_magic[0] = 'O';
|
||||
reply_hdr.pkt_magic[1] = 'R';
|
||||
reply_hdr.pkt_magic[2] = 'G';
|
||||
@@ -340,14 +480,14 @@ void NetworkClient::SendRequest_RGBController_ResizeZone(unsigned int dev_idx, i
|
||||
reply_data[0] = zone;
|
||||
reply_data[1] = new_size;
|
||||
|
||||
port.tcp_client_write((char *)&reply_hdr, sizeof(NetPacketHeader));
|
||||
port.tcp_client_write((char *)&reply_data, sizeof(reply_data));
|
||||
send(client_sock, (char *)&reply_hdr, sizeof(NetPacketHeader), MSG_NOSIGNAL);
|
||||
send(client_sock, (char *)&reply_data, sizeof(reply_data), MSG_NOSIGNAL);
|
||||
}
|
||||
|
||||
void NetworkClient::SendRequest_RGBController_UpdateLEDs(unsigned int dev_idx, unsigned char * data, unsigned int size)
|
||||
{
|
||||
NetPacketHeader reply_hdr;
|
||||
|
||||
|
||||
reply_hdr.pkt_magic[0] = 'O';
|
||||
reply_hdr.pkt_magic[1] = 'R';
|
||||
reply_hdr.pkt_magic[2] = 'G';
|
||||
@@ -357,14 +497,14 @@ void NetworkClient::SendRequest_RGBController_UpdateLEDs(unsigned int dev_idx, u
|
||||
reply_hdr.pkt_id = NET_PACKET_ID_RGBCONTROLLER_UPDATELEDS;
|
||||
reply_hdr.pkt_size = size;
|
||||
|
||||
port.tcp_client_write((char *)&reply_hdr, sizeof(NetPacketHeader));
|
||||
port.tcp_client_write((char *)data, size);
|
||||
send(client_sock, (char *)&reply_hdr, sizeof(NetPacketHeader), MSG_NOSIGNAL);
|
||||
send(client_sock, (char *)data, size, 0);
|
||||
}
|
||||
|
||||
void NetworkClient::SendRequest_RGBController_UpdateZoneLEDs(unsigned int dev_idx, unsigned char * data, unsigned int size)
|
||||
{
|
||||
NetPacketHeader reply_hdr;
|
||||
|
||||
|
||||
reply_hdr.pkt_magic[0] = 'O';
|
||||
reply_hdr.pkt_magic[1] = 'R';
|
||||
reply_hdr.pkt_magic[2] = 'G';
|
||||
@@ -374,14 +514,14 @@ void NetworkClient::SendRequest_RGBController_UpdateZoneLEDs(unsigned int dev_id
|
||||
reply_hdr.pkt_id = NET_PACKET_ID_RGBCONTROLLER_UPDATEZONELEDS;
|
||||
reply_hdr.pkt_size = size;
|
||||
|
||||
port.tcp_client_write((char *)&reply_hdr, sizeof(NetPacketHeader));
|
||||
port.tcp_client_write((char *)data, size);
|
||||
send(client_sock, (char *)&reply_hdr, sizeof(NetPacketHeader), MSG_NOSIGNAL);
|
||||
send(client_sock, (char *)data, size, MSG_NOSIGNAL);
|
||||
}
|
||||
|
||||
void NetworkClient::SendRequest_RGBController_UpdateSingleLED(unsigned int dev_idx, unsigned char * data, unsigned int size)
|
||||
{
|
||||
NetPacketHeader reply_hdr;
|
||||
|
||||
|
||||
reply_hdr.pkt_magic[0] = 'O';
|
||||
reply_hdr.pkt_magic[1] = 'R';
|
||||
reply_hdr.pkt_magic[2] = 'G';
|
||||
@@ -391,14 +531,14 @@ void NetworkClient::SendRequest_RGBController_UpdateSingleLED(unsigned int dev_i
|
||||
reply_hdr.pkt_id = NET_PACKET_ID_RGBCONTROLLER_UPDATESINGLELED;
|
||||
reply_hdr.pkt_size = size;
|
||||
|
||||
port.tcp_client_write((char *)&reply_hdr, sizeof(NetPacketHeader));
|
||||
port.tcp_client_write((char *)data, size);
|
||||
send(client_sock, (char *)&reply_hdr, sizeof(NetPacketHeader), MSG_NOSIGNAL);
|
||||
send(client_sock, (char *)data, size, MSG_NOSIGNAL);
|
||||
}
|
||||
|
||||
void NetworkClient::SendRequest_RGBController_SetCustomMode(unsigned int dev_idx)
|
||||
{
|
||||
NetPacketHeader reply_hdr;
|
||||
|
||||
|
||||
reply_hdr.pkt_magic[0] = 'O';
|
||||
reply_hdr.pkt_magic[1] = 'R';
|
||||
reply_hdr.pkt_magic[2] = 'G';
|
||||
@@ -408,13 +548,13 @@ void NetworkClient::SendRequest_RGBController_SetCustomMode(unsigned int dev_idx
|
||||
reply_hdr.pkt_id = NET_PACKET_ID_RGBCONTROLLER_SETCUSTOMMODE;
|
||||
reply_hdr.pkt_size = 0;
|
||||
|
||||
port.tcp_client_write((char *)&reply_hdr, sizeof(NetPacketHeader));
|
||||
send(client_sock, (char *)&reply_hdr, sizeof(NetPacketHeader), MSG_NOSIGNAL);
|
||||
}
|
||||
|
||||
void NetworkClient::SendRequest_RGBController_UpdateMode(unsigned int dev_idx, unsigned char * data, unsigned int size)
|
||||
{
|
||||
NetPacketHeader reply_hdr;
|
||||
|
||||
|
||||
reply_hdr.pkt_magic[0] = 'O';
|
||||
reply_hdr.pkt_magic[1] = 'R';
|
||||
reply_hdr.pkt_magic[2] = 'G';
|
||||
@@ -424,6 +564,6 @@ void NetworkClient::SendRequest_RGBController_UpdateMode(unsigned int dev_idx, u
|
||||
reply_hdr.pkt_id = NET_PACKET_ID_RGBCONTROLLER_UPDATEMODE;
|
||||
reply_hdr.pkt_size = size;
|
||||
|
||||
port.tcp_client_write((char *)&reply_hdr, sizeof(NetPacketHeader));
|
||||
port.tcp_client_write((char *)data, size);
|
||||
send(client_sock, (char *)&reply_hdr, sizeof(NetPacketHeader), MSG_NOSIGNAL);
|
||||
send(client_sock, (char *)data, size, MSG_NOSIGNAL);
|
||||
}
|
||||
|
||||
+19
-2
@@ -10,19 +10,26 @@
|
||||
#include "NetworkProtocol.h"
|
||||
#include "net_port.h"
|
||||
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef void (*NetClientCallback)(void *);
|
||||
|
||||
class NetworkClient
|
||||
{
|
||||
public:
|
||||
NetworkClient(std::vector<RGBController *>& control);
|
||||
|
||||
void ClientInfoChanged();
|
||||
|
||||
const char * GetIP();
|
||||
unsigned short GetPort();
|
||||
bool GetOnline();
|
||||
|
||||
void RegisterClientInfoChangeCallback(NetClientCallback new_callback, void * new_callback_arg);
|
||||
|
||||
void SetIP(const char *new_ip);
|
||||
void SetName(const char *new_name);
|
||||
void SetPort(unsigned short new_port);
|
||||
@@ -51,18 +58,28 @@ public:
|
||||
|
||||
void SendRequest_RGBController_UpdateMode(unsigned int dev_idx, unsigned char * data, unsigned int size);
|
||||
|
||||
protected:
|
||||
std::vector<RGBController *>& controllers;
|
||||
std::vector<RGBController *> server_controllers;
|
||||
|
||||
protected:
|
||||
std::vector<RGBController *>& controllers;
|
||||
|
||||
|
||||
private:
|
||||
SOCKET client_sock;
|
||||
std::string client_name;
|
||||
net_port port;
|
||||
char port_ip[20];
|
||||
unsigned short port_num;
|
||||
bool server_connected;
|
||||
bool server_initialized;
|
||||
unsigned int server_controller_count;
|
||||
|
||||
std::thread * ConnectionThread;
|
||||
std::thread * ListenThread;
|
||||
|
||||
std::mutex ClientInfoChangeMutex;
|
||||
std::vector<NetClientCallback> ClientInfoChangeCallbacks;
|
||||
std::vector<void *> ClientInfoChangeCallbackArgs;
|
||||
|
||||
int recv_select(SOCKET s, char *buf, int len, int flags);
|
||||
};
|
||||
|
||||
+7
-7
@@ -185,7 +185,7 @@ void NetworkServer::StopServer()
|
||||
|
||||
for(unsigned int client_idx = 0; client_idx < ServerClients.size(); client_idx++)
|
||||
{
|
||||
delete[] ServerClients[client_idx];
|
||||
delete ServerClients[client_idx];
|
||||
}
|
||||
|
||||
ServerClients.clear();
|
||||
@@ -338,7 +338,7 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
||||
//Read first byte of magic
|
||||
bytes_read = recv_select(client_sock, &header.pkt_magic[0], 1, 0);
|
||||
|
||||
if(bytes_read == 0)
|
||||
if(bytes_read <= 0)
|
||||
{
|
||||
goto listen_done;
|
||||
}
|
||||
@@ -352,7 +352,7 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
||||
//Read second byte of magic
|
||||
bytes_read = recv_select(client_sock, &header.pkt_magic[1], 1, 0);
|
||||
|
||||
if(bytes_read == 0)
|
||||
if(bytes_read <= 0)
|
||||
{
|
||||
goto listen_done;
|
||||
}
|
||||
@@ -366,7 +366,7 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
||||
//Read third byte of magic
|
||||
bytes_read = recv_select(client_sock, &header.pkt_magic[2], 1, 0);
|
||||
|
||||
if(bytes_read == 0)
|
||||
if(bytes_read <= 0)
|
||||
{
|
||||
goto listen_done;
|
||||
}
|
||||
@@ -380,7 +380,7 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
||||
//Read fourth byte of magic
|
||||
bytes_read = recv_select(client_sock, &header.pkt_magic[3], 1, 0);
|
||||
|
||||
if(bytes_read == 0)
|
||||
if(bytes_read <= 0)
|
||||
{
|
||||
goto listen_done;
|
||||
}
|
||||
@@ -401,7 +401,7 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
||||
|
||||
bytes_read += tmp_bytes_read;
|
||||
|
||||
if(tmp_bytes_read == 0)
|
||||
if(tmp_bytes_read <= 0)
|
||||
{
|
||||
goto listen_done;
|
||||
}
|
||||
@@ -423,7 +423,7 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
||||
|
||||
tmp_bytes_read = recv_select(client_sock, &data[bytes_read], header.pkt_size - bytes_read, 0);
|
||||
|
||||
if(tmp_bytes_read == 0)
|
||||
if(tmp_bytes_read <= 0)
|
||||
{
|
||||
goto listen_done;
|
||||
}
|
||||
|
||||
+7
-3
@@ -254,7 +254,7 @@ void DetectI2CBusses()
|
||||
memset(device_string, 0x00, sizeof(device_string));
|
||||
read(test_fd, device_string, sizeof(device_string));
|
||||
device_string[strlen(device_string) - 1] = 0x00;
|
||||
|
||||
|
||||
close(test_fd);
|
||||
|
||||
strcpy(device_string, "/dev/");
|
||||
@@ -291,9 +291,10 @@ void DetectPatriotViperControllers(std::vector<i2c_smbus_interface*> &busses, st
|
||||
void DetectPolychromeControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
|
||||
void DetectRGBFusionControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
|
||||
void DetectRGBFusionGPUControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
|
||||
void DetectRGBFusion2SMBusControllers(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 DetectAuraAddressableControllers(std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectAuraUSBControllers(std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectAuraCoreControllers(std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectLEDStripControllers(std::vector<RGBController*> &rgb_controllers);
|
||||
void DetectHue2Controllers(std::vector<RGBController*> &rgb_controllers);
|
||||
@@ -335,11 +336,14 @@ void DetectRGBControllers(void)
|
||||
DetectPolychromeControllers(busses, rgb_controllers);
|
||||
DetectRGBFusionGPUControllers(busses, rgb_controllers);
|
||||
|
||||
//TODO: Implement better detection before enabling this controller
|
||||
//DetectRGBFusion2SMBusControllers(busses, rgb_controllers);
|
||||
|
||||
DetectRGBFusionControllers(busses, rgb_controllers);
|
||||
DetectMSIMysticLightControllers(rgb_controllers);
|
||||
DetectMSIRGBControllers(rgb_controllers);
|
||||
|
||||
DetectAuraAddressableControllers(rgb_controllers);
|
||||
DetectAuraUSBControllers(rgb_controllers);
|
||||
DetectAuraCoreControllers(rgb_controllers);
|
||||
DetectLEDStripControllers(rgb_controllers);
|
||||
DetectHue2Controllers(rgb_controllers);
|
||||
|
||||
+17
-7
@@ -5,7 +5,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
TARGET = OpenRGB
|
||||
TEMPLATE = app
|
||||
|
||||
VERSION = 0.11
|
||||
VERSION = 0.2
|
||||
win32:BUILDDATE = $$system(date /t)
|
||||
unix:BUILDDATE = $$system(date -R)
|
||||
GIT_COMMIT_ID = $$system(git --git-dir $$_PRO_FILE_PWD_/.git --work-tree $$_PRO_FILE_PWD_ rev-parse HEAD)
|
||||
@@ -31,7 +31,7 @@ INCLUDEPATH += \
|
||||
serial_port/ \
|
||||
super_io/ \
|
||||
Controllers/AMDWraithPrismController/ \
|
||||
Controllers/AuraAddressableController/ \
|
||||
Controllers/AuraUSBController/ \
|
||||
Controllers/AuraCoreController/ \
|
||||
Controllers/AuraGPUController/ \
|
||||
Controllers/AuraSMBusController/ \
|
||||
@@ -55,6 +55,7 @@ INCLUDEPATH += \
|
||||
Controllers/PoseidonZRGBController/ \
|
||||
Controllers/RedragonController/ \
|
||||
Controllers/RGBFusionController/ \
|
||||
Controllers/RGBFusion2SMBusController/ \
|
||||
Controllers/RGBFusion2USBController/ \
|
||||
Controllers/RGBFusionGPUController/ \
|
||||
Controllers/ThermaltakeRiingController/ \
|
||||
@@ -88,8 +89,10 @@ SOURCES += \
|
||||
super_io/super_io.cpp \
|
||||
Controllers/AMDWraithPrismController/AMDWraithPrismController.cpp \
|
||||
Controllers/AMDWraithPrismController/AMDWraithPrismControllerDetect.cpp \
|
||||
Controllers/AuraAddressableController/AuraAddressableController.cpp \
|
||||
Controllers/AuraAddressableController/AuraAddressableControllerDetect.cpp \
|
||||
Controllers/AuraUSBController/AuraUSBController.cpp \
|
||||
Controllers/AuraUSBController/AuraAddressableController.cpp \
|
||||
Controllers/AuraUSBController/AuraMainboardController.cpp \
|
||||
Controllers/AuraUSBController/AuraUSBControllerDetect.cpp \
|
||||
Controllers/AuraCoreController/AuraCoreController.cpp \
|
||||
Controllers/AuraCoreController/AuraCoreControllerDetect.cpp \
|
||||
Controllers/AuraGPUController/AuraGPUController.cpp \
|
||||
@@ -136,6 +139,8 @@ SOURCES += \
|
||||
Controllers/RGBFusionController/RGBFusionControllerDetect.cpp \
|
||||
Controllers/RGBFusion2USBController/RGBFusion2USBController.cpp \
|
||||
Controllers/RGBFusion2USBController/RGBFusion2USBControllerDetect.cpp \
|
||||
Controllers/RGBFusion2SMBusController/RGBFusion2SMBusController.cpp \
|
||||
Controllers/RGBFusion2SMBusController/RGBFusion2SMBusControllerDetect.cpp \
|
||||
Controllers/RGBFusionGPUController/RGBFusionGPUController.cpp \
|
||||
Controllers/RGBFusionGPUController/RGBFusionGPUControllerDetect.cpp \
|
||||
Controllers/RedragonController/RedragonK556Controller.cpp \
|
||||
@@ -146,7 +151,7 @@ SOURCES += \
|
||||
RGBController/RGBController.cpp \
|
||||
RGBController/E131ControllerDetect.cpp \
|
||||
RGBController/RGBController_AMDWraithPrism.cpp \
|
||||
RGBController/RGBController_AuraAddressable.cpp \
|
||||
RGBController/RGBController_AuraUSB.cpp \
|
||||
RGBController/RGBController_AuraCore.cpp \
|
||||
RGBController/RGBController_AuraGPU.cpp \
|
||||
RGBController/RGBController_AuraSMBus.cpp \
|
||||
@@ -174,6 +179,7 @@ SOURCES += \
|
||||
RGBController/RGBController_RedragonK556.cpp \
|
||||
RGBController/RGBController_RedragonM711.cpp \
|
||||
RGBController/RGBController_RGBFusion.cpp \
|
||||
RGBController/RGBController_RGBFusion2SMBus.cpp \
|
||||
RGBController/RGBController_RGBFusion2USB.cpp \
|
||||
RGBController/RGBController_RGBFusionGPU.cpp \
|
||||
RGBController/RGBController_ThermaltakeRiing.cpp \
|
||||
@@ -200,7 +206,9 @@ HEADERS += \
|
||||
serial_port/serial_port.h \
|
||||
super_io/super_io.h \
|
||||
Controllers/AMDWraithPrismController/AMDWraithPrismController.h \
|
||||
Controllers/AuraAddressableController/AuraAddressableController.h \
|
||||
Controllers/AuraUSBController/AuraUSBController.h \
|
||||
Controllers/AuraUSBController/AuraAddressableController.h \
|
||||
Controllers/AuraUSBController/AuraMainboardController.h \
|
||||
Controllers/AuraCoreController/AuraCoreController.h \
|
||||
Controllers/AuraGPUController/AuraGPUController.h \
|
||||
Controllers/AuraSMBusController/AuraSMBusController.h \
|
||||
@@ -223,13 +231,14 @@ HEADERS += \
|
||||
Controllers/PoseidonZRGBController/PoseidonZRGBController.h \
|
||||
Controllers/RGBFusionController/RGBFusionController.h \
|
||||
Controllers/RGBFusion2USBController/RGBFusion2USBController.h \
|
||||
Controllers/RGBFusion2SMBusController/RGBFusion2SMBusController.h \
|
||||
Controllers/RGBFusionGPUController/RGBFusionGPUController.h \
|
||||
Controllers/RedragonController/RedragonK556Controller.h \
|
||||
Controllers/RedragonController/RedragonM711Controller.h \
|
||||
Controllers/ThermaltakeRiingController/ThermaltakeRiingController.h \
|
||||
RGBController/RGBController.h \
|
||||
RGBController/RGBController_AMDWraithPrism.h \
|
||||
RGBController/RGBController_AuraAddressable.h \
|
||||
RGBController/RGBController_AuraUSB.h \
|
||||
RGBController/RGBController_AuraCore.h \
|
||||
RGBController/RGBController_AuraGPU.h \
|
||||
RGBController/RGBController_AuraSMBus.h \
|
||||
@@ -256,6 +265,7 @@ HEADERS += \
|
||||
RGBController/RGBController_RedragonK556.h \
|
||||
RGBController/RGBController_RedragonM711.h \
|
||||
RGBController/RGBController_RGBFusion.h \
|
||||
RGBController/RGBController_RGBFusion2SMBus.h \
|
||||
RGBController/RGBController_RGBFusion2USB.h \
|
||||
RGBController/RGBController_RGBFusionGPU.h \
|
||||
RGBController/RGBController_ThermaltakeRiing.h \
|
||||
|
||||
@@ -199,7 +199,7 @@ static const razer_zone blackwidow_chroma_v2_zone =
|
||||
|
||||
static const razer_device blackwidow_chroma_v2_device =
|
||||
{
|
||||
"Razer Blackwidow Chroma V2",
|
||||
"Razer BlackWidow Chroma V2",
|
||||
DEVICE_TYPE_KEYBOARD,
|
||||
true,
|
||||
6,
|
||||
|
||||
+21
-15
@@ -1,22 +1,22 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_AuraAddressable.cpp |
|
||||
| RGBController_AuraUSB.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for Asus Aura |
|
||||
| addressable controller driver |
|
||||
| USB controller driver |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 1/18/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_AuraAddressable.h"
|
||||
#include "RGBController_AuraUSB.h"
|
||||
|
||||
RGBController_AuraAddressable::RGBController_AuraAddressable(AuraAddressableController* aura_ptr)
|
||||
RGBController_AuraUSB::RGBController_AuraUSB(AuraUSBController* aura_ptr)
|
||||
{
|
||||
aura = aura_ptr;
|
||||
|
||||
name = "ASUS Aura Addressable";
|
||||
name = "ASUS Aura USB";
|
||||
version = aura->GetDeviceName();
|
||||
type = DEVICE_TYPE_MOTHERBOARD;
|
||||
description = "ASUS Aura Addressable Device";
|
||||
description = "ASUS Aura USB Device";
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
@@ -99,12 +99,12 @@ RGBController_AuraAddressable::RGBController_AuraAddressable(AuraAddressableCont
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_AuraAddressable::~RGBController_AuraAddressable()
|
||||
RGBController_AuraUSB::~RGBController_AuraUSB()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_AuraAddressable::SetupZones()
|
||||
void RGBController_AuraUSB::SetupZones()
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Only set LED count on the first run |
|
||||
@@ -164,7 +164,7 @@ void RGBController_AuraAddressable::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_AuraAddressable::ResizeZone(int zone, int new_size)
|
||||
void RGBController_AuraUSB::ResizeZone(int zone, int new_size)
|
||||
{
|
||||
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
|
||||
{
|
||||
@@ -174,7 +174,7 @@ void RGBController_AuraAddressable::ResizeZone(int zone, int new_size)
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_AuraAddressable::DeviceUpdateLEDs()
|
||||
void RGBController_AuraUSB::DeviceUpdateLEDs()
|
||||
{
|
||||
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
@@ -182,24 +182,24 @@ void RGBController_AuraAddressable::DeviceUpdateLEDs()
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_AuraAddressable::UpdateZoneLEDs(int zone)
|
||||
void RGBController_AuraUSB::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
aura->SetChannelLEDs(zone, zones[zone].colors, zones[zone].leds_count);
|
||||
}
|
||||
|
||||
void RGBController_AuraAddressable::UpdateSingleLED(int led)
|
||||
void RGBController_AuraUSB::UpdateSingleLED(int led)
|
||||
{
|
||||
unsigned int channel = leds[led].value;
|
||||
|
||||
aura->SetChannelLEDs(channel, zones[channel].colors, zones[channel].leds_count);
|
||||
}
|
||||
|
||||
void RGBController_AuraAddressable::SetCustomMode()
|
||||
void RGBController_AuraUSB::SetCustomMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_AuraAddressable::UpdateMode()
|
||||
void RGBController_AuraUSB::UpdateMode()
|
||||
{
|
||||
unsigned char red = 0;
|
||||
unsigned char grn = 0;
|
||||
@@ -212,5 +212,11 @@ void RGBController_AuraAddressable::UpdateMode()
|
||||
blu = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
}
|
||||
|
||||
aura->SetMode(modes[active_mode].value, red, grn, blu);
|
||||
for(unsigned int zone_idx; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
if(zones[zone_idx].leds_count > 0)
|
||||
{
|
||||
aura->SetMode(zone_idx, modes[active_mode].value, red, grn, blu);
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -1,23 +1,23 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_AuraAddressable.h |
|
||||
| RGBController_AuraUSB.h |
|
||||
| |
|
||||
| Generic RGB Interface for Asus Aura |
|
||||
| addressable controller driver |
|
||||
| USB controller driver |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 1/18/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "AuraAddressableController.h"
|
||||
#include "AuraUSBController.h"
|
||||
|
||||
#define AURA_ADDRESSABLE_MAX_LEDS 120
|
||||
|
||||
class RGBController_AuraAddressable : public RGBController
|
||||
class RGBController_AuraUSB : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_AuraAddressable(AuraAddressableController* aura_ptr);
|
||||
~RGBController_AuraAddressable();
|
||||
RGBController_AuraUSB(AuraUSBController* aura_ptr);
|
||||
~RGBController_AuraUSB();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
void UpdateMode();
|
||||
|
||||
private:
|
||||
AuraAddressableController* aura;
|
||||
AuraUSBController* aura;
|
||||
std::vector<unsigned int> leds_channel;
|
||||
std::vector<unsigned int> zones_channel;
|
||||
};
|
||||
@@ -0,0 +1,187 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_RGBFusion2SMBus.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for OpenRGB |
|
||||
| Gigabyte RGB Fusion 2 SMBUS Driver |
|
||||
| |
|
||||
| Matt Harper (5/5/2020) |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_RGBFusion2SMBus.h"
|
||||
|
||||
/* TODO - Validate all of these
|
||||
* CPU
|
||||
* ???
|
||||
* Mobo logo - Verified
|
||||
* Case rear
|
||||
* Case
|
||||
* ???
|
||||
* ???
|
||||
* ARGB header 1
|
||||
* ARGB header 2
|
||||
*
|
||||
* Do ??? actually map to anything? Are they even supported?
|
||||
* If not, what is an elegant way to display but not wreck existing logic?
|
||||
*/
|
||||
static const char* rgb_fusion_zone_names[] =
|
||||
{
|
||||
"CPU",
|
||||
"???",
|
||||
"Motherboard Logo",
|
||||
"Case Rear",
|
||||
"Case",
|
||||
"???",
|
||||
"???",
|
||||
"ARGB Header 1",
|
||||
"ARGB Header 2",
|
||||
"???"
|
||||
};
|
||||
|
||||
RGBController_RGBFusion2SMBus::RGBController_RGBFusion2SMBus(RGBFusion2SMBusController* rgb_fusion_ptr)
|
||||
{
|
||||
rgb_fusion = rgb_fusion_ptr;
|
||||
|
||||
name = "RGB Fusion 2 SMBus";
|
||||
description = "RGB Fusion 2 SMBus";
|
||||
location = rgb_fusion->GetDeviceLocation();
|
||||
|
||||
type = DEVICE_TYPE_MOTHERBOARD;
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = RGB_FUSION_2_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Pulse;
|
||||
Pulse.name = "Pulse";
|
||||
Pulse.value = RGB_FUSION_2_MODE_PULSE;
|
||||
Pulse.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Pulse.speed_min = RGB_FUSION_2_SPEED_SLOW;
|
||||
Pulse.speed_max = RGB_FUSION_2_SPEED_FAST;
|
||||
Pulse.speed = RGB_FUSION_2_SPEED_NORMAL;
|
||||
Pulse.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Pulse);
|
||||
|
||||
mode Flashing;
|
||||
Flashing.name = "Flashing";
|
||||
Flashing.value = RGB_FUSION_2_MODE_FLASHING;
|
||||
Flashing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Flashing.speed_min = 0x01;
|
||||
Flashing.speed_max = 0x04;
|
||||
Flashing.speed = 0x02;
|
||||
Flashing.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Flashing);
|
||||
|
||||
mode ColorCycle;
|
||||
ColorCycle.name = "Color Cycle";
|
||||
ColorCycle.value = RGB_FUSION_2_MODE_COLOR_CYCLE;
|
||||
ColorCycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
ColorCycle.speed_min = RGB_FUSION_2_SPEED_SLOW;
|
||||
ColorCycle.speed_max = RGB_FUSION_2_SPEED_FAST;
|
||||
ColorCycle.speed = RGB_FUSION_2_SPEED_NORMAL;
|
||||
ColorCycle.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(ColorCycle);
|
||||
|
||||
SetupZones();
|
||||
|
||||
// Initialize active mode
|
||||
// TODO - broken. Need to complete GetDeviceMode
|
||||
active_mode = GetDeviceMode();
|
||||
}
|
||||
|
||||
void RGBController_RGBFusion2SMBus::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Search through all LEDs and create zones for each channel |
|
||||
| type |
|
||||
\*---------------------------------------------------------*/
|
||||
for(unsigned int zone_idx = 0; zone_idx < rgb_fusion->GetLEDCount(); zone_idx++)
|
||||
{
|
||||
zone* new_zone = new zone();
|
||||
|
||||
// Set zone name to channel name
|
||||
new_zone->name = rgb_fusion_zone_names[zone_idx];
|
||||
new_zone->leds_min = 1;
|
||||
new_zone->leds_max = 1;
|
||||
new_zone->leds_count = 1;
|
||||
|
||||
// Push new zone to zones vector
|
||||
zones.push_back(*new_zone);
|
||||
}
|
||||
|
||||
for(unsigned int led_idx = 0; led_idx < zones.size(); led_idx++)
|
||||
{
|
||||
led* new_led = new led();
|
||||
|
||||
// Set LED name to channel name
|
||||
new_led->name = rgb_fusion_zone_names[led_idx];
|
||||
|
||||
// Push new LED to LEDs vector
|
||||
leds.push_back(*new_led);
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_RGBFusion2SMBus::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_RGBFusion2SMBus::DeviceUpdateLEDs()
|
||||
{
|
||||
for (std::size_t led = 0; led < colors.size(); led++)
|
||||
{
|
||||
RGBColor color = colors[led];
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
int mode = modes[active_mode].value;
|
||||
unsigned int speed = modes[active_mode].speed;
|
||||
|
||||
rgb_fusion->SetLEDEffect(led, mode, speed, red, grn, blu);
|
||||
}
|
||||
|
||||
rgb_fusion->Apply();
|
||||
}
|
||||
|
||||
void RGBController_RGBFusion2SMBus::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
RGBColor color = colors[zone];
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
|
||||
int mode = modes[active_mode].value;
|
||||
unsigned int speed = modes[active_mode].speed;
|
||||
|
||||
rgb_fusion->SetLEDEffect(zone, mode, speed, red, grn, blu);
|
||||
rgb_fusion->Apply();
|
||||
}
|
||||
|
||||
void RGBController_RGBFusion2SMBus::UpdateSingleLED(int led)
|
||||
{
|
||||
UpdateZoneLEDs(led);
|
||||
}
|
||||
|
||||
// TODO - Research if possible to read device state
|
||||
int RGBController_RGBFusion2SMBus::GetDeviceMode()
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
void RGBController_RGBFusion2SMBus::SetCustomMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_RGBFusion2SMBus::UpdateMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_RGBFusion2SMBus.h |
|
||||
| |
|
||||
| Generic RGB Interface for OpenRGB |
|
||||
| Gigabyte RGB Fusion 2 SMBUS Driver |
|
||||
| |
|
||||
| Matt Harper (5/5/2020) |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "RGBFusion2SMBusController.h"
|
||||
|
||||
class RGBController_RGBFusion2SMBus : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_RGBFusion2SMBus(RGBFusion2SMBusController* rgb_fusion_ptr);
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void UpdateMode();
|
||||
|
||||
private:
|
||||
RGBFusion2SMBusController* rgb_fusion;
|
||||
|
||||
int GetDeviceMode();
|
||||
};
|
||||
@@ -18,6 +18,29 @@ RGBController_ThermaltakeRiing::RGBController_ThermaltakeRiing(ThermaltakeRiingC
|
||||
type = DEVICE_TYPE_COOLER;
|
||||
description = "Thermaltake Riing Device";
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = THERMALTAKE_MODE_PER_LED;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.speed_min = 0;
|
||||
Direct.speed_max = 0;
|
||||
Direct.speed = 0;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = THERMALTAKE_MODE_FULL;
|
||||
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Static.colors_min = 1;
|
||||
Static.colors_max = 1;
|
||||
Static.speed_min = 0;
|
||||
Static.speed_max = 0;
|
||||
Static.speed = 0;
|
||||
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Static.colors.resize(1);
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Flow;
|
||||
Flow.name = "Flow";
|
||||
Flow.value = THERMALTAKE_MODE_FLOW;
|
||||
@@ -78,29 +101,6 @@ RGBController_ThermaltakeRiing::RGBController_ThermaltakeRiing(ThermaltakeRiingC
|
||||
Wave.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Wave);
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = THERMALTAKE_MODE_PER_LED;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.speed_min = 0;
|
||||
Direct.speed_max = 0;
|
||||
Direct.speed = 0;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = THERMALTAKE_MODE_FULL;
|
||||
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Static.colors_min = 1;
|
||||
Static.colors_max = 1;
|
||||
Static.speed_min = 0;
|
||||
Static.speed_max = 0;
|
||||
Static.speed = 0;
|
||||
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Static.colors.resize(1);
|
||||
modes.push_back(Static);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ void RGBController_ThermaltakeRiing::UpdateSingleLED(int led)
|
||||
|
||||
void RGBController_ThermaltakeRiing::SetCustomMode()
|
||||
{
|
||||
active_mode = 6;
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_ThermaltakeRiing::UpdateMode()
|
||||
|
||||
@@ -422,11 +422,12 @@ bool OptionSaveProfile(std::string argument)
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool ProcessOptions(int argc, char *argv[], Options *options)
|
||||
int ProcessOptions(int argc, char *argv[], Options *options)
|
||||
{
|
||||
int arg_index = 1;
|
||||
int current_device = -1;
|
||||
int current_zone = -1;
|
||||
unsigned int ret_flags = 0;
|
||||
int arg_index = 1;
|
||||
int current_device = -1;
|
||||
int current_zone = -1;
|
||||
|
||||
options->hasDevice = false;
|
||||
|
||||
@@ -444,10 +445,26 @@ bool ProcessOptions(int argc, char *argv[], Options *options)
|
||||
arg_index++;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| --gui |
|
||||
\*---------------------------------------------------------*/
|
||||
if(option == "--gui")
|
||||
{
|
||||
ret_flags |= 2;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| --i2c-tools / --yolo |
|
||||
\*---------------------------------------------------------*/
|
||||
else if(option == "--i2c-tools" || option == "--yolo")
|
||||
{
|
||||
ret_flags |= 4;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| -h / --help |
|
||||
\*---------------------------------------------------------*/
|
||||
if(option == "--help" || option == "-h")
|
||||
else if(option == "--help" || option == "-h")
|
||||
{
|
||||
OptionHelp();
|
||||
exit(0);
|
||||
@@ -478,7 +495,7 @@ bool ProcessOptions(int argc, char *argv[], Options *options)
|
||||
{
|
||||
if(!OptionDevice(¤t_device, argument, options))
|
||||
{
|
||||
return false;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,7 +506,7 @@ bool ProcessOptions(int argc, char *argv[], Options *options)
|
||||
{
|
||||
if(!OptionZone(¤t_device, ¤t_zone, argument, options))
|
||||
{
|
||||
return false;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -500,7 +517,7 @@ bool ProcessOptions(int argc, char *argv[], Options *options)
|
||||
{
|
||||
if(!OptionColor(¤t_device, ¤t_zone, argument, options))
|
||||
{
|
||||
return false;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -511,7 +528,7 @@ bool ProcessOptions(int argc, char *argv[], Options *options)
|
||||
{
|
||||
if(!OptionMode(¤t_device, argument, options))
|
||||
{
|
||||
return false;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -522,7 +539,7 @@ bool ProcessOptions(int argc, char *argv[], Options *options)
|
||||
{
|
||||
if(!OptionSize(¤t_device, ¤t_zone, argument, options))
|
||||
{
|
||||
return false;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -549,7 +566,7 @@ bool ProcessOptions(int argc, char *argv[], Options *options)
|
||||
else
|
||||
{
|
||||
std::cout << "Error: Invalid option: " + option << std::endl;
|
||||
return false;
|
||||
return 1;
|
||||
}
|
||||
|
||||
arg_index++;
|
||||
@@ -566,16 +583,14 @@ bool ProcessOptions(int argc, char *argv[], Options *options)
|
||||
if(!options->devices[option_idx].hasOption)
|
||||
{
|
||||
std::cout << "Error: Device " + std::to_string(option_idx) + " specified, but neither mode nor color given" << std::endl;
|
||||
return false;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return options->allDeviceOptions.hasOption;
|
||||
return ret_flags;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ApplyOptions(DeviceOptions& options)
|
||||
@@ -653,7 +668,7 @@ void ApplyOptions(DeviceOptions& options)
|
||||
}
|
||||
}
|
||||
|
||||
int cli_main(int argc, char *argv[], std::vector<RGBController *> rgb_controllers_in, ProfileManager* profile_manager_in)
|
||||
unsigned int cli_main(int argc, char *argv[], std::vector<RGBController *> rgb_controllers_in, ProfileManager* profile_manager_in)
|
||||
{
|
||||
rgb_controllers = rgb_controllers_in;
|
||||
profile_manager = profile_manager_in;
|
||||
@@ -662,10 +677,20 @@ int cli_main(int argc, char *argv[], std::vector<RGBController *> rgb_controller
|
||||
| Process the argument options |
|
||||
\*---------------------------------------------------------*/
|
||||
Options options;
|
||||
if (!ProcessOptions(argc, argv, &options))
|
||||
unsigned int ret_flags = ProcessOptions(argc, argv, &options);
|
||||
switch(ret_flags)
|
||||
{
|
||||
OptionHelp();
|
||||
return -1;
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case 1:
|
||||
OptionHelp();
|
||||
exit(-1);
|
||||
break;
|
||||
|
||||
default:
|
||||
return ret_flags;
|
||||
break;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
@@ -704,5 +729,7 @@ int cli_main(int argc, char *argv[], std::vector<RGBController *> rgb_controller
|
||||
}
|
||||
}
|
||||
|
||||
exit(0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ extern std::vector<i2c_smbus_interface*> busses;
|
||||
extern std::vector<RGBController*> rgb_controllers;
|
||||
|
||||
// See cli.cpp
|
||||
extern int cli_main(int argc, char *argv[], std::vector<RGBController *> rgb_controllers_in, ProfileManager* profile_manager_in);
|
||||
extern unsigned int cli_main(int argc, char *argv[], std::vector<RGBController *> rgb_controllers_in, ProfileManager* profile_manager_in);
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
@@ -40,9 +40,22 @@ int main(int argc, char* argv[])
|
||||
|
||||
profile_manager.LoadSizeFromProfile("sizes.ors");
|
||||
|
||||
if (argc > 1 && strcmp(argv[1], "--gui"))
|
||||
unsigned int ret_flags = 0;
|
||||
if(argc > 1)
|
||||
{
|
||||
return cli_main(argc, argv, rgb_controllers, &profile_manager);
|
||||
ret_flags = cli_main(argc, argv, rgb_controllers, &profile_manager);
|
||||
}
|
||||
|
||||
if(ret_flags && 2)
|
||||
{
|
||||
//GUI is enabled
|
||||
}
|
||||
|
||||
bool show_i2c_tools = false;
|
||||
if(ret_flags && 4)
|
||||
{
|
||||
//I2C Tools is enabled
|
||||
show_i2c_tools = true;
|
||||
}
|
||||
|
||||
NetworkServer server(rgb_controllers);
|
||||
@@ -50,7 +63,7 @@ int main(int argc, char* argv[])
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QApplication a(argc, argv);
|
||||
|
||||
Ui::OpenRGBDialog2 dlg(busses, rgb_controllers, &profile_manager, &server);
|
||||
Ui::OpenRGBDialog2 dlg(busses, rgb_controllers, &profile_manager, &server, show_i2c_tools);
|
||||
dlg.show();
|
||||
|
||||
return a.exec();
|
||||
|
||||
@@ -127,7 +127,8 @@ bool net_port::tcp_client(const char * client_name, const char * port)
|
||||
|
||||
bool net_port::tcp_client_connect()
|
||||
{
|
||||
if (!connected)
|
||||
connected = false;
|
||||
|
||||
{
|
||||
sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (sock == INVALID_SOCKET)
|
||||
@@ -185,7 +186,7 @@ bool net_port::tcp_client_connect()
|
||||
closesocket(sock);
|
||||
}
|
||||
}
|
||||
return(true);
|
||||
return(connected);
|
||||
}
|
||||
|
||||
bool net_port::tcp_server(const char * port)
|
||||
|
||||
+2
-1
@@ -71,12 +71,13 @@ public:
|
||||
void tcp_close();
|
||||
|
||||
bool connected;
|
||||
SOCKET sock;
|
||||
|
||||
private:
|
||||
#ifdef WIN32
|
||||
WSADATA wsa;
|
||||
#endif
|
||||
SOCKET sock;
|
||||
|
||||
std::vector<SOCKET *> clients;
|
||||
|
||||
sockaddr addrDest;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
using namespace Ui;
|
||||
|
||||
OpenRGBDialog2::OpenRGBDialog2(std::vector<i2c_smbus_interface *>& bus, std::vector<RGBController *>& control, ProfileManager* manager, NetworkServer* server, QWidget *parent) : QMainWindow(parent), busses(bus), controllers(control), profile_manager(manager), network_server(server), ui(new OpenRGBDialog2Ui)
|
||||
OpenRGBDialog2::OpenRGBDialog2(std::vector<i2c_smbus_interface *>& bus, std::vector<RGBController *>& control, ProfileManager* manager, NetworkServer* server, bool show_i2c_tools, QWidget *parent) : QMainWindow(parent), busses(bus), controllers(control), profile_manager(manager), network_server(server), ui(new OpenRGBDialog2Ui)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
@@ -203,7 +203,7 @@ OpenRGBDialog2::OpenRGBDialog2(std::vector<i2c_smbus_interface *>& bus, std::vec
|
||||
/*-----------------------------------------------------*\
|
||||
| Show the I2C Tools page only if enabled |
|
||||
\*-----------------------------------------------------*/
|
||||
if(true) //TODO: SMBus Tools enable flag
|
||||
if(show_i2c_tools)
|
||||
{
|
||||
OpenRGBSystemInfoPage *SMBusToolsPage = new OpenRGBSystemInfoPage(bus);
|
||||
ui->InformationTabBar->addTab(SMBusToolsPage, "");
|
||||
@@ -235,7 +235,7 @@ OpenRGBDialog2::OpenRGBDialog2(std::vector<i2c_smbus_interface *>& bus, std::vec
|
||||
SoftwareTabLabel->setIndent(20);
|
||||
SoftwareTabLabel->setGeometry(0, 0, 200, 20);
|
||||
|
||||
if(true) //TODO: SMBus Tools enable flag
|
||||
if(show_i2c_tools)
|
||||
{
|
||||
InformationTabBar->setTabButton(control.size() + 1, QTabBar::LeftSide, SoftwareTabLabel);
|
||||
}
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ class Ui::OpenRGBDialog2 : public QMainWindow
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenRGBDialog2(std::vector<i2c_smbus_interface *>& bus, std::vector<RGBController *>& control, ProfileManager* manager, NetworkServer* server, QWidget *parent = 0);
|
||||
explicit OpenRGBDialog2(std::vector<i2c_smbus_interface *>& bus, std::vector<RGBController *>& control, ProfileManager* manager, NetworkServer* server, bool show_i2c_tools, QWidget *parent = 0);
|
||||
~OpenRGBDialog2();
|
||||
|
||||
void show();
|
||||
|
||||
Reference in New Issue
Block a user