Publish LumaOps source
This commit is contained in:
+259
@@ -0,0 +1,259 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_SteelSeriesRival.cpp |
|
||||
| |
|
||||
| RGBController for SteelSeries Rival |
|
||||
| |
|
||||
| B Horn (bahorn) 13 May 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_SteelSeriesRival.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char* name;
|
||||
const int value;
|
||||
} steelseries_rival_led_info;
|
||||
|
||||
static const steelseries_rival_led_info rival_650_leds[]=
|
||||
{
|
||||
{"Left 1", 0x12},
|
||||
{"Left 2", 0x14},
|
||||
{"Left 3", 0x16},
|
||||
{"Right 1", 0x13},
|
||||
{"Right 2", 0x15},
|
||||
{"Right 3", 0x17},
|
||||
};
|
||||
|
||||
static const steelseries_rival_led_info rival_600_leds[]=
|
||||
{
|
||||
{"Left top", 0x02},
|
||||
{"Left mid", 0x04},
|
||||
{"Left bottom", 0x06},
|
||||
{"Right top", 0x03},
|
||||
{"Right mid", 0x05},
|
||||
{"Right bottom", 0x07},
|
||||
};
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name Steel Series Rival
|
||||
@category Mouse
|
||||
@type USB
|
||||
@save :x:
|
||||
@direct :white_check_mark:
|
||||
@effects :white_check_mark:
|
||||
@detectors DetectSteelSeriesRival100,DetectSteelSeriesRival300,DetectSteelSeriesRival600,DetectSteelSeriesRival650,DetectSteelSeriesRival700
|
||||
@comment
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
RGBController_SteelSeriesRival::RGBController_SteelSeriesRival(SteelSeriesRivalController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetDeviceName();
|
||||
vendor = "SteelSeries";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = "SteelSeries Rival Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
version = controller->GetFirmwareVersion();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = STEELSERIES_RIVAL_DIRECT;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Pulsate;
|
||||
Pulsate.name = "Pulsate";
|
||||
Pulsate.value = STEELSERIES_RIVAL_PULSATE;
|
||||
Pulsate.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE;
|
||||
Pulsate.color_mode = MODE_COLORS_PER_LED;
|
||||
Pulsate.speed_min = STEELSERIES_RIVAL_EFFECT_PULSATE_MIN;
|
||||
Pulsate.speed_max = STEELSERIES_RIVAL_EFFECT_PULSATE_MAX;
|
||||
Pulsate.speed = STEELSERIES_RIVAL_EFFECT_PULSATE_MID;
|
||||
modes.push_back(Pulsate);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_SteelSeriesRival::~RGBController_SteelSeriesRival()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesRival::SetupZones()
|
||||
{
|
||||
/* Rival 100 Series only has one Zone */
|
||||
zone logo_zone;
|
||||
logo_zone.name = "Logo";
|
||||
logo_zone.type = ZONE_TYPE_SINGLE;
|
||||
logo_zone.leds_min = 1;
|
||||
logo_zone.leds_max = 1;
|
||||
logo_zone.leds_count = 1;
|
||||
logo_zone.matrix_map = NULL;
|
||||
zones.push_back(logo_zone);
|
||||
|
||||
led logo_led;
|
||||
logo_led.name = "Logo";
|
||||
logo_led.value = 0;
|
||||
leds.push_back(logo_led);
|
||||
|
||||
/* Rival 300 and 700 extend this by adding Scroll Wheel LED + Zone */
|
||||
if(controller->GetMouseType() == RIVAL_300 ||
|
||||
controller->GetMouseType() == RIVAL_700)
|
||||
{
|
||||
zone wheel_zone;
|
||||
wheel_zone.name = "Scroll Wheel";
|
||||
wheel_zone.type = ZONE_TYPE_SINGLE;
|
||||
wheel_zone.leds_min = 1;
|
||||
wheel_zone.leds_max = 1;
|
||||
wheel_zone.leds_count = 1;
|
||||
wheel_zone.matrix_map = NULL;
|
||||
zones.push_back(wheel_zone);
|
||||
|
||||
led wheel_led;
|
||||
wheel_led.name = "Scroll Wheel";
|
||||
wheel_led.value = 1;
|
||||
leds.push_back(wheel_led);
|
||||
}
|
||||
/* Rival 650 extends this by Scroll Wheel LED + Zone and additional lights LEDs + Zone */
|
||||
else if(controller->GetMouseType() == RIVAL_650)
|
||||
{
|
||||
leds[0].value = 0x11;
|
||||
|
||||
zone wheel_zone;
|
||||
wheel_zone.name = "Scroll Wheel";
|
||||
wheel_zone.type = ZONE_TYPE_SINGLE;
|
||||
wheel_zone.leds_min = 1;
|
||||
wheel_zone.leds_max = 1;
|
||||
wheel_zone.leds_count = 1;
|
||||
wheel_zone.matrix_map = NULL;
|
||||
zones.push_back(wheel_zone);
|
||||
|
||||
led wheel_led;
|
||||
wheel_led.name = "Scroll Wheel";
|
||||
wheel_led.value = 0x10;
|
||||
leds.push_back(wheel_led);
|
||||
|
||||
zone mouse_zone;
|
||||
mouse_zone.name = "Mouse";
|
||||
mouse_zone.type = ZONE_TYPE_LINEAR;
|
||||
mouse_zone.leds_min = 6;
|
||||
mouse_zone.leds_max = 6;
|
||||
mouse_zone.leds_count = 6;
|
||||
mouse_zone.matrix_map = NULL;
|
||||
zones.push_back(mouse_zone);
|
||||
|
||||
for(const steelseries_rival_led_info led_info: rival_650_leds)
|
||||
{
|
||||
led mouse_led;
|
||||
mouse_led.name = led_info.name;
|
||||
mouse_led.value = led_info.value;
|
||||
leds.push_back(mouse_led);
|
||||
}
|
||||
}
|
||||
/* Rival 600 is simular to Rival 650 */
|
||||
else if(controller->GetMouseType() == RIVAL_600)
|
||||
{
|
||||
leds[0].value = 0x01;
|
||||
|
||||
zone wheel_zone;
|
||||
wheel_zone.name = "Scroll Wheel";
|
||||
wheel_zone.type = ZONE_TYPE_SINGLE;
|
||||
wheel_zone.leds_min = 1;
|
||||
wheel_zone.leds_max = 1;
|
||||
wheel_zone.leds_count = 1;
|
||||
wheel_zone.matrix_map = NULL;
|
||||
zones.push_back(wheel_zone);
|
||||
|
||||
led wheel_led;
|
||||
wheel_led.name = "Scroll Wheel";
|
||||
wheel_led.value = 0x00;
|
||||
leds.push_back(wheel_led);
|
||||
|
||||
zone mouse_zone;
|
||||
mouse_zone.name = "Mouse";
|
||||
mouse_zone.type = ZONE_TYPE_LINEAR;
|
||||
mouse_zone.leds_min = 6;
|
||||
mouse_zone.leds_max = 6;
|
||||
mouse_zone.leds_count = 6;
|
||||
mouse_zone.matrix_map = NULL;
|
||||
zones.push_back(mouse_zone);
|
||||
|
||||
for(const steelseries_rival_led_info led_info: rival_600_leds)
|
||||
{
|
||||
led mouse_led;
|
||||
mouse_led.name = led_info.name;
|
||||
mouse_led.value = led_info.value;
|
||||
leds.push_back(mouse_led);
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesRival::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesRival::DeviceUpdateLEDs()
|
||||
{
|
||||
for(unsigned int i = 0; i < leds.size(); i++)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[i]);
|
||||
unsigned char grn = RGBGetGValue(colors[i]);
|
||||
unsigned char blu = RGBGetBValue(colors[i]);
|
||||
controller->SetColor(leds[i].value, red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesRival::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
for(unsigned int i = 0; i < zones[zone].leds_count; i++)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(zones[zone].colors[i]);
|
||||
unsigned char grn = RGBGetGValue(zones[zone].colors[i]);
|
||||
unsigned char blu = RGBGetBValue(zones[zone].colors[i]);
|
||||
controller->SetColor(zones[zone].leds[i].value, red, grn, blu);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesRival::UpdateSingleLED(int led)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[led]);
|
||||
unsigned char grn = RGBGetGValue(colors[led]);
|
||||
unsigned char blu = RGBGetBValue(colors[led]);
|
||||
controller->SetColor(leds[led].value, red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesRival::DeviceUpdateMode()
|
||||
{
|
||||
/* Strictly, the device actually does support different modes for the
|
||||
* different zones, but we don't support that. */
|
||||
//steelseries_type mouse_type = rival->GetMouseType();
|
||||
switch (modes[active_mode].value)
|
||||
{
|
||||
case STEELSERIES_RIVAL_DIRECT:
|
||||
controller->SetLightEffectAll(STEELSERIES_RIVAL_EFFECT_DIRECT);
|
||||
break;
|
||||
|
||||
case STEELSERIES_RIVAL_PULSATE:
|
||||
controller->SetLightEffectAll(modes[active_mode].speed);
|
||||
break;
|
||||
}
|
||||
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_SteelSeriesRival::DeviceSaveMode()
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
controller->SaveMode();
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_SteelSeriesRival.h |
|
||||
| |
|
||||
| RGBController for SteelSeries Rival |
|
||||
| |
|
||||
| B Horn (bahorn) 13 May 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "SteelSeriesRivalController.h"
|
||||
|
||||
class RGBController_SteelSeriesRival : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_SteelSeriesRival(SteelSeriesRivalController* controller_ptr);
|
||||
~RGBController_SteelSeriesRival();
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void DeviceUpdateMode();
|
||||
void DeviceSaveMode();
|
||||
|
||||
private:
|
||||
SteelSeriesRivalController* controller;
|
||||
};
|
||||
+353
@@ -0,0 +1,353 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| SteelSeriesRivalController.cpp |
|
||||
| |
|
||||
| Driver for SteelSeries Rival |
|
||||
| |
|
||||
| B Horn (bahorn) 13 May 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "SteelSeriesRivalController.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
static void send_usb_msg(hid_device* dev, unsigned char * data_pkt, unsigned int size)
|
||||
{
|
||||
unsigned char* usb_pkt = new unsigned char[size + 1];
|
||||
|
||||
usb_pkt[0] = 0x00;
|
||||
for(unsigned int i = 1; i < size + 1; i++)
|
||||
{
|
||||
usb_pkt[i] = data_pkt[i-1];
|
||||
}
|
||||
|
||||
hid_write(dev, usb_pkt, size + 1);
|
||||
|
||||
delete[] usb_pkt;
|
||||
}
|
||||
|
||||
SteelSeriesRivalController::SteelSeriesRivalController
|
||||
(
|
||||
hid_device* dev_handle,
|
||||
steelseries_type proto_type,
|
||||
const char* path,
|
||||
std::string dev_name
|
||||
)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
name = dev_name;
|
||||
proto = proto_type;
|
||||
}
|
||||
|
||||
SteelSeriesRivalController::~SteelSeriesRivalController()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string SteelSeriesRivalController::GetDeviceLocation()
|
||||
{
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string SteelSeriesRivalController::GetDeviceName()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string SteelSeriesRivalController::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));
|
||||
}
|
||||
|
||||
std::string SteelSeriesRivalController::GetFirmwareVersion()
|
||||
{
|
||||
if (proto != RIVAL_300 && proto != RIVAL_700) return "";
|
||||
|
||||
unsigned char usb_buf[2] = { 0x10, 0x00 };
|
||||
uint16_t version;
|
||||
std::string return_string;
|
||||
|
||||
send_usb_msg(dev, usb_buf, 2);
|
||||
hid_read(dev, (unsigned char *)&version, 2);
|
||||
|
||||
return_string = std::to_string(version);
|
||||
return return_string;
|
||||
}
|
||||
|
||||
steelseries_type SteelSeriesRivalController::GetMouseType()
|
||||
{
|
||||
return proto;
|
||||
}
|
||||
|
||||
/* Saves to the internal configuration */
|
||||
void SteelSeriesRivalController::SaveMode()
|
||||
{
|
||||
unsigned char usb_buf[9];
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
usb_buf[0x00] = 0x09;
|
||||
send_usb_msg(dev, usb_buf, 9);
|
||||
}
|
||||
|
||||
void SteelSeriesRivalController::SetLightEffect
|
||||
(
|
||||
unsigned char zone_id,
|
||||
unsigned char effect
|
||||
)
|
||||
{
|
||||
unsigned char usb_buf[9];
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
switch(proto)
|
||||
{
|
||||
case RIVAL_100:
|
||||
usb_buf[0x00] = 0x07;
|
||||
usb_buf[0x01] = 0x00;
|
||||
break;
|
||||
|
||||
case RIVAL_300:
|
||||
usb_buf[0x00] = 0x07;
|
||||
usb_buf[0x01] = zone_id + 1;
|
||||
break;
|
||||
|
||||
case RIVAL_700:
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
usb_buf[0x02] = effect;
|
||||
send_usb_msg(dev, usb_buf, 9);
|
||||
}
|
||||
|
||||
void SteelSeriesRivalController::SetLightEffectAll
|
||||
(
|
||||
unsigned char effect
|
||||
)
|
||||
{
|
||||
switch(proto)
|
||||
{
|
||||
case RIVAL_100:
|
||||
SetLightEffect(0, effect);
|
||||
break;
|
||||
|
||||
case RIVAL_300:
|
||||
SetLightEffect(0, effect);
|
||||
SetLightEffect(1, effect);
|
||||
break;
|
||||
|
||||
case RIVAL_650:
|
||||
for(int i=0x10; i<0x18; i++)
|
||||
{
|
||||
SetLightEffect(i, effect);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SteelSeriesRivalController::SetRival650Color
|
||||
(
|
||||
unsigned char zone_id,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
)
|
||||
{
|
||||
unsigned char usb_buf[60];
|
||||
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
usb_buf[0x00] = 0x03;
|
||||
usb_buf[0x04] = 0x30;
|
||||
usb_buf[0x06] = 0x10;
|
||||
usb_buf[0x07] = 0x27;
|
||||
usb_buf[0x16] = 0x01;
|
||||
usb_buf[0x1E] = 0x04;
|
||||
usb_buf[0x1F] = red;
|
||||
usb_buf[0x20] = green;
|
||||
usb_buf[0x21] = blue;
|
||||
usb_buf[0x22] = 0xFF;
|
||||
usb_buf[0x27] = 0xFF;
|
||||
usb_buf[0x29] = 0x54;
|
||||
usb_buf[0x2C] = 0xFF;
|
||||
usb_buf[0x2D] = 0x54;
|
||||
usb_buf[0x2E] = red;
|
||||
usb_buf[0x2F] = green;
|
||||
usb_buf[0x30] = blue;
|
||||
usb_buf[0x31] = 0x56;
|
||||
|
||||
send_usb_msg(dev, usb_buf, 60);
|
||||
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
usb_buf[0x00] = 0x03;
|
||||
usb_buf[0x02] = 0x30;
|
||||
usb_buf[0x04] = 0x2C;
|
||||
|
||||
send_usb_msg(dev, usb_buf, 60);
|
||||
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
usb_buf[0x00] = 0x05;
|
||||
usb_buf[0x02] = zone_id;//mousekey 0x10-0x17
|
||||
usb_buf[0x03] = 0xFF;
|
||||
usb_buf[0x08] = 0x5C;
|
||||
|
||||
send_usb_msg(dev, usb_buf, 60);
|
||||
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
usb_buf[0x00] = 0x1C;
|
||||
usb_buf[0x02] = 0x55;
|
||||
usb_buf[0x04] = 0x46;
|
||||
|
||||
send_usb_msg(dev, usb_buf, 60);
|
||||
}
|
||||
|
||||
void SteelSeriesRivalController::SetRival600Color
|
||||
(
|
||||
unsigned char zone_id,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
)
|
||||
{
|
||||
unsigned char usb_pkt[0x07];
|
||||
|
||||
memset(usb_pkt, 0x00, sizeof(usb_pkt));
|
||||
|
||||
usb_pkt[0x00] = 0x1c;
|
||||
usb_pkt[0x01] = 0x27;
|
||||
usb_pkt[0x02] = 0x00;
|
||||
usb_pkt[0x03] = 1 << zone_id;
|
||||
usb_pkt[0x04] = red;
|
||||
usb_pkt[0x05] = green;
|
||||
usb_pkt[0x06] = blue;
|
||||
|
||||
hid_write(dev, usb_pkt, 0x07);
|
||||
}
|
||||
|
||||
void SteelSeriesRivalController::SetRival700Color
|
||||
(
|
||||
unsigned char zone_id,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
)
|
||||
{
|
||||
const uint16_t REPORT_SIZE = 578;
|
||||
|
||||
unsigned char usb_buf[REPORT_SIZE];
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
usb_buf[0x00] = 0x05;
|
||||
usb_buf[0x02] = zone_id;
|
||||
|
||||
usb_buf[0x03] = red;
|
||||
usb_buf[0x04] = green;
|
||||
usb_buf[0x05] = blue;
|
||||
|
||||
usb_buf[0x0b] = zone_id;
|
||||
usb_buf[0x0c] = 0x01;
|
||||
|
||||
unsigned char *usb_pkt = new unsigned char[REPORT_SIZE + 1];
|
||||
|
||||
usb_pkt[0] = 0x00;
|
||||
for (unsigned int i = 1; i < REPORT_SIZE + 1; i++)
|
||||
{
|
||||
usb_pkt[i] = usb_buf[i - 1];
|
||||
}
|
||||
|
||||
hid_send_feature_report(dev, usb_pkt, REPORT_SIZE + 1);
|
||||
|
||||
delete[] usb_pkt;
|
||||
}
|
||||
|
||||
void SteelSeriesRivalController::SetColor
|
||||
(
|
||||
unsigned char zone_id,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
)
|
||||
{
|
||||
unsigned char usb_buf[9];
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
switch(proto)
|
||||
{
|
||||
case RIVAL_100:
|
||||
usb_buf[0x00] = 0x05;
|
||||
usb_buf[0x01] = 0x00;
|
||||
break;
|
||||
|
||||
case RIVAL_300:
|
||||
usb_buf[0x00] = 0x08;
|
||||
usb_buf[0x01] = zone_id + 1;
|
||||
break;
|
||||
|
||||
case RIVAL_650:
|
||||
SetRival650Color(zone_id, red, green, blue);
|
||||
return;
|
||||
|
||||
case RIVAL_600:
|
||||
SetRival600Color(zone_id, red, green, blue);
|
||||
return;
|
||||
|
||||
case RIVAL_700:
|
||||
SetRival700Color(zone_id, red, green, blue);
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
usb_buf[0x02] = red;
|
||||
usb_buf[0x03] = green;
|
||||
usb_buf[0x04] = blue;
|
||||
|
||||
send_usb_msg(dev, usb_buf, 9);
|
||||
}
|
||||
|
||||
void SteelSeriesRivalController::SetColorAll
|
||||
(
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
)
|
||||
{
|
||||
switch(proto)
|
||||
{
|
||||
case RIVAL_100:
|
||||
SetColor(0, red, green, blue);
|
||||
break;
|
||||
|
||||
case RIVAL_300:
|
||||
SetColor(0, red, green, blue);
|
||||
SetColor(1, red, green, blue);
|
||||
break;
|
||||
|
||||
case RIVAL_650:
|
||||
for(int i = 0x10; i < 0x18; i++)
|
||||
{
|
||||
SetColor(i, red, green, blue);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| SteelSeriesRivalController.h |
|
||||
| |
|
||||
| Driver for SteelSeries Rival |
|
||||
| |
|
||||
| B Horn (bahorn) 13 May 2020 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <hidapi.h>
|
||||
#include "SteelSeriesGeneric.h"
|
||||
|
||||
/* Mode, we then use these to set actual effect based on speed. */
|
||||
enum
|
||||
{
|
||||
STEELSERIES_RIVAL_DIRECT = 0x00,
|
||||
STEELSERIES_RIVAL_PULSATE = 0x01
|
||||
};
|
||||
|
||||
/* Effects */
|
||||
enum
|
||||
{
|
||||
STEELSERIES_RIVAL_EFFECT_DIRECT = 0x01,
|
||||
STEELSERIES_RIVAL_EFFECT_PULSATE_MIN = 0x02,
|
||||
STEELSERIES_RIVAL_EFFECT_PULSATE_MID = 0x03,
|
||||
STEELSERIES_RIVAL_EFFECT_PULSATE_MAX = 0x04
|
||||
};
|
||||
|
||||
class SteelSeriesRivalController
|
||||
{
|
||||
public:
|
||||
SteelSeriesRivalController
|
||||
(
|
||||
hid_device* dev_handle,
|
||||
steelseries_type proto_type,
|
||||
const char* path,
|
||||
std::string dev_name
|
||||
);
|
||||
|
||||
~SteelSeriesRivalController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetDeviceName();
|
||||
std::string GetSerialString();
|
||||
std::string GetFirmwareVersion();
|
||||
|
||||
steelseries_type GetMouseType();
|
||||
|
||||
void SaveMode();
|
||||
|
||||
void SetLightEffect
|
||||
(
|
||||
unsigned char zone_id,
|
||||
unsigned char effect
|
||||
);
|
||||
|
||||
void SetLightEffectAll
|
||||
(
|
||||
unsigned char effect
|
||||
);
|
||||
|
||||
void SetColor
|
||||
(
|
||||
unsigned char zone_id,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
);
|
||||
void SetColorAll
|
||||
(
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
);
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string name;
|
||||
steelseries_type proto;
|
||||
|
||||
void SetRival650Color
|
||||
(
|
||||
unsigned char zone_id,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
);
|
||||
|
||||
void SetRival600Color
|
||||
(
|
||||
unsigned char zone_id,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
);
|
||||
|
||||
void SetRival700Color
|
||||
(
|
||||
unsigned char zone_id,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user