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,100 @@
/*---------------------------------------------------------*\
| MSI3ZoneController.cpp |
| |
| Driver for MSI/SteelSeries 3-Zone keyboard |
| |
| Adam Honse (CalcProgrammer1) 25 Dec 2019 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "MSI3ZoneController.h"
#include "StringUtils.h"
MSI3ZoneController::MSI3ZoneController(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
location = path;
//strcpy(device_name, "MSI 3-Zone Keyboard");
}
MSI3ZoneController::~MSI3ZoneController()
{
hid_close(dev);
}
char* MSI3ZoneController::GetDeviceName()
{
return device_name;
}
std::string MSI3ZoneController::GetDeviceLocation()
{
return("HID: " + location);
}
std::string MSI3ZoneController::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 MSI3ZoneController::SetLEDs(std::vector<RGBColor> colors)
{
//Shout out to bparker06 for reverse engineering the MSI keyboard USB protocol!
// https://github.com/bparker06/msi-keyboard/blob/master/keyboard.cpp for original implementation
unsigned char buf[8] = { 0 };
buf[0] = 1;
buf[1] = 2;
buf[2] = 64;
buf[3] = 1;
buf[4] = RGBGetRValue(colors[0]);
buf[5] = RGBGetGValue(colors[0]);
buf[6] = RGBGetBValue(colors[0]);
buf[7] = 236;
hid_send_feature_report(dev, buf, 8);
buf[3] = 2;
buf[4] = RGBGetRValue(colors[1]);
buf[5] = RGBGetGValue(colors[1]);
buf[6] = RGBGetBValue(colors[1]);
hid_send_feature_report(dev, buf, 8);
buf[3] = 3;
buf[4] = RGBGetRValue(colors[2]);
buf[5] = RGBGetGValue(colors[2]);
buf[6] = RGBGetBValue(colors[2]);
hid_send_feature_report(dev, buf, 8);
buf[3] = 4;
buf[4] = RGBGetRValue(colors[3]);
buf[5] = RGBGetGValue(colors[3]);
buf[6] = RGBGetBValue(colors[3]);
hid_send_feature_report(dev, buf, 8);
buf[3] = 5;
hid_send_feature_report(dev, buf, 8);
buf[3] = 6;
hid_send_feature_report(dev, buf, 8);
buf[3] = 7;
hid_send_feature_report(dev, buf, 8);
}
@@ -0,0 +1,34 @@
/*---------------------------------------------------------*\
| MSI3ZoneController.h |
| |
| Driver for MSI/SteelSeries 3-Zone keyboard |
| |
| Adam Honse (CalcProgrammer1) 25 Dec 2019 |
| |
| 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"
class MSI3ZoneController
{
public:
MSI3ZoneController(hid_device* dev_handle, const char* path);
~MSI3ZoneController();
char* GetDeviceName();
std::string GetDeviceLocation();
std::string GetSerialString();
void SetLEDs(std::vector<RGBColor> colors);
private:
char device_name[32];
hid_device* dev;
std::string location;
};
@@ -0,0 +1,43 @@
/*---------------------------------------------------------*\
| MSI3ZoneControllerDetect.cpp |
| |
| Detector for MSI/SteelSeries 3-Zone keyboard |
| |
| Adam Honse (CalcProgrammer1) 25 Dec 2019 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include <hidapi.h>
#include "Detector.h"
#include "MSI3ZoneController.h"
#include "RGBController_MSI3Zone.h"
#define MSI_3_ZONE_KEYBOARD_VID 0x1770
#define MSI_3_ZONE_KEYBOARD_PID 0xFF00
/******************************************************************************************\
* *
* DetectMSI3ZoneControllers *
* *
* Tests the USB address to see if an MSI/SteelSeries 3-zone Keyboard controller *
* exists there. *
* *
\******************************************************************************************/
void DetectMSI3ZoneControllers(hid_device_info* info, const std::string&)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
MSI3ZoneController* controller = new MSI3ZoneController(dev, info->path);
RGBController_MSI3Zone* rgb_controller = new RGBController_MSI3Zone(controller);
// Constructor sets the name
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
} /* DetectMSI3ZoneControllers() */
REGISTER_HID_DETECTOR("MSI 3-Zone Laptop", DetectMSI3ZoneControllers, MSI_3_ZONE_KEYBOARD_VID, MSI_3_ZONE_KEYBOARD_PID);
@@ -0,0 +1,121 @@
/*---------------------------------------------------------*\
| RGBController_MSI3Zone.cpp |
| |
| RGBController for MSI/SteelSeries 3-Zone keyboard |
| |
| Adam Honse (CalcProgrammer1) 25 Dec 2019 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "RGBController_MSI3Zone.h"
/**------------------------------------------------------------------*\
@name MSI 3 Zone Keyboard
@category Keyboard
@type USB
@save :x:
@direct :white_check_mark:
@effects :x:
@detectors DetectMSI3ZoneControllers
@comment
\*-------------------------------------------------------------------*/
RGBController_MSI3Zone::RGBController_MSI3Zone(MSI3ZoneController* controller_ptr)
{
controller = controller_ptr;
name = "MSI 3-Zone Keyboard";
vendor = "MSI";
type = DEVICE_TYPE_LAPTOP;
description = "MSI 3-Zone Keyboard Device";
location = controller->GetDeviceLocation();
serial = controller->GetSerialString();
mode Direct;
Direct.name = "Direct";
Direct.value = 0;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
SetupZones();
}
RGBController_MSI3Zone::~RGBController_MSI3Zone()
{
delete controller;
}
void RGBController_MSI3Zone::SetupZones()
{
/*---------------------------------------------------------*\
| Set up Keyboard zone and Keyboard LEDs |
\*---------------------------------------------------------*/
zone keyboard_zone;
keyboard_zone.name = "Keyboard";
keyboard_zone.type = ZONE_TYPE_LINEAR;
keyboard_zone.leds_min = 3;
keyboard_zone.leds_max = 3;
keyboard_zone.leds_count = 3;
keyboard_zone.matrix_map = NULL;
zones.push_back(keyboard_zone);
led left_led;
left_led.name = "Keyboard Left";
leds.push_back(left_led);
led mid_led;
mid_led.name = "Keyboard Middle";
leds.push_back(mid_led);
led right_led;
right_led.name = "Keyboard Right";
leds.push_back(right_led);
/*---------------------------------------------------------*\
| Set up Aux zone and Aux LED |
\*---------------------------------------------------------*/
zone aux_zone;
aux_zone.name = "Aux";
aux_zone.type = ZONE_TYPE_SINGLE;
aux_zone.leds_min = 1;
aux_zone.leds_max = 1;
aux_zone.leds_count = 1;
aux_zone.matrix_map = NULL;
zones.push_back(aux_zone);
led aux_led;
aux_led.name = "Aux";
leds.push_back(aux_led);
SetupColors();
}
void RGBController_MSI3Zone::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_MSI3Zone::DeviceUpdateLEDs()
{
controller->SetLEDs(colors);
}
void RGBController_MSI3Zone::UpdateZoneLEDs(int /*zone*/)
{
controller->SetLEDs(colors);
}
void RGBController_MSI3Zone::UpdateSingleLED(int /*led*/)
{
controller->SetLEDs(colors);
}
void RGBController_MSI3Zone::DeviceUpdateMode()
{
}
@@ -0,0 +1,35 @@
/*---------------------------------------------------------*\
| RGBController_MSI3Zone.h |
| |
| RGBController for MSI/SteelSeries 3-Zone keyboard |
| |
| Adam Honse (CalcProgrammer1) 25 Dec 2019 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include "RGBController.h"
#include "MSI3ZoneController.h"
class RGBController_MSI3Zone : public RGBController
{
public:
RGBController_MSI3Zone(MSI3ZoneController* controller_ptr);
~RGBController_MSI3Zone();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void DeviceUpdateMode();
private:
MSI3ZoneController* controller;
};