Skip to content

Commit 1dbc9ef

Browse files
jamesj999Sapd
authored andcommitted
SteelSeries Arctis 7 Battery Support + 2019 Model Support (#40)
* Add battery support for SteelSeries Arctis 7 (Pre-2019) * Adding support for 2019 Arctis 7 variant. * Correcting error in udev rules. * Updating README.md to include updates for SteelSeries Arctis 7. * Fix 50-steelseries-arctis-7.rules UDev rule, According to Udev versions used in Ubuntu 19.04. Previous version did not work.
1 parent 94cf16c commit 1dbc9ef

8 files changed

Lines changed: 129 additions & 4 deletions

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@ talking. This differs from a simple loopback via PulseAudio as you won't have an
1414
- Logitech G533
1515
- Logitech G430 (Last working on macOS in commit 41be99379f)
1616
- SteelSeries Arctis 7
17+
- SteelSeries Arctis 7 (2019 Revision)
1718
- SteelSeries Arctis Pro 2019 Edition
1819

1920
### Other Features
2021

22+
2123
Corsair Void (Pro) also supports checking of the battery and switching LED off/on
24+
SteelSeries Arctis 7 (including 2019 revision) support checking of the battery.
25+
2226

2327
For more features (like getting battery percentage of other devices, or settings LEDs etc. of specific devices), the protocol of the respective headset must be analyzed further. This can be done by capturing the USB traffic and analyzing it with WireShark or USBlyzer.
2428

src/device_registry.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
#include "devices/logitech_g633.h"
99
#include "devices/logitech_g930.h"
1010
#include "devices/steelseries_arctis7.h"
11+
#include "devices/steelseries_arctis7_2019.h"
1112
#include "devices/steelseries_arctispro_2019.h"
1213

1314
#include <string.h>
1415

1516

16-
#define NUMDEVICES 9
17+
#define NUMDEVICES 10
1718
// array of pointers to device
1819
static struct device *(devicelist[NUMDEVICES]);
1920

@@ -27,7 +28,8 @@ void init_devices()
2728
g633_init(&devicelist[5]);
2829
g930_init(&devicelist[6]);
2930
arctis7_init(&devicelist[7]);
30-
arctispro_2019_init(&devicelist[8]);
31+
arctis7_2019_init(&devicelist[8]);
32+
arctispro_2019_init(&devicelist[9]);
3133
}
3234

3335
int get_device(struct device* device_found, uint16_t idVendor, uint16_t idProduct)

src/devices/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ set(SOURCE_FILES ${SOURCE_FILES}
1515
${CMAKE_CURRENT_SOURCE_DIR}/logitech_g633.h
1616
${CMAKE_CURRENT_SOURCE_DIR}/steelseries_arctis7.c
1717
${CMAKE_CURRENT_SOURCE_DIR}/steelseries_arctis7.h
18+
${CMAKE_CURRENT_SOURCE_DIR}/steelseries_arctis7_2019.c
19+
${CMAKE_CURRENT_SOURCE_DIR}/steelseries_arctis7_2019.h
1820
${CMAKE_CURRENT_SOURCE_DIR}/steelseries_arctispro_2019.c
1921
${CMAKE_CURRENT_SOURCE_DIR}/steelseries_arctispro_2019.h
2022
PARENT_SCOPE)

src/devices/steelseries_arctis7.c

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
static struct device device_arctis7;
99

1010
static int arctis7_send_sidetone(hid_device *device_handle, uint8_t num);
11+
static int arctis7_request_battery(hid_device *device_handle);
1112

1213
void arctis7_init(struct device** device)
1314
{
@@ -17,8 +18,9 @@ void arctis7_init(struct device** device)
1718

1819
strcpy(device_arctis7.device_name, "SteelSeries Arctis 7");
1920

20-
device_arctis7.capabilities = CAP_SIDETONE;
21+
device_arctis7.capabilities = CAP_SIDETONE | CAP_BATTERY_STATUS;
2122
device_arctis7.send_sidetone = &arctis7_send_sidetone;
23+
device_arctis7.request_battery = &arctis7_request_battery;
2224

2325
*device = &device_arctis7;
2426
}
@@ -55,3 +57,29 @@ static int arctis7_send_sidetone(hid_device *device_handle, uint8_t num)
5557

5658
return ret;
5759
}
60+
61+
static int arctis7_request_battery(hid_device *device_handle)
62+
{
63+
64+
int r = 0;
65+
66+
// request battery status
67+
unsigned char data_request[2] = {0x06, 0x18};
68+
69+
r = hid_write(device_handle, data_request, 2);
70+
71+
if (r < 0) return r;
72+
73+
// read battery status
74+
unsigned char data_read[8];
75+
76+
r = hid_read(device_handle, data_read, 8);
77+
78+
if (r < 0) return r;
79+
80+
int bat = data_read[2];
81+
82+
if (bat > 100) return 100;
83+
84+
return bat;
85+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#include "../device.h"
2+
#include "../utility.h"
3+
4+
#include <hidapi.h>
5+
#include <string.h>
6+
#include <stdlib.h>
7+
8+
static struct device device_arctis7_2019;
9+
10+
static int arctis7_2019_send_sidetone(hid_device *device_handle, uint8_t num);
11+
static int arctis7_2019_request_battery(hid_device *device_handle);
12+
13+
void arctis7_2019_init(struct device** device)
14+
{
15+
device_arctis7_2019.idVendor = VENDOR_STEELSERIES;
16+
device_arctis7_2019.idProduct = 0x12ad;
17+
device_arctis7_2019.idInterface = 0x05;
18+
19+
strcpy(device_arctis7_2019.device_name, "SteelSeries Arctis 7");
20+
21+
device_arctis7_2019.capabilities = CAP_SIDETONE | CAP_BATTERY_STATUS;
22+
device_arctis7_2019.send_sidetone = &arctis7_2019_send_sidetone;
23+
device_arctis7_2019.request_battery = &arctis7_2019_request_battery;
24+
25+
*device = &device_arctis7_2019;
26+
}
27+
28+
static int arctis7_2019_send_sidetone(hid_device *device_handle, uint8_t num)
29+
{
30+
int ret = -1;
31+
32+
// the range of the Arctis 7 seems to be from 0 to 0x12 (18)
33+
num = map(num, 0, 128, 0x00, 0x12);
34+
35+
unsigned char *buf = calloc(31, 1);
36+
37+
if (!buf)
38+
{
39+
return ret;
40+
}
41+
42+
const unsigned char data_on[5] = {0x06, 0x35, 0x01, 0x00, num};
43+
const unsigned char data_off[2] = {0x06, 0x35};
44+
45+
if (num)
46+
{
47+
memmove(buf, data_on, sizeof(data_on));
48+
}
49+
else
50+
{
51+
memmove(buf, data_off, sizeof(data_off));
52+
}
53+
54+
ret = hid_write(device_handle, buf, 31);
55+
56+
SAFE_FREE(buf);
57+
58+
return ret;
59+
}
60+
61+
static int arctis7_2019_request_battery(hid_device *device_handle)
62+
{
63+
64+
int r = 0;
65+
66+
// request battery status
67+
unsigned char data_request[2] = {0x06, 0x18};
68+
69+
r = hid_write(device_handle, data_request, 2);
70+
71+
if (r < 0) return r;
72+
73+
// read battery status
74+
unsigned char data_read[8];
75+
76+
r = hid_read(device_handle, data_read, 8);
77+
78+
if (r < 0) return r;
79+
80+
int bat = data_read[2];
81+
82+
if (bat > 100) return 100;
83+
84+
return bat;
85+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
void arctis7_2019_init(struct device** device);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1038", ATTRS{idProduct}=="12ad", MODE="0666"

udev/50-steelseries-arctis-7.rules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
SUBSYSTEM=="hidraw", SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1260", MODE="0666"
1+
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1038", ATTRS{idProduct}=="1260", MODE="0666"

0 commit comments

Comments
 (0)