-
-
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.
Merge pull request #16 from Ionic/feature/support-steelseries-arctis7
Add support for SteelSeries Arctis 7.
- Loading branch information
Showing
9 changed files
with
196 additions
and
5 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,57 @@ | ||
#include "../device.h" | ||
#include "../utility.h" | ||
|
||
#include <hidapi.h> | ||
#include <string.h> | ||
#include <stdlib.h> | ||
|
||
static struct device device_arctis7; | ||
|
||
static int arctis7_send_sidetone(hid_device *device_handle, uint8_t num); | ||
|
||
void arctis7_init(struct device** device) | ||
{ | ||
device_arctis7.idVendor = VENDOR_STEELSERIES; | ||
device_arctis7.idProduct = 0x1260; | ||
device_arctis7.idInterface = 0x05; | ||
|
||
strcpy(device_arctis7.device_name, "SteelSeries Arctis 7"); | ||
|
||
device_arctis7.capabilities = CAP_SIDETONE; | ||
device_arctis7.send_sidetone = &arctis7_send_sidetone; | ||
|
||
*device = &device_arctis7; | ||
} | ||
|
||
static int arctis7_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; | ||
} |
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_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
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 @@ | ||
SUBSYSTEM=="usb", ENV{ID_MODEL}=="SteelSeries_Arctis_7", MODE="0666" |