mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-04-26 08:48:59 -04:00
Rework individual Logitech mouse controllers into a single shared controller and add Direct mode.
Squashes all commits from Merge Request !495
This commit is contained in:
@@ -1,34 +1,28 @@
|
||||
#include "Detector.h"
|
||||
#include "LogitechG203Controller.h"
|
||||
#include "LogitechG203LController.h"
|
||||
#include "LogitechG213Controller.h"
|
||||
#include "LogitechG303Controller.h"
|
||||
#include "LogitechG403Controller.h"
|
||||
#include "LogitechG502PSController.h"
|
||||
#include "LogitechG560Controller.h"
|
||||
#include "LogitechG810Controller.h"
|
||||
#include "LogitechG815Controller.h"
|
||||
#include "LogitechGProWirelessController.h"
|
||||
#include "LogitechGPowerPlayController.h"
|
||||
#include "LogitechGLightsyncController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_LogitechG203.h"
|
||||
#include "RGBController_LogitechG203L.h"
|
||||
#include "RGBController_LogitechG213.h"
|
||||
#include "RGBController_LogitechG303.h"
|
||||
#include "RGBController_LogitechG403.h"
|
||||
#include "RGBController_LogitechG502PS.h"
|
||||
#include "RGBController_LogitechG560.h"
|
||||
#include "RGBController_LogitechG810.h"
|
||||
#include "RGBController_LogitechG815.h"
|
||||
#include "RGBController_LogitechGProWireless.h"
|
||||
#include "RGBController_LogitechGLightsync.h"
|
||||
#include "RGBController_LogitechGLightsync1zone.h"
|
||||
#include "RGBController_LogitechGPowerPlay.h"
|
||||
#include <vector>
|
||||
#include <hidapi/hidapi.h>
|
||||
#include <LogManager.h>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Logitech vendor ID |
|
||||
\*-----------------------------------------------------*/
|
||||
#define LOGITECH_VID 0x046D
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Keyboard product IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
@@ -41,6 +35,7 @@
|
||||
#define LOGITECH_G810_2_PID 0xC337
|
||||
#define LOGITECH_G813_PID 0xC232
|
||||
#define LOGITECH_G815_PID 0xC33F
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Mouse product IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
@@ -49,21 +44,49 @@
|
||||
#define LOGITECH_G303_PID 0xC080
|
||||
#define LOGITECH_G403_PID 0xC083
|
||||
#define LOGITECH_G403H_PID 0xC08F
|
||||
#define LOGITECH_G403_WIRELESS_PID 0xC082
|
||||
#define LOGITECH_G403_WIRELESS_VIRTUAL_PID 0x405D
|
||||
#define LOGITECH_G502_PS_PID 0xC332
|
||||
#define LOGITECH_G502H_PID 0xC08B
|
||||
#define LOGITECH_G502_WIRELESS_PID 0xC08D
|
||||
#define LOGITECH_G502_WIRELESS_VIRTUAL_PID 0x407F
|
||||
#define LOGITECH_G703_WIRELESS_PID 0xC087
|
||||
#define LOGITECH_G703_WIRELESS_VIRTUAL_PID 0x4070
|
||||
#define LOGITECH_G900_WIRELESS_PID 0xC081
|
||||
#define LOGITECH_G900_WIRELESS_VIRTUAL_PID 0x4053
|
||||
#define LOGITECH_G903_WIRELESS_PID 0xC086
|
||||
#define LOGITECH_G903_WIRELESS_VIRTUAL_PID 0x4067
|
||||
#define LOGITECH_G_LIGHTSPEED_WIRELESS_PID 0xC539
|
||||
#define LOGITECH_GPRO_WIRED_PID 0xC085
|
||||
#define LOGITECH_GPRO_HERO_WIRED_PID 0xC08C
|
||||
#define LOGITECH_GPRO_WIRELESS_PID 0xC088
|
||||
#define LOGITECH_GPRO_WIRELESS_VIRTUAL_PID 0x4079
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Mousemat product IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define LOGITECH_G_LIGHTSPEED_POWERPLAY_PID 0xC53A
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Speaker product IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define LOGITECH_G560_PID 0x0A78
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Logitech Keyboards |
|
||||
\*-----------------------------------------------------*/
|
||||
void DetectLogitechKeyboardG213(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
LogitechG213Controller* controller = new LogitechG213Controller(dev, info->path);
|
||||
RGBController_LogitechG213* rgb_controller = new RGBController_LogitechG213(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
void DetectLogitechKeyboardG810(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
/*-------------------------------------------------------------------------------------------------*\
|
||||
@@ -121,129 +144,13 @@ void DetectLogitechKeyboardG810(hid_device_info* info, const std::string& name)
|
||||
#endif
|
||||
}
|
||||
|
||||
void DetectLogitechKeyboardG213(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
LogitechG213Controller* controller = new LogitechG213Controller(dev, info->path);
|
||||
RGBController_LogitechG213* rgb_controller = new RGBController_LogitechG213(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
void DetectLogitechMouseG203(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
LogitechG203Controller* controller = new LogitechG203Controller(dev, info->path);
|
||||
RGBController_LogitechG203* rgb_controller = new RGBController_LogitechG203(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
void DetectLogitechMouseG203L(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
LogitechG203LController* controller = new LogitechG203LController(dev, info->path);
|
||||
RGBController_LogitechG203L* rgb_controller = new RGBController_LogitechG203L(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
void DetectLogitechMouseG303(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
LogitechG303Controller* controller = new LogitechG303Controller(dev, info->path);
|
||||
RGBController_LogitechG303* rgb_controller = new RGBController_LogitechG303(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
void DetectLogitechMouseG403(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
LogitechG403Controller* controller = new LogitechG403Controller(dev, info->path);
|
||||
RGBController_LogitechG403* rgb_controller = new RGBController_LogitechG403(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
void DetectLogitechMouseG502PS(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
LogitechG502PSController* controller = new LogitechG502PSController(dev, info->path);
|
||||
RGBController_LogitechG502PS* rgb_controller = new RGBController_LogitechG502PS(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
void DetectLogitechMouseGPRO(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
LogitechGProWirelessController* controller = new LogitechGProWirelessController(dev, info->path);
|
||||
RGBController_LogitechGProWireless* rgb_controller = new RGBController_LogitechGProWireless(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
void DetectLogitechMouseGLS(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
//Add mouse
|
||||
LogitechGProWirelessController* mouse_controller = new LogitechGProWirelessController(dev, info->path);
|
||||
RGBController_LogitechGProWireless* mouse_rgb_controller = new RGBController_LogitechGProWireless(mouse_controller);
|
||||
mouse_rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(mouse_rgb_controller);
|
||||
|
||||
//Add Powerplay mousemat
|
||||
LogitechGPowerPlayController* mousemat_controller = new LogitechGPowerPlayController(dev, info->path);
|
||||
RGBController_LogitechGPowerPlay* mousemat_rgb_controller = new RGBController_LogitechGPowerPlay(mousemat_controller);
|
||||
mousemat_rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(mousemat_rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
void DetectLogitechG560(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
//Add G560 Speaker
|
||||
LogitechG560Controller* speaker_controller = new LogitechG560Controller(dev, info->path);
|
||||
RGBController_LogitechG560* speaker_rgb_controller = new RGBController_LogitechG560(speaker_controller);
|
||||
speaker_rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(speaker_rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
void DetectLogitechKeyboardG815(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
/*-------------------------------------------------------------------------------------------------*\
|
||||
| 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 _WIN32
|
||||
#ifdef USE_HID_USAGE
|
||||
hid_device* dev_usage_0x0602 = nullptr;
|
||||
hid_device* dev_usage_0x0604 = nullptr;
|
||||
hid_device_info* info_temp = info;
|
||||
@@ -300,38 +207,258 @@ void DetectLogitechKeyboardG815(hid_device_info* info, const std::string& name)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Logitech Mice |
|
||||
\*-----------------------------------------------------*/
|
||||
static void addLogitechLightsyncMouse1zone(hid_device_info* info, const std::string& name, unsigned char hid_dev_index, unsigned char hid_feature_index, unsigned char hid_fctn_ase_id)
|
||||
{
|
||||
#ifdef USE_HID_USAGE
|
||||
{
|
||||
hid_device* dev_usage_1 = nullptr;
|
||||
hid_device* dev_usage_2 = nullptr;
|
||||
hid_device_info* info_temp = info;
|
||||
while (info_temp)
|
||||
{
|
||||
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 1
|
||||
&& info_temp->usage_page == info->usage_page) // constant 0x00FF
|
||||
{
|
||||
if (info_temp->usage == 1)
|
||||
{
|
||||
dev_usage_1 = hid_open_path(info_temp->path);
|
||||
}
|
||||
else if (info_temp->usage == 2)
|
||||
{
|
||||
dev_usage_2 = hid_open_path(info_temp->path);
|
||||
}
|
||||
}
|
||||
if (dev_usage_1 && dev_usage_2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
info_temp = info_temp->next;
|
||||
}
|
||||
if (dev_usage_1 && dev_usage_2)
|
||||
{
|
||||
LogitechGLightsyncController* controller = new LogitechGLightsyncController(dev_usage_1, dev_usage_2, info->path, hid_dev_index, hid_feature_index, hid_fctn_ase_id);
|
||||
RGBController_LogitechGLightsync1zone* rgb_controller = new RGBController_LogitechGLightsync1zone (controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_NOTICE("Unable to open all device report endpoints, unable to add device");
|
||||
hid_close(dev_usage_1);
|
||||
hid_close(dev_usage_2);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if (dev)
|
||||
{
|
||||
LogitechGLightsyncController* controller = new LogitechGLightsyncController(dev, dev, info->path, hid_dev_index, hid_feature_index, hid_fctn_ase_id);
|
||||
RGBController_LogitechGLightsync1zone* rgb_controller = new RGBController_LogitechGLightsync1zone(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void addLogitechLightsyncMouse2zone(hid_device_info* info, const std::string& name, unsigned char hid_dev_index, unsigned char hid_feature_index, unsigned char hid_fctn_ase_id)
|
||||
{
|
||||
#ifdef USE_HID_USAGE
|
||||
{
|
||||
hid_device* dev_usage_1 = nullptr;
|
||||
hid_device* dev_usage_2 = nullptr;
|
||||
hid_device_info* info_temp = info;
|
||||
while (info_temp)
|
||||
{
|
||||
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 1
|
||||
&& info_temp->usage_page == info->usage_page) // constant 0x00FF
|
||||
{
|
||||
if (info_temp->usage == 1)
|
||||
{
|
||||
dev_usage_1 = hid_open_path(info_temp->path);
|
||||
}
|
||||
else if (info_temp->usage == 2)
|
||||
{
|
||||
dev_usage_2 = hid_open_path(info_temp->path);
|
||||
}
|
||||
}
|
||||
if (dev_usage_1 && dev_usage_2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
info_temp = info_temp->next;
|
||||
}
|
||||
if (dev_usage_1 && dev_usage_2)
|
||||
{
|
||||
LogitechGLightsyncController* controller = new LogitechGLightsyncController(dev_usage_1, dev_usage_2, info->path, hid_dev_index, hid_feature_index, hid_fctn_ase_id);
|
||||
RGBController_LogitechGLightsync* rgb_controller = new RGBController_LogitechGLightsync (controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_NOTICE("Unable to open all device report endpoints, unable to add device");
|
||||
hid_close(dev_usage_1);
|
||||
hid_close(dev_usage_2);
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if (dev)
|
||||
{
|
||||
LogitechGLightsyncController* controller = new LogitechGLightsyncController(dev, dev, info->path, hid_dev_index, hid_feature_index, hid_fctn_ase_id);
|
||||
RGBController_LogitechGLightsync* rgb_controller = new RGBController_LogitechGLightsync(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void DetectLogitechMouseG203(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
addLogitechLightsyncMouse1zone(info, name, 0xFF, 0x0E, 0x3A);
|
||||
}
|
||||
|
||||
void DetectLogitechMouseG203L(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
LogitechG203LController* controller = new LogitechG203LController(dev, info->path);
|
||||
RGBController_LogitechG203L* rgb_controller = new RGBController_LogitechG203L(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DetectLogitechMouseG303(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
addLogitechLightsyncMouse2zone(info, name, 0xFF, 0x0E, 0x3A);
|
||||
}
|
||||
|
||||
void DetectLogitechMouseG403(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
addLogitechLightsyncMouse2zone(info, name, 0xFF, 0x0E, 0x3A);
|
||||
}
|
||||
|
||||
void DetectLogitechMouseG403WW(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
addLogitechLightsyncMouse2zone(info, name, 0xFF, 0x18, 0x3A);
|
||||
}
|
||||
|
||||
void DetectLogitechMouseG502PS(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
addLogitechLightsyncMouse2zone(info, name, 0xFF, 0x02, 0x3A);
|
||||
}
|
||||
|
||||
void DetectLogitechMouseG502WW(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
addLogitechLightsyncMouse2zone(info, name, 0xFF, 0x07, 0x3A);
|
||||
}
|
||||
|
||||
void DetectLogitechMouseG703WW(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
addLogitechLightsyncMouse2zone(info, name, 0x01, 0x18, 0x3C);
|
||||
}
|
||||
|
||||
void DetectLogitechMouseG900WW(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
addLogitechLightsyncMouse2zone(info, name, 0x01, 0x17, 0x3A);
|
||||
}
|
||||
|
||||
void DetectLogitechMouseG903WW(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
addLogitechLightsyncMouse2zone(info, name, 0x01, 0x17, 0x3A);
|
||||
}
|
||||
|
||||
void DetectLogitechMouseGPRO(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
addLogitechLightsyncMouse2zone(info, name, 0x01, 0x07, 0x3C);
|
||||
}
|
||||
|
||||
void DetectLogitechMouseGLS(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
//Add mouse
|
||||
LogitechGLightsyncController* controller = new LogitechGLightsyncController(dev, dev, info->path, 0x01, 0x07, 0x3C);
|
||||
RGBController_LogitechGLightsync* rgb_controller = new RGBController_LogitechGLightsync(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
|
||||
//Add Powerplay mousemat
|
||||
LogitechGLightsyncController* mousemat_controller = new LogitechGLightsyncController(dev, dev, info->path, 0x01, 0x07, 0x3C);
|
||||
RGBController_LogitechGPowerPlay* mousemat_rgb_controller = new RGBController_LogitechGPowerPlay(mousemat_controller);
|
||||
mousemat_rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(mousemat_rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Other Logitech Devices |
|
||||
\*-----------------------------------------------------*/
|
||||
void DetectLogitechG560(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
//Add G560 Speaker
|
||||
LogitechG560Controller* speaker_controller = new LogitechG560Controller(dev, info->path);
|
||||
RGBController_LogitechG560* speaker_rgb_controller = new RGBController_LogitechG560(speaker_controller);
|
||||
speaker_rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(speaker_rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
|
||||
| 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_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);
|
||||
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
|
||||
| Mice |
|
||||
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
REGISTER_HID_DETECTOR_IPU("Logitech G203 Prodigy", DetectLogitechMouseG203, LOGITECH_VID, LOGITECH_G203_PID, 1, 0xFF00, 2);
|
||||
REGISTER_HID_DETECTOR_IPU("Logitech G203 Lightsync", DetectLogitechMouseG203L, LOGITECH_VID, LOGITECH_G203L_PID, 1, 0xFF00, 2);
|
||||
REGISTER_HID_DETECTOR_IPU("Logitech G303 Daedalus Apex", DetectLogitechMouseG303, LOGITECH_VID, LOGITECH_G303_PID, 1, 0xFF00, 2);
|
||||
REGISTER_HID_DETECTOR_IPU("Logitech G403 Prodigy", DetectLogitechMouseG403, LOGITECH_VID, LOGITECH_G403_PID, 1, 0xFF00, 2);
|
||||
REGISTER_HID_DETECTOR_IPU("Logitech G403 Hero", DetectLogitechMouseG403, LOGITECH_VID, LOGITECH_G403H_PID, 1, 0xFF00, 2);
|
||||
REGISTER_HID_DETECTOR_IPU("Logitech G502 Proteus Spectrum", DetectLogitechMouseG502PS, LOGITECH_VID, LOGITECH_G502_PS_PID, 1, 0xFF00, 2);
|
||||
REGISTER_HID_DETECTOR_IPU("Logitech G502 Hero", DetectLogitechMouseG502PS, LOGITECH_VID, LOGITECH_G502H_PID, 1, 0xFF00, 2);
|
||||
REGISTER_HID_DETECTOR_IPU("Logitech G Pro Gaming Mouse", DetectLogitechMouseG203, LOGITECH_VID, LOGITECH_GPRO_WIRED_PID, 1, 0xFF00, 2);
|
||||
REGISTER_HID_DETECTOR_IPU("Logitech G Pro (HERO) Gaming Mouse", DetectLogitechMouseG203, LOGITECH_VID, LOGITECH_GPRO_HERO_WIRED_PID, 1, 0xFF00, 2);
|
||||
REGISTER_HID_DETECTOR_IPU("Logitech G Lightspeed Wireless Gaming Mouse", DetectLogitechMouseGPRO, LOGITECH_VID, LOGITECH_G_LIGHTSPEED_WIRELESS_PID, 2, 0xFF00, 2);
|
||||
REGISTER_HID_DETECTOR_IPU("Logitech G Pro Wireless Gaming Mouse (Wired)", DetectLogitechMouseGPRO, LOGITECH_VID, LOGITECH_GPRO_WIRELESS_PID, 2, 0xFF00, 2);
|
||||
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_G203L_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 Prodigy", DetectLogitechMouseG403, LOGITECH_VID, LOGITECH_G403_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("Logitech G403 Hero", DetectLogitechMouseG403, LOGITECH_VID, LOGITECH_G403H_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("Logitech G403 Prodigy Wireless (wired)", DetectLogitechMouseG403WW, LOGITECH_VID, LOGITECH_G403_WIRELESS_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("Logitech G502 Proteus Spectrum", DetectLogitechMouseG502PS, LOGITECH_VID, LOGITECH_G502_PS_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("Logitech G502 Hero", DetectLogitechMouseG502PS, LOGITECH_VID, LOGITECH_G502H_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("Logitech G502 LIGHTSPEED Wireless (wired)", DetectLogitechMouseG502WW, LOGITECH_VID, LOGITECH_G502_WIRELESS_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("Logitech G703 Wireless (wired)", DetectLogitechMouseG703WW, LOGITECH_VID, LOGITECH_G703_WIRELESS_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("Logitech G900 Chaos Spectrum Wireless (wired)", DetectLogitechMouseG900WW, LOGITECH_VID, LOGITECH_G900_WIRELESS_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("Logitech G903 LIGHTSPEED Wireless (wired)", DetectLogitechMouseG903WW, LOGITECH_VID, LOGITECH_G903_WIRELESS_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("Logitech G Pro Gaming Mouse", DetectLogitechMouseG203, LOGITECH_VID, LOGITECH_GPRO_WIRED_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("Logitech G Pro (HERO) Gaming Mouse", DetectLogitechMouseG203, LOGITECH_VID, LOGITECH_GPRO_HERO_WIRED_PID, 1, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("Logitech G Lightspeed Wireless Gaming Mouse", DetectLogitechMouseGPRO, LOGITECH_VID, LOGITECH_G_LIGHTSPEED_WIRELESS_PID, 2, 0xFF00);
|
||||
REGISTER_HID_DETECTOR_IP("Logitech G Pro Wireless Gaming Mouse (Wired)", DetectLogitechMouseGPRO, LOGITECH_VID, LOGITECH_GPRO_WIRELESS_PID, 2, 0xFF00);
|
||||
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
|
||||
| Mousemats |
|
||||
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
REGISTER_HID_DETECTOR_IPU("Logitech G Powerplay Mousepad with Lightspeed", DetectLogitechMouseGLS, LOGITECH_VID, LOGITECH_G_LIGHTSPEED_POWERPLAY_PID, 2, 0xFF00, 2);
|
||||
REGISTER_HID_DETECTOR_IPU("Logitech G Powerplay Mousepad with Lightspeed", DetectLogitechMouseGLS, LOGITECH_VID, LOGITECH_G_LIGHTSPEED_POWERPLAY_PID, 2, 0xFF00, 2);
|
||||
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
|
||||
| Speakers |
|
||||
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
REGISTER_HID_DETECTOR_IPU("Logitech G560 Lightsync Speaker", DetectLogitechG560, LOGITECH_VID, LOGITECH_G560_PID, 2, 0xFF43, 514);
|
||||
REGISTER_HID_DETECTOR_IPU("Logitech G560 Lightsync Speaker", DetectLogitechG560, LOGITECH_VID, LOGITECH_G560_PID, 2, 0xFF43, 514);
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| LogitechG203Controller.cpp |
|
||||
| |
|
||||
| Driver for Logitech G203 Prodigy mouse |
|
||||
| lighting controller |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 5/17/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "LogitechG203Controller.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
LogitechG203Controller::LogitechG203Controller(hid_device* dev_handle, const char* path)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
}
|
||||
|
||||
LogitechG203Controller::~LogitechG203Controller()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string LogitechG203Controller::GetDeviceLocation()
|
||||
{
|
||||
return("HID " + location);
|
||||
}
|
||||
|
||||
std::string LogitechG203Controller::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
hid_get_serial_number_string(dev, serial_string, 128);
|
||||
|
||||
std::wstring return_wstring = serial_string;
|
||||
std::string return_string(return_wstring.begin(), return_wstring.end());
|
||||
|
||||
return(return_string);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------*\
|
||||
| Private packet sending functions. |
|
||||
\*-------------------------------------------------------------------------------------------------*/
|
||||
|
||||
void LogitechG203Controller::SendMouseMode
|
||||
(
|
||||
unsigned char mode,
|
||||
unsigned short speed,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
)
|
||||
{
|
||||
char usb_buf[20];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Lighting Control packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x11;
|
||||
usb_buf[0x01] = 0xFF;
|
||||
usb_buf[0x02] = 0x0E;
|
||||
usb_buf[0x03] = 0x3C;
|
||||
usb_buf[0x04] = 0x00;
|
||||
|
||||
usb_buf[0x05] = mode;
|
||||
|
||||
usb_buf[0x06] = red;
|
||||
usb_buf[0x07] = green;
|
||||
usb_buf[0x08] = blue;
|
||||
|
||||
speed = 100 * speed;
|
||||
if(mode == LOGITECH_G203_MODE_CYCLE)
|
||||
{
|
||||
usb_buf[0x0B] = speed >> 8;
|
||||
usb_buf[0x0C] = speed & 0xFF;
|
||||
usb_buf[0x0D] = 0x64;
|
||||
}
|
||||
else if(mode == LOGITECH_G203_MODE_BREATHING)
|
||||
{
|
||||
usb_buf[0x09] = speed >> 8;
|
||||
usb_buf[0x0A] = speed & 0xFF;
|
||||
usb_buf[0x0C] = 0x64;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, (unsigned char *)usb_buf, 20);
|
||||
hid_read(dev, (unsigned char *)usb_buf, 20);
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| LogitechG203Controller.h |
|
||||
| |
|
||||
| Definitions and types for Logitech G203 |
|
||||
| Prodigy mouse lighting controller |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 5/17/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController.h"
|
||||
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
enum
|
||||
{
|
||||
LOGITECH_G203_MODE_OFF = 0x00,
|
||||
LOGITECH_G203_MODE_STATIC = 0x01,
|
||||
LOGITECH_G203_MODE_CYCLE = 0x02,
|
||||
LOGITECH_G203_MODE_BREATHING = 0x03,
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------------------------*\
|
||||
| Speed is 1000 for fast and 20000 for slow. |
|
||||
| Values are multiplied by 100 later to give lots of GUI steps. |
|
||||
\*---------------------------------------------------------------------------------------------*/
|
||||
enum
|
||||
{
|
||||
LOGITECH_G203_SPEED_SLOWEST = 0xC8, /* Slowest speed */
|
||||
LOGITECH_G203_SPEED_NORMAL = 0x32, /* Normal speed */
|
||||
LOGITECH_G203_SPEED_FASTEST = 0x0A, /* Fastest speed */
|
||||
};
|
||||
|
||||
class LogitechG203Controller
|
||||
{
|
||||
public:
|
||||
LogitechG203Controller(hid_device* dev_handle, const char* path);
|
||||
~LogitechG203Controller();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SendMouseMode
|
||||
(
|
||||
unsigned char mode,
|
||||
unsigned short speed,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
);
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
};
|
||||
@@ -1,81 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| LogitechG303Controller.cpp |
|
||||
| |
|
||||
| Driver for Logitech G303 Daedalus Apex |
|
||||
| mouse lighting controller |
|
||||
| |
|
||||
| TheRogueZeta 02/14/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "LogitechG303Controller.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
LogitechG303Controller::LogitechG303Controller(hid_device* dev_handle, const char* path)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
}
|
||||
|
||||
LogitechG303Controller::~LogitechG303Controller()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string LogitechG303Controller::GetDeviceLocation()
|
||||
{
|
||||
return(location);
|
||||
}
|
||||
|
||||
void LogitechG303Controller::SendMouseMode
|
||||
(
|
||||
unsigned char mode,
|
||||
std::uint16_t speed,
|
||||
unsigned char channel,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
)
|
||||
{
|
||||
unsigned char usb_buf[20];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Lighting Control packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x11;
|
||||
usb_buf[0x01] = 0xFF;
|
||||
usb_buf[0x02] = 0x0E;
|
||||
usb_buf[0x03] = 0x3C;
|
||||
usb_buf[0x04] = channel;
|
||||
|
||||
usb_buf[0x05] = mode;
|
||||
|
||||
usb_buf[0x06] = red;
|
||||
usb_buf[0x07] = green;
|
||||
usb_buf[0x08] = blue;
|
||||
|
||||
speed = 100 * speed;
|
||||
if(mode == LOGITECH_G303_MODE_CYCLE)
|
||||
{
|
||||
usb_buf[0x0B] = speed >> 8;
|
||||
usb_buf[0x0C] = speed & 0xFF;
|
||||
usb_buf[0x0D] = 0x64;
|
||||
}
|
||||
else if(mode == LOGITECH_G303_MODE_BREATHING)
|
||||
{
|
||||
usb_buf[0x09] = speed >> 8;
|
||||
usb_buf[0x0A] = speed & 0xFF;
|
||||
usb_buf[0x0C] = 0x64;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 20);
|
||||
hid_read(dev, usb_buf, 20);
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| LogitechG303Controller.h |
|
||||
| |
|
||||
| Definitions and types for Logitech G303 |
|
||||
| Daedalus Apex mouse lighting controller |
|
||||
| |
|
||||
| TheRogueZeta 02/14/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController.h"
|
||||
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
enum
|
||||
{
|
||||
LOGITECH_G303_MODE_OFF = 0x00,
|
||||
LOGITECH_G303_MODE_STATIC = 0x01,
|
||||
LOGITECH_G303_MODE_CYCLE = 0x02,
|
||||
LOGITECH_G303_MODE_BREATHING = 0x03,
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------------------------*\
|
||||
| Speed is 1000 for fast and 20000 for slow. |
|
||||
| Values are mutipled by 100 later to give lots of GUI steps. |
|
||||
\*---------------------------------------------------------------------------------------------*/
|
||||
enum
|
||||
{
|
||||
LOGITECH_G303_SPEED_SLOWEST = 0xC8, /* Slowest speed */
|
||||
LOGITECH_G303_SPEED_NORMAL = 0x32, /* Normal speed */
|
||||
LOGITECH_G303_SPEED_FASTEST = 0x0A, /* Fastest speed */
|
||||
};
|
||||
|
||||
class LogitechG303Controller
|
||||
{
|
||||
public:
|
||||
LogitechG303Controller(hid_device* dev_handle, const char* path);
|
||||
~LogitechG303Controller();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
|
||||
void SendMouseMode
|
||||
(
|
||||
unsigned char mode,
|
||||
unsigned short speed,
|
||||
unsigned char channel,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
);
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
};
|
||||
@@ -1,92 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| LogitechG403Controller.cpp |
|
||||
| |
|
||||
| Driver for Logitech G403 Prodigy mouse |
|
||||
| lighting controller |
|
||||
| |
|
||||
| Martin Hartl (inlart) 5/19/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "LogitechG403Controller.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
LogitechG403Controller::LogitechG403Controller(hid_device* dev_handle, const char* path)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
}
|
||||
|
||||
LogitechG403Controller::~LogitechG403Controller()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string LogitechG403Controller::GetDeviceLocation()
|
||||
{
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string LogitechG403Controller::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
hid_get_serial_number_string(dev, serial_string, 128);
|
||||
|
||||
std::wstring return_wstring = serial_string;
|
||||
std::string return_string(return_wstring.begin(), return_wstring.end());
|
||||
|
||||
return(return_string);
|
||||
}
|
||||
|
||||
void LogitechG403Controller::SendMouseMode
|
||||
(
|
||||
unsigned char mode,
|
||||
std::uint16_t speed,
|
||||
unsigned char channel,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
)
|
||||
{
|
||||
unsigned char usb_buf[20];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Lighting Control packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x11;
|
||||
usb_buf[0x01] = 0xFF;
|
||||
usb_buf[0x02] = 0x0E;
|
||||
usb_buf[0x03] = 0x3C;
|
||||
usb_buf[0x04] = channel;
|
||||
|
||||
usb_buf[0x05] = mode;
|
||||
|
||||
usb_buf[0x06] = red;
|
||||
usb_buf[0x07] = green;
|
||||
usb_buf[0x08] = blue;
|
||||
|
||||
speed = 100 * speed;
|
||||
if(mode == LOGITECH_G403_MODE_CYCLE)
|
||||
{
|
||||
usb_buf[0x0B] = speed >> 8;
|
||||
usb_buf[0x0C] = speed & 0xFF;
|
||||
usb_buf[0x0D] = 0x64;
|
||||
}
|
||||
else if(mode == LOGITECH_G403_MODE_BREATHING)
|
||||
{
|
||||
usb_buf[0x09] = speed >> 8;
|
||||
usb_buf[0x0A] = speed & 0xFF;
|
||||
usb_buf[0x0C] = 0x64;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 20);
|
||||
hid_read(dev, usb_buf, 20);
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| LogitechG403Controller.h |
|
||||
| |
|
||||
| Definitions and types for Logitech G403 |
|
||||
| Prodigy mouse lighting controller |
|
||||
| |
|
||||
| Martin Hartl (inlart) 5/19/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController.h"
|
||||
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
enum
|
||||
{
|
||||
LOGITECH_G403_MODE_OFF = 0x00,
|
||||
LOGITECH_G403_MODE_STATIC = 0x01,
|
||||
LOGITECH_G403_MODE_CYCLE = 0x02,
|
||||
LOGITECH_G403_MODE_BREATHING = 0x03,
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------------------------*\
|
||||
| Speed is 1000 for fast and 20000 for slow. |
|
||||
| Values are multiplied by 100 later to give lots of GUI steps. |
|
||||
\*---------------------------------------------------------------------------------------------*/
|
||||
enum
|
||||
{
|
||||
LOGITECH_G403_SPEED_SLOWEST = 0xC8, /* Slowest speed */
|
||||
LOGITECH_G403_SPEED_NORMAL = 0x32, /* Normal speed */
|
||||
LOGITECH_G403_SPEED_FASTEST = 0x0A, /* Fastest speed */
|
||||
};
|
||||
|
||||
class LogitechG403Controller
|
||||
{
|
||||
public:
|
||||
LogitechG403Controller(hid_device* dev_handle, const char* path);
|
||||
~LogitechG403Controller();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SendMouseMode
|
||||
(
|
||||
unsigned char mode,
|
||||
unsigned short speed,
|
||||
unsigned char channel,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
);
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
};
|
||||
@@ -1,94 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| Logitech502PSController.cpp |
|
||||
| |
|
||||
| Driver for Logitech G502 Proteus |
|
||||
| Spectrum mouse lighting controller |
|
||||
| |
|
||||
| kernzerfall 07/28/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "LogitechG502PSController.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
LogitechG502PSController::LogitechG502PSController(hid_device* dev_handle, const char* path)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
}
|
||||
|
||||
LogitechG502PSController::~LogitechG502PSController()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string LogitechG502PSController::GetDeviceLocation()
|
||||
{
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string LogitechG502PSController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
hid_get_serial_number_string(dev, serial_string, 128);
|
||||
|
||||
std::wstring return_wstring = serial_string;
|
||||
std::string return_string(return_wstring.begin(), return_wstring.end());
|
||||
|
||||
return(return_string);
|
||||
}
|
||||
|
||||
void LogitechG502PSController::SendMouseMode
|
||||
(
|
||||
unsigned char mode,
|
||||
std::uint16_t speed,
|
||||
unsigned char channel,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
)
|
||||
{
|
||||
unsigned char usb_buf[20];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Lighting Control packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x11;
|
||||
usb_buf[0x01] = 0xFF;
|
||||
usb_buf[0x02] = 0x02;
|
||||
usb_buf[0x03] = 0x3A;
|
||||
usb_buf[0x04] = channel;
|
||||
|
||||
usb_buf[0x05] = mode;
|
||||
|
||||
usb_buf[0x06] = red;
|
||||
usb_buf[0x07] = green;
|
||||
usb_buf[0x08] = blue;
|
||||
|
||||
speed = 100 * speed;
|
||||
if(mode == LOGITECH_G502_PS_MODE_CYCLE)
|
||||
{
|
||||
usb_buf[0x0B] = speed >> 8;
|
||||
usb_buf[0x0C] = speed & 0xFF;
|
||||
usb_buf[0x0D] = 0x64;
|
||||
}
|
||||
else if(mode == LOGITECH_G502_PS_MODE_BREATHING)
|
||||
{
|
||||
usb_buf[0x09] = speed >> 8;
|
||||
usb_buf[0x0A] = speed & 0xFF;
|
||||
usb_buf[0x0C] = 0x64;
|
||||
}else if(mode == LOGITECH_G502_PS_MODE_STATIC){
|
||||
usb_buf[0x09] = 0x02;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 20);
|
||||
hid_read(dev, usb_buf, 20);
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| Logitech502PSController.h |
|
||||
| |
|
||||
| Definitions and types for Logitech |
|
||||
| G502 Proteus Spectrum mouse lighting |
|
||||
| controller |
|
||||
| |
|
||||
| kernzerfall 07/28/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController.h"
|
||||
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
enum
|
||||
{
|
||||
LOGITECH_G502_PS_MODE_OFF = 0x00,
|
||||
LOGITECH_G502_PS_MODE_STATIC = 0x01,
|
||||
LOGITECH_G502_PS_MODE_CYCLE = 0x03,
|
||||
LOGITECH_G502_PS_MODE_BREATHING = 0x02
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------------------------*\
|
||||
| Speed is 1000 for fast and 20000 for slow. |
|
||||
| Values are multiplied by 100 later to give lots of GUI steps. |
|
||||
\*---------------------------------------------------------------------------------------------*/
|
||||
enum
|
||||
{
|
||||
LOGITECH_G502_PS_SPEED_SLOWEST = 0xC8, /* Slowest speed */
|
||||
LOGITECH_G502_PS_SPEED_NORMAL = 0x32, /* Normal speed */
|
||||
LOGITECH_G502_PS_SPEED_FASTEST = 0x0A, /* Fastest speed */
|
||||
};
|
||||
|
||||
class LogitechG502PSController
|
||||
{
|
||||
public:
|
||||
LogitechG502PSController(hid_device* dev_handle, const char* path);
|
||||
~LogitechG502PSController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SendMouseMode
|
||||
(
|
||||
unsigned char mode,
|
||||
unsigned short speed,
|
||||
unsigned char channel,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
);
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
};
|
||||
133
Controllers/LogitechController/LogitechGLightsyncController.cpp
Normal file
133
Controllers/LogitechController/LogitechGLightsyncController.cpp
Normal file
@@ -0,0 +1,133 @@
|
||||
/*-----------------------------------------*\
|
||||
| LogitechGLightsyncController.cpp |
|
||||
| |
|
||||
| Driver for Logitech G Lightsync |
|
||||
| lighting controllers |
|
||||
| |
|
||||
| TheRogueZeta 04/21/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "LogitechGLightsyncController.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
LogitechGLightsyncController::LogitechGLightsyncController(hid_device* dev_cmd_handle, hid_device *dev_handle, const char *path, unsigned char hid_dev_index, unsigned char hid_feature_index, unsigned char hid_fctn_ase_id)
|
||||
{
|
||||
dev = dev_handle;
|
||||
cmd_dev = dev_cmd_handle;
|
||||
location = path;
|
||||
dev_index = hid_dev_index;
|
||||
feature_index = hid_feature_index;
|
||||
fctn_ase_id = hid_fctn_ase_id;
|
||||
}
|
||||
|
||||
LogitechGLightsyncController::~LogitechGLightsyncController()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string LogitechGLightsyncController::GetDeviceLocation()
|
||||
{
|
||||
return (location);
|
||||
}
|
||||
|
||||
std::string LogitechGLightsyncController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
hid_get_serial_number_string(dev, serial_string, 128);
|
||||
|
||||
std::wstring return_wstring = serial_string;
|
||||
std::string return_string(return_wstring.begin(), return_wstring.end());
|
||||
|
||||
return(return_string);
|
||||
}
|
||||
|
||||
void LogitechGLightsyncController::UpdateMouseLED(
|
||||
unsigned char mode,
|
||||
std::uint16_t speed,
|
||||
unsigned char zone,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue,
|
||||
unsigned char brightness
|
||||
)
|
||||
{
|
||||
unsigned char usb_buf[20];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Lighting Control packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x11;
|
||||
usb_buf[0x01] = dev_index;
|
||||
usb_buf[0x02] = feature_index;
|
||||
usb_buf[0x03] = fctn_ase_id;
|
||||
|
||||
usb_buf[0x04] = zone;
|
||||
usb_buf[0x05] = mode;
|
||||
|
||||
usb_buf[0x06] = red;
|
||||
usb_buf[0x07] = green;
|
||||
usb_buf[0x08] = blue;
|
||||
|
||||
speed = 100 * speed;
|
||||
if (mode == LOGITECH_G_LIGHTSYNC_MODE_STATIC)
|
||||
{
|
||||
usb_buf[0x09] = 0x02;
|
||||
}
|
||||
if (mode == LOGITECH_G_LIGHTSYNC_MODE_CYCLE)
|
||||
{
|
||||
usb_buf[0x0B] = speed >> 8;
|
||||
usb_buf[0x0C] = speed & 0xFF;
|
||||
usb_buf[0x0D] = brightness;
|
||||
}
|
||||
else if (mode == LOGITECH_G_LIGHTSYNC_MODE_BREATHING)
|
||||
{
|
||||
usb_buf[0x09] = speed >> 8;
|
||||
usb_buf[0x0A] = speed & 0xFF;
|
||||
usb_buf[0x0C] = brightness;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 20);
|
||||
hid_read(dev, usb_buf, 20);
|
||||
}
|
||||
|
||||
void LogitechGLightsyncController::SetDirectMode(bool direct)
|
||||
{
|
||||
char cmd_buf[7];
|
||||
char usb_buf[20];
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(cmd_buf, 0x00, sizeof(cmd_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Command Control packet |
|
||||
\*-----------------------------------------------------*/
|
||||
cmd_buf[0x00] = 0x10;
|
||||
cmd_buf[0x01] = dev_index;
|
||||
cmd_buf[0x02] = feature_index;
|
||||
cmd_buf[0x03] = 0x8A;
|
||||
cmd_buf[0x04] = 0x00;
|
||||
cmd_buf[0x05] = 0x00;
|
||||
/*-----------------------------------------------------*\
|
||||
| If direct, disable save to flash |
|
||||
\*-----------------------------------------------------*/
|
||||
if(direct)
|
||||
{
|
||||
cmd_buf[0x04] = 0x01;
|
||||
cmd_buf[0x05] = 0x01;
|
||||
}
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(cmd_dev, (unsigned char *)cmd_buf, 7);
|
||||
hid_read(dev, (unsigned char *)usb_buf, 20);
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*-----------------------------------------*\
|
||||
| LogitechGLightsyncController.h |
|
||||
| |
|
||||
| Definitions and types for Logitech |
|
||||
| Lightsync lighting controllers |
|
||||
| |
|
||||
| TheRogueZeta 04/21/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController.h"
|
||||
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
enum
|
||||
{
|
||||
LOGITECH_G_LIGHTSYNC_MODE_OFF = 0x00,
|
||||
LOGITECH_G_LIGHTSYNC_MODE_STATIC = 0x01,
|
||||
LOGITECH_G_LIGHTSYNC_MODE_CYCLE = 0x02,
|
||||
LOGITECH_G_LIGHTSYNC_MODE_BREATHING = 0x03,
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------------------------*\
|
||||
| Speed is 1000 for fast and 20000 for slow. |
|
||||
| Values are multiplied by 100 later to give lots of GUI steps. |
|
||||
\*---------------------------------------------------------------------------------------------*/
|
||||
enum
|
||||
{
|
||||
LOGITECH_G_LIGHTSYNC_SPEED_SLOWEST = 0xC8, /* Slowest speed */
|
||||
LOGITECH_G_LIGHTSYNC_SPEED_NORMAL = 0x32, /* Normal speed */
|
||||
LOGITECH_G_LIGHTSYNC_SPEED_FASTEST = 0x0A, /* Fastest speed */
|
||||
};
|
||||
|
||||
class LogitechGLightsyncController
|
||||
{
|
||||
public:
|
||||
LogitechGLightsyncController(
|
||||
hid_device* dev_cmd_handle,
|
||||
hid_device* dev_handle,
|
||||
const char* path,
|
||||
unsigned char hid_dev_index,
|
||||
unsigned char hid_feature_index,
|
||||
unsigned char hid_fctn_ase_id);
|
||||
~LogitechGLightsyncController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetSerialString();
|
||||
|
||||
void UpdateMouseLED
|
||||
(
|
||||
unsigned char mode,
|
||||
unsigned short speed,
|
||||
unsigned char zone,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue,
|
||||
unsigned char brightness
|
||||
);
|
||||
void SetDirectMode(bool direct);
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
hid_device* cmd_dev;
|
||||
std::string location;
|
||||
unsigned char dev_index;
|
||||
unsigned char feature_index;
|
||||
unsigned char fctn_ase_id;
|
||||
bool direct_state;
|
||||
};
|
||||
@@ -1,99 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| LogitechGPowerPlayController.cpp |
|
||||
| |
|
||||
| Driver for Logitech G PowerPlay Wireless |
|
||||
| Charging System |
|
||||
| |
|
||||
| TheRogueZeta 8/31/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "LogitechGPowerPlayController.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
LogitechGPowerPlayController::LogitechGPowerPlayController(hid_device* dev_handle, const char* path)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
}
|
||||
|
||||
LogitechGPowerPlayController::~LogitechGPowerPlayController()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string LogitechGPowerPlayController::GetDeviceLocation()
|
||||
{
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string LogitechGPowerPlayController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
hid_get_serial_number_string(dev, serial_string, 128);
|
||||
|
||||
std::wstring return_wstring = serial_string;
|
||||
std::string return_string(return_wstring.begin(), return_wstring.end());
|
||||
|
||||
return(return_string);
|
||||
}
|
||||
|
||||
void LogitechGPowerPlayController::SendMouseMatMode
|
||||
(
|
||||
unsigned char mode,
|
||||
std::uint16_t speed,
|
||||
unsigned char zone,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
// unsigned char brightness
|
||||
)
|
||||
{
|
||||
unsigned char usb_buf[20];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Lighting Control packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x11;
|
||||
usb_buf[0x01] = 0x07;
|
||||
usb_buf[0x02] = 0x0B;
|
||||
usb_buf[0x03] = 0x3E;
|
||||
|
||||
usb_buf[0x04] = zone;
|
||||
usb_buf[0x05] = mode;
|
||||
|
||||
usb_buf[0x06] = red;
|
||||
usb_buf[0x07] = green;
|
||||
usb_buf[0x08] = blue;
|
||||
|
||||
speed = 100 * speed;
|
||||
if(mode == LOGITECH_G_POWERPLAY_MODE_STATIC)
|
||||
{
|
||||
usb_buf[0x09] = 0x02;
|
||||
}
|
||||
if(mode == LOGITECH_G_POWERPLAY_MODE_CYCLE)
|
||||
{
|
||||
usb_buf[0x0B] = speed >> 8;
|
||||
usb_buf[0x0C] = speed & 0xFF;
|
||||
//usb_buf[0x0D] = brightness;
|
||||
usb_buf[0x0D] = 0x64;
|
||||
}
|
||||
else if(mode == LOGITECH_G_POWERPLAY_MODE_BREATHING)
|
||||
{
|
||||
usb_buf[0x09] = speed >> 8;
|
||||
usb_buf[0x0A] = speed & 0xFF;
|
||||
//usb_buf[0x0C] = brightness;
|
||||
usb_buf[0x0C] = 0x64;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 20);
|
||||
hid_read(dev, usb_buf, 20);
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| LogitechGPowerPlayController.h |
|
||||
| |
|
||||
| Definitions and types for Logitech G |
|
||||
| PowerPlay Wireless lighting controller |
|
||||
| |
|
||||
| TheRogueZeta 8/31/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController.h"
|
||||
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
enum
|
||||
{
|
||||
LOGITECH_G_POWERPLAY_MODE_OFF = 0x00,
|
||||
LOGITECH_G_POWERPLAY_MODE_STATIC = 0x01,
|
||||
LOGITECH_G_POWERPLAY_MODE_CYCLE = 0x02,
|
||||
LOGITECH_G_POWERPLAY_MODE_BREATHING = 0x03,
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------------------------*\
|
||||
| Speed is 1000 for fast and 20000 for slow. |
|
||||
| Values are multiplied by 100 later to give lots of GUI steps. |
|
||||
\*---------------------------------------------------------------------------------------------*/
|
||||
enum
|
||||
{
|
||||
LOGITECH_G_POWERPLAY_SPEED_SLOWEST = 0xC8, /* Slowest speed */
|
||||
LOGITECH_G_POWERPLAY_SPEED_NORMAL = 0x32, /* Normal speed */
|
||||
LOGITECH_G_POWERPLAY_SPEED_FASTEST = 0x0A, /* Fastest speed */
|
||||
};
|
||||
|
||||
class LogitechGPowerPlayController
|
||||
{
|
||||
public:
|
||||
LogitechGPowerPlayController(hid_device* dev_handle, const char* path);
|
||||
~LogitechGPowerPlayController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SendMouseMatMode
|
||||
(
|
||||
unsigned char mode,
|
||||
unsigned short speed,
|
||||
unsigned char zone,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
// unsigned char brightness
|
||||
);
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
};
|
||||
@@ -1,99 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| LogitechGProWirelessController.cpp |
|
||||
| |
|
||||
| Driver for Logitech G Pro Wireless Gaming|
|
||||
| Mouse lighting controller |
|
||||
| |
|
||||
| TheRogueZeta 8/5/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "LogitechGProWirelessController.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
LogitechGProWirelessController::LogitechGProWirelessController(hid_device* dev_handle, const char* path)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
}
|
||||
|
||||
LogitechGProWirelessController::~LogitechGProWirelessController()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string LogitechGProWirelessController::GetDeviceLocation()
|
||||
{
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string LogitechGProWirelessController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
hid_get_serial_number_string(dev, serial_string, 128);
|
||||
|
||||
std::wstring return_wstring = serial_string;
|
||||
std::string return_string(return_wstring.begin(), return_wstring.end());
|
||||
|
||||
return(return_string);
|
||||
}
|
||||
|
||||
void LogitechGProWirelessController::SendMouseMode
|
||||
(
|
||||
unsigned char mode,
|
||||
std::uint16_t speed,
|
||||
unsigned char zone,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
// unsigned char brightness
|
||||
)
|
||||
{
|
||||
unsigned char usb_buf[20];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Lighting Control packet |
|
||||
\*-----------------------------------------------------*/
|
||||
usb_buf[0x00] = 0x11;
|
||||
usb_buf[0x01] = 0x01;
|
||||
usb_buf[0x02] = 0x07;
|
||||
usb_buf[0x03] = 0x3C;
|
||||
|
||||
usb_buf[0x04] = zone;
|
||||
usb_buf[0x05] = mode;
|
||||
|
||||
usb_buf[0x06] = red;
|
||||
usb_buf[0x07] = green;
|
||||
usb_buf[0x08] = blue;
|
||||
|
||||
speed = 100 * speed;
|
||||
if(mode == LOGITECH_G_PRO_WIRELESS_MODE_STATIC)
|
||||
{
|
||||
usb_buf[0x09] = 0x02;
|
||||
}
|
||||
if(mode == LOGITECH_G_PRO_WIRELESS_MODE_CYCLE)
|
||||
{
|
||||
usb_buf[0x0B] = speed >> 8;
|
||||
usb_buf[0x0C] = speed & 0xFF;
|
||||
//usb_buf[0x0D] = brightness;
|
||||
usb_buf[0x0D] = 0x64;
|
||||
}
|
||||
else if(mode == LOGITECH_G_PRO_WIRELESS_MODE_BREATHING)
|
||||
{
|
||||
usb_buf[0x09] = speed >> 8;
|
||||
usb_buf[0x0A] = speed & 0xFF;
|
||||
//usb_buf[0x0C] = brightness;
|
||||
usb_buf[0x0C] = 0x64;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_write(dev, usb_buf, 20);
|
||||
hid_read(dev, usb_buf, 20);
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| LogitechGProWirelessController.h |
|
||||
| |
|
||||
| Definitions and types for Logitech G Pro |
|
||||
| Wireless Gaming Mouse lighting controller|
|
||||
| |
|
||||
| TheRogueZeta 8/5/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController.h"
|
||||
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
enum
|
||||
{
|
||||
LOGITECH_G_PRO_WIRELESS_MODE_OFF = 0x00,
|
||||
LOGITECH_G_PRO_WIRELESS_MODE_STATIC = 0x01,
|
||||
LOGITECH_G_PRO_WIRELESS_MODE_CYCLE = 0x02,
|
||||
LOGITECH_G_PRO_WIRELESS_MODE_BREATHING = 0x03,
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------------------------*\
|
||||
| Speed is 1000 for fast and 20000 for slow. |
|
||||
| Values are multiplied by 100 later to give lots of GUI steps. |
|
||||
\*---------------------------------------------------------------------------------------------*/
|
||||
enum
|
||||
{
|
||||
LOGITECH_G_PRO_WIRELESS_SPEED_SLOWEST = 0xC8, /* Slowest speed */
|
||||
LOGITECH_G_PRO_WIRELESS_SPEED_NORMAL = 0x32, /* Normal speed */
|
||||
LOGITECH_G_PRO_WIRELESS_SPEED_FASTEST = 0x0A, /* Fastest speed */
|
||||
};
|
||||
|
||||
class LogitechGProWirelessController
|
||||
{
|
||||
public:
|
||||
LogitechGProWirelessController(hid_device* dev_handle, const char* path);
|
||||
~LogitechGProWirelessController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SendMouseMode
|
||||
(
|
||||
unsigned char mode,
|
||||
unsigned short speed,
|
||||
unsigned char zone,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
// unsigned char brightness
|
||||
);
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
};
|
||||
@@ -1,117 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_LogitechG203.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for Logitech G203 |
|
||||
| Prodigy RGB Mouse |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 5/17/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_LogitechG203.h"
|
||||
|
||||
RGBController_LogitechG203::RGBController_LogitechG203(LogitechG203Controller* logitech_ptr)
|
||||
{
|
||||
logitech = logitech_ptr;
|
||||
|
||||
name = "Logitech Mouse Device";
|
||||
vendor = "Logitech";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = "Logitech Mouse Device";
|
||||
location = logitech->GetDeviceLocation();
|
||||
serial = logitech->GetSerialString();
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = LOGITECH_G203_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = LOGITECH_G203_MODE_OFF;
|
||||
Off.flags = 0;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
mode Cycle;
|
||||
Cycle.name = "Cycle";
|
||||
Cycle.value = LOGITECH_G203_MODE_CYCLE;
|
||||
Cycle.flags = MODE_FLAG_HAS_SPEED;
|
||||
Cycle.color_mode = MODE_COLORS_NONE;
|
||||
Cycle.speed_min = LOGITECH_G203_SPEED_SLOWEST;
|
||||
Cycle.speed_max = LOGITECH_G203_SPEED_FASTEST;
|
||||
Cycle.speed = LOGITECH_G203_SPEED_NORMAL;
|
||||
modes.push_back(Cycle);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = LOGITECH_G203_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.speed_min = LOGITECH_G203_SPEED_SLOWEST;
|
||||
Breathing.speed_max = LOGITECH_G203_SPEED_FASTEST;
|
||||
Breathing.speed = LOGITECH_G203_SPEED_NORMAL;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_LogitechG203::~RGBController_LogitechG203()
|
||||
{
|
||||
delete logitech;
|
||||
}
|
||||
|
||||
void RGBController_LogitechG203::SetupZones()
|
||||
{
|
||||
zone g203_zone;
|
||||
g203_zone.name = "Mouse";
|
||||
g203_zone.type = ZONE_TYPE_SINGLE;
|
||||
g203_zone.leds_min = 1;
|
||||
g203_zone.leds_max = 1;
|
||||
g203_zone.leds_count = 1;
|
||||
g203_zone.matrix_map = NULL;
|
||||
zones.push_back(g203_zone);
|
||||
|
||||
led g203_led;
|
||||
g203_led.name = "Mouse";
|
||||
leds.push_back(g203_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_LogitechG203::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_LogitechG203::DeviceUpdateLEDs()
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[0]);
|
||||
unsigned char grn = RGBGetGValue(colors[0]);
|
||||
unsigned char blu = RGBGetBValue(colors[0]);
|
||||
|
||||
logitech->SendMouseMode(modes[active_mode].value, modes[active_mode].speed, red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_LogitechG203::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_LogitechG203::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_LogitechG203::SetCustomMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_LogitechG203::DeviceUpdateMode()
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_LogitechG203.h |
|
||||
| |
|
||||
| Generic RGB Interface for Logitech G203 |
|
||||
| Prodigy RGB Mouse |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 5/17/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "LogitechG203Controller.h"
|
||||
|
||||
class RGBController_LogitechG203 : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_LogitechG203(LogitechG203Controller* logitech_ptr);
|
||||
~RGBController_LogitechG203();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
LogitechG203Controller* logitech;
|
||||
};
|
||||
@@ -1,129 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_LogitechG303.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for Logitech G303 |
|
||||
| Daedalus Apex Mouse |
|
||||
| |
|
||||
| TheRogueZeta 02/14/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_LogitechG303.h"
|
||||
|
||||
RGBController_LogitechG303::RGBController_LogitechG303(LogitechG303Controller* logitech_ptr)
|
||||
{
|
||||
logitech = logitech_ptr;
|
||||
|
||||
name = "Logitech Mouse Device";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = "Logitech Mouse Device";
|
||||
location = logitech->GetDeviceLocation();
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = LOGITECH_G303_MODE_OFF;
|
||||
Off.flags = 0;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = LOGITECH_G303_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Cycle;
|
||||
Cycle.name = "Cycle";
|
||||
Cycle.value = LOGITECH_G303_MODE_CYCLE;
|
||||
Cycle.flags = MODE_FLAG_HAS_SPEED;
|
||||
Cycle.color_mode = MODE_COLORS_NONE;
|
||||
Cycle.speed_min = LOGITECH_G303_SPEED_SLOWEST;
|
||||
Cycle.speed_max = LOGITECH_G303_SPEED_FASTEST;
|
||||
Cycle.speed = LOGITECH_G303_SPEED_NORMAL;
|
||||
modes.push_back(Cycle);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = LOGITECH_G303_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.speed_min = LOGITECH_G303_SPEED_SLOWEST;
|
||||
Breathing.speed_max = LOGITECH_G303_SPEED_FASTEST;
|
||||
Breathing.speed = LOGITECH_G303_SPEED_NORMAL;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_LogitechG303::~RGBController_LogitechG303()
|
||||
{
|
||||
delete logitech;
|
||||
}
|
||||
|
||||
void RGBController_LogitechG303::SetupZones()
|
||||
{
|
||||
zone G303_primary_zone;
|
||||
G303_primary_zone.name = "Primary";
|
||||
G303_primary_zone.type = ZONE_TYPE_SINGLE;
|
||||
G303_primary_zone.leds_min = 1;
|
||||
G303_primary_zone.leds_max = 1;
|
||||
G303_primary_zone.leds_count = 1;
|
||||
G303_primary_zone.matrix_map = NULL;
|
||||
zones.push_back(G303_primary_zone);
|
||||
|
||||
led G303_primary_led;
|
||||
G303_primary_led.name = "Primary";
|
||||
leds.push_back(G303_primary_led);
|
||||
|
||||
zone G303_logo_zone;
|
||||
G303_logo_zone.name = "Logo";
|
||||
G303_logo_zone.type = ZONE_TYPE_SINGLE;
|
||||
G303_logo_zone.leds_min = 1;
|
||||
G303_logo_zone.leds_max = 1;
|
||||
G303_logo_zone.leds_count = 1;
|
||||
G303_logo_zone.matrix_map = NULL;
|
||||
zones.push_back(G303_logo_zone);
|
||||
|
||||
led G303_logo_led;
|
||||
G303_logo_led.name = "Logo";
|
||||
leds.push_back(G303_logo_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_LogitechG303::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_LogitechG303::DeviceUpdateLEDs()
|
||||
{
|
||||
UpdateZoneLEDs(0);
|
||||
UpdateZoneLEDs(1);
|
||||
}
|
||||
|
||||
void RGBController_LogitechG303::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[zone]);
|
||||
unsigned char grn = RGBGetGValue(colors[zone]);
|
||||
unsigned char blu = RGBGetBValue(colors[zone]);
|
||||
|
||||
logitech->SendMouseMode(modes[active_mode].value, modes[active_mode].speed, zone, red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_LogitechG303::UpdateSingleLED(int led)
|
||||
{
|
||||
UpdateZoneLEDs(led);
|
||||
}
|
||||
|
||||
void RGBController_LogitechG303::SetCustomMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_LogitechG303::DeviceUpdateMode()
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_LogitechG303.h |
|
||||
| |
|
||||
| Generic RGB Interface for Logitech G303 |
|
||||
| Daedalus Apex Mouse |
|
||||
| |
|
||||
| TheRogueZeta 02/14/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "LogitechG303Controller.h"
|
||||
|
||||
class RGBController_LogitechG303 : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_LogitechG303(LogitechG303Controller* logitech_ptr);
|
||||
~RGBController_LogitechG303();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
LogitechG303Controller* logitech;
|
||||
};
|
||||
@@ -1,131 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_LogitechG403.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for Logitech G403 |
|
||||
| Prodigy RGB Mouse |
|
||||
| |
|
||||
| Martin Hartl (inlar) 5/19/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_LogitechG403.h"
|
||||
|
||||
RGBController_LogitechG403::RGBController_LogitechG403(LogitechG403Controller* logitech_ptr)
|
||||
{
|
||||
logitech = logitech_ptr;
|
||||
|
||||
name = "Logitech Mouse Device";
|
||||
vendor = "Logitech";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = "Logitech Mouse Device";
|
||||
location = logitech->GetDeviceLocation();
|
||||
serial = logitech->GetSerialString();
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = LOGITECH_G403_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = LOGITECH_G403_MODE_OFF;
|
||||
Off.flags = 0;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
mode Cycle;
|
||||
Cycle.name = "Cycle";
|
||||
Cycle.value = LOGITECH_G403_MODE_CYCLE;
|
||||
Cycle.flags = MODE_FLAG_HAS_SPEED;
|
||||
Cycle.color_mode = MODE_COLORS_NONE;
|
||||
Cycle.speed_min = LOGITECH_G403_SPEED_SLOWEST;
|
||||
Cycle.speed_max = LOGITECH_G403_SPEED_FASTEST;
|
||||
Cycle.speed = LOGITECH_G403_SPEED_NORMAL;
|
||||
modes.push_back(Cycle);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = LOGITECH_G403_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.speed_min = LOGITECH_G403_SPEED_SLOWEST;
|
||||
Breathing.speed_max = LOGITECH_G403_SPEED_FASTEST;
|
||||
Breathing.speed = LOGITECH_G403_SPEED_NORMAL;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_LogitechG403::~RGBController_LogitechG403()
|
||||
{
|
||||
delete logitech;
|
||||
}
|
||||
|
||||
void RGBController_LogitechG403::SetupZones()
|
||||
{
|
||||
zone G403_wheel_zone;
|
||||
G403_wheel_zone.name = "Scroll Wheel";
|
||||
G403_wheel_zone.type = ZONE_TYPE_SINGLE;
|
||||
G403_wheel_zone.leds_min = 1;
|
||||
G403_wheel_zone.leds_max = 1;
|
||||
G403_wheel_zone.leds_count = 1;
|
||||
G403_wheel_zone.matrix_map = NULL;
|
||||
zones.push_back(G403_wheel_zone);
|
||||
|
||||
led G403_wheel_led;
|
||||
G403_wheel_led.name = "Scroll Wheel";
|
||||
leds.push_back(G403_wheel_led);
|
||||
|
||||
zone G403_logo_zone;
|
||||
G403_logo_zone.name = "Logo";
|
||||
G403_logo_zone.type = ZONE_TYPE_SINGLE;
|
||||
G403_logo_zone.leds_min = 1;
|
||||
G403_logo_zone.leds_max = 1;
|
||||
G403_logo_zone.leds_count = 1;
|
||||
G403_logo_zone.matrix_map = NULL;
|
||||
zones.push_back(G403_logo_zone);
|
||||
|
||||
led G403_logo_led;
|
||||
G403_logo_led.name = "Logo";
|
||||
leds.push_back(G403_logo_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_LogitechG403::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_LogitechG403::DeviceUpdateLEDs()
|
||||
{
|
||||
UpdateZoneLEDs(0);
|
||||
UpdateZoneLEDs(1);
|
||||
}
|
||||
|
||||
void RGBController_LogitechG403::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[zone]);
|
||||
unsigned char grn = RGBGetGValue(colors[zone]);
|
||||
unsigned char blu = RGBGetBValue(colors[zone]);
|
||||
|
||||
logitech->SendMouseMode(modes[active_mode].value, modes[active_mode].speed, zone, red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_LogitechG403::UpdateSingleLED(int led)
|
||||
{
|
||||
UpdateZoneLEDs(led);
|
||||
}
|
||||
|
||||
void RGBController_LogitechG403::SetCustomMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_LogitechG403::DeviceUpdateMode()
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_LogitechG403.h |
|
||||
| |
|
||||
| Generic RGB Interface for Logitech G403 |
|
||||
| Prodigy RGB Mouse |
|
||||
| |
|
||||
| Martin Hartl (inlar) 5/19/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "LogitechG403Controller.h"
|
||||
|
||||
class RGBController_LogitechG403 : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_LogitechG403(LogitechG403Controller* logitech_ptr);
|
||||
~RGBController_LogitechG403();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
LogitechG403Controller* logitech;
|
||||
};
|
||||
@@ -1,131 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_LogitechG403.h |
|
||||
| |
|
||||
| Generic RGB Interface for Logitech G502 |
|
||||
| Proteus Sprectrum Mouse |
|
||||
| |
|
||||
| kernzerfall 07/28/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_LogitechG502PS.h"
|
||||
|
||||
RGBController_LogitechG502PS::RGBController_LogitechG502PS(LogitechG502PSController* logitech_ptr)
|
||||
{
|
||||
logitech = logitech_ptr;
|
||||
|
||||
name = "Logitech Mouse Device";
|
||||
vendor = "Logitech";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = "Logitech Mouse Device";
|
||||
location = logitech->GetDeviceLocation();
|
||||
serial = logitech->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = LOGITECH_G502_PS_MODE_STATIC;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = LOGITECH_G502_PS_MODE_OFF;
|
||||
Off.flags = 0;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
mode Cycle;
|
||||
Cycle.name = "Cycle";
|
||||
Cycle.value = LOGITECH_G502_PS_MODE_CYCLE;
|
||||
Cycle.flags = MODE_FLAG_HAS_SPEED;
|
||||
Cycle.color_mode = MODE_COLORS_NONE;
|
||||
Cycle.speed_min = LOGITECH_G502_PS_SPEED_SLOWEST;
|
||||
Cycle.speed_max = LOGITECH_G502_PS_SPEED_FASTEST;
|
||||
Cycle.speed = LOGITECH_G502_PS_SPEED_NORMAL;
|
||||
modes.push_back(Cycle);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = LOGITECH_G502_PS_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.speed_min = LOGITECH_G502_PS_SPEED_SLOWEST;
|
||||
Breathing.speed_max = LOGITECH_G502_PS_SPEED_FASTEST;
|
||||
Breathing.speed = LOGITECH_G502_PS_SPEED_NORMAL;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_LogitechG502PS::~RGBController_LogitechG502PS()
|
||||
{
|
||||
delete logitech;
|
||||
}
|
||||
|
||||
void RGBController_LogitechG502PS::SetupZones()
|
||||
{
|
||||
zone G502_PS_side_zone;
|
||||
G502_PS_side_zone.name = "DPI";
|
||||
G502_PS_side_zone.type = ZONE_TYPE_SINGLE;
|
||||
G502_PS_side_zone.leds_min = 1;
|
||||
G502_PS_side_zone.leds_max = 1;
|
||||
G502_PS_side_zone.leds_count = 1;
|
||||
G502_PS_side_zone.matrix_map = NULL;
|
||||
zones.push_back(G502_PS_side_zone);
|
||||
|
||||
led G502_PS_side_led;
|
||||
G502_PS_side_led.name = "DPI";
|
||||
leds.push_back(G502_PS_side_led);
|
||||
|
||||
zone G502_logo_zone;
|
||||
G502_logo_zone.name = "Logo";
|
||||
G502_logo_zone.type = ZONE_TYPE_SINGLE;
|
||||
G502_logo_zone.leds_min = 1;
|
||||
G502_logo_zone.leds_max = 1;
|
||||
G502_logo_zone.leds_count = 1;
|
||||
G502_logo_zone.matrix_map = NULL;
|
||||
zones.push_back(G502_logo_zone);
|
||||
|
||||
led G502_logo_led;
|
||||
G502_logo_led.name = "Logo";
|
||||
leds.push_back(G502_logo_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_LogitechG502PS::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_LogitechG502PS::DeviceUpdateLEDs()
|
||||
{
|
||||
UpdateZoneLEDs(0);
|
||||
UpdateZoneLEDs(1);
|
||||
}
|
||||
|
||||
void RGBController_LogitechG502PS::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[zone]);
|
||||
unsigned char grn = RGBGetGValue(colors[zone]);
|
||||
unsigned char blu = RGBGetBValue(colors[zone]);
|
||||
|
||||
logitech->SendMouseMode(modes[active_mode].value, modes[active_mode].speed, zone, red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_LogitechG502PS::UpdateSingleLED(int led)
|
||||
{
|
||||
UpdateZoneLEDs(led);
|
||||
}
|
||||
|
||||
void RGBController_LogitechG502PS::SetCustomMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RGBController_LogitechG502PS::DeviceUpdateMode()
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_LogitechGLightsync.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for |
|
||||
| Logitech G Lightsync Devices |
|
||||
| |
|
||||
| TheRogueZeta 04/21/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_LogitechGLightsync.h"
|
||||
|
||||
RGBController_LogitechGLightsync::RGBController_LogitechGLightsync(LogitechGLightsyncController* logitech_ptr)
|
||||
{
|
||||
logitech = logitech_ptr;
|
||||
|
||||
name = "Logitech G Lightsync Mouse";
|
||||
vendor = "Logitech";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = "Logitech G Lightsync Mouse";
|
||||
location = logitech->GetDeviceLocation();
|
||||
serial = logitech->GetSerialString();
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = LOGITECH_G_LIGHTSYNC_MODE_OFF;
|
||||
Off.flags = 0;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0xFF;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = LOGITECH_G_LIGHTSYNC_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Cycle;
|
||||
Cycle.name = "Spectrum Cycle";
|
||||
Cycle.value = LOGITECH_G_LIGHTSYNC_MODE_CYCLE;
|
||||
Cycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Cycle.color_mode = MODE_COLORS_NONE;
|
||||
Cycle.speed_min = LOGITECH_G_LIGHTSYNC_SPEED_SLOWEST;
|
||||
Cycle.speed_max = LOGITECH_G_LIGHTSYNC_SPEED_FASTEST;
|
||||
Cycle.speed = LOGITECH_G_LIGHTSYNC_SPEED_NORMAL;
|
||||
modes.push_back(Cycle);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = LOGITECH_G_LIGHTSYNC_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.speed_min = LOGITECH_G_LIGHTSYNC_SPEED_SLOWEST;
|
||||
Breathing.speed_max = LOGITECH_G_LIGHTSYNC_SPEED_FASTEST;
|
||||
Breathing.speed = LOGITECH_G_LIGHTSYNC_SPEED_NORMAL;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_LogitechGLightsync::~RGBController_LogitechGLightsync()
|
||||
{
|
||||
delete logitech;
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync::SetupZones()
|
||||
{
|
||||
zone GLightsync_primary_zone;
|
||||
GLightsync_primary_zone.name = "DPI";
|
||||
GLightsync_primary_zone.type = ZONE_TYPE_SINGLE;
|
||||
GLightsync_primary_zone.leds_min = 1;
|
||||
GLightsync_primary_zone.leds_max = 1;
|
||||
GLightsync_primary_zone.leds_count = 1;
|
||||
GLightsync_primary_zone.matrix_map = NULL;
|
||||
zones.push_back(GLightsync_primary_zone);
|
||||
|
||||
led GLightsync_primary_led;
|
||||
GLightsync_primary_led.name = "DPI";
|
||||
leds.push_back(GLightsync_primary_led);
|
||||
|
||||
zone GLightsync_logo_zone;
|
||||
GLightsync_logo_zone.name = "Logo";
|
||||
GLightsync_logo_zone.type = ZONE_TYPE_SINGLE;
|
||||
GLightsync_logo_zone.leds_min = 1;
|
||||
GLightsync_logo_zone.leds_max = 1;
|
||||
GLightsync_logo_zone.leds_count = 1;
|
||||
GLightsync_logo_zone.matrix_map = NULL;
|
||||
zones.push_back(GLightsync_logo_zone);
|
||||
|
||||
led GLightsync_logo_led;
|
||||
GLightsync_logo_led.name = "Logo";
|
||||
leds.push_back(GLightsync_logo_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync::DeviceUpdateLEDs()
|
||||
{
|
||||
UpdateZoneLEDs(0);
|
||||
UpdateZoneLEDs(1);
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[zone]);
|
||||
unsigned char grn = RGBGetGValue(colors[zone]);
|
||||
unsigned char blu = RGBGetBValue(colors[zone]);
|
||||
|
||||
// Replace direct mode with static when sending to controller.
|
||||
unsigned char temp_mode = (modes[active_mode].value != 0xFF) ? modes[active_mode].value : LOGITECH_G_LIGHTSYNC_MODE_STATIC;
|
||||
|
||||
logitech->UpdateMouseLED(temp_mode, modes[active_mode].speed, zone, red, grn, blu, /* Brightness */ 0x64);
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync::UpdateSingleLED(int led)
|
||||
{
|
||||
UpdateZoneLEDs(led);
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync::SetCustomMode()
|
||||
{
|
||||
active_mode = 1; //Hard coded to first value in list
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync::DeviceUpdateMode()
|
||||
{
|
||||
// If direct mode is true, then sent the packet to put the mouse in direct mode
|
||||
// This code will only be called when we change modes as to not spam the device.
|
||||
logitech->SetDirectMode(modes[active_mode].value == 0xFF);
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
@@ -1,21 +1,21 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_LogitechGProWireless.h |
|
||||
| RGBController_LogitechGLightsync.h |
|
||||
| |
|
||||
| Generic RGB Interface for |
|
||||
| Logitech G Pro Wireless Gaming Mouse |
|
||||
| Logitech G Lightsync Devices |
|
||||
| |
|
||||
| TheRogueZeta 8/5/2020 |
|
||||
| TheRogueZeta 04/21/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "LogitechGProWirelessController.h"
|
||||
#include "LogitechGLightsyncController.h"
|
||||
|
||||
class RGBController_LogitechGProWireless : public RGBController
|
||||
class RGBController_LogitechGLightsync : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_LogitechGProWireless(LogitechGProWirelessController* logitech_ptr);
|
||||
~RGBController_LogitechGProWireless();
|
||||
RGBController_LogitechGLightsync(LogitechGLightsyncController* logitech_ptr);
|
||||
~RGBController_LogitechGLightsync();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
@@ -29,5 +29,5 @@ public:
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
LogitechGProWirelessController* logitech;
|
||||
LogitechGLightsyncController* logitech;
|
||||
};
|
||||
@@ -0,0 +1,130 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_LogitechGLightsync1zone.cpp|
|
||||
| |
|
||||
| Generic RGB Interface for single zone |
|
||||
| Logitech G Lightsync Devices |
|
||||
| |
|
||||
| TheRogueZeta 04/21/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_LogitechGLightsync1zone.h"
|
||||
|
||||
RGBController_LogitechGLightsync1zone::RGBController_LogitechGLightsync1zone(LogitechGLightsyncController* logitech_ptr)
|
||||
{
|
||||
logitech = logitech_ptr;
|
||||
|
||||
name = "Logitech G Lightsync Mouse Single Zone";
|
||||
vendor = "Logitech";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = "Logitech G Lightsync Mouse Single Zone";
|
||||
location = logitech->GetDeviceLocation();
|
||||
serial = logitech->GetSerialString();
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = LOGITECH_G_LIGHTSYNC_MODE_OFF;
|
||||
Off.flags = 0;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0xFF;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = LOGITECH_G_LIGHTSYNC_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Cycle;
|
||||
Cycle.name = "Spectrum Cycle";
|
||||
Cycle.value = LOGITECH_G_LIGHTSYNC_MODE_CYCLE;
|
||||
Cycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Cycle.color_mode = MODE_COLORS_NONE;
|
||||
Cycle.speed_min = LOGITECH_G_LIGHTSYNC_SPEED_SLOWEST;
|
||||
Cycle.speed_max = LOGITECH_G_LIGHTSYNC_SPEED_FASTEST;
|
||||
Cycle.speed = LOGITECH_G_LIGHTSYNC_SPEED_NORMAL;
|
||||
modes.push_back(Cycle);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = LOGITECH_G_LIGHTSYNC_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.speed_min = LOGITECH_G_LIGHTSYNC_SPEED_SLOWEST;
|
||||
Breathing.speed_max = LOGITECH_G_LIGHTSYNC_SPEED_FASTEST;
|
||||
Breathing.speed = LOGITECH_G_LIGHTSYNC_SPEED_NORMAL;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_LogitechGLightsync1zone::~RGBController_LogitechGLightsync1zone()
|
||||
{
|
||||
delete logitech;
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync1zone::SetupZones()
|
||||
{
|
||||
zone GLightsync_logo_zone;
|
||||
GLightsync_logo_zone.name = "Logo";
|
||||
GLightsync_logo_zone.type = ZONE_TYPE_SINGLE;
|
||||
GLightsync_logo_zone.leds_min = 1;
|
||||
GLightsync_logo_zone.leds_max = 1;
|
||||
GLightsync_logo_zone.leds_count = 1;
|
||||
GLightsync_logo_zone.matrix_map = NULL;
|
||||
zones.push_back(GLightsync_logo_zone);
|
||||
|
||||
led GLightsync_logo_led;
|
||||
GLightsync_logo_led.name = "Logo";
|
||||
leds.push_back(GLightsync_logo_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync1zone::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync1zone::DeviceUpdateLEDs()
|
||||
{
|
||||
UpdateZoneLEDs(0);
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync1zone::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[zone]);
|
||||
unsigned char grn = RGBGetGValue(colors[zone]);
|
||||
unsigned char blu = RGBGetBValue(colors[zone]);
|
||||
|
||||
// Replace direct mode with static when sending to controller.
|
||||
unsigned char temp_mode = (modes[active_mode].value != 0xFF) ? modes[active_mode].value : LOGITECH_G_LIGHTSYNC_MODE_STATIC;
|
||||
|
||||
logitech->UpdateMouseLED(temp_mode, modes[active_mode].speed, zone, red, grn, blu, /* Brightness */ 0x64);
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync1zone::UpdateSingleLED(int led)
|
||||
{
|
||||
UpdateZoneLEDs(led);
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync1zone::SetCustomMode()
|
||||
{
|
||||
active_mode = 1; //Hard coded to first value in list
|
||||
}
|
||||
|
||||
void RGBController_LogitechGLightsync1zone::DeviceUpdateMode()
|
||||
{
|
||||
// If direct mode is true, then sent the packet to put the mouse in direct mode
|
||||
// This code will only be called when we change modes as to not spam the device.
|
||||
logitech->SetDirectMode(modes[active_mode].value == 0xFF);
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
@@ -1,21 +1,21 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_LogitechG403.h |
|
||||
| RGBController_LogitechGLightsync1zone.h |
|
||||
| |
|
||||
| Generic RGB Interface for Logitech G502 |
|
||||
| Proteus Sprectrum Mouse |
|
||||
| Generic RGB Interface for single zone |
|
||||
| Logitech G Lightsync Devices |
|
||||
| |
|
||||
| kernzerfall 07/28/2020 |
|
||||
| TheRogueZeta 04/21/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "LogitechG502PSController.h"
|
||||
#include "LogitechGLightsyncController.h"
|
||||
|
||||
class RGBController_LogitechG502PS : public RGBController
|
||||
class RGBController_LogitechGLightsync1zone : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_LogitechG502PS(LogitechG502PSController* logitech_ptr);
|
||||
~RGBController_LogitechG502PS();
|
||||
RGBController_LogitechGLightsync1zone(LogitechGLightsyncController* logitech_ptr);
|
||||
~RGBController_LogitechGLightsync1zone();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
@@ -29,5 +29,5 @@ public:
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
LogitechG502PSController* logitech;
|
||||
LogitechGLightsyncController* logitech;
|
||||
};
|
||||
@@ -9,49 +9,56 @@
|
||||
|
||||
#include "RGBController_LogitechGPowerPlay.h"
|
||||
|
||||
RGBController_LogitechGPowerPlay::RGBController_LogitechGPowerPlay(LogitechGPowerPlayController* logitech_ptr)
|
||||
RGBController_LogitechGPowerPlay::RGBController_LogitechGPowerPlay(LogitechGLightsyncController* logitech_ptr)
|
||||
{
|
||||
logitech = logitech_ptr;
|
||||
|
||||
name = "Logitech G PowerPlay Wireless Charging System";
|
||||
vendor = "Logitech";
|
||||
type = DEVICE_TYPE_MOUSEMAT;
|
||||
description = "Logitech G PowerPlay Wireless Charging System";
|
||||
location = logitech->GetDeviceLocation();
|
||||
serial = logitech->GetSerialString();
|
||||
name = "Logitech G PowerPlay Wireless Charging System";
|
||||
vendor = "Logitech";
|
||||
type = DEVICE_TYPE_MOUSEMAT;
|
||||
description = "Logitech G PowerPlay Wireless Charging System";
|
||||
location = logitech->GetDeviceLocation();
|
||||
serial = logitech->GetSerialString();
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = LOGITECH_G_POWERPLAY_MODE_OFF;
|
||||
Off.flags = 0;
|
||||
Off.color_mode = MODE_COLORS_PER_LED;
|
||||
Off.name = "Off";
|
||||
Off.value = LOGITECH_G_LIGHTSYNC_MODE_OFF;
|
||||
Off.flags = 0;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0xFF;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = LOGITECH_G_POWERPLAY_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
Static.name = "Static";
|
||||
Static.value = LOGITECH_G_LIGHTSYNC_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Cycle;
|
||||
Cycle.name = "Cycle";
|
||||
Cycle.value = LOGITECH_G_POWERPLAY_MODE_CYCLE;
|
||||
Cycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Cycle.color_mode = MODE_COLORS_PER_LED;
|
||||
Cycle.speed_min = LOGITECH_G_POWERPLAY_SPEED_SLOWEST;
|
||||
Cycle.speed_max = LOGITECH_G_POWERPLAY_SPEED_FASTEST;
|
||||
Cycle.speed = LOGITECH_G_POWERPLAY_SPEED_NORMAL;
|
||||
Cycle.name = "Spectrum Cycle";
|
||||
Cycle.value = LOGITECH_G_LIGHTSYNC_MODE_CYCLE;
|
||||
Cycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Cycle.color_mode = MODE_COLORS_NONE;
|
||||
Cycle.speed_min = LOGITECH_G_LIGHTSYNC_SPEED_SLOWEST;
|
||||
Cycle.speed_max = LOGITECH_G_LIGHTSYNC_SPEED_FASTEST;
|
||||
Cycle.speed = LOGITECH_G_LIGHTSYNC_SPEED_NORMAL;
|
||||
modes.push_back(Cycle);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = LOGITECH_G_POWERPLAY_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.speed_min = LOGITECH_G_POWERPLAY_SPEED_SLOWEST;
|
||||
Breathing.speed_max = LOGITECH_G_POWERPLAY_SPEED_FASTEST;
|
||||
Breathing.speed = LOGITECH_G_POWERPLAY_SPEED_NORMAL;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = LOGITECH_G_LIGHTSYNC_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.speed_min = LOGITECH_G_LIGHTSYNC_SPEED_SLOWEST;
|
||||
Breathing.speed_max = LOGITECH_G_LIGHTSYNC_SPEED_FASTEST;
|
||||
Breathing.speed = LOGITECH_G_LIGHTSYNC_SPEED_NORMAL;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
SetupZones();
|
||||
@@ -90,6 +97,7 @@ void RGBController_LogitechGPowerPlay::ResizeZone(int /*zone*/, int /*new_size*/
|
||||
void RGBController_LogitechGPowerPlay::DeviceUpdateLEDs()
|
||||
{
|
||||
UpdateZoneLEDs(0);
|
||||
UpdateZoneLEDs(1);
|
||||
}
|
||||
|
||||
void RGBController_LogitechGPowerPlay::UpdateZoneLEDs(int zone)
|
||||
@@ -98,7 +106,10 @@ void RGBController_LogitechGPowerPlay::UpdateZoneLEDs(int zone)
|
||||
unsigned char grn = RGBGetGValue(colors[zone]);
|
||||
unsigned char blu = RGBGetBValue(colors[zone]);
|
||||
|
||||
logitech->SendMouseMatMode(modes[active_mode].value, modes[active_mode].speed, zone, red, grn, blu);
|
||||
// Replace direct mode with static when sending to controller.
|
||||
unsigned char temp_mode = (modes[active_mode].value != 0xFF) ? modes[active_mode].value : LOGITECH_G_LIGHTSYNC_MODE_STATIC;
|
||||
|
||||
logitech->UpdateMouseLED(temp_mode, modes[active_mode].speed, zone, red, grn, blu, /* Brightness */ 0x64);
|
||||
}
|
||||
|
||||
void RGBController_LogitechGPowerPlay::UpdateSingleLED(int led)
|
||||
@@ -108,10 +119,13 @@ void RGBController_LogitechGPowerPlay::UpdateSingleLED(int led)
|
||||
|
||||
void RGBController_LogitechGPowerPlay::SetCustomMode()
|
||||
{
|
||||
|
||||
active_mode = 1; //Hard coded to first value in list
|
||||
}
|
||||
|
||||
void RGBController_LogitechGPowerPlay::DeviceUpdateMode()
|
||||
{
|
||||
// If direct mode is true, then sent the packet to put the mouse in direct mode
|
||||
// This code will only be called when we change modes as to not spam the device.
|
||||
logitech->SetDirectMode(modes[active_mode].value == 0xFF);
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
}
|
||||
@@ -9,12 +9,12 @@
|
||||
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "LogitechGPowerPlayController.h"
|
||||
#include "LogitechGLightsyncController.h"
|
||||
|
||||
class RGBController_LogitechGPowerPlay : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_LogitechGPowerPlay(LogitechGPowerPlayController* logitech_ptr);
|
||||
RGBController_LogitechGPowerPlay(LogitechGLightsyncController* logitech_ptr);
|
||||
~RGBController_LogitechGPowerPlay();
|
||||
|
||||
void SetupZones();
|
||||
@@ -29,5 +29,5 @@ public:
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
LogitechGPowerPlayController* logitech;
|
||||
LogitechGLightsyncController* logitech;
|
||||
};
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_LogitechGProWireless.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for |
|
||||
| Logitech G Pro Wireless Gaming Mouse |
|
||||
| |
|
||||
| TheRogueZeta 8/5/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_LogitechGProWireless.h"
|
||||
|
||||
RGBController_LogitechGProWireless::RGBController_LogitechGProWireless(LogitechGProWirelessController* logitech_ptr)
|
||||
{
|
||||
logitech = logitech_ptr;
|
||||
|
||||
name = "Logitech G Pro Wireless Gaming Mouse";
|
||||
vendor = "Logitech";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = "Logitech G Pro Wireless Gaming Mouse";
|
||||
location = logitech->GetDeviceLocation();
|
||||
serial = logitech->GetSerialString();
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = LOGITECH_G_PRO_WIRELESS_MODE_OFF;
|
||||
Off.flags = 0;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = LOGITECH_G_PRO_WIRELESS_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Cycle;
|
||||
Cycle.name = "Cycle";
|
||||
Cycle.value = LOGITECH_G_PRO_WIRELESS_MODE_CYCLE;
|
||||
Cycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Cycle.color_mode = MODE_COLORS_NONE;
|
||||
Cycle.speed_min = LOGITECH_G_PRO_WIRELESS_SPEED_SLOWEST;
|
||||
Cycle.speed_max = LOGITECH_G_PRO_WIRELESS_SPEED_FASTEST;
|
||||
Cycle.speed = LOGITECH_G_PRO_WIRELESS_SPEED_NORMAL;
|
||||
modes.push_back(Cycle);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = LOGITECH_G_PRO_WIRELESS_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.speed_min = LOGITECH_G_PRO_WIRELESS_SPEED_SLOWEST;
|
||||
Breathing.speed_max = LOGITECH_G_PRO_WIRELESS_SPEED_FASTEST;
|
||||
Breathing.speed = LOGITECH_G_PRO_WIRELESS_SPEED_NORMAL;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_LogitechGProWireless::~RGBController_LogitechGProWireless()
|
||||
{
|
||||
delete logitech;
|
||||
}
|
||||
|
||||
void RGBController_LogitechGProWireless::SetupZones()
|
||||
{
|
||||
zone GProWireless_primary_zone;
|
||||
GProWireless_primary_zone.name = "DPI";
|
||||
GProWireless_primary_zone.type = ZONE_TYPE_SINGLE;
|
||||
GProWireless_primary_zone.leds_min = 1;
|
||||
GProWireless_primary_zone.leds_max = 1;
|
||||
GProWireless_primary_zone.leds_count = 1;
|
||||
GProWireless_primary_zone.matrix_map = NULL;
|
||||
zones.push_back(GProWireless_primary_zone);
|
||||
|
||||
led GProWireless_primary_led;
|
||||
GProWireless_primary_led.name = "DPI";
|
||||
leds.push_back(GProWireless_primary_led);
|
||||
|
||||
zone GProWireless_logo_zone;
|
||||
GProWireless_logo_zone.name = "Logo";
|
||||
GProWireless_logo_zone.type = ZONE_TYPE_SINGLE;
|
||||
GProWireless_logo_zone.leds_min = 1;
|
||||
GProWireless_logo_zone.leds_max = 1;
|
||||
GProWireless_logo_zone.leds_count = 1;
|
||||
GProWireless_logo_zone.matrix_map = NULL;
|
||||
zones.push_back(GProWireless_logo_zone);
|
||||
|
||||
led GProWireless_logo_led;
|
||||
GProWireless_logo_led.name = "Logo";
|
||||
leds.push_back(GProWireless_logo_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_LogitechGProWireless::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_LogitechGProWireless::DeviceUpdateLEDs()
|
||||
{
|
||||
UpdateZoneLEDs(0);
|
||||
UpdateZoneLEDs(1);
|
||||
}
|
||||
|
||||
void RGBController_LogitechGProWireless::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[zone]);
|
||||
unsigned char grn = RGBGetGValue(colors[zone]);
|
||||
unsigned char blu = RGBGetBValue(colors[zone]);
|
||||
|
||||
logitech->SendMouseMode(modes[active_mode].value, modes[active_mode].speed, zone, red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_LogitechGProWireless::UpdateSingleLED(int led)
|
||||
{
|
||||
UpdateZoneLEDs(led);
|
||||
}
|
||||
|
||||
void RGBController_LogitechGProWireless::SetCustomMode()
|
||||
{
|
||||
active_mode = 1;
|
||||
}
|
||||
|
||||
void RGBController_LogitechGProWireless::DeviceUpdateMode()
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
28
OpenRGB.pro
28
OpenRGB.pro
@@ -275,28 +275,20 @@ HEADERS +=
|
||||
Controllers/LEDStripController/RGBController_LEDStrip.h \
|
||||
Controllers/LianLiController/LianLiUniHubController.h \
|
||||
Controllers/LianLiController/RGBController_LianLiUniHub.h \
|
||||
Controllers/LogitechController/LogitechG203Controller.h \
|
||||
Controllers/LogitechController/LogitechG203LController.h \
|
||||
Controllers/LogitechController/LogitechG213Controller.h \
|
||||
Controllers/LogitechController/LogitechG303Controller.h \
|
||||
Controllers/LogitechController/LogitechG403Controller.h \
|
||||
Controllers/LogitechController/LogitechG502PSController.h \
|
||||
Controllers/LogitechController/LogitechG560Controller.h \
|
||||
Controllers/LogitechController/LogitechG810Controller.h \
|
||||
Controllers/LogitechController/LogitechG815Controller.h \
|
||||
Controllers/LogitechController/LogitechGPowerPlayController.h \
|
||||
Controllers/LogitechController/LogitechGProWirelessController.h \
|
||||
Controllers/LogitechController/RGBController_LogitechG203.h \
|
||||
Controllers/LogitechController/LogitechGLightsyncController.h \
|
||||
Controllers/LogitechController/RGBController_LogitechG203L.h \
|
||||
Controllers/LogitechController/RGBController_LogitechG213.h \
|
||||
Controllers/LogitechController/RGBController_LogitechG303.h \
|
||||
Controllers/LogitechController/RGBController_LogitechG403.h \
|
||||
Controllers/LogitechController/RGBController_LogitechG502PS.h \
|
||||
Controllers/LogitechController/RGBController_LogitechG560.h \
|
||||
Controllers/LogitechController/RGBController_LogitechG810.h \
|
||||
Controllers/LogitechController/RGBController_LogitechG815.h \
|
||||
Controllers/LogitechController/RGBController_LogitechGLightsync.h \
|
||||
Controllers/LogitechController/RGBController_LogitechGLightsync1zone.h \
|
||||
Controllers/LogitechController/RGBController_LogitechGPowerPlay.h \
|
||||
Controllers/LogitechController/RGBController_LogitechGProWireless.h \
|
||||
Controllers/MSI3ZoneController/MSI3ZoneController.h \
|
||||
Controllers/MSI3ZoneController/RGBController_MSI3Zone.h \
|
||||
Controllers/MSIGPUController/MSIGPUController.h \
|
||||
@@ -557,28 +549,20 @@ SOURCES +=
|
||||
Controllers/LianLiController/LianLiUniHubController.cpp \
|
||||
Controllers/LianLiController/RGBController_LianLiUniHub.cpp \
|
||||
Controllers/LogitechController/LogitechControllerDetect.cpp \
|
||||
Controllers/LogitechController/LogitechG203Controller.cpp \
|
||||
Controllers/LogitechController/LogitechG203LController.cpp \
|
||||
Controllers/LogitechController/LogitechG213Controller.cpp \
|
||||
Controllers/LogitechController/LogitechG303Controller.cpp \
|
||||
Controllers/LogitechController/LogitechG403Controller.cpp \
|
||||
Controllers/LogitechController/LogitechG502PSController.cpp \
|
||||
Controllers/LogitechController/LogitechG560Controller.cpp \
|
||||
Controllers/LogitechController/LogitechG810Controller.cpp \
|
||||
Controllers/LogitechController/LogitechG815Controller.cpp \
|
||||
Controllers/LogitechController/LogitechGPowerPlayController.cpp \
|
||||
Controllers/LogitechController/LogitechGProWirelessController.cpp \
|
||||
Controllers/LogitechController/RGBController_LogitechG203.cpp \
|
||||
Controllers/LogitechController/LogitechGLightsyncController.cpp \
|
||||
Controllers/LogitechController/RGBController_LogitechG203L.cpp \
|
||||
Controllers/LogitechController/RGBController_LogitechG213.cpp \
|
||||
Controllers/LogitechController/RGBController_LogitechG303.cpp \
|
||||
Controllers/LogitechController/RGBController_LogitechG403.cpp \
|
||||
Controllers/LogitechController/RGBController_LogitechG502PS.cpp \
|
||||
Controllers/LogitechController/RGBController_LogitechG560.cpp \
|
||||
Controllers/LogitechController/RGBController_LogitechG810.cpp \
|
||||
Controllers/LogitechController/RGBController_LogitechG815.cpp \
|
||||
Controllers/LogitechController/RGBController_LogitechGLightsync.cpp \
|
||||
Controllers/LogitechController/RGBController_LogitechGLightsync1zone.cpp \
|
||||
Controllers/LogitechController/RGBController_LogitechGPowerPlay.cpp \
|
||||
Controllers/LogitechController/RGBController_LogitechGProWireless.cpp \
|
||||
Controllers/MSI3ZoneController/MSI3ZoneController.cpp \
|
||||
Controllers/MSI3ZoneController/MSI3ZoneControllerDetect.cpp \
|
||||
Controllers/MSI3ZoneController/RGBController_MSI3Zone.cpp \
|
||||
|
||||
Reference in New Issue
Block a user