Publish curated LumaOps source from c85ee9ef8f1454f5c305398902afbb9e6738de40
Managed validation / full (push) Failing after 8s

This commit is contained in:
Public Source Publisher committed 2026-09-30 00:26:45 +00:00
1 parent 91f8b3e3c1
commit def7920856
2271 files changed
+501225 -501178

No files matched your search

@@ -1,194 +1,194 @@
/*---------------------------------------------------------*\
| QMKOpenRGBRevBController.cpp |
| |
| Driver for OpenRGB QMK Keyboard Protocol Revision B |
| |
| Kasper 28 Jun 2021 |
| Jath03 28 May 2021 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "QMKKeycodes.h"
#include "QMKOpenRGBRevBController.h"
using namespace std::chrono_literals;
QMKOpenRGBRevBController::QMKOpenRGBRevBController(hid_device *dev_handle, const char *path) :
QMKOpenRGBBaseController(dev_handle, path, 20)
{
}
QMKOpenRGBRevBController::~QMKOpenRGBRevBController()
{
}
void QMKOpenRGBRevBController::GetLEDInfo(unsigned int leds_count)
{
unsigned int leds_sent = 0;
unsigned int leds_per_update_info = 8;
while (leds_sent < leds_count)
{
if ((leds_count - leds_sent) < leds_per_update_info)
{
leds_per_update_info = leds_count - leds_sent;
}
unsigned char usb_buf[QMK_OPENRGB_PACKET_SIZE];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, QMK_OPENRGB_PACKET_SIZE);
/*-----------------------------------------------------*\
| Set up config table request packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = QMK_OPENRGB_GET_LED_INFO;
usb_buf[0x02] = leds_sent;
usb_buf[0x03] = leds_per_update_info;
int bytes_read = 0;
do
{
hid_write(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE);
bytes_read = hid_read_timeout(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE, QMK_OPENRGB_HID_READ_TIMEOUT);
} while(bytes_read <= 0);
for (unsigned int led_idx = 0; led_idx < leds_per_update_info; led_idx++)
{
unsigned int offset = led_idx * 7;
if(usb_buf[(offset) + QMK_OPENRGB_FLAG_BYTE] != QMK_OPENRGB_FAILURE)
{
led_points.push_back(point_t{usb_buf[(offset) + QMK_OPENRGB_POINT_X_BYTE], usb_buf[(offset) + QMK_OPENRGB_POINT_Y_BYTE]});
led_flags.push_back(usb_buf[(offset) + QMK_OPENRGB_FLAG_BYTE]);
led_colors.push_back(ToRGBColor(usb_buf[(offset) + QMK_OPENRGB_R_COLOR_BYTE], usb_buf[(offset) + QMK_OPENRGB_G_COLOR_BYTE], usb_buf[(offset) + QMK_OPENRGB_B_COLOR_BYTE]));
}
if(usb_buf[(offset) + QMK_OPENRGB_KEYCODE_BYTE] != 0)
{
if(qmk_keynames.count(usb_buf[(offset) + QMK_OPENRGB_KEYCODE_BYTE]) > 0)
{
led_names.push_back(qmk_keynames[usb_buf[(offset) + QMK_OPENRGB_KEYCODE_BYTE]]);
}
else
{
LOG_DEBUG("[%s] Key code: %d (%02X) @ offset %d was not found in the QMK keyname map",
device_name.c_str(), usb_buf[offset + QMK_OPENRGB_KEYCODE_BYTE],
usb_buf[offset + QMK_OPENRGB_KEYCODE_BYTE], leds_sent + led_idx);
led_names.push_back(KEY_EN_UNUSED);
}
}
}
leds_sent += leds_per_update_info;
}
}
std::vector<unsigned int> QMKOpenRGBRevBController::GetEnabledModes()
{
unsigned char usb_buf[QMK_OPENRGB_PACKET_SIZE];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, QMK_OPENRGB_PACKET_SIZE);
/*-----------------------------------------------------*\
| Set up config table request packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = QMK_OPENRGB_GET_ENABLED_MODES;
int bytes_read = 0;
do
{
hid_write(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE);
bytes_read = hid_read_timeout(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE, QMK_OPENRGB_HID_READ_TIMEOUT);
} while(bytes_read <= 0);
std::vector<unsigned int> enabled_modes;
int i = 1;
while (usb_buf[i] != 0)
{
enabled_modes.push_back(usb_buf[i]);
i++;
}
return enabled_modes;
}
void QMKOpenRGBRevBController::DirectModeSetSingleLED(unsigned int led, unsigned char red, unsigned char green, unsigned char blue)
{
unsigned char usb_buf[QMK_OPENRGB_PACKET_SIZE];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, QMK_OPENRGB_PACKET_SIZE);
/*-----------------------------------------------------*\
| Set up config table request packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = QMK_OPENRGB_DIRECT_MODE_SET_SINGLE_LED;
usb_buf[0x02] = led;
usb_buf[0x03] = red;
usb_buf[0x04] = green;
usb_buf[0x05] = blue;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
hid_read_timeout(dev, usb_buf, 65, QMK_OPENRGB_HID_READ_TIMEOUT);
}
void QMKOpenRGBRevBController::DirectModeSetLEDs(std::vector<RGBColor> colors, unsigned int leds_count)
{
unsigned int leds_sent = 0;
unsigned int tmp_leds_per_update = leds_per_update;
while (leds_sent < leds_count)
{
if ((leds_count - leds_sent) < tmp_leds_per_update)
{
tmp_leds_per_update = leds_count - leds_sent;
}
unsigned char usb_buf[QMK_OPENRGB_PACKET_SIZE];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, QMK_OPENRGB_PACKET_SIZE);
/*-----------------------------------------------------*\
| Set up config table request packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = QMK_OPENRGB_DIRECT_MODE_SET_LEDS;
usb_buf[0x02] = leds_sent;
usb_buf[0x03] = tmp_leds_per_update;
for (unsigned int led_idx = 0; led_idx < tmp_leds_per_update; led_idx++)
{
usb_buf[(led_idx * 3) + 4] = RGBGetRValue(colors[led_idx + leds_sent]);
usb_buf[(led_idx * 3) + 5] = RGBGetGValue(colors[led_idx + leds_sent]);
usb_buf[(led_idx * 3) + 6] = RGBGetBValue(colors[led_idx + leds_sent]);
}
hid_write(dev, usb_buf, 65);
if(delay > 0ms)
{
std::this_thread::sleep_for(delay);
}
leds_sent += tmp_leds_per_update;
}
}
/*---------------------------------------------------------*\
| QMKOpenRGBRevBController.cpp |
| |
| Driver for OpenRGB QMK Keyboard Protocol Revision B |
| |
| Kasper 28 Jun 2021 |
| Jath03 28 May 2021 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "QMKKeycodes.h"
#include "QMKOpenRGBRevBController.h"
using namespace std::chrono_literals;
QMKOpenRGBRevBController::QMKOpenRGBRevBController(hid_device *dev_handle, const char *path) :
QMKOpenRGBBaseController(dev_handle, path, 20)
{
}
QMKOpenRGBRevBController::~QMKOpenRGBRevBController()
{
}
void QMKOpenRGBRevBController::GetLEDInfo(unsigned int leds_count)
{
unsigned int leds_sent = 0;
unsigned int leds_per_update_info = 8;
while (leds_sent < leds_count)
{
if ((leds_count - leds_sent) < leds_per_update_info)
{
leds_per_update_info = leds_count - leds_sent;
}
unsigned char usb_buf[QMK_OPENRGB_PACKET_SIZE];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, QMK_OPENRGB_PACKET_SIZE);
/*-----------------------------------------------------*\
| Set up config table request packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = QMK_OPENRGB_GET_LED_INFO;
usb_buf[0x02] = leds_sent;
usb_buf[0x03] = leds_per_update_info;
int bytes_read = 0;
do
{
hid_write(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE);
bytes_read = hid_read_timeout(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE, QMK_OPENRGB_HID_READ_TIMEOUT);
} while(bytes_read <= 0);
for (unsigned int led_idx = 0; led_idx < leds_per_update_info; led_idx++)
{
unsigned int offset = led_idx * 7;
if(usb_buf[(offset) + QMK_OPENRGB_FLAG_BYTE] != QMK_OPENRGB_FAILURE)
{
led_points.push_back(point_t{usb_buf[(offset) + QMK_OPENRGB_POINT_X_BYTE], usb_buf[(offset) + QMK_OPENRGB_POINT_Y_BYTE]});
led_flags.push_back(usb_buf[(offset) + QMK_OPENRGB_FLAG_BYTE]);
led_colors.push_back(ToRGBColor(usb_buf[(offset) + QMK_OPENRGB_R_COLOR_BYTE], usb_buf[(offset) + QMK_OPENRGB_G_COLOR_BYTE], usb_buf[(offset) + QMK_OPENRGB_B_COLOR_BYTE]));
}
if(usb_buf[(offset) + QMK_OPENRGB_KEYCODE_BYTE] != 0)
{
if(qmk_keynames.count(usb_buf[(offset) + QMK_OPENRGB_KEYCODE_BYTE]) > 0)
{
led_names.push_back(qmk_keynames[usb_buf[(offset) + QMK_OPENRGB_KEYCODE_BYTE]]);
}
else
{
LOG_DEBUG("[%s] Key code: %d (%02X) @ offset %d was not found in the QMK keyname map",
device_name.c_str(), usb_buf[offset + QMK_OPENRGB_KEYCODE_BYTE],
usb_buf[offset + QMK_OPENRGB_KEYCODE_BYTE], leds_sent + led_idx);
led_names.push_back(KEY_EN_UNUSED);
}
}
}
leds_sent += leds_per_update_info;
}
}
std::vector<unsigned int> QMKOpenRGBRevBController::GetEnabledModes()
{
unsigned char usb_buf[QMK_OPENRGB_PACKET_SIZE];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, QMK_OPENRGB_PACKET_SIZE);
/*-----------------------------------------------------*\
| Set up config table request packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = QMK_OPENRGB_GET_ENABLED_MODES;
int bytes_read = 0;
do
{
hid_write(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE);
bytes_read = hid_read_timeout(dev, usb_buf, QMK_OPENRGB_PACKET_SIZE, QMK_OPENRGB_HID_READ_TIMEOUT);
} while(bytes_read <= 0);
std::vector<unsigned int> enabled_modes;
int i = 1;
while (usb_buf[i] != 0)
{
enabled_modes.push_back(usb_buf[i]);
i++;
}
return enabled_modes;
}
void QMKOpenRGBRevBController::DirectModeSetSingleLED(unsigned int led, unsigned char red, unsigned char green, unsigned char blue)
{
unsigned char usb_buf[QMK_OPENRGB_PACKET_SIZE];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, QMK_OPENRGB_PACKET_SIZE);
/*-----------------------------------------------------*\
| Set up config table request packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = QMK_OPENRGB_DIRECT_MODE_SET_SINGLE_LED;
usb_buf[0x02] = led;
usb_buf[0x03] = red;
usb_buf[0x04] = green;
usb_buf[0x05] = blue;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
hid_read_timeout(dev, usb_buf, 65, QMK_OPENRGB_HID_READ_TIMEOUT);
}
void QMKOpenRGBRevBController::DirectModeSetLEDs(std::vector<RGBColor> colors, unsigned int leds_count)
{
unsigned int leds_sent = 0;
unsigned int tmp_leds_per_update = leds_per_update;
while (leds_sent < leds_count)
{
if ((leds_count - leds_sent) < tmp_leds_per_update)
{
tmp_leds_per_update = leds_count - leds_sent;
}
unsigned char usb_buf[QMK_OPENRGB_PACKET_SIZE];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, QMK_OPENRGB_PACKET_SIZE);
/*-----------------------------------------------------*\
| Set up config table request packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = 0x00;
usb_buf[0x01] = QMK_OPENRGB_DIRECT_MODE_SET_LEDS;
usb_buf[0x02] = leds_sent;
usb_buf[0x03] = tmp_leds_per_update;
for (unsigned int led_idx = 0; led_idx < tmp_leds_per_update; led_idx++)
{
usb_buf[(led_idx * 3) + 4] = RGBGetRValue(colors[led_idx + leds_sent]);
usb_buf[(led_idx * 3) + 5] = RGBGetGValue(colors[led_idx + leds_sent]);
usb_buf[(led_idx * 3) + 6] = RGBGetBValue(colors[led_idx + leds_sent]);
}
hid_write(dev, usb_buf, 65);
if(delay > 0ms)
{
std::this_thread::sleep_for(delay);
}
leds_sent += tmp_leds_per_update;
}
}
@@ -1,32 +1,32 @@
/*---------------------------------------------------------*\
| QMKOpenRGBRevBController.h |
| |
| Driver for OpenRGB QMK Keyboard Protocol Revision B |
| |
| Kasper 28 Jun 2021 |
| Jath03 28 May 2021 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include "QMKOpenRGBBaseController.h"
class QMKOpenRGBRevBController : public QMKOpenRGBBaseController
{
public:
QMKOpenRGBRevBController(hid_device *dev_handle, const char *path);
~QMKOpenRGBRevBController();
//Virtual function implementations
void GetLEDInfo(unsigned int leds_count);
void DirectModeSetSingleLED(unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
void DirectModeSetLEDs(std::vector<RGBColor> colors, unsigned int num_colors);
//Protocol Specific functions
std::vector<unsigned int> GetEnabledModes();
private:
};
/*---------------------------------------------------------*\
| QMKOpenRGBRevBController.h |
| |
| Driver for OpenRGB QMK Keyboard Protocol Revision B |
| |
| Kasper 28 Jun 2021 |
| Jath03 28 May 2021 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include "QMKOpenRGBBaseController.h"
class QMKOpenRGBRevBController : public QMKOpenRGBBaseController
{
public:
QMKOpenRGBRevBController(hid_device *dev_handle, const char *path);
~QMKOpenRGBRevBController();
//Virtual function implementations
void GetLEDInfo(unsigned int leds_count);
void DirectModeSetSingleLED(unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
void DirectModeSetLEDs(std::vector<RGBColor> colors, unsigned int num_colors);
//Protocol Specific functions
std::vector<unsigned int> GetEnabledModes();
private:
};
@@ -1,101 +1,101 @@
/*---------------------------------------------------------*\
| RGBController_QMKOpenRGBRevB.h |
| |
| RGBController for OpenRGB QMK Keyboard Protocol |
| Revision B |
| |
| Kasper 28 Jun 2021 |
| Jath03 28 May 2021 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include "RGBController.h"
#include "QMKOpenRGBRevBController.h"
#define NO_LED 0xFFFFFFFF
typedef std::vector<std::vector<unsigned int>> VectorMatrix;
class RGBController_QMKOpenRGBRevB : public RGBController
{
public:
RGBController_QMKOpenRGBRevB(QMKOpenRGBRevBController* controller_ptr, bool save);
~RGBController_QMKOpenRGBRevB();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void DeviceUpdateMode();
void DeviceSaveMode();
private:
QMKOpenRGBRevBController* controller;
std::vector<unsigned int> flat_matrix_map;
std::vector<unsigned int> flat_underglow_map;
void InitializeMode
(
std::string name,
unsigned int &current_mode,
unsigned int flags,
unsigned int color_mode,
bool save
);
unsigned int CalculateDivisor
(
std::vector<point_t> led_points,
std::set<int> rows,
std::set<int> columns
);
void CountKeyTypes
(
std::vector<unsigned int> led_flags,
unsigned int total_led_count,
unsigned int& key_leds,
unsigned int& underglow_leds
);
void PlaceLEDsInMaps
(
std::set<int> unique_rows,
std::set<int> unique_cols,
unsigned int divisor,
std::vector<point_t> led_points,
std::vector<unsigned int> led_flags,
VectorMatrix& matrix_map_xl,
VectorMatrix& underglow_map_xl
);
VectorMatrix MakeEmptyMatrixMap
(
std::size_t height,
std::size_t width
);
void CleanMatrixMaps
(
VectorMatrix& matrix_map,
VectorMatrix& underglow_map,
unsigned int height,
bool has_underglow
);
std::vector<unsigned int> FlattenMatrixMap
(
VectorMatrix matrix_map
);
};
/*---------------------------------------------------------*\
| RGBController_QMKOpenRGBRevB.h |
| |
| RGBController for OpenRGB QMK Keyboard Protocol |
| Revision B |
| |
| Kasper 28 Jun 2021 |
| Jath03 28 May 2021 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include "RGBController.h"
#include "QMKOpenRGBRevBController.h"
#define NO_LED 0xFFFFFFFF
typedef std::vector<std::vector<unsigned int>> VectorMatrix;
class RGBController_QMKOpenRGBRevB : public RGBController
{
public:
RGBController_QMKOpenRGBRevB(QMKOpenRGBRevBController* controller_ptr, bool save);
~RGBController_QMKOpenRGBRevB();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void DeviceUpdateMode();
void DeviceSaveMode();
private:
QMKOpenRGBRevBController* controller;
std::vector<unsigned int> flat_matrix_map;
std::vector<unsigned int> flat_underglow_map;
void InitializeMode
(
std::string name,
unsigned int &current_mode,
unsigned int flags,
unsigned int color_mode,
bool save
);
unsigned int CalculateDivisor
(
std::vector<point_t> led_points,
std::set<int> rows,
std::set<int> columns
);
void CountKeyTypes
(
std::vector<unsigned int> led_flags,
unsigned int total_led_count,
unsigned int& key_leds,
unsigned int& underglow_leds
);
void PlaceLEDsInMaps
(
std::set<int> unique_rows,
std::set<int> unique_cols,
unsigned int divisor,
std::vector<point_t> led_points,
std::vector<unsigned int> led_flags,
VectorMatrix& matrix_map_xl,
VectorMatrix& underglow_map_xl
);
VectorMatrix MakeEmptyMatrixMap
(
std::size_t height,
std::size_t width
);
void CleanMatrixMaps
(
VectorMatrix& matrix_map,
VectorMatrix& underglow_map,
unsigned int height,
bool has_underglow
);
std::vector<unsigned int> FlattenMatrixMap
(
VectorMatrix matrix_map
);
};