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,75 @@
/*---------------------------------------------------------*\
| LexipMouseController.cpp |
| |
| Driver for Lexip mouse |
| |
| Morgan Guimard (morg) 21 Feb 2022 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include <string.h>
#include "LexipMouseController.h"
#include "StringUtils.h"
LexipMouseController::LexipMouseController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name)
{
dev = dev_handle;
location = info.path;
name = dev_name;
}
LexipMouseController::~LexipMouseController()
{
hid_close(dev);
}
std::string LexipMouseController::GetDeviceLocation()
{
return("HID: " + location);
}
std::string LexipMouseController::GetNameString()
{
return(name);
}
std::string LexipMouseController::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 LexipMouseController::SetDirect(RGBColor color)
{
/*-----------------------------------------*\
| Send a change color packet |
| |
| URB INTERRUPT OUT, pad a leading zero |
| |
| 00 24 01 RR GG BB 00 64 80 00 .... 00 |
\*-----------------------------------------*/
unsigned char usb_buf[PACKET_DATA_LENGTH];
memset(usb_buf, 0x00, PACKET_DATA_LENGTH);
usb_buf[0x01] = 0x24; // constant data
usb_buf[0x02] = 0x01; // constant data
usb_buf[0x03] = RGBGetRValue(color); // red channel
usb_buf[0x04] = RGBGetGValue(color); // green channel
usb_buf[0x05] = RGBGetBValue(color); // blue channel
usb_buf[0x07] = 0x64; // constant data
usb_buf[0x08] = 0x80; // constant data
hid_write(dev, usb_buf, PACKET_DATA_LENGTH);
}
@@ -0,0 +1,38 @@
/*---------------------------------------------------------*\
| LexipMouseController.h |
| |
| Driver for Lexip mouse |
| |
| Morgan Guimard (morg) 21 Feb 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 PACKET_DATA_LENGTH 64
class LexipMouseController
{
public:
LexipMouseController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name);
~LexipMouseController();
std::string GetDeviceLocation();
std::string GetNameString();
std::string GetSerialString();
void SetDirect(RGBColor color);
protected:
hid_device* dev;
private:
std::string location;
std::string name;
std::string version;
};
@@ -0,0 +1,39 @@
/*---------------------------------------------------------*\
| LexipMouseControllerDetect.cpp |
| |
| Detector for Lexip mouse |
| |
| Morgan Guimard (morg) 21 Feb 2022 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "Detector.h"
#include "LexipMouseController.h"
#include "RGBController_LexipMouse.h"
/*---------------------------------------------------------*\
| Lexip vendor ID |
\*---------------------------------------------------------*/
#define LEXIP_VID 0x04D8
/*---------------------------------------------------------*\
| Product ID |
\*---------------------------------------------------------*/
#define LEXIP_NP93_ALPHA_PID 0xFD0A
void DetectLexipMouseControllers(hid_device_info* info, const std::string& name)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
LexipMouseController* controller = new LexipMouseController(dev, *info, name);
RGBController_LexipMouse* rgb_controller = new RGBController_LexipMouse(controller);
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
REGISTER_HID_DETECTOR_IPU("Np93 ALPHA - Gaming Mouse", DetectLexipMouseControllers, LEXIP_VID, LEXIP_NP93_ALPHA_PID, 0, 0x0001, 2);
@@ -0,0 +1,97 @@
/*---------------------------------------------------------*\
| RGBController_LexipMouse.cpp |
| |
| RGBController for Lexip mouse |
| |
| Morgan Guimard (morg) 21 Feb 2022 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include <chrono>
#include <thread>
#include "RGBController_LexipMouse.h"
/**------------------------------------------------------------------*\
@name Lexip Mouse
@category Mouse
@type USB
@save :x:
@direct :white_check_mark:
@effects :x:
@detectors DetectLexipMouseControllers
@comment
\*-------------------------------------------------------------------*/
RGBController_LexipMouse::RGBController_LexipMouse(LexipMouseController* controller_ptr)
{
controller = controller_ptr;
name = controller->GetNameString();
vendor = "Lexip";
type = DEVICE_TYPE_MOUSE;
description = name;
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_LexipMouse::~RGBController_LexipMouse()
{
delete controller;
}
void RGBController_LexipMouse::SetupZones()
{
zone new_zone;
new_zone.name = "Mouse";
new_zone.type = ZONE_TYPE_LINEAR;
new_zone.leds_min = 1;
new_zone.leds_max = 1;
new_zone.leds_count = 1;
new_zone.matrix_map = nullptr;
zones.emplace_back(new_zone);
leds.resize(1);
leds[0].name = "LED 1";
SetupColors();
}
void RGBController_LexipMouse::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_LexipMouse::DeviceUpdateLEDs()
{
UpdateZoneLEDs(0);
}
void RGBController_LexipMouse::UpdateZoneLEDs(int /*zone*/)
{
controller->SetDirect(colors[0]);
}
void RGBController_LexipMouse::UpdateSingleLED(int led)
{
UpdateZoneLEDs(led);
}
void RGBController_LexipMouse::DeviceUpdateMode()
{
UpdateZoneLEDs(0);
}
@@ -0,0 +1,34 @@
/*---------------------------------------------------------*\
| RGBController_LexipMouse.h |
| |
| RGBController for Lexip mouse |
| |
| Morgan Guimard (morg) 21 Feb 2022 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include "RGBController.h"
#include "LexipMouseController.h"
class RGBController_LexipMouse : public RGBController
{
public:
RGBController_LexipMouse(LexipMouseController* controller_ptr);
~RGBController_LexipMouse();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void DeviceUpdateMode();
private:
LexipMouseController* controller;
};