Skip to content

Commit 8487b5c

Browse files
austinleroyCalcProgrammer1
authored andcommitted
Adding support for Logitech G600 Mouse
1 parent 3a2d0f4 commit 8487b5c

File tree

5 files changed

+290
-0
lines changed

5 files changed

+290
-0
lines changed

Controllers/LogitechController/LogitechControllerDetect.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "LogitechG203LController.h"
1616
#include "LogitechG213Controller.h"
1717
#include "LogitechG560Controller.h"
18+
#include "LogitechG600Controller.h"
1819
#include "LogitechG933Controller.h"
1920
#include "LogitechG810Controller.h"
2021
#include "LogitechGProKeyboardController.h"
@@ -27,6 +28,7 @@
2728
#include "RGBController_LogitechG203L.h"
2829
#include "RGBController_LogitechG213.h"
2930
#include "RGBController_LogitechG560.h"
31+
#include "RGBController_LogitechG600.h"
3032
#include "RGBController_LogitechG933.h"
3133
#include "RGBController_LogitechG810.h"
3234
#include "RGBController_LogitechGProKeyboard.h"
@@ -81,6 +83,7 @@ using namespace std::chrono_literals;
8183
#define LOGITECH_G502_PROTEUS_SPECTRUM_PID 0xC332
8284
#define LOGITECH_G502_HERO_PID 0xC08B
8385
#define LOGITECH_G502_LIGHTSPEED_PID 0xC08D
86+
#define LOGITECH_G600_PID 0xC24A
8487
#define LOGITECH_G703_LIGHTSPEED_PID 0xC087
8588
#define LOGITECH_G703_HERO_LIGHTSPEED_PID 0xC090
8689
#define LOGITECH_G900_LIGHTSPEED_PID 0xC081
@@ -577,6 +580,19 @@ void DetectLogitechMouseG403(hid_device_info* info, const std::string& name)
577580
addLogitechLightsyncMouse2zone(info, name, 0xFF, 0x0E, 0x3A);
578581
}
579582

583+
void DetectLogitechMouseG600(hid_device_info* info, const std::string& name)
584+
{
585+
hid_device* dev = hid_open_path(info->path);
586+
587+
if(dev)
588+
{
589+
LogitechG600Controller* controller = new LogitechG600Controller(dev, info->path, name);
590+
RGBController_LogitechG600* rgb_controller = new RGBController_LogitechG600(controller);
591+
592+
ResourceManager::get()->RegisterRGBController(rgb_controller);
593+
}
594+
}
595+
580596
void DetectLogitechMouseGPRO(hid_device_info* info, const std::string& name)
581597
{
582598
addLogitechLightsyncMouse1zone(info, name, 0xFF, 0x0E, 0x3C);
@@ -662,6 +678,7 @@ REGISTER_HID_DETECTOR_IPU("Logitech G203 Lightsync", Dete
662678
REGISTER_HID_DETECTOR_IPU("Logitech G203 Lightsync", DetectLogitechMouseG203L, LOGITECH_VID, LOGITECH_G203_LIGHTSYNC_PID_2, 1, 0xFF00, 2);
663679
REGISTER_HID_DETECTOR_IP ("Logitech G303 Daedalus Apex", DetectLogitechMouseG303, LOGITECH_VID, LOGITECH_G303_PID, 1, 0xFF00);
664680
REGISTER_HID_DETECTOR_IP ("Logitech G403 HERO", DetectLogitechMouseG403, LOGITECH_VID, LOGITECH_G403_HERO_PID, 1, 0xFF00);
681+
REGISTER_HID_DETECTOR_IP ("Logitech G600 Gaming Mouse", DetectLogitechMouseG600, LOGITECH_VID, LOGITECH_G600_PID, 1, 0xFF80);
665682
REGISTER_HID_DETECTOR_IP ("Logitech G Pro Gaming Mouse", DetectLogitechMouseGPRO, LOGITECH_VID, LOGITECH_G_PRO_PID, 1, 0xFF00);
666683
REGISTER_HID_DETECTOR_IP ("Logitech G Pro HERO Gaming Mouse", DetectLogitechMouseGPRO, LOGITECH_VID, LOGITECH_G_PRO_HERO_PID, 1, 0xFF00);
667684
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*---------------------------------------------------------*\
2+
| LogitechG600Controller.cpp |
3+
| |
4+
| Driver for Logitech G600 Gaming Mouse |
5+
| |
6+
| Austin B (austinleroy) 11 Sep 2025 |
7+
| |
8+
| This file is part of the OpenRGB project |
9+
| SPDX-License-Identifier: GPL-2.0-only |
10+
\*---------------------------------------------------------*/
11+
12+
#include <cstring>
13+
#include "LogitechG600Controller.h"
14+
#include "StringUtils.h"
15+
16+
LogitechG600Controller::LogitechG600Controller(hid_device* dev_handle, const char* path, std::string dev_name)
17+
{
18+
dev = dev_handle;
19+
location = path;
20+
name = dev_name;
21+
}
22+
23+
LogitechG600Controller::~LogitechG600Controller()
24+
{
25+
if(dev != nullptr)
26+
{
27+
hid_close(dev);
28+
}
29+
}
30+
31+
std::string LogitechG600Controller::GetNameString()
32+
{
33+
return(name);
34+
}
35+
36+
std::string LogitechG600Controller::GetSerialString()
37+
{
38+
wchar_t serial_string[128];
39+
int ret = hid_get_serial_number_string(dev, serial_string, 128);
40+
41+
if(ret != 0)
42+
{
43+
return("");
44+
}
45+
46+
return(StringUtils::wstring_to_string(serial_string));
47+
}
48+
49+
void LogitechG600Controller::SetMode
50+
(
51+
unsigned char mode,
52+
unsigned short speed,
53+
RGBColor color
54+
)
55+
{
56+
unsigned char usb_buf[8];
57+
58+
memset(usb_buf, 0x00, sizeof(usb_buf));
59+
60+
usb_buf[0x00] = 0xF1;
61+
usb_buf[0x01] = RGBGetRValue(color);
62+
usb_buf[0x02] = RGBGetGValue(color);
63+
usb_buf[0x03] = RGBGetBValue(color);
64+
usb_buf[0x04] = mode;
65+
usb_buf[0x05] = speed & 0xFF;
66+
67+
hid_send_feature_report(dev, usb_buf, sizeof(usb_buf));
68+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*---------------------------------------------------------*\
2+
| LogitechG600Controller.h |
3+
| |
4+
| Driver for Logitech G600 Gaming Mouse |
5+
| |
6+
| Austin B (austinleroy) 11 Sep 2025 |
7+
| |
8+
| This file is part of the OpenRGB project |
9+
| SPDX-License-Identifier: GPL-2.0-only |
10+
\*---------------------------------------------------------*/
11+
12+
#pragma once
13+
14+
#include <string>
15+
#include <hidapi.h>
16+
#include "RGBController.h"
17+
18+
19+
enum
20+
{
21+
LOGITECH_G600_MODE_DIRECT = 0x00,
22+
LOGITECH_G600_MODE_BREATHING = 0x01,
23+
LOGITECH_G600_MODE_CYCLE = 0x02
24+
};
25+
26+
/*---------------------------------------------------------------------------------------------*\
27+
| Speed is number of seconds for cycle to complete. |
28+
\*---------------------------------------------------------------------------------------------*/
29+
enum
30+
{
31+
LOGITECH_G600_SPEED_SLOWEST = 0x0F, /* Slowest speed */
32+
LOGITECH_G600_SPEED_NORMAL = 0x03, /* Normal speed */
33+
LOGITECH_G600_SPEED_FASTEST = 0x01, /* Fastest speed */
34+
};
35+
36+
class LogitechG600Controller
37+
{
38+
public:
39+
LogitechG600Controller(hid_device* dev, const char* path, std::string dev_name);
40+
~LogitechG600Controller();
41+
42+
std::string GetNameString();
43+
std::string GetSerialString();
44+
45+
void SetMode
46+
(
47+
unsigned char mode,
48+
unsigned short speed,
49+
RGBColor color
50+
);
51+
52+
private:
53+
hid_device* dev;
54+
std::string location;
55+
std::string name;
56+
};
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/*---------------------------------------------------------*\
2+
| RGBController_LogitechG600.cpp |
3+
| |
4+
| RGBController for Logitech G600 Gaming Mouse |
5+
| |
6+
| Austin B (austinleroy) 11 Sep 2025 |
7+
| |
8+
| This file is part of the OpenRGB project |
9+
| SPDX-License-Identifier: GPL-2.0-only |
10+
\*---------------------------------------------------------*/
11+
12+
#include "RGBController_LogitechG600.h"
13+
14+
/**------------------------------------------------------------------*\
15+
@name Logitech G600
16+
@category Mouse
17+
@type USB
18+
@save :o:
19+
@direct :white_check_mark:
20+
@effects :white_check_mark:
21+
@detectors DetectLogitechMouseG600
22+
@comment
23+
\*-------------------------------------------------------------------*/
24+
25+
RGBController_LogitechG600::RGBController_LogitechG600(LogitechG600Controller* controller_ptr)
26+
{
27+
controller = controller_ptr;
28+
29+
name = controller->GetNameString();
30+
vendor = "Logitech";
31+
type = DEVICE_TYPE_MOUSE;
32+
description = "Logitech Mouse Device";
33+
serial = controller->GetSerialString();
34+
35+
mode Direct;
36+
Direct.name = "Direct";
37+
Direct.value = LOGITECH_G600_MODE_DIRECT;
38+
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
39+
Direct.color_mode = MODE_COLORS_PER_LED;
40+
modes.push_back(Direct);
41+
42+
mode Breathing;
43+
Breathing.name = "Breathing";
44+
Breathing.value = LOGITECH_G600_MODE_BREATHING;
45+
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED;
46+
Breathing.color_mode = MODE_COLORS_PER_LED;
47+
Breathing.speed_min = LOGITECH_G600_SPEED_SLOWEST;
48+
Breathing.speed_max = LOGITECH_G600_SPEED_FASTEST;
49+
Breathing.speed = LOGITECH_G600_SPEED_NORMAL;
50+
modes.push_back(Breathing);
51+
52+
mode Cycle;
53+
Cycle.name = "Spectrum Cycle";
54+
Cycle.value = LOGITECH_G600_MODE_CYCLE;
55+
Cycle.flags = MODE_FLAG_HAS_SPEED;
56+
Cycle.color_mode = MODE_COLORS_NONE;
57+
Cycle.speed_min = LOGITECH_G600_SPEED_SLOWEST;
58+
Cycle.speed_max = LOGITECH_G600_SPEED_FASTEST;
59+
Cycle.speed = LOGITECH_G600_SPEED_NORMAL;
60+
modes.push_back(Cycle);
61+
62+
SetupZones();
63+
}
64+
65+
RGBController_LogitechG600::~RGBController_LogitechG600()
66+
{
67+
delete controller;
68+
}
69+
70+
void RGBController_LogitechG600::SetupZones()
71+
{
72+
zone side_lights_zone;
73+
side_lights_zone.name = "Side Lights";
74+
side_lights_zone.type = ZONE_TYPE_SINGLE;
75+
side_lights_zone.leds_min = 1;
76+
side_lights_zone.leds_max = 1;
77+
side_lights_zone.leds_count = 1;
78+
side_lights_zone.matrix_map = NULL;
79+
zones.push_back(side_lights_zone);
80+
81+
// Set up LED
82+
led g600_led;
83+
g600_led.name = "All";
84+
leds.push_back(g600_led);
85+
86+
SetupColors();
87+
}
88+
89+
void RGBController_LogitechG600::ResizeZone(int /*zone*/, int /*new_size*/)
90+
{
91+
/*---------------------------------------------------------*\
92+
| Currently does not support resizing zones |
93+
\*---------------------------------------------------------*/
94+
}
95+
96+
void RGBController_LogitechG600::DeviceUpdateLEDs()
97+
{
98+
controller->SetMode(modes[active_mode].value, modes[active_mode].speed, GetLED(0));
99+
}
100+
101+
void RGBController_LogitechG600::UpdateZoneLEDs(int /*zone*/)
102+
{
103+
DeviceUpdateLEDs();
104+
}
105+
106+
void RGBController_LogitechG600::UpdateSingleLED(int /*led*/)
107+
{
108+
DeviceUpdateLEDs();
109+
}
110+
111+
void RGBController_LogitechG600::DeviceUpdateMode()
112+
{
113+
controller->SetMode(modes[active_mode].value, modes[active_mode].speed, GetLED(0));
114+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*---------------------------------------------------------*\
2+
| RGBController_LogitechG600.h |
3+
| |
4+
| RGBController for Logitech G600 Gaming Mouse |
5+
| |
6+
| Austin B (austinleroy) 11 Sep 2025 |
7+
| |
8+
| This file is part of the OpenRGB project |
9+
| SPDX-License-Identifier: GPL-2.0-only |
10+
\*---------------------------------------------------------*/
11+
12+
#pragma once
13+
14+
#include "RGBController.h"
15+
#include "LogitechG600Controller.h"
16+
17+
class RGBController_LogitechG600 : public RGBController
18+
{
19+
public:
20+
RGBController_LogitechG600(LogitechG600Controller* controller_ptr);
21+
~RGBController_LogitechG600();
22+
23+
void SetupZones();
24+
25+
void ResizeZone(int zone, int new_size);
26+
27+
void DeviceUpdateLEDs();
28+
void UpdateZoneLEDs(int zone);
29+
void UpdateSingleLED(int led);
30+
31+
void DeviceUpdateMode();
32+
33+
private:
34+
LogitechG600Controller* controller;
35+
};

0 commit comments

Comments
 (0)