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,102 @@
/*---------------------------------------------------------*\
| LogitechX56Controller.cpp |
| |
| Driver for Logitech X56 |
| |
| Edbgon 11 Jun 2021 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include <cstring>
#include "LogitechX56Controller.h"
#include "StringUtils.h"
LogitechX56Controller::LogitechX56Controller(hid_device* dev_handle, const char* path, std::string dev_name)
{
dev = dev_handle;
location = path;
name = dev_name;
}
LogitechX56Controller::~LogitechX56Controller()
{
hid_close(dev);
}
std::string LogitechX56Controller::GetDeviceLocation()
{
return("HID: " + location);
}
std::string LogitechX56Controller::GetDeviceName()
{
return(name);
}
std::string LogitechX56Controller::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 LogitechX56Controller::SetColor(RGBColor color, uint8_t brightness)
{
unsigned char buf[X56_CONTROLLER_PACKET_SIZE];
unsigned char cbuf[X56_CONTROLLER_PACKET_SIZE];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(buf, 0x00, X56_CONTROLLER_PACKET_SIZE);
memset(cbuf, 0x00, X56_CONTROLLER_PACKET_SIZE);
/*-----------------------------------------------------*\
| Set up init packet |
\*-----------------------------------------------------*/
buf[0x00] = 0x09;
buf[0x02] = 0x02;
buf[0x03] = brightness;
/*-----------------------------------------------------*\
| Set up color packet |
\*-----------------------------------------------------*/
cbuf[0x00] = 0x09;
cbuf[0x02] = 0x03;
cbuf[0x03] = RGBGetRValue(color);
cbuf[0x04] = RGBGetGValue(color);
cbuf[0x05] = RGBGetBValue(color);
/*-----------------------------------------------------*\
| Send packets |
\*-----------------------------------------------------*/
hid_send_feature_report(dev, buf, X56_CONTROLLER_PACKET_SIZE);
hid_send_feature_report(dev, cbuf, X56_CONTROLLER_PACKET_SIZE);
}
void LogitechX56Controller::Save()
{
uint8_t buffer[X56_CONTROLLER_PACKET_SIZE];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(buffer, 0x00, X56_CONTROLLER_PACKET_SIZE);
/*-----------------------------------------------------*\
| Set up init packet |
\*-----------------------------------------------------*/
buffer[0x00] = 0x01;
buffer[0x01] = 0x01;
hid_send_feature_report(dev, buffer, X56_CONTROLLER_PACKET_SIZE);
}
@@ -0,0 +1,38 @@
/*---------------------------------------------------------*\
| LogitechX56Controller.h |
| |
| Driver for Logitech X56 |
| |
| Edbgon 11 Jun 2021 |
| |
| 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 X56_CONTROLLER_PACKET_SIZE 64
class LogitechX56Controller
{
public:
LogitechX56Controller(hid_device* dev_handle, const char* path, std::string dev_name);
~LogitechX56Controller();
std::string GetDeviceLocation();
std::string GetDeviceName();
std::string GetSerialString();
void SetColor(RGBColor colors, uint8_t brightness);
void Save();
private:
hid_device* dev;
std::string location;
std::string name;
};
@@ -0,0 +1,110 @@
/*---------------------------------------------------------*\
| RGBController_LogitechX56.cpp |
| |
| RGBController for Logitech X56 |
| |
| Edbgon 11 Jun 2021 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "RGBController_LogitechX56.h"
/**------------------------------------------------------------------*\
@name Logitech X56
@category Gamepad
@type USB
@save :white_check_mark:
@direct :white_check_mark:
@effects :x:
@detectors DetectLogitechX56
@comment
\*-------------------------------------------------------------------*/
RGBController_LogitechX56::RGBController_LogitechX56(LogitechX56Controller* controller_ptr)
{
controller = controller_ptr;
name = controller->GetDeviceName();
vendor = "Logitech";
type = DEVICE_TYPE_GAMEPAD;
description = "Logitech X56 Device";
location = controller->GetDeviceLocation();
serial = controller->GetSerialString();
mode Direct;
Direct.name = "Direct";
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE | MODE_FLAG_HAS_BRIGHTNESS;
Direct.color_mode = MODE_COLORS_PER_LED;
Direct.brightness_min = 0x00;
Direct.brightness_max = 0x64;
Direct.brightness = 0x64;
modes.push_back(Direct);
SetupZones();
}
RGBController_LogitechX56::~RGBController_LogitechX56()
{
delete controller;
}
void RGBController_LogitechX56::SetupZones()
{
/*---------------------------------------------------------*\
| Each device has only one zone and LED |
\*---------------------------------------------------------*/
zone x56_zone;
x56_zone.name = "X56";
x56_zone.type = ZONE_TYPE_SINGLE;
x56_zone.leds_min = 1;
x56_zone.leds_max = 1;
x56_zone.leds_count = 1;
x56_zone.matrix_map = NULL;
zones.push_back(x56_zone);
led x56_led;
x56_led.name = "X56";
leds.push_back(x56_led);
SetupColors();
}
void RGBController_LogitechX56::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_LogitechX56::DeviceUpdateLEDs()
{
controller->SetColor(colors[0], modes[active_mode].brightness);
}
void RGBController_LogitechX56::UpdateZoneLEDs(int /*zone*/)
{
/*---------------------------------------------------------*\
| Packet expects both LEDs |
\*---------------------------------------------------------*/
DeviceUpdateLEDs();
}
void RGBController_LogitechX56::UpdateSingleLED(int /*led*/)
{
/*---------------------------------------------------------*\
| Packet expects both LEDs |
\*---------------------------------------------------------*/
DeviceUpdateLEDs();
}
void RGBController_LogitechX56::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}
void RGBController_LogitechX56::DeviceSaveMode()
{
controller->Save();
}
@@ -0,0 +1,36 @@
/*---------------------------------------------------------*\
| RGBController_LogitechX56.h |
| |
| RGBController for Logitech X56 |
| |
| Edbgon 11 Jun 2021 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include "RGBController.h"
#include "LogitechX56Controller.h"
class RGBController_LogitechX56 : public RGBController
{
public:
RGBController_LogitechX56(LogitechX56Controller* controller_ptr);
~RGBController_LogitechX56();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void DeviceUpdateMode();
void DeviceSaveMode();
private:
LogitechX56Controller* controller;
};