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,78 @@
/*---------------------------------------------------------*\
| HyperXPulsefireRaidController.cpp |
| |
| Driver for HyperX Pulsefire Raid |
| |
| Morgan Guimard (morg) 06 Apr 2022 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include <cstring>
#include "HyperXPulsefireRaidController.h"
#include "StringUtils.h"
using namespace std::chrono_literals;
HyperXPulsefireRaidController::HyperXPulsefireRaidController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name)
{
dev = dev_handle;
location = info.path;
name = dev_name;
}
HyperXPulsefireRaidController::~HyperXPulsefireRaidController()
{
hid_close(dev);
}
std::string HyperXPulsefireRaidController::GetDeviceLocation()
{
return("HID: " + location);
}
std::string HyperXPulsefireRaidController::GetNameString()
{
return(name);
}
std::string HyperXPulsefireRaidController::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 HyperXPulsefireRaidController::SendColors(std::vector<RGBColor> colors)
{
unsigned char usb_buf[HYPERX_PULSFIRE_RAID_PACKET_DATA_LENGTH];
memset(usb_buf, 0x00, HYPERX_PULSFIRE_RAID_PACKET_DATA_LENGTH);
usb_buf[0] = HYPERX_PULSFIRE_RAID_REPORT_ID;
usb_buf[1] = HYPERX_PULSFIRE_RAID_DIRECT_MODE_START_PACKET;
for(unsigned int i = 0; i < 2; i++)
{
usb_buf[3 * i + 2] = RGBGetRValue(colors[i]);
usb_buf[3 * i + 3] = RGBGetGValue(colors[i]);
usb_buf[3 * i + 4] = RGBGetBValue(colors[i]);
}
usb_buf[8] = HYPERX_PULSFIRE_RAID_DIRECT_MODE_END_PACKET;
Send(usb_buf);
}
void HyperXPulsefireRaidController::Send(unsigned char* packet)
{
hid_send_feature_report(dev, packet, HYPERX_PULSFIRE_RAID_PACKET_DATA_LENGTH);
std::this_thread::sleep_for(10ms);
}
@@ -0,0 +1,51 @@
/*---------------------------------------------------------*\
| HyperXPulsefireRaidController.h |
| |
| Driver for HyperX Pulsefire Raid |
| |
| Morgan Guimard (morg) 06 Apr 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 HYPERX_PULSFIRE_RAID_PACKET_DATA_LENGTH 264
#define HYPERX_PULSFIRE_RAID_REPORT_ID 0x07
#define HYPERX_PULSFIRE_RAID_LEDS_COUNT 2
#define HYPERX_PULSFIRE_RAID_DIRECT_MODE_START_PACKET 0x0A
#define HYPERX_PULSFIRE_RAID_DIRECT_MODE_END_PACKET 0xA0
enum
{
HYPERX_PULSFIRE_RAID_BRIGHTNESS_MIN = 0x00,
HYPERX_PULSFIRE_RAID_BRIGHTNESS_MAX = 0x64
};
class HyperXPulsefireRaidController
{
public:
HyperXPulsefireRaidController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name);
~HyperXPulsefireRaidController();
std::string GetNameString();
std::string GetSerialString();
std::string GetDeviceLocation();
void SendColors(std::vector<RGBColor> colors);
void SetBrightness(unsigned char brightness);
protected:
hid_device* dev;
private:
std::string location;
std::string name;
void Send(unsigned char* packet);
};
@@ -0,0 +1,135 @@
/*---------------------------------------------------------*\
| RGBController_HyperXPulsefireRaid.cpp |
| |
| RGBController for HyperX Pulsefire Raid |
| |
| Morgan Guimard (morg) 06 Apr 2022 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "RGBController_HyperXPulsefireRaid.h"
/**------------------------------------------------------------------*\
@name HyperX Pulsefire Raid
@category Mouse
@type USB
@save :x:
@direct :white_check_mark:
@effects :x:
@detectors DetectHyperXPulsefireRaidControllers
@comment
\*-------------------------------------------------------------------*/
using namespace std::chrono_literals;
RGBController_HyperXPulsefireRaid::RGBController_HyperXPulsefireRaid(HyperXPulsefireRaidController* controller_ptr)
{
controller = controller_ptr;
name = controller->GetNameString();
vendor = "HyperX";
type = DEVICE_TYPE_MOUSE;
description = "HyperX Pulsefire Raid Device";
location = controller->GetDeviceLocation();
serial = controller->GetSerialString();
mode Direct;
Direct.name = "Direct";
Direct.value = 0x00;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Direct.color_mode = MODE_COLORS_PER_LED;
Direct.brightness = HYPERX_PULSFIRE_RAID_BRIGHTNESS_MAX;
Direct.brightness_min = HYPERX_PULSFIRE_RAID_BRIGHTNESS_MIN;
Direct.brightness_max = HYPERX_PULSFIRE_RAID_BRIGHTNESS_MAX;
modes.push_back(Direct);
SetupZones();
/*-----------------------------------------------------*\
| This devices requires a keepalive thread or it will |
| reset to default (flash) |
\*-----------------------------------------------------*/
keepalive_thread_run = 1;
keepalive_thread = new std::thread(&RGBController_HyperXPulsefireRaid::KeepaliveThread, this);
}
RGBController_HyperXPulsefireRaid::~RGBController_HyperXPulsefireRaid()
{
}
void RGBController_HyperXPulsefireRaid::SetupZones()
{
std::string led_names[HYPERX_PULSFIRE_RAID_LEDS_COUNT] =
{
"Scroll Wheel", "Logo"
};
for(unsigned int i = 0; i < HYPERX_PULSFIRE_RAID_LEDS_COUNT; i++)
{
zone new_zone;
new_zone.name = led_names[i];
new_zone.type = ZONE_TYPE_SINGLE;
new_zone.leds_min = 1;
new_zone.leds_max = 1;
new_zone.leds_count = 1;
new_zone.matrix_map = NULL;
zones.push_back(new_zone);
led new_led;
new_led.name = led_names[i];
leds.push_back(new_led);
}
SetupColors();
}
void RGBController_HyperXPulsefireRaid::ResizeZone(int /*zone*/, int /*new_size*/)
{
}
void RGBController_HyperXPulsefireRaid::DeviceUpdateLEDs()
{
UpdateSingleLED(0);
}
void RGBController_HyperXPulsefireRaid::UpdateZoneLEDs(int zone)
{
UpdateSingleLED(zone);
}
void RGBController_HyperXPulsefireRaid::UpdateSingleLED(int /*led*/)
{
last_update_time = std::chrono::steady_clock::now();
controller->SendColors(colors);
}
void RGBController_HyperXPulsefireRaid::DeviceUpdateMode()
{
}
void RGBController_HyperXPulsefireRaid::DeviceSaveMode()
{
}
void RGBController_HyperXPulsefireRaid::KeepaliveThread()
{
while(keepalive_thread_run.load())
{
if(active_mode == 0)
{
if((std::chrono::steady_clock::now() - last_update_time) > 1s)
{
UpdateLEDs();
}
}
std::this_thread::sleep_for(10ms);
}
}
@@ -0,0 +1,40 @@
/*---------------------------------------------------------*\
| RGBController_HyperXPulsefireRaid.h |
| |
| RGBController for HyperX Pulsefire Raid |
| |
| Morgan Guimard (morg) 06 Apr 2022 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include <chrono>
#include "RGBController.h"
#include "HyperXPulsefireRaidController.h"
class RGBController_HyperXPulsefireRaid : public RGBController
{
public:
RGBController_HyperXPulsefireRaid(HyperXPulsefireRaidController* controller_ptr);
~RGBController_HyperXPulsefireRaid();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void DeviceUpdateMode();
void DeviceSaveMode();
private:
HyperXPulsefireRaidController* controller;
std::thread* keepalive_thread;
std::atomic<bool> keepalive_thread_run;
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
void KeepaliveThread();
};