Skip to content

Instantly share code, notes, and snippets.

@Spirit532
Created July 14, 2021 10:39
Show Gist options
  • Save Spirit532/3390d754f450b090783d074c1e7bab56 to your computer and use it in GitHub Desktop.
Save Spirit532/3390d754f450b090783d074c1e7bab56 to your computer and use it in GitHub Desktop.
SteelSeries Arctis Wireless Pro OLED display drawing
#ifdef WIN32
#include <windows.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include "hidapi/hidapi.h"
#pragma comment(lib, "hidapi.lib")
#define MAX_STR 255
void drawpx(int x, int y, int on, unsigned char * buffer)
{
if(on)
buffer[(x - 1) + (y / 8) * 128] |= (1 << (y & 7));
else
buffer[(x - 1) + (y / 8) * 128] &= ~(1 << (y & 7));
}
int main(int argc, char* argv[])
{
int res;
wchar_t wstr[MAX_STR];
hid_device* handle;
// Initialize the hidapi library
res = hid_init();
// Open the device using the VID & PID, no serial number
handle = hid_open(0x1038, 0x1290, NULL);
hid_set_nonblocking(handle, 0);
// Read the Manufacturer String
res = hid_get_manufacturer_string(handle, wstr, MAX_STR);
wprintf(L"Manufacturer String: %s\n", wstr);
// Read the Product String
res = hid_get_product_string(handle, wstr, MAX_STR);
wprintf(L"Product String: %s\n", wstr);
// Read the Serial Number String
res = hid_get_serial_number_string(handle, wstr, MAX_STR);
wprintf(L"Serial Number String: (%d) %s\n", wstr[0], wstr);
char data[1025] = { 0 };
data[0] = 0x00; // Report type = 0;
data[1] = 0xD2; // "Draw on screen" function
drawpx(0, 0, 1, &data[2]);
drawpx(127, 0, 1, &data[2]);
drawpx(0, 39, 1, &data[2]);
drawpx(127, 39, 1, &data[2]);
res = hid_send_feature_report(handle, data, 1025);
// Close the device
hid_close(handle);
// Finalize the hidapi library
res = hid_exit();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment