Publish LumaOps source
This commit is contained in:
+106
@@ -0,0 +1,106 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_SteelSeriesArctis5.cpp |
|
||||
| |
|
||||
| RGBController for SteelSeries Arctis 5 |
|
||||
| |
|
||||
| Morgan Guimard 04 Mar 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_SteelSeriesArctis5.h"
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name Steelseries Arctis 5
|
||||
@category Headset
|
||||
@type USB
|
||||
@save :x:
|
||||
@direct :white_check_mark:
|
||||
@effects :x:
|
||||
@detectors DetectSteelSeriesArctis5
|
||||
@comment
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
RGBController_SteelSeriesArctis5::RGBController_SteelSeriesArctis5(SteelSeriesArctis5Controller* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetNameString();
|
||||
vendor = "SteelSeries";
|
||||
type = DEVICE_TYPE_HEADSET;
|
||||
description = "SteelSeries Arctis 5 Headset Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0x00;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_SteelSeriesArctis5::~RGBController_SteelSeriesArctis5()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesArctis5::SetupZones()
|
||||
{
|
||||
const std::string zone_names[2] =
|
||||
{
|
||||
"Left" , "Right"
|
||||
};
|
||||
|
||||
for(const std::string& zone_name : zone_names)
|
||||
{
|
||||
zone zone;
|
||||
zone.name = zone_name;
|
||||
zone.type = ZONE_TYPE_SINGLE;
|
||||
zone.leds_min = 1;
|
||||
zone.leds_max = 1;
|
||||
zone.leds_count = 1;
|
||||
zone.matrix_map = NULL;
|
||||
zones.push_back(zone);
|
||||
|
||||
led mouse_led;
|
||||
mouse_led.name = zone_name;
|
||||
leds.push_back(mouse_led);
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesArctis5::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesArctis5::DeviceUpdateLEDs()
|
||||
{
|
||||
for(unsigned int i = 0; i < zones.size(); i++)
|
||||
{
|
||||
UpdateZoneLEDs(i);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesArctis5::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
controller->SetColor(zone, colors[zone]);
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesArctis5::UpdateSingleLED(int led)
|
||||
{
|
||||
UpdateZoneLEDs(led);
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesArctis5::DeviceUpdateMode()
|
||||
{
|
||||
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_SteelSeriesArctis5.h |
|
||||
| |
|
||||
| RGBController for SteelSeries Arctis 5 |
|
||||
| |
|
||||
| Morgan Guimard 04 Mar 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "SteelSeriesArctis5Controller.h"
|
||||
|
||||
class RGBController_SteelSeriesArctis5 : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_SteelSeriesArctis5(SteelSeriesArctis5Controller* controller_ptr);
|
||||
~RGBController_SteelSeriesArctis5();
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
SteelSeriesArctis5Controller* controller;
|
||||
};
|
||||
+140
@@ -0,0 +1,140 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| SteelSeriesArctis5Controller.cpp |
|
||||
| |
|
||||
| Driver for SteelSeries Arctis 5 |
|
||||
| |
|
||||
| Morgan Guimard 04 Mar 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <string.h>
|
||||
#include "SteelSeriesArctis5Controller.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
SteelSeriesArctis5Controller::SteelSeriesArctis5Controller(hid_device* dev_handle, const hid_device_info& info, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = info.path;
|
||||
name = dev_name;
|
||||
}
|
||||
|
||||
SteelSeriesArctis5Controller::~SteelSeriesArctis5Controller()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string SteelSeriesArctis5Controller::GetDeviceLocation()
|
||||
{
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string SteelSeriesArctis5Controller::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string SteelSeriesArctis5Controller::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
int ret = hid_get_serial_number_string(dev, serial_string, 128);
|
||||
|
||||
if(ret != 0)
|
||||
{
|
||||
return("");
|
||||
}
|
||||
|
||||
return(StringUtils::wstring_to_string(serial_string));
|
||||
}
|
||||
|
||||
void SteelSeriesArctis5Controller::SetColor(unsigned char zone_id, RGBColor color)
|
||||
{
|
||||
unsigned char usb_buf[ARCTIS_5_REPORT_SIZE];
|
||||
|
||||
/*----------------------------------------------*\
|
||||
| Two packets are sent before a color change |
|
||||
\*----------------------------------------------*/
|
||||
memset(usb_buf, 0x00, ARCTIS_5_REPORT_SIZE);
|
||||
|
||||
usb_buf[0x00] = ARCTIS_5_REPORT_ID;
|
||||
usb_buf[0x01] = 0x81;
|
||||
usb_buf[0x02] = 0x43;
|
||||
usb_buf[0x03] = 0x01;
|
||||
usb_buf[0x04] = 0x22;
|
||||
|
||||
hid_write(dev, usb_buf, ARCTIS_5_REPORT_SIZE);
|
||||
|
||||
usb_buf[0x04] = 0x23;
|
||||
|
||||
hid_write(dev, usb_buf, ARCTIS_5_REPORT_SIZE);
|
||||
|
||||
/*----------------------------------------------*\
|
||||
| First packet: send color |
|
||||
\*----------------------------------------------*/
|
||||
memset(usb_buf, 0x00, ARCTIS_5_REPORT_SIZE);
|
||||
|
||||
usb_buf[0x00] = ARCTIS_5_REPORT_ID;
|
||||
usb_buf[0x01] = 0x8A;
|
||||
usb_buf[0x02] = 0x42;
|
||||
|
||||
usb_buf[0x04] = 0x20;
|
||||
usb_buf[0x05] = 0x41;
|
||||
|
||||
usb_buf[0x07] = RGBGetRValue(color);
|
||||
usb_buf[0x08] = RGBGetGValue(color);
|
||||
usb_buf[0x09] = RGBGetBValue(color);
|
||||
|
||||
usb_buf[0x0A] = 0xFF;
|
||||
usb_buf[0x0B] = 0x32;
|
||||
usb_buf[0x0C] = 0xC8;
|
||||
usb_buf[0x0D] = 0xC8;
|
||||
|
||||
hid_write(dev, usb_buf, ARCTIS_5_REPORT_SIZE);
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Second packet: apply to zone |
|
||||
\*-----------------------------------------*/
|
||||
memset(usb_buf, 0x00, ARCTIS_5_REPORT_SIZE);
|
||||
|
||||
usb_buf[0x00] = ARCTIS_5_REPORT_ID;
|
||||
usb_buf[0x01] = 0x8A;
|
||||
usb_buf[0x02] = 0x42;
|
||||
|
||||
usb_buf[0x04] = 0x20;
|
||||
usb_buf[0x05] = 0x41;
|
||||
usb_buf[0x06] = 0x08;
|
||||
usb_buf[0x07] = zone_id;
|
||||
usb_buf[0x08] = 0x01;
|
||||
|
||||
hid_write(dev, usb_buf, ARCTIS_5_REPORT_SIZE);
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Thrid packet: apply to zone |
|
||||
\*-----------------------------------------*/
|
||||
memset(usb_buf, 0x00, ARCTIS_5_REPORT_SIZE);
|
||||
|
||||
usb_buf[0x00] = ARCTIS_5_REPORT_ID;
|
||||
usb_buf[0x01] = 0x8A;
|
||||
usb_buf[0x02] = 0x42;
|
||||
|
||||
usb_buf[0x04] = 0x20;
|
||||
usb_buf[0x05] = 0x60;
|
||||
usb_buf[0x06] = zone_id;
|
||||
|
||||
hid_write(dev, usb_buf, ARCTIS_5_REPORT_SIZE);
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Last packet: apply |
|
||||
\*-----------------------------------------*/
|
||||
memset(usb_buf, 0x00, ARCTIS_5_REPORT_SIZE);
|
||||
|
||||
usb_buf[0x00] = ARCTIS_5_REPORT_ID;
|
||||
usb_buf[0x01] = 0x8A;
|
||||
usb_buf[0x02] = 0x42;
|
||||
|
||||
usb_buf[0x04] = 0x20;
|
||||
usb_buf[0x05] = 0x05;
|
||||
|
||||
hid_write(dev, usb_buf, ARCTIS_5_REPORT_SIZE);
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| SteelSeriesArctis5Controller.h |
|
||||
| |
|
||||
| Driver for SteelSeries Arctis 5 |
|
||||
| |
|
||||
| Morgan Guimard 04 Mar 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <hidapi.h>
|
||||
#include "RGBController.h"
|
||||
|
||||
#define ARCTIS_5_REPORT_SIZE 37
|
||||
#define ARCTIS_5_REPORT_ID 0x06
|
||||
|
||||
class SteelSeriesArctis5Controller
|
||||
{
|
||||
public:
|
||||
SteelSeriesArctis5Controller(hid_device* dev_handle, const hid_device_info& info, std::string dev_name);
|
||||
~SteelSeriesArctis5Controller();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetNameString();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SetColor(unsigned char zone_id, RGBColor color);
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string name;
|
||||
};
|
||||
Reference in New Issue
Block a user