Skip to content

Commit 366fbd9

Browse files
Mola19CalcProgrammer1
authored andcommitted
Add ASUS Strix Evolve mouse
Commit amended for code style by Adam Honse <[email protected]>
1 parent 186d8a5 commit 366fbd9

File tree

6 files changed

+412
-0
lines changed

6 files changed

+412
-0
lines changed
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
/*-----------------------------------------*\
2+
| AsusAuraStrixEvolveController.cpp |
3+
| |
4+
| Driver for ASUS Aura RGB USB |
5+
| lighting controller |
6+
| |
7+
| Mola19 11/30/2021 |
8+
\*-----------------------------------------*/
9+
10+
#include "AsusAuraStrixEvolveController.h"
11+
12+
#include <cstring>
13+
#include <chrono>
14+
#include <thread>
15+
16+
AuraStrixEvolveController::AuraStrixEvolveController(hid_device* dev_handle, const char* path, uint16_t pid)
17+
{
18+
dev = dev_handle;
19+
location = path;
20+
device_pid = pid;
21+
}
22+
23+
AuraStrixEvolveController::~AuraStrixEvolveController()
24+
{
25+
hid_close(dev);
26+
}
27+
28+
std::string AuraStrixEvolveController::GetDeviceLocation()
29+
{
30+
return("HID: " + location);
31+
}
32+
33+
std::string AuraStrixEvolveController::GetSerialString()
34+
{
35+
wchar_t serial_string[HID_MAX_STR];
36+
int ret = hid_get_serial_number_string(dev, serial_string, HID_MAX_STR);
37+
38+
if(ret != 0)
39+
{
40+
return("");
41+
}
42+
43+
std::wstring return_wstring = serial_string;
44+
std::string return_string(return_wstring.begin(), return_wstring.end());
45+
46+
return(return_string);
47+
}
48+
49+
std::string AuraStrixEvolveController::GetVersion()
50+
{
51+
unsigned char usb_buf[9] = { 0x0c, 0xc4, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
52+
hid_send_feature_report(dev, usb_buf, 9);
53+
54+
unsigned char usb_buf_out[9] = { 0x0c };
55+
hid_get_feature_report(dev, usb_buf_out, 9);
56+
57+
return std::string("1." + std::to_string(usb_buf_out[3]));
58+
}
59+
60+
int AuraStrixEvolveController::GetActiveProfile()
61+
{
62+
int profile;
63+
64+
do
65+
{
66+
unsigned char usb_buf[9] = { 0x0c, 0xdf, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
67+
hid_send_feature_report(dev, usb_buf, 9);
68+
69+
unsigned char usb_buf_out[9] = { 0x0c };
70+
hid_get_feature_report(dev, usb_buf_out, 9);
71+
72+
profile = usb_buf_out[4] % 16;
73+
} while (profile > 2);
74+
75+
return profile + 1;
76+
}
77+
78+
void AuraStrixEvolveController::SendUpdate
79+
(
80+
unsigned char key,
81+
unsigned char value
82+
)
83+
{
84+
unsigned char usb_buf[9];
85+
86+
/*-----------------------------------------------------*\
87+
| Zero out buffer |
88+
\*-----------------------------------------------------*/
89+
memset(usb_buf, 0x00, 9);
90+
91+
/*-----------------------------------------------------*\
92+
| Set up message packet |
93+
\*-----------------------------------------------------*/
94+
usb_buf[0x00] = 0x0c;
95+
usb_buf[0x01] = 0xc4;
96+
usb_buf[0x02] = 0x0f;
97+
usb_buf[0x03] = 0x00;
98+
usb_buf[0x04] = key;
99+
usb_buf[0x05] = value;
100+
hid_send_feature_report(dev, usb_buf, 9);
101+
}
102+
103+
104+
void AuraStrixEvolveController::UpdateProfile
105+
(
106+
unsigned char key,
107+
unsigned char profile,
108+
unsigned char value
109+
)
110+
{
111+
unsigned char usb_buf[9];
112+
113+
/*-----------------------------------------------------*\
114+
| Zero out buffer |
115+
\*-----------------------------------------------------*/
116+
memset(usb_buf, 0x00, 9);
117+
118+
/*-----------------------------------------------------*\
119+
| Set up message packet |
120+
\*-----------------------------------------------------*/
121+
usb_buf[0x00] = 0x0c;
122+
usb_buf[0x01] = 0xde;
123+
usb_buf[0x02] = key;
124+
usb_buf[0x03] = profile;
125+
usb_buf[0x04] = value;
126+
hid_send_feature_report(dev, usb_buf, 9);
127+
std::this_thread::sleep_for(std::chrono::milliseconds(5));
128+
}
129+
130+
void AuraStrixEvolveController::SendSavePacket()
131+
{
132+
unsigned char usb_buf[9];
133+
134+
/*-----------------------------------------------------*\
135+
| Zero out buffer |
136+
\*-----------------------------------------------------*/
137+
memset(usb_buf, 0x00, 9);
138+
139+
/*-----------------------------------------------------*\
140+
| Set up message packet |
141+
\*-----------------------------------------------------*/
142+
usb_buf[0x00] = 0x0c;
143+
usb_buf[0x01] = 0xc4;
144+
145+
hid_send_feature_report(dev, usb_buf, 9);
146+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*-----------------------------------------*\
2+
| AsusAuraStrixEvolveController.h |
3+
| |
4+
| Definitions and types for ASUS Aura |
5+
| USB RGB lighting controller |
6+
| |
7+
| Mola19 11/30/2021 |
8+
\*-----------------------------------------*/
9+
10+
#include "RGBController.h"
11+
12+
#include <string>
13+
#include <hidapi/hidapi.h>
14+
15+
#pragma once
16+
17+
#define HID_MAX_STR 255
18+
19+
class AuraStrixEvolveController
20+
{
21+
public:
22+
AuraStrixEvolveController(hid_device* dev_handle, const char* path, uint16_t pid);
23+
virtual ~AuraStrixEvolveController();
24+
25+
std::string GetDeviceLocation();
26+
std::string GetSerialString();
27+
std::string GetVersion();
28+
int GetActiveProfile();
29+
30+
void SendUpdate
31+
(
32+
unsigned char key,
33+
unsigned char value
34+
);
35+
36+
void UpdateProfile
37+
(
38+
unsigned char key,
39+
unsigned char profile,
40+
unsigned char value
41+
);
42+
43+
void SendSavePacket();
44+
45+
uint16_t device_pid;
46+
47+
private:
48+
hid_device* dev;
49+
std::string location;
50+
};

Controllers/AsusAuraUSBController/AsusAuraUSBControllerDetect.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
#include "AsusAuraTUFKeyboardController.h"
66
#include "AsusAuraMainboardController.h"
77
#include "AsusAuraMouseController.h"
8+
#include "AsusAuraStrixEvolveController.h"
89
#include "RGBController.h"
910
#include "RGBController_AsusAuraUSB.h"
1011
#include "RGBController_AsusAuraHeadsetStand.h"
1112
#include "RGBController_AsusAuraKeyboard.h"
1213
#include "RGBController_AsusAuraTUFKeyboard.h"
1314
#include "RGBController_AsusAuraMouse.h"
15+
#include "RGBController_AsusAuraStrixEvolve.h"
1416
#include <stdexcept>
1517
#include <hidapi/hidapi.h>
1618
#include "dependencies/dmiinfo.h"
@@ -44,6 +46,7 @@
4446
| MICE - defined in AsusAuraMouseDevices.h |
4547
\*-----------------------------------------------------------------*/
4648

49+
#define AURA_ROG_STRIX_EVOLVE_PID 0x185B
4750

4851
/*-----------------------------------------------------------------*\
4952
| OTHER |
@@ -151,6 +154,18 @@ void DetectAsusAuraUSBMice(hid_device_info* info, const std::string& name)
151154
}
152155
}
153156

157+
void DetectAsusAuraUSBStrixEvolve(hid_device_info* info, const std::string& name)
158+
{
159+
hid_device* dev = hid_open_path(info->path);
160+
if(dev)
161+
{
162+
AuraStrixEvolveController* controller = new AuraStrixEvolveController(dev, info->path, info->product_id);
163+
RGBController_AuraStrixEvolve* rgb_controller = new RGBController_AuraStrixEvolve(controller);
164+
rgb_controller->name = name;
165+
ResourceManager::get()->RegisterRGBController(rgb_controller);
166+
}
167+
}
168+
154169
void DetectAsusAuraUSBHeadsetStand(hid_device_info* info, const std::string& name)
155170
{
156171
hid_device* dev = hid_open_path(info->path);
@@ -218,6 +233,8 @@ REGISTER_HID_DETECTOR_IP("ASUS ROG Strix Impact II", DetectAsusAuraUS
218233
REGISTER_HID_DETECTOR_IP("ASUS TUF Gaming M3", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_TUF_M3_PID, 1, 0xFF01);
219234
REGISTER_HID_DETECTOR_IP("ASUS TUF Gaming M5", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_TUF_M5_PID, 2, 0xFF01);
220235

236+
REGISTER_HID_DETECTOR_IP("ASUS ROG Strix Evolve", DetectAsusAuraUSBStrixEvolve, AURA_USB_VID, AURA_ROG_STRIX_EVOLVE_PID, 1, 0x0008);
237+
221238
/*-----------------------------------------------------------------*\
222239
| OTHER |
223240
\*-----------------------------------------------------------------*/

0 commit comments

Comments
 (0)