Publish LumaOps source

This commit is contained in:
LumaOps release export
2026-09-03 01:18:36 +02:00
commit 7f1c0e5f71
2363 changed files with 501543 additions and 0 deletions
@@ -0,0 +1,200 @@
/*---------------------------------------------------------*\
| RGBController_SteelSeriesOldApex.cpp |
| |
| RGBController for older SteelSeries Apex keyboards |
| (Apex/Apex Fnatic/Apex 350) |
| |
| Based on findings in ApexCtl by Audrius/tuxmark5, et. |
| al, https://github.com/tuxmark5/ApexCtl |
| |
| David Lee (RAMChYLD) 15 Nov 2020 |
| Based on work by B Horn (bahorn) 13 May 2020 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "RGBController_SteelSeriesOldApex.h"
/**------------------------------------------------------------------*\
@name Steel Series Apex (Old)
@category Keyboard
@type USB
@save :x:
@direct :white_check_mark:
@effects :x:
@detectors DetectSteelSeriesApexOld
@comment
\*-------------------------------------------------------------------*/
RGBController_SteelSeriesOldApex::RGBController_SteelSeriesOldApex(SteelSeriesOldApexController* controller_ptr)
{
controller = controller_ptr;
name = controller->GetDeviceName();
vendor = "SteelSeries";
type = DEVICE_TYPE_KEYBOARD;
description = "SteelSeries Old Apex Device";
location = controller->GetDeviceLocation();
serial = controller->GetSerialString();
mode direct;
direct.name = "Direct";
direct.value = STEELSERIES_OLDAPEX_DIRECT;
direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(direct);
SetupZones();
}
RGBController_SteelSeriesOldApex::~RGBController_SteelSeriesOldApex()
{
delete controller;
}
void RGBController_SteelSeriesOldApex::SetupZones()
{
/* We have 5 zones to work with. Here goes... */
zone qwerty_zone;
qwerty_zone.name = "QWERTY";
qwerty_zone.type = ZONE_TYPE_LINEAR;
qwerty_zone.leds_min = 1;
qwerty_zone.leds_max = 1;
qwerty_zone.leds_count = 1;
qwerty_zone.matrix_map = NULL;
zones.push_back(qwerty_zone);
led qwerty_led;
qwerty_led.name = "QWERTY";
leds.push_back(qwerty_led);
zone tenkey_zone;
tenkey_zone.name = "TenKey";
tenkey_zone.type = ZONE_TYPE_LINEAR;
tenkey_zone.leds_min = 1;
tenkey_zone.leds_max = 1;
tenkey_zone.leds_count = 1;
tenkey_zone.matrix_map = NULL;
zones.push_back(tenkey_zone);
led tenkey_led;
tenkey_led.name = "TenKey";
leds.push_back(tenkey_led);
zone function_zone;
function_zone.name = "FunctionKeys";
function_zone.type = ZONE_TYPE_LINEAR;
function_zone.leds_min = 1;
function_zone.leds_max = 1;
function_zone.leds_count = 1;
function_zone.matrix_map = NULL;
zones.push_back(function_zone);
led function_led;
function_led.name = "FunctionKeys";
leds.push_back(function_led);
zone mx_zone;
mx_zone.name = "MXKeys";
mx_zone.type = ZONE_TYPE_LINEAR;
mx_zone.leds_min = 1;
mx_zone.leds_max = 1;
mx_zone.leds_count = 1;
mx_zone.matrix_map = NULL;
zones.push_back(mx_zone);
led mx_led;
mx_led.name = "MXKeys";
leds.push_back(mx_led);
zone logo_zone;
logo_zone.name = "Logo";
logo_zone.type = ZONE_TYPE_LINEAR;
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";
leds.push_back(logo_led);
SetupColors();
}
void RGBController_SteelSeriesOldApex::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_SteelSeriesOldApex::DeviceUpdateLEDs()
{
// Due to the inefficient packet design of the OG Apex
// All colors must be blasted with each update
color32 qwerty;
qwerty.red = RGBGetRValue(colors[0]);
qwerty.green = RGBGetGValue(colors[0]);
qwerty.blue = RGBGetBValue(colors[0]);
qwerty.alpha = modes[active_mode].value;
color32 tenkey;
tenkey.red = RGBGetRValue(colors[1]);
tenkey.green = RGBGetGValue(colors[1]);
tenkey.blue = RGBGetBValue(colors[1]);
tenkey.alpha = modes[active_mode].value;
color32 functionkey;
functionkey.red = RGBGetRValue(colors[2]);
functionkey.green = RGBGetGValue(colors[2]);
functionkey.blue = RGBGetBValue(colors[2]);
functionkey.alpha = modes[active_mode].value;
color32 mxkey;
mxkey.red = RGBGetRValue(colors[3]);
mxkey.green = RGBGetGValue(colors[3]);
mxkey.blue = RGBGetBValue(colors[3]);
mxkey.alpha = modes[active_mode].value;
color32 logo;
logo.red = RGBGetRValue(colors[4]);
logo.green = RGBGetGValue(colors[4]);
logo.blue = RGBGetBValue(colors[4]);
logo.alpha = modes[active_mode].value;
controller->SetColorDetailed(qwerty, tenkey, functionkey, mxkey, logo);
}
void RGBController_SteelSeriesOldApex::UpdateZoneLEDs(int /*zone*/)
{
// updating for one zone is pointless,
// all zones have to be blasted anyway
// so just do a full update
DeviceUpdateLEDs();
}
void RGBController_SteelSeriesOldApex::UpdateSingleLED(int /*led*/)
{
// Each zone is one LED, however
// updating for one zone is pointless,
// all zones have to be blasted anyway
// so just do a full update
DeviceUpdateLEDs();
}
void RGBController_SteelSeriesOldApex::DeviceUpdateMode()
{
// We are using SetLightingEffect to control the brightness of
// LEDs. Per-zone brightness is actually possible but we are not
// doing that for now. Brightness affects whole keyboard.
// Because at the moment all this code does is change brightness,
// We just let the new value set in and do a device LED update
// and blast the brightness value along with the RGB values
DeviceUpdateLEDs();
}
@@ -0,0 +1,40 @@
/*---------------------------------------------------------*\
| RGBController_SteelSeriesOldApex.h |
| |
| RGBController for older SteelSeries Apex keyboards |
| (Apex/Apex Fnatic/Apex 350) |
| |
| Based on findings in ApexCtl by Audrius/tuxmark5, et. |
| al, https://github.com/tuxmark5/ApexCtl |
| |
| David Lee (RAMChYLD) 15 Nov 2020 |
| Based on work by 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 "SteelSeriesOldApexController.h"
#include "color32.h"
class RGBController_SteelSeriesOldApex : public RGBController
{
public:
RGBController_SteelSeriesOldApex(SteelSeriesOldApexController* controller_ptr);
~RGBController_SteelSeriesOldApex();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void DeviceUpdateMode();
private:
SteelSeriesOldApexController* controller;
};
@@ -0,0 +1,124 @@
/*---------------------------------------------------------*\
| SteelSeriesOldApexController.cpp |
| |
| Driver for older SteelSeries Apex keyboards |
| (Apex/Apex Fnatic/Apex 350) |
| |
| Based on findings in ApexCtl by Audrius/tuxmark5, et. |
| al, https://github.com/tuxmark5/ApexCtl |
| |
| David Lee (RAMChYLD) 15 Nov 2020 |
| Based on work by B Horn (bahorn) 13 May 2020 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include <cstring>
#include <stdio.h>
#include <stdlib.h>
#include "SteelSeriesOldApexController.h"
#include "StringUtils.h"
static void send_usb_msg(hid_device* dev, char * data_pkt, unsigned int size)
{
char* usb_pkt = new 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, (unsigned char *)usb_pkt, size + 1);
delete[] usb_pkt;
}
SteelSeriesOldApexController::SteelSeriesOldApexController
(
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;
}
SteelSeriesOldApexController::~SteelSeriesOldApexController()
{
hid_close(dev);
}
std::string SteelSeriesOldApexController::GetDeviceLocation()
{
return("HID: " + location);
}
std::string SteelSeriesOldApexController::GetDeviceName()
{
return(name);
}
std::string SteelSeriesOldApexController::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));
}
steelseries_type SteelSeriesOldApexController::GetKeyboardType()
{
return proto;
}
void SteelSeriesOldApexController::SetColorDetailed(color32 qwerty, color32 tenkey, color32 functionkey, color32 mxkey, color32 logo)
{
char usb_buf[32];
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x07;
usb_buf[0x01] = 0x00; // All zones
// QWERTY Zone
usb_buf[0x02] = qwerty.red;
usb_buf[0x03] = qwerty.green;
usb_buf[0x04] = qwerty.blue;
usb_buf[0x05] = qwerty.alpha;
// Tenkey Zone
usb_buf[0x06] = tenkey.red;
usb_buf[0x07] = tenkey.green;
usb_buf[0x08] = tenkey.blue;
usb_buf[0x09] = tenkey.alpha;
// FunctionKey Zone
usb_buf[0x0A] = functionkey.red;
usb_buf[0x0B] = functionkey.green;
usb_buf[0x0C] = functionkey.blue;
usb_buf[0x0D] = functionkey.alpha;
// MXKey Zone
usb_buf[0x0E] = mxkey.red;
usb_buf[0x0F] = mxkey.green;
usb_buf[0x10] = mxkey.blue;
usb_buf[0x11] = mxkey.alpha;
//Logo Zone
usb_buf[0x12] = logo.red;
usb_buf[0x13] = logo.green;
usb_buf[0x14] = logo.blue;
usb_buf[0x15] = logo.alpha;
send_usb_msg(dev, usb_buf, 32);
}
@@ -0,0 +1,71 @@
/*---------------------------------------------------------*\
| SteelSeriesOldApexController.h |
| |
| Driver for older SteelSeries Apex keyboards |
| (Apex/Apex Fnatic/Apex 350) |
| |
| Based on findings in ApexCtl by Audrius/tuxmark5, et. |
| al, https://github.com/tuxmark5/ApexCtl |
| |
| David Lee (RAMChYLD) 15 Nov 2020 |
| Based on work by 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 "color32.h"
#include "SteelSeriesGeneric.h"
/* Mode, we then use these to set actual effect based on speed. */
enum
{
STEELSERIES_OLDAPEX_DIRECT = 0x08,
};
/* Effects */
enum
{
STEELSERIES_OLDAPEX_EFFECT_DIRECT = 0x08,
};
class SteelSeriesOldApexController
{
public:
SteelSeriesOldApexController
(
hid_device* dev_handle,
steelseries_type proto_type,
const char* path,
std::string dev_name
);
~SteelSeriesOldApexController();
std::string GetDeviceLocation();
std::string GetDeviceName();
std::string GetSerialString();
steelseries_type GetKeyboardType();
void SetColorDetailed
(
color32 qwerty,
color32 tenkey,
color32 functionkey,
color32 mxkey,
color32 logo
);
void DoUpdateLEDs();
private:
hid_device* dev;
std::string location;
std::string name;
steelseries_type proto;
};