Compare commits

..
Author SHA1 Message Date
yawor 95cef19ef2 Add support for Logitech G915 2021-09-03 03:40:11 +00:00
33 changed files with 250 additions and 1033 deletions
@@ -44,7 +44,6 @@ static const gpu_pci_device device_list[] =
{ NVIDIA_VEN, NVIDIA_GTX1080TI_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_GTX1080TI_GAMING, 0x29, "ASUS ROG Strix GTX1080 Ti Gaming" },
{ NVIDIA_VEN, NVIDIA_GTX1080TI_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_GTX1080TI_11G_GAMING, 0x29, "ASUS ROG Strix GTX1080 Ti 11G Gaming" },
{ NVIDIA_VEN, NVIDIA_GTX1650S_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_GTX1650S_OC, 0x2A, "ASUS ROG Strix GTX 1650S OC 4G" },
{ NVIDIA_VEN, NVIDIA_GTX1660S_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_GTX1660S_O6G_GAMING, 0x2A, "ASUS ROG Strix GTX 1660S O6G Gaming" },
{ NVIDIA_VEN, NVIDIA_GTX1660TI_DEV, ASUS_SUB_VEN, ASUS_ROG_GTX1660TI_OC, 0x2A, "ASUS ROG GTX 1660 Ti OC 6G" },
{ NVIDIA_VEN, NVIDIA_RTX2060_TU106_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX2060_EVO_GAMING, 0x2A, "ASUS ROG STRIX RTX 2060 EVO Gaming 6G" },
{ NVIDIA_VEN, NVIDIA_RTX2060S_DEV, ASUS_SUB_VEN, ASUS_ROG_STRIX_RTX2060S_A8G_EVO_GAMING, 0x2A, "ASUS ROG STRIX RTX 2060S A8G EVO Gaming 8G"},
@@ -320,28 +320,136 @@ void DetectLogitechKeyboardG815(hid_device_info* info, const std::string& name)
void DetectLogitechKeyboardG915(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
/*-------------------------------------------------------------------------------------------------*\
| Logitech keyboards use two different usages, one for 20-byte packets and one for 64-byte packets |
| Usage 0x0602 for 20 byte, usage 0x0604 for 64 byte, both are on usage page 0xFF43 |
\*-------------------------------------------------------------------------------------------------*/
#ifdef USE_HID_USAGE
hid_device* dev_usage_0x0001 = nullptr;
hid_device* dev_usage_0x0002 = nullptr;
hid_device_info* info_temp = info;
if(dev)
while(info_temp)
{
LogitechG915Controller* controller = new LogitechG915Controller(dev, false);
if(info_temp->vendor_id == info->vendor_id // constant LOGITECH_VID
&& info_temp->product_id == info->product_id // NON-constant
&& info_temp->interface_number == info->interface_number // constant 2
&& info_temp->usage_page == info->usage_page) // constant 0xFF00
{
if(info_temp->usage == 0x0001)
{
dev_usage_0x0001 = hid_open_path(info_temp->path);
}
else if(info_temp->usage == 0x0002)
{
dev_usage_0x0002 = hid_open_path(info_temp->path);
}
}
if(dev_usage_0x0001 && dev_usage_0x0002)
{
break;
}
info_temp = info_temp->next;
}
if(dev_usage_0x0001 && dev_usage_0x0002)
{
LogitechG915Controller* controller = new LogitechG915Controller(dev_usage_0x0001, dev_usage_0x0002, false);
RGBController_LogitechG915* rgb_controller = new RGBController_LogitechG915(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
else
{
/*-------------------------------------------------*\
| Not all of them could be opened, do some cleanup |
\*-------------------------------------------------*/
if(dev_usage_0x0001)
{
hid_close(dev_usage_0x0001);
}
if(dev_usage_0x0002)
{
hid_close(dev_usage_0x0002);
}
}
#else
hid_device* dev = hid_open_path(info->path);
if(dev)
{
LogitechG915Controller* controller = new LogitechG915Controller(dev, dev, false);
RGBController_LogitechG915* rgb_controller = new RGBController_LogitechG915(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
#endif
}
void DetectLogitechKeyboardG915Wired(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
/*-------------------------------------------------------------------------------------------------*\
| Logitech keyboards use two different usages, one for 20-byte packets and one for 64-byte packets |
| Usage 0x0602 for 20 byte, usage 0x0604 for 64 byte, both are on usage page 0xFF43 |
\*-------------------------------------------------------------------------------------------------*/
#ifdef USE_HID_USAGE
hid_device* dev_usage_0x0001 = nullptr;
hid_device* dev_usage_0x0002 = nullptr;
hid_device_info* info_temp = info;
if(dev)
while(info_temp)
{
LogitechG915Controller* controller = new LogitechG915Controller(dev, true);
if(info_temp->vendor_id == info->vendor_id // constant LOGITECH_VID
&& info_temp->product_id == info->product_id // NON-constant
&& info_temp->interface_number == info->interface_number // constant 2
&& info_temp->usage_page == info->usage_page) // constant 0xFF00
{
if(info_temp->usage == 0x0001)
{
dev_usage_0x0001 = hid_open_path(info_temp->path);
}
else if(info_temp->usage == 0x0002)
{
dev_usage_0x0002 = hid_open_path(info_temp->path);
}
}
if(dev_usage_0x0001 && dev_usage_0x0002)
{
break;
}
info_temp = info_temp->next;
}
if(dev_usage_0x0001 && dev_usage_0x0002)
{
LogitechG915Controller* controller = new LogitechG915Controller(dev_usage_0x0001, dev_usage_0x0002, true);
RGBController_LogitechG915* rgb_controller = new RGBController_LogitechG915(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
else
{
/*-------------------------------------------------*\
| Not all of them could be opened, do some cleanup |
\*-------------------------------------------------*/
if(dev_usage_0x0001)
{
hid_close(dev_usage_0x0001);
}
if(dev_usage_0x0002)
{
hid_close(dev_usage_0x0002);
}
}
#else
hid_device* dev = hid_open_path(info->path);
if(dev)
{
LogitechG915Controller* controller = new LogitechG915Controller(dev, dev, true);
RGBController_LogitechG915* rgb_controller = new RGBController_LogitechG915(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
#endif
}
/*-----------------------------------------------------*\
@@ -555,46 +663,46 @@ void DetectLogitechX56(hid_device_info* info, const std::string& name)
}
}
/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*\
| Keyboards |
\*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IPU("Logitech G213", DetectLogitechKeyboardG213, LOGITECH_VID, LOGITECH_G213_PID, 1, 0xFF43, 0x0602);
REGISTER_HID_DETECTOR_IP ("Logitech G512", DetectLogitechKeyboardG810, LOGITECH_VID, LOGITECH_G512_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G512 RGB", DetectLogitechKeyboardG810, LOGITECH_VID, LOGITECH_G512_RGB_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G610 Orion", DetectLogitechKeyboardG810, LOGITECH_VID, LOGITECH_G610_1_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G610 Orion", DetectLogitechKeyboardG810, LOGITECH_VID, LOGITECH_G610_2_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G810 Orion Spectrum", DetectLogitechKeyboardG810, LOGITECH_VID, LOGITECH_G810_1_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G810 Orion Spectrum", DetectLogitechKeyboardG810, LOGITECH_VID, LOGITECH_G810_2_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G813 RGB Mechanical Gaming Keyboard", DetectLogitechKeyboardG815, LOGITECH_VID, LOGITECH_G813_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G815 RGB Mechanical Gaming Keyboard", DetectLogitechKeyboardG815, LOGITECH_VID, LOGITECH_G815_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G910 Orion Spark", DetectLogitechKeyboardG910, LOGITECH_VID, LOGITECH_G910_ORION_SPARK_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G910 Orion Spectrum", DetectLogitechKeyboardG910, LOGITECH_VID, LOGITECH_G910_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IPU("Logitech G915 Wireless RGB Mechanical Gaming Keyboard", DetectLogitechKeyboardG915, LOGITECH_VID, LOGITECH_G915_RECEIVER_PID, 2, 0xFF00, 2);
REGISTER_HID_DETECTOR_IPU("Logitech G915 Wireless RGB Mechanical Gaming Keyboard (Wired)", DetectLogitechKeyboardG915Wired, LOGITECH_VID, LOGITECH_G915_WIRED_PID, 2, 0xFF00, 2);
/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*\
| Mice |
\*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IP ("Logitech G203 Prodigy", DetectLogitechMouseG203, LOGITECH_VID, LOGITECH_G203_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IPU("Logitech G203 Lightsync", DetectLogitechMouseG203L, LOGITECH_VID, LOGITECH_G203_LIGHTSYNC_PID, 1, 0xFF00, 2);
REGISTER_HID_DETECTOR_IP ("Logitech G303 Daedalus Apex", DetectLogitechMouseG303, LOGITECH_VID, LOGITECH_G303_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IP ("Logitech G403 Hero", DetectLogitechMouseG403, LOGITECH_VID, LOGITECH_G403_HERO_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IP ("Logitech G502 Proteus Spectrum Gaming Mouse", DetectLogitechMouseG502PS, LOGITECH_VID, LOGITECH_G502_PROTEUS_SPECTRUM_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IP ("Logitech G502 Hero Gaming Mouse", DetectLogitechMouseG502PS, LOGITECH_VID, LOGITECH_G502_HERO_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IP ("Logitech G Pro Gaming Mouse", DetectLogitechMouseGPRO, LOGITECH_VID, LOGITECH_G_PRO_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IP ("Logitech G Pro (HERO) Gaming Mouse", DetectLogitechMouseGPRO, LOGITECH_VID, LOGITECH_G_PRO_HERO_PID, 1, 0xFF00);
/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*\
| Speakers |
\*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IPU("Logitech G560 Lightsync Speaker", DetectLogitechG560, LOGITECH_VID, LOGITECH_G560_PID, 2, 0xFF43, 514);
/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*\
| Headsets |
\*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IPU("Logitech G933 Lightsync Headset", DetectLogitechG933, LOGITECH_VID, LOGITECH_G933_PID, 3, 0xFF43, 514);
/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*\
| Joysticks |
\*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IP("Logitech X56 Rhino Hotas Joystick", DetectLogitechX56, LOGITECH_X56_VID, LOGITECH_X56_JOYSTICK_PID, 2, 0xFF00);
REGISTER_HID_DETECTOR_IP("Logitech X56 Rhino Hotas Throttle", DetectLogitechX56, LOGITECH_X56_VID, LOGITECH_X56_THROTTLE_PID, 2, 0xFF00);
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
| Keyboards |
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IPU("Logitech G213", DetectLogitechKeyboardG213, LOGITECH_VID, LOGITECH_G213_PID, 1, 0xFF43, 0x0602);
REGISTER_HID_DETECTOR_IP ("Logitech G512", DetectLogitechKeyboardG810, LOGITECH_VID, LOGITECH_G512_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G512 RGB", DetectLogitechKeyboardG810, LOGITECH_VID, LOGITECH_G512_RGB_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G610 Orion", DetectLogitechKeyboardG810, LOGITECH_VID, LOGITECH_G610_1_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G610 Orion", DetectLogitechKeyboardG810, LOGITECH_VID, LOGITECH_G610_2_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G810 Orion Spectrum", DetectLogitechKeyboardG810, LOGITECH_VID, LOGITECH_G810_1_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G810 Orion Spectrum", DetectLogitechKeyboardG810, LOGITECH_VID, LOGITECH_G810_2_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G813 RGB Mechanical Gaming Keyboard", DetectLogitechKeyboardG815, LOGITECH_VID, LOGITECH_G813_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G815 RGB Mechanical Gaming Keyboard", DetectLogitechKeyboardG815, LOGITECH_VID, LOGITECH_G815_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G910 Orion Spark", DetectLogitechKeyboardG910, LOGITECH_VID, LOGITECH_G910_ORION_SPARK_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G910 Orion Spectrum", DetectLogitechKeyboardG910, LOGITECH_VID, LOGITECH_G910_PID, 1, 0xFF43);
REGISTER_HID_DETECTOR_IP ("Logitech G915 Wireless RGB Mechanical Gaming Keyboard", DetectLogitechKeyboardG915, LOGITECH_VID, LOGITECH_G915_RECEIVER_PID, 2, 0xFF00);
REGISTER_HID_DETECTOR_IP ("Logitech G915 Wireless RGB Mechanical Gaming Keyboard (Wired)", DetectLogitechKeyboardG915Wired, LOGITECH_VID, LOGITECH_G915_WIRED_PID, 2, 0xFF00);
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
| Mice |
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IP ("Logitech G203 Prodigy", DetectLogitechMouseG203, LOGITECH_VID, LOGITECH_G203_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IPU("Logitech G203 Lightsync", DetectLogitechMouseG203L, LOGITECH_VID, LOGITECH_G203_LIGHTSYNC_PID, 1, 0xFF00, 2);
REGISTER_HID_DETECTOR_IP ("Logitech G303 Daedalus Apex", DetectLogitechMouseG303, LOGITECH_VID, LOGITECH_G303_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IP ("Logitech G403 Hero", DetectLogitechMouseG403, LOGITECH_VID, LOGITECH_G403_HERO_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IP ("Logitech G502 Proteus Spectrum Gaming Mouse", DetectLogitechMouseG502PS, LOGITECH_VID, LOGITECH_G502_PROTEUS_SPECTRUM_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IP ("Logitech G502 Hero Gaming Mouse", DetectLogitechMouseG502PS, LOGITECH_VID, LOGITECH_G502_HERO_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IP ("Logitech G Pro Gaming Mouse", DetectLogitechMouseGPRO, LOGITECH_VID, LOGITECH_G_PRO_PID, 1, 0xFF00);
REGISTER_HID_DETECTOR_IP ("Logitech G Pro (HERO) Gaming Mouse", DetectLogitechMouseGPRO, LOGITECH_VID, LOGITECH_G_PRO_HERO_PID, 1, 0xFF00);
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
| Speakers |
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IPU("Logitech G560 Lightsync Speaker", DetectLogitechG560, LOGITECH_VID, LOGITECH_G560_PID, 2, 0xFF43, 514);
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
| Headsets |
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IPU("Logitech G933 Lightsync Headset", DetectLogitechG933, LOGITECH_VID, LOGITECH_G933_PID, 3, 0xFF43, 514);
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
| Joysticks |
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
REGISTER_HID_DETECTOR_IP("Logitech X56 Rhino Hotas Joystick", DetectLogitechX56, LOGITECH_X56_VID, LOGITECH_X56_JOYSTICK_PID, 2, 0xFF00);
REGISTER_HID_DETECTOR_IP("Logitech X56 Rhino Hotas Throttle", DetectLogitechX56, LOGITECH_X56_VID, LOGITECH_X56_THROTTLE_PID, 2, 0xFF00);
/*---------------------------------------------------------------------------------------------------------*\
| Windows and MacOS Lightspeed Detection |
@@ -10,23 +10,20 @@
#include "LogitechG915Controller.h"
#include <cstring>
LogitechG915Controller::LogitechG915Controller(hid_device* dev_handle, bool wired)
LogitechG915Controller::LogitechG915Controller(hid_device* dev_handle_0x11, hid_device* dev_handle_0x12, bool wired)
{
this->dev_handle = dev_handle;
if(wired)
{
feature_4522_idx = 0x0E;
dev_pkt_0x11 = dev_handle_0x11;
dev_pkt_0x12 = dev_handle_0x12;
if (wired) {
feature_4522_idx = 0x0e;
feature_8040_idx = 0x13;
feature_8071_idx = 0x09;
feature_8081_idx = 0x0A;
}
else
{
feature_4522_idx = 0x0F;
feature_8081_idx = 0x0a;
} else {
feature_4522_idx = 0x0f;
feature_8040_idx = 0x14;
feature_8071_idx = 0x0A;
feature_8081_idx = 0x0B;
feature_8071_idx = 0x0a;
feature_8081_idx = 0x0b;
}
}
@@ -38,7 +35,7 @@ LogitechG915Controller::~LogitechG915Controller()
std::string LogitechG915Controller::GetSerialString()
{
wchar_t serial_string[128];
int ret = hid_get_serial_number_string(dev_handle, serial_string, 128);
int ret = hid_get_serial_number_string(dev_pkt_0x11, serial_string, 128);
if(ret != 0)
{
@@ -103,8 +100,8 @@ void LogitechG915Controller::SendCommit()
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev_handle, (unsigned char *)usb_buf, 20);
hid_read_timeout(dev_handle, (unsigned char *)usb_buf, 20, LOGITECH_READ_TIMEOUT);
hid_write(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
hid_read_timeout(dev_pkt_0x11, (unsigned char *)usb_buf, 20, LOGITECH_READ_TIMEOUT);
}
void LogitechG915Controller::InitializeDirect()
@@ -127,8 +124,8 @@ void LogitechG915Controller::InitializeDirect()
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev_handle, (unsigned char *)usb_buf, 20);
hid_read(dev_handle, (unsigned char *)usb_buf, 20);
hid_write(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
hid_read(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
/*-----------------------------------------------------*\
| Zero out buffer |
@@ -146,8 +143,8 @@ void LogitechG915Controller::InitializeDirect()
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev_handle, (unsigned char *)usb_buf, 20);
hid_read(dev_handle, (unsigned char *)usb_buf, 20);
hid_write(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
hid_read(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
/*-----------------------------------------------------*\
| Zero out buffer |
@@ -166,8 +163,8 @@ void LogitechG915Controller::InitializeDirect()
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev_handle, (unsigned char *)usb_buf, 20);
hid_read(dev_handle, (unsigned char *)usb_buf, 20);
hid_write(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
hid_read(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
/*-----------------------------------------------------*\
| Zero out buffer |
@@ -187,8 +184,8 @@ void LogitechG915Controller::InitializeDirect()
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev_handle, (unsigned char *)usb_buf, 20);
hid_read(dev_handle, (unsigned char *)usb_buf, 20);
hid_write(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
hid_read(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
}
void LogitechG915Controller::SendSingleLed
@@ -223,8 +220,8 @@ void LogitechG915Controller::SendSingleLed
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev_handle, (unsigned char *)usb_buf, 20);
hid_read(dev_handle, (unsigned char *)usb_buf, 20);
hid_write(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
hid_read(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
}
void LogitechG915Controller::SendDirectFrame
@@ -256,8 +253,8 @@ void LogitechG915Controller::SendDirectFrame
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev_handle, (unsigned char *)usb_buf, 20);
hid_read_timeout(dev_handle, (unsigned char *)usb_buf, 20, LOGITECH_READ_TIMEOUT);
hid_write(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
hid_read_timeout(dev_pkt_0x11, (unsigned char *)usb_buf, 20, LOGITECH_READ_TIMEOUT);
}
void LogitechG915Controller::SendMode
@@ -315,6 +312,6 @@ void LogitechG915Controller::SendMode
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev_handle, (unsigned char *)usb_buf, 20);
hid_read(dev_handle, (unsigned char *)usb_buf, 20);
hid_write(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
hid_read(dev_pkt_0x11, (unsigned char *)usb_buf, 20);
}
@@ -64,7 +64,7 @@ enum
class LogitechG915Controller
{
public:
LogitechG915Controller(hid_device* dev_handle, bool wired);
LogitechG915Controller(hid_device* dev_handle_0x11, hid_device* dev_handle_0x12, bool wired);
~LogitechG915Controller();
std::string GetSerialString();
@@ -92,7 +92,8 @@ public:
);
private:
hid_device* dev_handle;
hid_device* dev_pkt_0x11;
hid_device* dev_pkt_0x12;
char feature_4522_idx;
char feature_8040_idx;
char feature_8071_idx;
@@ -16,7 +16,6 @@
#include "RGBController.h"
#include "RGBController_QMKOpenRGBRev9.h"
#include "RGBController_QMKOpenRGBRevB.h"
#include "LogManager.h"
#include <hidapi/hidapi.h>
/*-----------------------------------------------------*\
@@ -24,7 +23,6 @@
\*-----------------------------------------------------*/
#define QMK_OPENRGB_PROTOCOL_VERSION_9 0x09
#define QMK_OPENRGB_PROTOCOL_VERSION_B 0x0B
#define QMK_OPENRGB_PROTOCOL_VERSION_C 0x0C
/*-----------------------------------------------------*\
| Usage and Usage Page |
@@ -79,36 +77,14 @@ void DetectQMKOpenRGBControllers(hid_device_info *info, const std::string&)
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
break;
case QMK_OPENRGB_PROTOCOL_VERSION_B:
{
QMKOpenRGBRevBController* controller = new QMKOpenRGBRevBController(dev, info->path);
RGBController_QMKOpenRGBRevB* rgb_controller = new RGBController_QMKOpenRGBRevB(controller, false);
RGBController_QMKOpenRGBRevB* rgb_controller = new RGBController_QMKOpenRGBRevB(controller);
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
break;
case QMK_OPENRGB_PROTOCOL_VERSION_C:
{
QMKOpenRGBRevBController* controller = new QMKOpenRGBRevBController(dev, info->path);
RGBController_QMKOpenRGBRevB* rgb_controller = new RGBController_QMKOpenRGBRevB(controller, true);
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
break;
default:
if (version == 0)
{
LOG_WARNING("[QMK OpenRGB] Detection failed - the detected keyboard does not have the OpenRGB protocol feature enabled! \n"
"Please make sure your keyboard supports RGB Matrix, add OPENRGB_ENABLE = yes to the rules.mk inside your keymap folder, compile and flash again!");
}
else if (version < QMK_OPENRGB_PROTOCOL_VERSION_9)
{
LOG_WARNING("[QMK OpenRGB] Detection failed - the detected keyboard is using an outdated protocol version %i. Please update to to the update to the latest version of QMK-OpenRGB! \n"
"For officaly supported QMK boards grab <a href=\"https://github.com/Kasper24/QMK-OpenRGB\">url</a> \n"
"For Sonix boards grab <a href=\"https://github.com/SonixQMK/qmk_firmware/tree/sn32_openrgb\">url</a>", version);
}
else if (version > QMK_OPENRGB_PROTOCOL_VERSION_C)
{
LOG_WARNING("[QMK OpenRGB] Detection failed - the detected keyboard is using version protocol %i which is not supported by this OpenRGB build. Please update OpenRGB!", version);
}
}
}
}
@@ -11,8 +11,6 @@
#include "QMKOpenRGBRev9Controller.h"
using namespace std::chrono_literals;
static std::map<uint8_t, std::string> QMKKeycodeToKeynameMap
{
{ 0, "" }, { 1, "Right Fn" }, { 2, "" }, { 3, "" },
@@ -87,15 +85,6 @@ QMKOpenRGBRev9Controller::QMKOpenRGBRev9Controller(hid_device *dev_handle, const
leds_per_update = 20;
}
if(qmk_settings.contains("delay"))
{
delay = (unsigned int)qmk_settings["delay"] * 1ms;
}
else
{
delay = 0ms;
}
dev = dev_handle;
location = path;
@@ -462,11 +451,6 @@ void QMKOpenRGBRev9Controller::DirectModeSetLEDs(std::vector<RGBColor> colors, u
hid_write(dev, usb_buf, 65);
if(delay > 0ms)
{
std::this_thread::sleep_for(delay);
}
leds_sent += tmp_leds_per_update;
}
}
@@ -56,8 +56,6 @@ private:
std::string device_name;
std::string device_vendor;
std::chrono::milliseconds delay;
unsigned int total_number_of_leds;
unsigned int total_number_of_leds_with_empty_space;
unsigned int mode;
@@ -9,8 +9,6 @@
#include "QMKOpenRGBRevBController.h"
using namespace std::chrono_literals;
static std::map<uint8_t, std::string> QMKKeycodeToKeynameMap
{
{ 0, "" }, { 1, "Right Fn" }, { 2, "" }, { 3, "" },
@@ -85,15 +83,6 @@ QMKOpenRGBRevBController::QMKOpenRGBRevBController(hid_device *dev_handle, const
leds_per_update = 20;
}
if(qmk_settings.contains("delay"))
{
delay = (unsigned int)qmk_settings["delay"] * 1ms;
}
else
{
delay = 0ms;
}
dev = dev_handle;
location = path;
@@ -393,7 +382,7 @@ std::vector<unsigned int> QMKOpenRGBRevBController::GetEnabledModes()
return enabled_modes;
}
void QMKOpenRGBRevBController::SetMode(hsv_t hsv_color, unsigned char mode, unsigned char speed, bool save)
void QMKOpenRGBRevBController::SetMode(hsv_t hsv_color, unsigned char mode, unsigned char speed)
{
unsigned char usb_buf[QMK_OPENRGB_PACKET_SIZE];
@@ -412,7 +401,6 @@ void QMKOpenRGBRevBController::SetMode(hsv_t hsv_color, unsigned char mode, unsi
usb_buf[0x04] = hsv_color.value;
usb_buf[0x05] = mode;
usb_buf[0x06] = speed;
usb_buf[0x07] = save;
/*-----------------------------------------------------*\
| Send packet |
@@ -484,11 +472,6 @@ void QMKOpenRGBRevBController::DirectModeSetLEDs(std::vector<RGBColor> colors, u
hid_write(dev, usb_buf, 65);
if(delay > 0ms)
{
std::this_thread::sleep_for(delay);
}
leds_sent += tmp_leds_per_update;
}
}
}
@@ -39,7 +39,7 @@ public:
void GetLEDInfo(unsigned int leds_count);
std::vector<unsigned int> GetEnabledModes();
void SetMode(hsv_t hsv_color, unsigned char mode, unsigned char speed, bool save);
void SetMode(hsv_t hsv_color, unsigned char mode, unsigned char speed);
void DirectModeSetSingleLED(unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
void DirectModeSetLEDs(std::vector<RGBColor> colors, unsigned int num_colors);
@@ -54,8 +54,6 @@ private:
std::string device_name;
std::string device_vendor;
std::chrono::milliseconds delay;
unsigned int total_number_of_leds;
unsigned int total_number_of_leds_with_empty_space;
unsigned int mode;
@@ -8,10 +8,9 @@
\*-------------------------------------------------------------------*/
#include "hsv.h"
#include "LogManager.h"
#include "RGBController_QMKOpenRGBRevB.h"
RGBController_QMKOpenRGBRevB::RGBController_QMKOpenRGBRevB(QMKOpenRGBRevBController* controller_ptr, bool save)
RGBController_QMKOpenRGBRevB::RGBController_QMKOpenRGBRevB(QMKOpenRGBRevBController* controller_ptr)
{
controller = controller_ptr;
@@ -27,212 +26,212 @@ RGBController_QMKOpenRGBRevB::RGBController_QMKOpenRGBRevB(QMKOpenRGBRevBControl
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_SOLID_COLOR) != enabled_modes.end())
{
InitializeMode("Static", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR, MODE_COLORS_MODE_SPECIFIC, save);
InitializeMode("Static", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR, MODE_COLORS_MODE_SPECIFIC);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_ALPHA_MOD) != enabled_modes.end())
{
InitializeMode("Alpha Mod", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
InitializeMode("Alpha Mod", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_GRADIENT_UP_DOWN) != enabled_modes.end())
{
InitializeMode("Gradient Up Down", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
InitializeMode("Gradient Up Down", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_GRADIENT_LEFT_RIGHT) != enabled_modes.end())
{
InitializeMode("Gradient Left Right", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
InitializeMode("Gradient Left Right", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_BREATHING) != enabled_modes.end())
{
InitializeMode("Breathing", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
InitializeMode("Breathing", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_BAND_SAT) != enabled_modes.end())
{
InitializeMode("Band Saturation", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
InitializeMode("Band Saturation", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_BAND_VAL) != enabled_modes.end())
{
InitializeMode("Band Value", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
InitializeMode("Band Value", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_BAND_PINWHEEL_SAT) != enabled_modes.end())
{
InitializeMode("Band Pinwheel Saturation", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
InitializeMode("Band Pinwheel Saturation", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_BAND_PINWHEEL_VAL) != enabled_modes.end())
{
InitializeMode("Band Pinwheel Value", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
InitializeMode("Band Pinwheel Value", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_BAND_SPIRAL_SAT) != enabled_modes.end())
{
InitializeMode("Band Spiral Saturation", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
InitializeMode("Band Spiral Saturation", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_BAND_SPIRAL_VAL) != enabled_modes.end())
{
InitializeMode("Band Spiral Value", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
InitializeMode("Band Spiral Value", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_CYCLE_ALL) != enabled_modes.end())
{
InitializeMode("Cycle All", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
InitializeMode("Cycle All", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_CYCLE_LEFT_RIGHT) != enabled_modes.end())
{
InitializeMode("Cycle Left Right", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
InitializeMode("Cycle Left Right", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_CYCLE_UP_DOWN) != enabled_modes.end())
{
InitializeMode("Cycle Up Down", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
InitializeMode("Cycle Up Down", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_CYCLE_OUT_IN) != enabled_modes.end())
{
InitializeMode("Cycle Out In", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
InitializeMode("Cycle Out In", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_CYCLE_OUT_IN_DUAL) != enabled_modes.end())
{
InitializeMode("Cycle Out In Dual", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
InitializeMode("Cycle Out In Dual", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_RAINBOW_MOVING_CHEVRON) != enabled_modes.end())
{
InitializeMode("Rainbow Moving Chevron", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
InitializeMode("Rainbow Moving Chevron", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_CYCLE_PINWHEEL) != enabled_modes.end())
{
InitializeMode("Cycle Pinwheel", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
InitializeMode("Cycle Pinwheel", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_CYCLE_SPIRAL) != enabled_modes.end())
{
InitializeMode("Cycle Spiral", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
InitializeMode("Cycle Spiral", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_DUAL_BEACON) != enabled_modes.end())
{
InitializeMode("Dual Beacon", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
InitializeMode("Dual Beacon", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_RAINBOW_BEACON) != enabled_modes.end())
{
InitializeMode("Rainbow Beacon", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
InitializeMode("Rainbow Beacon", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_RAINBOW_PINWHEELS) != enabled_modes.end())
{
InitializeMode("Rainbow Pinwheels", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
InitializeMode("Rainbow Pinwheels", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_RAINDROPS) != enabled_modes.end())
{
InitializeMode("Raindrops", current_mode, 0, MODE_COLORS_NONE, save);
InitializeMode("Raindrops", current_mode, 0, MODE_COLORS_NONE);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_JELLYBEAN_RAINDROPS) != enabled_modes.end())
{
InitializeMode("Jellybean Raindrops", current_mode, 0, MODE_COLORS_NONE, save);
InitializeMode("Jellybean Raindrops", current_mode, 0, MODE_COLORS_NONE);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_HUE_BREATHING) != enabled_modes.end())
{
InitializeMode("Hue Breathing", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
InitializeMode("Hue Breathing", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_HUE_PENDULUM) != enabled_modes.end())
{
InitializeMode("Hue Pendulum", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
InitializeMode("Hue Pendulum", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_HUE_WAVE) != enabled_modes.end())
{
InitializeMode("Hue Wave", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
InitializeMode("Hue Wave", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_TYPING_HEATMAP) != enabled_modes.end())
{
InitializeMode("Typing Heatmap", current_mode, 0, MODE_COLORS_NONE, save);
InitializeMode("Typing Heatmap", current_mode, 0, MODE_COLORS_NONE);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_DIGITAL_RAIN) != enabled_modes.end())
{
InitializeMode("Digital Rain", current_mode, 0, MODE_COLORS_NONE, save);
InitializeMode("Digital Rain", current_mode, 0, MODE_COLORS_NONE);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_SOLID_REACTIVE_SIMPLE) != enabled_modes.end())
{
InitializeMode("Solid Reactive Simple", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
InitializeMode("Solid Reactive Simple", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_SOLID_REACTIVE) != enabled_modes.end())
{
InitializeMode("Solid Reactive", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
InitializeMode("Solid Reactive", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_SOLID_REACTIVE_WIDE) != enabled_modes.end())
{
InitializeMode("Solid Reactive Wide", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
InitializeMode("Solid Reactive Wide", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_SOLID_REACTIVE_MULTIWIDE) != enabled_modes.end())
{
InitializeMode("Solid Reactive Multi Wide", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
InitializeMode("Solid Reactive Multi Wide", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_SOLID_REACTIVE_CROSS) != enabled_modes.end())
{
InitializeMode("Solid Reactive Cross", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
InitializeMode("Solid Reactive Cross", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_SOLID_REACTIVE_MULTICROSS) != enabled_modes.end())
{
InitializeMode("Solid Reactive Multi Cross", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
InitializeMode("Solid Reactive Multi Cross", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_SOLID_REACTIVE_NEXUS) != enabled_modes.end())
{
InitializeMode("Solid Reactive Nexus", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
InitializeMode("Solid Reactive Nexus", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_SOLID_REACTIVE_MULTINEXUS) != enabled_modes.end())
{
InitializeMode("Solid Reactive Multi Nexus", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
InitializeMode("Solid Reactive Multi Nexus", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_SPLASH) != enabled_modes.end())
{
InitializeMode("Rainbow Reactive Splash", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
InitializeMode("Rainbow Reactive Splash", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_MULTISPLASH) != enabled_modes.end())
{
InitializeMode("Rainbow Reactive Multi Splash", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE, save);
InitializeMode("Rainbow Reactive Multi Splash", current_mode, MODE_FLAG_HAS_SPEED, MODE_COLORS_NONE);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_SOLID_SPLASH) != enabled_modes.end())
{
InitializeMode("Solid Reactive Splash", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
InitializeMode("Solid Reactive Splash", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_SOLID_MULTISPLASH) != enabled_modes.end())
{
InitializeMode("Solid Reactive Multi Splash", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC, save);
InitializeMode("Solid Reactive Multi Splash", current_mode, MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED, MODE_COLORS_MODE_SPECIFIC);
}
if(std::find(enabled_modes.begin(), enabled_modes.end(), QMK_OPENRGB_MODE_OPENRGB_DIRECT) != enabled_modes.end())
{
InitializeMode("Direct", current_mode, MODE_FLAG_HAS_PER_LED_COLOR, MODE_COLORS_PER_LED, save);
InitializeMode("Direct", current_mode, MODE_FLAG_HAS_PER_LED_COLOR, MODE_COLORS_PER_LED);
}
/*-----------------------------------------------------*\
@@ -431,11 +430,11 @@ void RGBController_QMKOpenRGBRevB::DeviceUpdateMode()
{
if(modes[active_mode].color_mode == MODE_COLORS_PER_LED)
{
controller->SetMode({ 0, 255, 255 }, modes[active_mode].value, 127, false);
controller->SetMode({ 0, 255, 255 }, modes[active_mode].value, 127);
}
else if(modes[active_mode].color_mode == MODE_COLORS_NONE)
{
controller->SetMode({ 0, 255, 255 }, modes[active_mode].value, modes[active_mode].speed, false);
controller->SetMode({ 0, 255, 255 }, modes[active_mode].value, modes[active_mode].speed);
}
else if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
{
@@ -445,34 +444,11 @@ void RGBController_QMKOpenRGBRevB::DeviceUpdateMode()
if(modes[active_mode].flags & MODE_FLAG_HAS_SPEED)
{
controller->SetMode(hsv_color, modes[active_mode].value, modes[active_mode].speed, false);
controller->SetMode(hsv_color, modes[active_mode].value, modes[active_mode].speed);
}
else
{
controller->SetMode(hsv_color, modes[active_mode].value, 127, false);
}
}
}
void RGBController_QMKOpenRGBRevB::DeviceSaveMode()
{
if(modes[active_mode].color_mode == MODE_COLORS_NONE)
{
controller->SetMode({ 0, 255, 255 }, modes[active_mode].value, modes[active_mode].speed, true);
}
else if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
{
RGBColor rgb_color = modes[active_mode].colors[0];
hsv_t hsv_color;
rgb2hsv(rgb_color, &hsv_color);
if(modes[active_mode].flags & MODE_FLAG_HAS_SPEED)
{
controller->SetMode(hsv_color, modes[active_mode].value, modes[active_mode].speed, true);
}
else
{
controller->SetMode(hsv_color, modes[active_mode].value, 127, true);
controller->SetMode(hsv_color, modes[active_mode].value, 127);
}
}
}
@@ -482,8 +458,7 @@ void RGBController_QMKOpenRGBRevB::InitializeMode
std::string name,
unsigned int &current_mode,
unsigned int flags,
unsigned int color_mode,
bool save
unsigned int color_mode
)
{
mode qmk_mode;
@@ -516,13 +491,6 @@ void RGBController_QMKOpenRGBRevB::InitializeMode
}
else
{
/*-----------------------------------------------------*\
| Every mode apart from direct is save-able |
\*-----------------------------------------------------*/
if(save == true)
{
qmk_mode.flags = flags | MODE_FLAG_MANUAL_SAVE;
}
modes.push_back(qmk_mode);
}
}
@@ -23,7 +23,7 @@ typedef std::vector<std::vector<unsigned int>> VectorMatrix;
class RGBController_QMKOpenRGBRevB : public RGBController
{
public:
RGBController_QMKOpenRGBRevB(QMKOpenRGBRevBController* controller_ptr, bool save);
RGBController_QMKOpenRGBRevB(QMKOpenRGBRevBController* controller_ptr);
~RGBController_QMKOpenRGBRevB();
void SetupZones();
@@ -35,7 +35,6 @@ public:
void SetCustomMode();
void DeviceUpdateMode();
void DeviceSaveMode();
private:
QMKOpenRGBRevBController* controller;
@@ -47,8 +46,7 @@ private:
std::string name,
unsigned int &current_mode,
unsigned int flags,
unsigned int color_mode,
bool save
unsigned int color_mode
);
unsigned int CalculateDivisor
@@ -93,20 +93,14 @@ void DetectRazerARGBControllers(hid_device_info* info, const std::string& name)
/*-------------------------------------------------------------------------------------------------*\
| Razer's ARGB controller uses two different interfaces, one for 90-byte Razer report packets and |
| one for 320-byte ARGB packets. Interface 0 for 90-byte and interface 1 for 320-byte. |
| |
| Create a local copy of the HID enumerations for the Razer ARGB controller VID/PID and iterate |
| through it. This prevents detection from failing if interface 1 comes before interface 0 in the |
| main info list. |
\*-------------------------------------------------------------------------------------------------*/
hid_device* dev_interface_0 = nullptr;
hid_device* dev_interface_1 = nullptr;
hid_device_info* info_full = hid_enumerate(RAZER_VID, RAZER_CHROMA_ADDRESSABLE_RGB_CONTROLLER_PID);
hid_device_info* info_temp = info_full;
hid_device_info* info_temp = info;
while(info_temp)
{
if(info_temp->vendor_id == info->vendor_id
&& info_temp->product_id == info->product_id )
if(info_temp->vendor_id == info->vendor_id // constant LOGITECH_VID
&& info_temp->product_id == info->product_id ) // NON-constant
{
if(info_temp->interface_number == 0)
{
@@ -123,9 +117,6 @@ void DetectRazerARGBControllers(hid_device_info* info, const std::string& name)
}
info_temp = info_temp->next;
}
hid_free_enumeration(info_full);
if(dev_interface_0 && dev_interface_1)
{
RazerController* controller = new RazerController(dev_interface_0, dev_interface_1, info->path, info->product_id, name);
+4 -27
View File
@@ -20,15 +20,6 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
greaterThan(QT_MAJOR_VERSION, 5): DEFINES += _QT6
#-----------------------------------------------------------------------------------------------#
# pkg-config Configuration #
#-----------------------------------------------------------------------------------------------#
greaterThan(QT_MAJOR_VERSION, 4) {
PKG_CONFIG = $$pkgConfigExecutable()
} else {
PKG_CONFIG = "pkgconf"
}
#-----------------------------------------------------------------------------------------------#
# Application Configuration #
#-----------------------------------------------------------------------------------------------#
@@ -175,8 +166,7 @@ HEADERS +=
qt/DeviceView.h \
qt/OpenRGBDialog2.h \
qt/OpenRGBPluginContainer.h \
qt/OpenRGBPluginsPage/OpenRGBPluginsEntry.h \
qt/OpenRGBPluginsPage/OpenRGBPluginsList.h \
qt/OpenRGBPluginsPage/OpenRGBPluginsEntry.h \
qt/OpenRGBPluginsPage/OpenRGBPluginsPage.h \
qt/OpenRGBProfileSaveDialog.h \
qt/OpenRGBServerInfoPage.h \
@@ -187,14 +177,10 @@ HEADERS +=
qt/OpenRGBZoneResizeDialog.h \
qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsEntry.h \
qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsPage.h \
qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsEntry.h \
qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsPage.h \
qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsEntry.h \
qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsPage.h \
qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsEntry.h \
qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsPage.h \
qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsEntry.h \
qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsPage.h \
qt/OpenRGBZonesBulkResizer.h \
qt/TabLabel.h \
serial_port/find_usb_serial_port.h \
@@ -508,8 +494,7 @@ SOURCES +=
qt/DeviceView.cpp \
qt/OpenRGBDialog2.cpp \
qt/OpenRGBPluginContainer.cpp \
qt/OpenRGBPluginsPage/OpenRGBPluginsEntry.cpp \
qt/OpenRGBPluginsPage/OpenRGBPluginsList.cpp \
qt/OpenRGBPluginsPage/OpenRGBPluginsEntry.cpp \
qt/OpenRGBPluginsPage/OpenRGBPluginsPage.cpp \
qt/OpenRGBProfileSaveDialog.cpp \
qt/OpenRGBServerInfoPage.cpp \
@@ -523,14 +508,10 @@ SOURCES +=
qt/hsv.cpp \
qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsEntry.cpp \
qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsPage.cpp \
qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsEntry.cpp \
qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsPage.cpp \
qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsEntry.cpp \
qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsPage.cpp \
qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsEntry.cpp \
qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsPage.cpp \
qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsEntry.cpp \
qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsPage.cpp \
serial_port/serial_port.cpp \
super_io/super_io.cpp \
AutoStart/AutoStart.cpp \
@@ -863,7 +844,7 @@ FORMS +=
qt/OpenRGBDialog.ui \
qt/OpenRGBDialog2.ui \
qt/OpenRGBPluginContainer.ui \
qt/OpenRGBPluginsPage/OpenRGBPluginsEntry.ui \
qt/OpenRGBPluginsPage/OpenRGBPluginsEntry.ui \
qt/OpenRGBPluginsPage/OpenRGBPluginsPage.ui \
qt/OpenRGBProfileSaveDialog.ui \
qt/OpenRGBServerInfoPage.ui \
@@ -874,14 +855,10 @@ FORMS +=
qt/OpenRGBZoneResizeDialog.ui \
qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsEntry.ui \
qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsPage.ui \
qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsEntry.ui \
qt/OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsPage.ui \
qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsEntry.ui \
qt/OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsPage.ui \
qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsEntry.ui \
qt/OpenRGBSerialSettingsPage/OpenRGBSerialSettingsPage.ui \
qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsEntry.ui \
qt/OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsPage.ui \
qt/OpenRGBZonesBulkResizer.ui \
qt/TabLabel.ui \
@@ -1126,7 +1103,7 @@ unix:!macx {
# hidapi-hidraw >= 0.10.1 supports USAGE/USAGE_PAGE #
# Define USE_HID_USAGE if hidapi-hidraw supports it #
#---------------------------------------------------------------------------------------#
HIDAPI_HIDRAW_VERSION = $$system($$PKG_CONFIG --modversion hidapi-hidraw)
HIDAPI_HIDRAW_VERSION = $$system(pkgconf --modversion hidapi-hidraw)
if(versionAtLeast(HIDAPI_HIDRAW_VERSION, "0.10.1")) {
DEFINES += USE_HID_USAGE
}
-1
View File
@@ -102,7 +102,6 @@
#define ASUS_ROG_STRIX_GTX1080TI_11G_GAMING 0x85F1
#define ASUS_ROG_STRIX_GTX1080TI_GAMING 0x85EA
#define ASUS_ROG_STRIX_GTX1650S_OC 0x874F
#define ASUS_ROG_STRIX_GTX1660S_O6G_GAMING 0x8752
#define ASUS_ROG_GTX1660TI_OC 0x86A5
#define ASUS_ROG_STRIX_RTX2060_EVO_GAMING 0x86D3
#define ASUS_ROG_STRIX_RTX2060S_A8G_EVO_GAMING 0x8703
-66
View File
@@ -453,16 +453,6 @@ OpenRGBDialog2::OpenRGBDialog2(QWidget *parent) : QMainWindow(parent), ui(new Op
\*-----------------------------------------------------*/
AddQMKORGBSettingsPage();
/*-----------------------------------------------------*\
| Add the Philips Wiz settings page |
\*-----------------------------------------------------*/
AddPhilipsWizSettingsPage();
/*-----------------------------------------------------*\
| Add the Yeelight settings page |
\*-----------------------------------------------------*/
AddYeelightSettingsPage();
/*-----------------------------------------------------*\
| Add the SMBus Tools page if enabled |
\*-----------------------------------------------------*/
@@ -661,34 +651,6 @@ void OpenRGBDialog2::AddE131SettingsPage()
ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel);
}
void OpenRGBDialog2::AddPhilipsWizSettingsPage()
{
/*-----------------------------------------------------*\
| Create the Settings page |
\*-----------------------------------------------------*/
PhilipsWizSettingsPage = new OpenRGBPhilipsWizSettingsPage();
ui->SettingsTabBar->addTab(PhilipsWizSettingsPage, "");
QString SettingsLabelString;
if(IsDarkTheme())
{
SettingsLabelString = "light_dark.png";
}
else
{
SettingsLabelString = "light.png";
}
/*-----------------------------------------------------*\
| Create the tab label |
\*-----------------------------------------------------*/
TabLabel* SettingsTabLabel = new TabLabel(SettingsLabelString, "Philips Wiz Devices");
ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel);
}
void OpenRGBDialog2::AddQMKORGBSettingsPage()
{
/*-----------------------------------------------------*\
@@ -745,34 +707,6 @@ void OpenRGBDialog2::AddSerialSettingsPage()
ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel);
}
void OpenRGBDialog2::AddYeelightSettingsPage()
{
/*-----------------------------------------------------*\
| Create the Settings page |
\*-----------------------------------------------------*/
YeelightSettingsPage = new OpenRGBYeelightSettingsPage();
ui->SettingsTabBar->addTab(YeelightSettingsPage, "");
QString SettingsLabelString;
if(IsDarkTheme())
{
SettingsLabelString = "light_dark.png";
}
else
{
SettingsLabelString = "light.png";
}
/*-----------------------------------------------------*\
| Create the tab label |
\*-----------------------------------------------------*/
TabLabel* SettingsTabLabel = new TabLabel(SettingsLabelString, "Yeelight Devices");
ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel);
}
void OpenRGBDialog2::AddPlugin(OpenRGBPluginEntry* plugin)
{
/*-----------------------------------------------------*\
-6
View File
@@ -10,10 +10,8 @@
#include "OpenRGBSupportedDevicesPage.h"
#include "OpenRGBSettingsPage.h"
#include "OpenRGBE131SettingsPage/OpenRGBE131SettingsPage.h"
#include "OpenRGBPhilipsWizSettingsPage/OpenRGBPhilipsWizSettingsPage.h"
#include "OpenRGBQMKORGBSettingsPage/OpenRGBQMKORGBSettingsPage.h"
#include "OpenRGBSerialSettingsPage/OpenRGBSerialSettingsPage.h"
#include "OpenRGBYeelightSettingsPage/OpenRGBYeelightSettingsPage.h"
#include "PluginManager.h"
#include <vector>
@@ -66,10 +64,8 @@ private:
OpenRGBSupportedDevicesPage *SupportedPage;
OpenRGBSettingsPage *SettingsPage;
OpenRGBE131SettingsPage *E131SettingsPage;
OpenRGBPhilipsWizSettingsPage *PhilipsWizSettingsPage;
OpenRGBQMKORGBSettingsPage *QMKORGBSettingsPage;
OpenRGBSerialSettingsPage *SerialSettingsPage;
OpenRGBYeelightSettingsPage *YeelightSettingsPage;
bool ShowI2CTools = false;
@@ -89,10 +85,8 @@ private:
void AddSupportedDevicesPage();
void AddSettingsPage();
void AddE131SettingsPage();
void AddPhilipsWizSettingsPage();
void AddQMKORGBSettingsPage();
void AddSerialSettingsPage();
void AddYeelightSettingsPage();
void AddPluginsPage(PluginManager* plugin_manager);
void ClearDevicesList();
@@ -1,16 +0,0 @@
#include "OpenRGBPhilipsWizSettingsEntry.h"
#include "ui_OpenRGBPhilipsWizSettingsEntry.h"
using namespace Ui;
OpenRGBPhilipsWizSettingsEntry::OpenRGBPhilipsWizSettingsEntry(QWidget *parent) :
QWidget(parent),
ui(new Ui::OpenRGBPhilipsWizSettingsEntryUi)
{
ui->setupUi(this);
}
OpenRGBPhilipsWizSettingsEntry::~OpenRGBPhilipsWizSettingsEntry()
{
delete ui;
}
@@ -1,21 +0,0 @@
#ifndef OPENRGBPHILIPSWIZSETTINGSENTRY_H
#define OPENRGBPHILIPSWIZSETTINGSENTRY_H
#include "ui_OpenRGBPhilipsWizSettingsEntry.h"
#include <QWidget>
namespace Ui {
class OpenRGBPhilipsWizSettingsEntry;
}
class Ui::OpenRGBPhilipsWizSettingsEntry : public QWidget
{
Q_OBJECT
public:
explicit OpenRGBPhilipsWizSettingsEntry(QWidget *parent = nullptr);
~OpenRGBPhilipsWizSettingsEntry();
Ui::OpenRGBPhilipsWizSettingsEntryUi *ui;
};
#endif // OPENRGBPHILIPSWIZSETTINGSENTRY_H
@@ -1,49 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>OpenRGBPhilipsWizSettingsEntryUi</class>
<widget class="QWidget" name="OpenRGBPhilipsWizSettingsEntryUi">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>190</width>
<height>59</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="3">
<widget class="QLineEdit" name="IPEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="IPLabel">
<property name="text">
<string>IP:</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>IPEdit</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
@@ -1,105 +0,0 @@
#include "OpenRGBPhilipsWizSettingsPage.h"
#include "ui_OpenRGBPhilipsWizSettingsPage.h"
#include "ResourceManager.h"
using namespace Ui;
OpenRGBPhilipsWizSettingsPage::OpenRGBPhilipsWizSettingsPage(QWidget *parent) :
QWidget(parent),
ui(new Ui::OpenRGBPhilipsWizSettingsPageUi)
{
ui->setupUi(this);
json wiz_settings;
/*-------------------------------------------------*\
| Get Philips Wiz settings |
\*-------------------------------------------------*/
wiz_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("PhilipsWizDevices");
/*-------------------------------------------------*\
| If the Wiz settings contains devices, process |
\*-------------------------------------------------*/
if(wiz_settings.contains("devices"))
{
for(unsigned int device_idx = 0; device_idx < wiz_settings["devices"].size(); device_idx++)
{
OpenRGBPhilipsWizSettingsEntry* entry = new OpenRGBPhilipsWizSettingsEntry;
if(wiz_settings["devices"][device_idx].contains("ip"))
{
entry->ui->IPEdit->setText(QString::fromStdString(wiz_settings["devices"][device_idx]["ip"]));
}
entries.push_back(entry);
QListWidgetItem* item = new QListWidgetItem;
item->setSizeHint(entry->sizeHint());
ui->PhilipsWizDeviceList->addItem(item);
ui->PhilipsWizDeviceList->setItemWidget(item, entry);
ui->PhilipsWizDeviceList->show();
}
}
}
OpenRGBPhilipsWizSettingsPage::~OpenRGBPhilipsWizSettingsPage()
{
delete ui;
}
void Ui::OpenRGBPhilipsWizSettingsPage::on_AddPhilipsWizDeviceButton_clicked()
{
OpenRGBPhilipsWizSettingsEntry* entry = new OpenRGBPhilipsWizSettingsEntry;
entries.push_back(entry);
QListWidgetItem* item = new QListWidgetItem;
item->setSizeHint(entry->sizeHint());
ui->PhilipsWizDeviceList->addItem(item);
ui->PhilipsWizDeviceList->setItemWidget(item, entry);
ui->PhilipsWizDeviceList->show();
}
void Ui::OpenRGBPhilipsWizSettingsPage::on_RemovePhilipsWizDeviceButton_clicked()
{
int cur_row = ui->PhilipsWizDeviceList->currentRow();
if(cur_row < 0)
{
return;
}
QListWidgetItem* item = ui->PhilipsWizDeviceList->takeItem(cur_row);
ui->PhilipsWizDeviceList->removeItemWidget(item);
delete item;
delete entries[cur_row];
entries.erase(entries.begin() + cur_row);
}
void Ui::OpenRGBPhilipsWizSettingsPage::on_SavePhilipsWizConfigurationButton_clicked()
{
json wiz_settings;
/*-------------------------------------------------*\
| Get Philips Wiz settings |
\*-------------------------------------------------*/
wiz_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("PhilipsWizDevices");
wiz_settings["devices"].clear();
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
{
/*-------------------------------------------------*\
| Required parameters |
\*-------------------------------------------------*/
wiz_settings["devices"][device_idx]["ip"] = entries[device_idx]->ui->IPEdit->text().toStdString();
}
ResourceManager::get()->GetSettingsManager()->SetSettings("PhilipsWizDevices", wiz_settings);
ResourceManager::get()->GetSettingsManager()->SaveSettings();
}
@@ -1,34 +0,0 @@
#ifndef OPENRGBPHILIPSWIZSETTINGSPAGE_H
#define OPENRGBPHILIPSWIZSETTINGSPAGE_H
#include "ui_OpenRGBPhilipsWizSettingsPage.h"
#include <QWidget>
#include "OpenRGBPhilipsWizSettingsEntry.h"
namespace Ui {
class OpenRGBPhilipsWizSettingsPage;
}
class Ui::OpenRGBPhilipsWizSettingsPage : public QWidget
{
Q_OBJECT
public:
explicit OpenRGBPhilipsWizSettingsPage(QWidget *parent = nullptr);
~OpenRGBPhilipsWizSettingsPage();
private slots:
void on_AddPhilipsWizDeviceButton_clicked();
void on_RemovePhilipsWizDeviceButton_clicked();
void on_SavePhilipsWizConfigurationButton_clicked();
private:
Ui::OpenRGBPhilipsWizSettingsPageUi *ui;
std::vector<OpenRGBPhilipsWizSettingsEntry*> entries;
};
#endif // OPENRGBPHILIPSWIZSETTINGSPAGE_H
@@ -1,49 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>OpenRGBPhilipsWizSettingsPageUi</class>
<widget class="QWidget" name="OpenRGBPhilipsWizSettingsPageUi">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QPushButton" name="AddPhilipsWizDeviceButton">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="RemovePhilipsWizDeviceButton">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="SavePhilipsWizConfigurationButton">
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QListWidget" name="PhilipsWizDeviceList">
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
@@ -1,45 +0,0 @@
#include "OpenRGBPluginsList.h"
#include <QMimeData>
#include <QUrl>
OpenRGBPluginsList::OpenRGBPluginsList(QWidget *parent) : QListWidget (parent)
{
setAcceptDrops(true);
}
void OpenRGBPluginsList::dropEvent(QDropEvent *event)
{
const QMimeData* mimeData = event->mimeData();
if (mimeData->hasUrls())
{
std::vector<std::string> path_list;
QList<QUrl> urls = mimeData->urls();
for(const QUrl& url: urls)
{
path_list.push_back(url.toLocalFile().toStdString());
}
emit PluginsDropped(path_list);
}
}
void OpenRGBPluginsList::dragEnterEvent(QDragEnterEvent *event)
{
if (event->mimeData()->hasUrls())
{
event->acceptProposedAction();
}
else
{
event->ignore();
}
}
void OpenRGBPluginsList::dragMoveEvent(QDragMoveEvent *event)
{
event->acceptProposedAction();
}
@@ -1,24 +0,0 @@
#ifndef OPENRGBPLUGINSLIST_H
#define OPENRGBPLUGINSLIST_H
#include <QListWidget>
#include <QDropEvent>
#include <QDragEnterEvent>
class OpenRGBPluginsList : public QListWidget
{
Q_OBJECT
public:
OpenRGBPluginsList(QWidget *parent = nullptr);
signals:
void PluginsDropped(std::vector<std::string>);
protected:
void dropEvent(QDropEvent *event) override;
void dragEnterEvent(QDragEnterEvent *event) override;
void dragMoveEvent(QDragMoveEvent *event) override;
};
#endif // OPENRGBPLUGINSLIST_H
+3 -39
View File
@@ -88,17 +88,7 @@ void Ui::OpenRGBPluginsPage::on_InstallPluginButton_clicked()
\*-----------------------------------------------------*/
QString install_file = QFileDialog::getOpenFileName(this, "Install OpenRGB Plugin", "", "DLL Files (*.dll; *.dylib; *.so; *.so.*)");
bool installed = InstallPlugin(install_file.toStdString());
if(installed)
{
RefreshList();
}
}
bool Ui::OpenRGBPluginsPage::InstallPlugin(std::string install_file)
{
std::string from_path = install_file;
std::string from_path = install_file.toStdString();
std::string to_path = ResourceManager::get()->GetConfigurationDirectory() + "plugins/";
std::string to_file = to_path + filesystem::path(from_path).filename().string();
bool match = false;
@@ -126,7 +116,7 @@ bool Ui::OpenRGBPluginsPage::InstallPlugin(std::string install_file)
if(reply != QMessageBox::Yes)
{
return false;
return;
}
}
@@ -142,14 +132,12 @@ bool Ui::OpenRGBPluginsPage::InstallPlugin(std::string install_file)
plugin_manager->AddPlugin(to_file);
return true;
RefreshList();
}
catch(std::exception& e)
{
}
return false;
}
void Ui::OpenRGBPluginsPage::on_RemovePluginButton_clicked()
@@ -310,27 +298,3 @@ void Ui::OpenRGBPluginsPage::on_EnableButton_clicked(OpenRGBPluginsEntry* entry)
plugin_manager->UnloadPlugin(entry_path);
}
}
void Ui::OpenRGBPluginsPage::on_PluginsList_itemSelectionChanged()
{
/*-----------------------------------------------------*\
| Enable the remove button when there's a selected item |
\*-----------------------------------------------------*/
ui->RemovePluginButton->setEnabled(!ui->PluginsList->selectedItems().empty());
}
void Ui::OpenRGBPluginsPage::on_PluginsList_PluginsDropped(std::vector<std::string> path_list)
{
bool installed = false;
for(const std::string& file_path: path_list)
{
installed |= InstallPlugin(file_path);
}
if(installed)
{
RefreshList();
}
}
@@ -26,16 +26,11 @@ private slots:
void on_RemovePluginButton_clicked();
void on_PluginsList_itemSelectionChanged();
void on_PluginsList_PluginsDropped(std::vector<std::string>);
private:
Ui::OpenRGBPluginsPageUi* ui;
PluginManager* plugin_manager;
std::vector<OpenRGBPluginsEntry*> entries;
bool InstallPlugin(std::string path);
void RefreshList();
};
+1 -11
View File
@@ -23,16 +23,13 @@
</item>
<item row="1" column="1">
<widget class="QPushButton" name="RemovePluginButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Remove Plugin</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="OpenRGBPluginsList" name="PluginsList">
<widget class="QListWidget" name="PluginsList">
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
@@ -40,13 +37,6 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>OpenRGBPluginsList</class>
<extends>QListWidget</extends>
<header>qt/OpenRGBPluginsPage/OpenRGBPluginsList.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
@@ -1,16 +0,0 @@
#include "OpenRGBYeelightSettingsEntry.h"
#include "ui_OpenRGBYeelightSettingsEntry.h"
using namespace Ui;
OpenRGBYeelightSettingsEntry::OpenRGBYeelightSettingsEntry(QWidget *parent) :
QWidget(parent),
ui(new Ui::OpenRGBYeelightSettingsEntryUi)
{
ui->setupUi(this);
}
OpenRGBYeelightSettingsEntry::~OpenRGBYeelightSettingsEntry()
{
delete ui;
}
@@ -1,21 +0,0 @@
#ifndef OPENRGBYEELIGHTSETTINGSENTRY_H
#define OPENRGBYEELIGHTSETTINGSENTRY_H
#include "ui_OpenRGBYeelightSettingsEntry.h"
#include <QWidget>
namespace Ui {
class OpenRGBYeelightSettingsEntry;
}
class Ui::OpenRGBYeelightSettingsEntry : public QWidget
{
Q_OBJECT
public:
explicit OpenRGBYeelightSettingsEntry(QWidget *parent = nullptr);
~OpenRGBYeelightSettingsEntry();
Ui::OpenRGBYeelightSettingsEntryUi *ui;
};
#endif // OPENRGBYeelightSETTINGSENTRY_H
@@ -1,63 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>OpenRGBYeelightSettingsEntryUi</class>
<widget class="QWidget" name="OpenRGBYeelightSettingsEntryUi">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>225</width>
<height>85</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="3">
<widget class="QLineEdit" name="IPEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="IPLabel">
<property name="text">
<string>IP:</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QCheckBox" name="MusicModeCheckBox">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="MusicModeLabel">
<property name="text">
<string>Music Mode:</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>IPEdit</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
@@ -1,111 +0,0 @@
#include "OpenRGBYeelightSettingsPage.h"
#include "ui_OpenRGBYeelightSettingsPage.h"
#include "ResourceManager.h"
using namespace Ui;
OpenRGBYeelightSettingsPage::OpenRGBYeelightSettingsPage(QWidget *parent) :
QWidget(parent),
ui(new Ui::OpenRGBYeelightSettingsPageUi)
{
ui->setupUi(this);
json yeelight_settings;
/*-------------------------------------------------*\
| Get Philips Wiz settings |
\*-------------------------------------------------*/
yeelight_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("YeelightDevices");
/*-------------------------------------------------*\
| If the Wiz settings contains devices, process |
\*-------------------------------------------------*/
if(yeelight_settings.contains("devices"))
{
for(unsigned int device_idx = 0; device_idx < yeelight_settings["devices"].size(); device_idx++)
{
OpenRGBYeelightSettingsEntry* entry = new OpenRGBYeelightSettingsEntry;
if(yeelight_settings["devices"][device_idx].contains("ip"))
{
entry->ui->IPEdit->setText(QString::fromStdString(yeelight_settings["devices"][device_idx]["ip"]));
}
if(yeelight_settings["devices"][device_idx].contains("music_mode"))
{
entry->ui->MusicModeCheckBox->setChecked(yeelight_settings["devices"][device_idx]["music_mode"]);
}
entries.push_back(entry);
QListWidgetItem* item = new QListWidgetItem;
item->setSizeHint(entry->sizeHint());
ui->YeelightDeviceList->addItem(item);
ui->YeelightDeviceList->setItemWidget(item, entry);
ui->YeelightDeviceList->show();
}
}
}
OpenRGBYeelightSettingsPage::~OpenRGBYeelightSettingsPage()
{
delete ui;
}
void Ui::OpenRGBYeelightSettingsPage::on_AddYeelightDeviceButton_clicked()
{
OpenRGBYeelightSettingsEntry* entry = new OpenRGBYeelightSettingsEntry;
entries.push_back(entry);
QListWidgetItem* item = new QListWidgetItem;
item->setSizeHint(entry->sizeHint());
ui->YeelightDeviceList->addItem(item);
ui->YeelightDeviceList->setItemWidget(item, entry);
ui->YeelightDeviceList->show();
}
void Ui::OpenRGBYeelightSettingsPage::on_RemoveYeelightDeviceButton_clicked()
{
int cur_row = ui->YeelightDeviceList->currentRow();
if(cur_row < 0)
{
return;
}
QListWidgetItem* item = ui->YeelightDeviceList->takeItem(cur_row);
ui->YeelightDeviceList->removeItemWidget(item);
delete item;
delete entries[cur_row];
entries.erase(entries.begin() + cur_row);
}
void Ui::OpenRGBYeelightSettingsPage::on_SaveYeelightConfigurationButton_clicked()
{
json yeelight_settings;
/*-------------------------------------------------*\
| Get Philips Wiz settings |
\*-------------------------------------------------*/
yeelight_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("YeelightDevices");
yeelight_settings["devices"].clear();
for(unsigned int device_idx = 0; device_idx < entries.size(); device_idx++)
{
/*-------------------------------------------------*\
| Required parameters |
\*-------------------------------------------------*/
yeelight_settings["devices"][device_idx]["ip"] = entries[device_idx]->ui->IPEdit->text().toStdString();
yeelight_settings["devices"][device_idx]["music_mode"] = entries[device_idx]->ui->MusicModeCheckBox->isChecked();
}
ResourceManager::get()->GetSettingsManager()->SetSettings("YeelightDevices", yeelight_settings);
ResourceManager::get()->GetSettingsManager()->SaveSettings();
}
@@ -1,34 +0,0 @@
#ifndef OPENRGBYEELIGHTSETTINGSPAGE_H
#define OPENRGBYEELIGHTSETTINGSPAGE_H
#include "ui_OpenRGBYeelightSettingsPage.h"
#include <QWidget>
#include "OpenRGBYeelightSettingsEntry.h"
namespace Ui {
class OpenRGBYeelightSettingsPage;
}
class Ui::OpenRGBYeelightSettingsPage : public QWidget
{
Q_OBJECT
public:
explicit OpenRGBYeelightSettingsPage(QWidget *parent = nullptr);
~OpenRGBYeelightSettingsPage();
private slots:
void on_AddYeelightDeviceButton_clicked();
void on_RemoveYeelightDeviceButton_clicked();
void on_SaveYeelightConfigurationButton_clicked();
private:
Ui::OpenRGBYeelightSettingsPageUi *ui;
std::vector<OpenRGBYeelightSettingsEntry*> entries;
};
#endif // OPENRGBYEELIGHTSETTINGSPAGE_H
@@ -1,49 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>OpenRGBYeelightSettingsPageUi</class>
<widget class="QWidget" name="OpenRGBYeelightSettingsPageUi">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QPushButton" name="AddYeelightDeviceButton">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="RemoveYeelightDeviceButton">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="SaveYeelightConfigurationButton">
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QListWidget" name="YeelightDeviceList">
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>