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,32 @@
/*---------------------------------------------------------*\
| MNTKeyboardController.cpp |
| |
| Driver for the MNT Reform keyboards |
| |
| Christian Heller <c.heller@plomlompom.de> 7 Aug 2024 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "MNTKeyboardController.h"
MNTKeyboardController::~MNTKeyboardController()
{
hid_close(dev);
}
void MNTKeyboardController::SendColorMatrix(unsigned char *color_map)
{
unsigned char row_size = kbd_cols * KBD_COLOR_SIZE;
unsigned char cmdbuf_size = CMD_OFFSET + row_size;
unsigned char *usb_buf = new unsigned char[cmdbuf_size];
memcpy(usb_buf, CMD_PREFIX, CMD_PREFIX_LEN);
for(unsigned int row_idx = 0; row_idx < KBD_ROWS; row_idx++)
{
usb_buf[CMD_PREFIX_LEN] = row_idx;
memcpy(usb_buf + CMD_OFFSET, color_map + row_idx * row_size, row_size);
hid_write(dev, usb_buf, cmdbuf_size);
}
delete[] usb_buf;
}
@@ -0,0 +1,43 @@
/*---------------------------------------------------------*\
| MNTKeyboardController.h |
| |
| Driver for the MNT Reform keyboards |
| |
| Christian Heller <c.heller@plomlompom.de> 7 Aug 2024 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include <hidapi.h>
#include <cstring>
#include <string>
#include "Detector.h"
#include "LogManager.h"
#define KBD_ROWS 6
#define KBD_COLOR_SIZE 3
#define CMD_PREFIX "xXRGB"
#define CMD_OFFSET (sizeof("xXRGB"))
#define CMD_PREFIX_LEN CMD_OFFSET - 1
#define KBD_VID 0x1209
#define KBD_INTERFACE 0
#define HID_USAGE_PAGE_DESKTOP 0x01
#define HID_USAGE_DESKTOP_KEYBOARD 0x06
class MNTKeyboardController
{
public:
~MNTKeyboardController();
void SendColorMatrix(unsigned char *color_map);
std::string location;
unsigned char kbd_cols;
protected:
hid_device *dev;
};
@@ -0,0 +1,51 @@
/*---------------------------------------------------------*\
| MNTKeyboardControllerDetect.cpp |
| |
| Driver for the MNT Reform keyboards |
| |
| Christian Heller <c.heller@plomlompom.de> 7 Aug 2024 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "Detector.h"
#include "LogManager.h"
#include <hidapi.h>
#include "MNTReformKeyboardController.h"
#include "MNTPocketReformKeyboardController.h"
#include "RGBController_MNTReformKeyboard.h"
#include "RGBController_MNTPocketReformKeyboard.h"
#define PID_KBD_REFORM 0x6D02
#define PID_KBD_POCKET_REFORM 0x6D06
void DetectMNTKeyboardControllers(hid_device_info *info, const std::string &name)
{
LOG_DEBUG("[%s] trying to detect … ", name.c_str());
hid_device *dev = hid_open_path(info->path);
if(dev)
{
LOG_DEBUG("[%s] found at %s", name.c_str(), info->path);
if(info->product_id == PID_KBD_REFORM)
{
MNTReformKeyboardController *controller = new MNTReformKeyboardController(dev, info->path);
RGBController_MNTReformKeyboard *rgb_controller = new RGBController_MNTReformKeyboard(controller);
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
else if(info->product_id == PID_KBD_POCKET_REFORM)
{
MNTPocketReformKeyboardController *controller = new MNTPocketReformKeyboardController(dev, info->path);
RGBController_MNTPocketReformKeyboard *rgb_controller = new RGBController_MNTPocketReformKeyboard(controller);
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
else
{
return;
}
LOG_DEBUG("[%s] successfully registered", name.c_str());
}
}
REGISTER_HID_DETECTOR_IPU("MNT Reform Keyboard", DetectMNTKeyboardControllers, KBD_VID, PID_KBD_REFORM, KBD_INTERFACE, HID_USAGE_PAGE_DESKTOP, HID_USAGE_DESKTOP_KEYBOARD);
REGISTER_HID_DETECTOR_IPU("MNT Pocket Reform Keyboard", DetectMNTKeyboardControllers, KBD_VID, PID_KBD_POCKET_REFORM, KBD_INTERFACE, HID_USAGE_PAGE_DESKTOP, HID_USAGE_DESKTOP_KEYBOARD);
@@ -0,0 +1,19 @@
/*---------------------------------------------------------*\
| MNTPocketReformKeyboardController.cpp |
| |
| Driver for the MNT Reform keyboards |
| |
| Christian Heller <c.heller@plomlompom.de> 7 Aug 2024 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "MNTPocketReformKeyboardController.h"
MNTPocketReformKeyboardController::MNTPocketReformKeyboardController(hid_device *dev_handle, const char *path)
{
dev = dev_handle;
location = path;
kbd_cols = KBD_COLS_POCKET_REFORM;
}
@@ -0,0 +1,22 @@
/*---------------------------------------------------------*\
| MNTPocketReformKeyboardController.cpp |
| |
| Driver for the MNT Reform keyboards |
| |
| Christian Heller <c.heller@plomlompom.de> 7 Aug 2024 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include "MNTKeyboardController.h"
#define KBD_COLS_POCKET_REFORM 12
class MNTPocketReformKeyboardController : public MNTKeyboardController
{
public:
MNTPocketReformKeyboardController(hid_device *dev_handle, const char *path);
};
@@ -0,0 +1,19 @@
/*---------------------------------------------------------*\
| MNTReformKeyboardController.cpp |
| |
| Driver for the MNT Reform keyboards |
| |
| Christian Heller <c.heller@plomlompom.de> 7 Aug 2024 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "MNTReformKeyboardController.h"
MNTReformKeyboardController::MNTReformKeyboardController(hid_device *dev_handle, const char *path)
{
dev = dev_handle;
location = path;
kbd_cols = KBD_COLS_REFORM;
}
@@ -0,0 +1,22 @@
/*---------------------------------------------------------*\
| MNTReformKeyboardController.h |
| |
| Driver for the MNT Reform keyboards |
| |
| Christian Heller <c.heller@plomlompom.de> 7 Aug 2024 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include "MNTKeyboardController.h"
#define KBD_COLS_REFORM 14
class MNTReformKeyboardController : public MNTKeyboardController
{
public:
MNTReformKeyboardController(hid_device *dev_handle, const char *path);
};
@@ -0,0 +1,81 @@
/*---------------------------------------------------------*\
| RGBController_MNTKeyboard.cpp |
| |
| Driver for the MNT Reform keyboards |
| |
| Christian Heller <c.heller@plomlompom.de> 7 Aug 2024 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "RGBController_MNTKeyboard.h"
void RGBController_MNTKeyboard::CommonInit()
{
vendor = "MNT Research";
type = DEVICE_TYPE_KEYBOARD;
location = controller->location;
modes.resize(1);
modes[0].name = "Direct";
modes[0].flags = MODE_FLAG_HAS_PER_LED_COLOR;
modes[0].color_mode = MODE_COLORS_PER_LED;
SetupZones();
SetAllLEDs(ToRGBColor(255, 255, 255));
DeviceUpdateLEDs();
}
RGBController_MNTKeyboard::~RGBController_MNTKeyboard()
{
delete zones[0].matrix_map;
delete controller;
}
void RGBController_MNTKeyboard::SetupZones()
{
zone new_zone;
new_zone.type = ZONE_TYPE_MATRIX;
new_zone.leds_count = KBD_ROWS * controller->kbd_cols;
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = KBD_ROWS;
new_zone.matrix_map->width = controller->kbd_cols;
new_zone.matrix_map->map = (unsigned int *)matrix_keys;
zones.push_back(new_zone);
for(unsigned int led_idx = 0; led_idx < zones[0].leds_count; led_idx++)
{
led new_led;
new_led.name = led_names[led_idx];
leds.push_back(new_led);
}
SetupColors();
}
void RGBController_MNTKeyboard::DeviceUpdateLEDs()
{
unsigned char *color_map = new unsigned char[zones[0].leds_count * KBD_COLOR_SIZE];
for(unsigned int led_idx = 0; led_idx < zones[0].leds_count; led_idx++)
{
RGBColor color = colors[led_idx];
int offset = led_idx * KBD_COLOR_SIZE;
color_map[offset + 2] = RGBGetRValue(color);
color_map[offset + 1] = RGBGetGValue(color);
color_map[offset + 0] = RGBGetBValue(color);
}
controller->SendColorMatrix(color_map);
delete[] color_map;
}
void RGBController_MNTKeyboard::ResizeZone(int, int)
{
}
void RGBController_MNTKeyboard::UpdateZoneLEDs(int)
{
DeviceUpdateLEDs();
}
void RGBController_MNTKeyboard::UpdateSingleLED(int)
{
DeviceUpdateLEDs();
}
void RGBController_MNTKeyboard::DeviceUpdateMode()
{
}
@@ -0,0 +1,37 @@
/*---------------------------------------------------------*\
| RGBController_MNTKeyboard.h |
| |
| Driver for the MNT Reform keyboards |
| |
| Christian Heller <c.heller@plomlompom.de> 7 Aug 2024 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include "RGBController.h"
#include "RGBControllerKeyNames.h"
#include "MNTKeyboardController.h"
#define NA 0xFFFFFFFF
class RGBController_MNTKeyboard : public RGBController
{
public:
~RGBController_MNTKeyboard();
void SetupZones();
void DeviceUpdateLEDs();
void ResizeZone(int, int);
void UpdateZoneLEDs(int);
void UpdateSingleLED(int);
void DeviceUpdateMode();
protected:
const char **led_names;
unsigned int *matrix_keys;
void CommonInit();
MNTKeyboardController *controller;
};
@@ -0,0 +1,121 @@
/*---------------------------------------------------------*\
| RGBController_MNTPocketReformKeyboard.cpp |
| |
| Driver for the MNT Reform keyboards |
| |
| Christian Heller <c.heller@plomlompom.de> 7 Aug 2024 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "RGBController_MNTPocketReformKeyboard.h"
/**----------------------------------------------*\
@name MNT Pocket Reform Keyboard
@category Keyboard
@type USB
@detectors DetectMNTKeyboardControllers
\*----------------------------------------------**/
static unsigned int matrix_keys_MNTPocketReform[KBD_ROWS][KBD_COLS_POCKET_REFORM] =
{
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11},
{12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23},
{24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35},
{36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47},
{48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59},
{NA, NA, NA, 63, 64, NA, NA, 69, 70, NA, NA, NA},
};
static const char *led_names_MNTPocketReform[] =
{
// row 0
KEY_EN_ESCAPE,
KEY_EN_1,
KEY_EN_2,
KEY_EN_3,
KEY_EN_4,
KEY_EN_5,
KEY_EN_6,
KEY_EN_7,
KEY_EN_8,
KEY_EN_9,
KEY_EN_0,
KEY_EN_BACKSPACE,
// row 1
KEY_EN_TAB,
KEY_EN_Q,
KEY_EN_W,
KEY_EN_E,
KEY_EN_R,
KEY_EN_T,
KEY_EN_Y,
KEY_EN_U,
KEY_EN_I,
KEY_EN_O,
KEY_EN_P,
KEY_EN_SEMICOLON,
// row 2
KEY_EN_LEFT_CONTROL,
KEY_EN_A,
KEY_EN_S,
KEY_EN_D,
KEY_EN_F,
KEY_EN_G,
KEY_EN_H,
KEY_EN_J,
KEY_EN_K,
KEY_EN_L,
KEY_EN_QUOTE,
KEY_EN_ANSI_ENTER,
// row 3
KEY_EN_LEFT_SHIFT,
KEY_EN_Z,
KEY_EN_X,
KEY_EN_C,
KEY_EN_V,
KEY_EN_B,
KEY_EN_N,
KEY_EN_M,
KEY_EN_COMMA,
KEY_EN_PERIOD,
KEY_EN_UP_ARROW,
KEY_EN_RIGHT_ALT,
// row 4
KEY_EN_LEFT_FUNCTION,
KEY_EN_LEFT_WINDOWS,
KEY_EN_LEFT_ALT,
KEY_EN_BACK_SLASH,
KEY_EN_EQUALS,
KEY_EN_SPACE,
KEY_EN_SPACE,
KEY_EN_MINUS,
KEY_EN_FORWARD_SLASH,
KEY_EN_LEFT_ARROW,
KEY_EN_DOWN_ARROW,
KEY_EN_RIGHT_ARROW,
// row 5
KEY_EN_UNUSED,
KEY_EN_UNUSED,
KEY_EN_UNUSED,
"Key: Left Button",
"Key: Scroll Mode",
KEY_EN_UNUSED,
KEY_EN_UNUSED,
KEY_EN_UNUSED,
KEY_EN_UNUSED,
"Key: Middle Button",
"Key: Right Button",
KEY_EN_UNUSED,
};
RGBController_MNTPocketReformKeyboard::RGBController_MNTPocketReformKeyboard(MNTPocketReformKeyboardController *controller_ptr)
{
led_names = led_names_MNTPocketReform;
matrix_keys = matrix_keys_MNTPocketReform[0];
controller = controller_ptr;
name = "MNT Pocket Reform Keyboard";
description = "MNT Pocket Reform Keyboard";
CommonInit();
}
@@ -0,0 +1,21 @@
/*---------------------------------------------------------*\
| RGBController_MNTPocketReformKeyboard.h |
| |
| Driver for the MNT Reform keyboards |
| |
| Christian Heller <c.heller@plomlompom.de> 7 Aug 2024 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include "RGBController_MNTKeyboard.h"
#include "MNTPocketReformKeyboardController.h"
class RGBController_MNTPocketReformKeyboard : public RGBController_MNTKeyboard
{
public:
RGBController_MNTPocketReformKeyboard(MNTPocketReformKeyboardController *controller_ptr);
};
@@ -0,0 +1,131 @@
/*---------------------------------------------------------*\
| RGBController_MNTReformKeyboard.cpp |
| |
| Driver for the MNT Reform keyboards |
| |
| Christian Heller <c.heller@plomlompom.de> 7 Aug 2024 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "RGBController_MNTReformKeyboard.h"
/**----------------------------------------------*\
@name MNT Reform Keyboard
@category Keyboard
@type USB
@detectors DetectMNTKeyboardControllers
\*----------------------------------------------**/
static unsigned int matrix_keys_MNTReform[KBD_ROWS][KBD_COLS_REFORM] =
{
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
{14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27},
{28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41},
{42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, NA},
{56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69},
{70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, NA, NA, NA}};
static const char *led_names_MNTReform[] =
{
// row 0
KEY_EN_ESCAPE,
KEY_EN_F1,
KEY_EN_F2,
KEY_EN_F3,
KEY_EN_F4,
KEY_EN_F5,
KEY_EN_F6,
KEY_EN_F7,
KEY_EN_F8,
KEY_EN_F9,
KEY_EN_F10,
KEY_EN_F11,
KEY_EN_F12,
KEY_EN_POWER,
// row 1
KEY_EN_BACK_TICK,
KEY_EN_1,
KEY_EN_2,
KEY_EN_3,
KEY_EN_4,
KEY_EN_5,
KEY_EN_6,
KEY_EN_7,
KEY_EN_8,
KEY_EN_9,
KEY_EN_0,
KEY_EN_MINUS,
KEY_EN_EQUALS,
KEY_EN_BACKSPACE,
// row 2
KEY_EN_TAB,
KEY_EN_Q,
KEY_EN_W,
KEY_EN_E,
KEY_EN_R,
KEY_EN_T,
KEY_EN_Y,
KEY_EN_U,
KEY_EN_I,
KEY_EN_O,
KEY_EN_P,
KEY_EN_LEFT_BRACKET,
KEY_EN_RIGHT_BRACKET,
KEY_EN_ANSI_BACK_SLASH,
// row 3
KEY_EN_LEFT_CONTROL,
KEY_EN_A,
KEY_EN_S,
KEY_EN_D,
KEY_EN_F,
KEY_EN_G,
KEY_EN_H,
KEY_EN_J,
KEY_EN_K,
KEY_EN_L,
KEY_EN_SEMICOLON,
KEY_EN_QUOTE,
KEY_EN_ANSI_ENTER,
KEY_EN_UNUSED,
// row 4
KEY_EN_LEFT_SHIFT,
KEY_EN_DELETE,
KEY_EN_Z,
KEY_EN_X,
KEY_EN_C,
KEY_EN_V,
KEY_EN_B,
KEY_EN_N,
KEY_EN_M,
KEY_EN_COMMA,
KEY_EN_PERIOD,
KEY_EN_FORWARD_SLASH,
KEY_EN_UP_ARROW,
KEY_EN_RIGHT_SHIFT,
// row 5
KEY_EN_LEFT_FUNCTION,
KEY_EN_LEFT_WINDOWS,
KEY_EN_LEFT_ALT,
KEY_EN_SPACE,
KEY_EN_SPACE,
KEY_EN_SPACE,
KEY_EN_RIGHT_ALT,
KEY_EN_RIGHT_CONTROL,
KEY_EN_LEFT_ARROW,
KEY_EN_DOWN_ARROW,
KEY_EN_RIGHT_ARROW,
KEY_EN_UNUSED,
KEY_EN_UNUSED,
KEY_EN_UNUSED};
RGBController_MNTReformKeyboard::RGBController_MNTReformKeyboard(MNTReformKeyboardController *controller_ptr)
{
led_names = led_names_MNTReform;
matrix_keys = matrix_keys_MNTReform[0];
controller = controller_ptr;
name = "MNT Reform Keyboard";
description = "MNT Reform Keyboard";
CommonInit();
}
@@ -0,0 +1,21 @@
/*---------------------------------------------------------*\
| RGBController_MNTReformKeyboard.h |
| |
| Driver for the MNT Reform keyboards |
| |
| Christian Heller <c.heller@plomlompom.de> 7 Aug 2024 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include "RGBController_MNTKeyboard.h"
#include "MNTReformKeyboardController.h"
class RGBController_MNTReformKeyboard : public RGBController_MNTKeyboard
{
public:
RGBController_MNTReformKeyboard(MNTReformKeyboardController *controller_ptr);
};