-
-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
8 changed files
with
129 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#include "../device.h" | ||
#include "../utility.h" | ||
|
||
#include <hidapi.h> | ||
#include <string.h> | ||
#include <stdlib.h> | ||
|
||
static struct device device_arctis7_2019; | ||
|
||
static int arctis7_2019_send_sidetone(hid_device *device_handle, uint8_t num); | ||
static int arctis7_2019_request_battery(hid_device *device_handle); | ||
|
||
void arctis7_2019_init(struct device** device) | ||
{ | ||
device_arctis7_2019.idVendor = VENDOR_STEELSERIES; | ||
device_arctis7_2019.idProduct = 0x12ad; | ||
device_arctis7_2019.idInterface = 0x05; | ||
|
||
strcpy(device_arctis7_2019.device_name, "SteelSeries Arctis 7"); | ||
|
||
device_arctis7_2019.capabilities = CAP_SIDETONE | CAP_BATTERY_STATUS; | ||
device_arctis7_2019.send_sidetone = &arctis7_2019_send_sidetone; | ||
device_arctis7_2019.request_battery = &arctis7_2019_request_battery; | ||
|
||
*device = &device_arctis7_2019; | ||
} | ||
|
||
static int arctis7_2019_send_sidetone(hid_device *device_handle, uint8_t num) | ||
{ | ||
int ret = -1; | ||
|
||
// the range of the Arctis 7 seems to be from 0 to 0x12 (18) | ||
num = map(num, 0, 128, 0x00, 0x12); | ||
|
||
unsigned char *buf = calloc(31, 1); | ||
|
||
if (!buf) | ||
{ | ||
return ret; | ||
} | ||
|
||
const unsigned char data_on[5] = {0x06, 0x35, 0x01, 0x00, num}; | ||
const unsigned char data_off[2] = {0x06, 0x35}; | ||
|
||
if (num) | ||
{ | ||
memmove(buf, data_on, sizeof(data_on)); | ||
} | ||
else | ||
{ | ||
memmove(buf, data_off, sizeof(data_off)); | ||
} | ||
|
||
ret = hid_write(device_handle, buf, 31); | ||
|
||
SAFE_FREE(buf); | ||
|
||
return ret; | ||
} | ||
|
||
static int arctis7_2019_request_battery(hid_device *device_handle) | ||
{ | ||
|
||
int r = 0; | ||
|
||
// request battery status | ||
unsigned char data_request[2] = {0x06, 0x18}; | ||
|
||
r = hid_write(device_handle, data_request, 2); | ||
|
||
if (r < 0) return r; | ||
|
||
// read battery status | ||
unsigned char data_read[8]; | ||
|
||
r = hid_read(device_handle, data_read, 8); | ||
|
||
if (r < 0) return r; | ||
|
||
int bat = data_read[2]; | ||
|
||
if (bat > 100) return 100; | ||
|
||
return bat; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#pragma once | ||
|
||
void arctis7_2019_init(struct device** device); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1038", ATTRS{idProduct}=="12ad", MODE="0666" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
SUBSYSTEM=="hidraw", SUBSYSTEMS=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1260", MODE="0666" | ||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1038", ATTRS{idProduct}=="1260", MODE="0666" |