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,208 @@
/*---------------------------------------------------------*\
| HPOmen30LController.cpp |
| |
| Driver for HP Omen 30L |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include <cstring>
#include <stdio.h>
#include <stdlib.h>
#include "HPOmen30LController.h"
#define HP_OMEN_30L_BUFFER_SIZE 58
#define HP_OMEN_30L_VERSION_ID 0x12
#define HP_OMEN_30L_MAX_BRIGHTNESS 0x64
HPOmen30LController::HPOmen30LController(hid_device* dev_handle, const char* path)
{
dev = dev_handle;
location = path;
strcpy(device_name, "HP Omen 30L");
hp_zone logo;
logo.value = HP_OMEN_30L_LOGO_ZONE;
logo.mode = HP_OMEN_30L_DIRECT;
logo.speed = HP_OMEN_30L_SPEED_MED;
logo.brightness = HP_OMEN_30L_MAX_BRIGHTNESS;
hp_zones.push_back(logo);
hp_zone bar;
bar.value = HP_OMEN_30L_BAR_ZONE;
bar.mode = HP_OMEN_30L_DIRECT;
bar.speed = HP_OMEN_30L_SPEED_MED;
bar.brightness = HP_OMEN_30L_MAX_BRIGHTNESS;
hp_zones.push_back(bar);
hp_zone fan;
fan.value = HP_OMEN_30L_FAN_ZONE;
fan.mode = HP_OMEN_30L_DIRECT;
fan.speed = HP_OMEN_30L_SPEED_MED;
fan.brightness = HP_OMEN_30L_MAX_BRIGHTNESS;
hp_zones.push_back(fan);
hp_zone cpu;
cpu.value = HP_OMEN_30L_CPU_ZONE;
cpu.mode = HP_OMEN_30L_DIRECT;
cpu.speed = HP_OMEN_30L_SPEED_MED;
cpu.brightness = HP_OMEN_30L_MAX_BRIGHTNESS;
hp_zones.push_back(cpu);
hp_zone botFan;
botFan.value = HP_OMEN_30L_BOT_FAN_ZONE;
botFan.mode = HP_OMEN_30L_DIRECT;
botFan.speed = HP_OMEN_30L_SPEED_MED;
botFan.brightness = HP_OMEN_30L_MAX_BRIGHTNESS;
hp_zones.push_back(botFan);
hp_zone midFan;
midFan.value = HP_OMEN_30L_MID_FAN_ZONE;
midFan.mode = HP_OMEN_30L_DIRECT;
midFan.speed = HP_OMEN_30L_SPEED_MED;
midFan.brightness = HP_OMEN_30L_MAX_BRIGHTNESS;
hp_zones.push_back(midFan);
hp_zone topFan;
topFan.value = HP_OMEN_30L_TOP_FAN_ZONE;
topFan.mode = HP_OMEN_30L_DIRECT;
topFan.speed = HP_OMEN_30L_SPEED_MED;
topFan.brightness = HP_OMEN_30L_MAX_BRIGHTNESS;
hp_zones.push_back(topFan);
}
HPOmen30LController::~HPOmen30LController()
{
hid_close(dev);
}
std::string HPOmen30LController::GetLocationString()
{
return("HID: " + location);
}
char* HPOmen30LController::GetDeviceName()
{
return device_name;
}
std::string HPOmen30LController::GetSerialString()
{
std::string ret_string = "";
return(ret_string);
}
std::string HPOmen30LController::GetEffectChannelString(unsigned char /*channel*/)
{
std::string ret_string = "";
return(ret_string);
}
std::string HPOmen30LController::GetFirmwareVersionString()
{
std::string ret_string = "";
return(ret_string);
}
void HPOmen30LController::SetZoneMode(int zone,unsigned char mode, unsigned char speed,unsigned char brightness)
{
hp_zones[zone].mode = mode;
hp_zones[zone].speed = speed;
hp_zones[zone].brightness = brightness;
}
void HPOmen30LController::SetZoneColor(int zone, std::vector<RGBColor> colors)
{
SendZoneUpdate(zone, colors);
}
void HPOmen30LController::SendZoneUpdate(int zone, std::vector<RGBColor> colors)
{
unsigned char usb_buf[HP_OMEN_30L_BUFFER_SIZE] = {}; // zero-initialize array
// 0x00 - 0x01: Unknown
// 0x02: Version ID (HP_OMEN_30L_VERSION_ID)
// 0x03: Lighting mode (static, direct, off, breathing, cycle, blinking, ...)
// 0x04: Total color count (only different from 1 in modes with changing colors)
// 0x05: Current color number (see above, used to set the different colors, one at a time, starting at 1)
// 0x06 - 0x07: Unknown
// 0x08 - 0x23: Used to control the RGB (static) or RGBA (direct) of the first seven LED zones
// 0x24 - 0x2f: Unknown, probably also used for RGB/RGBA control if there's support up to 10 zones
// 0x30: Brightness
// 0x31: Type (static=0x02, direct=0x04, changing colors=0x0A)
// 0x32 - 0x35: Unknown
// 0x36: Zone to update (can only update one at a time)
// 0x37: Power mode to update (on, suspend)
// 0x38: Theme (either 0 to use the colors set in 0x04/0x05, or the ID of a predefined theme)
// 0x39: Color change speed (only relevant for modes with changing colors)
usb_buf[0x02] = HP_OMEN_30L_VERSION_ID;
usb_buf[0x36] = hp_zones[zone].value;
// The Omen controller allows setting different modes for when the computer is powered on
// vs when the computer is suspended.
// Because the OpenRGB UI does not allow such a choice, we're only changing the powered on mode.
// If this ever changes, we need to take the user choice into consideration (HP_OMEN_30L_POWER_SUSPEND)
usb_buf[0x37] = HP_OMEN_30L_POWER_ON;
usb_buf[0x03] = hp_zones[zone].mode;
if (hp_zones[zone].mode == HP_OMEN_30L_OFF)
{
hid_write(dev, usb_buf, HP_OMEN_30L_BUFFER_SIZE);
return;
}
usb_buf[0x30] = hp_zones[zone].brightness;
int index = hp_zones[zone].value - 1;
if(hp_zones[zone].mode == HP_OMEN_30L_DIRECT)
{
usb_buf[0x31] = HP_OMEN_30L_DIRECT;
usb_buf[0x04] = 0x01;
usb_buf[0x05] = 0x01;
usb_buf[0x08 + index * 4] = HP_OMEN_30L_MAX_BRIGHTNESS;
usb_buf[0x09 + index * 4] = RGBGetRValue(colors[zone]);
usb_buf[0x0A + index * 4] = RGBGetGValue(colors[zone]);
usb_buf[0x0B + index * 4] = RGBGetBValue(colors[zone]);
hid_write(dev, usb_buf, HP_OMEN_30L_BUFFER_SIZE);
}
else if(hp_zones[zone].mode == HP_OMEN_30L_STATIC)
{
usb_buf[0x31] = 0x02;
usb_buf[0x04] = 0x01;
usb_buf[0x05] = 0x01;
usb_buf[0x08 + index * 3] = RGBGetRValue(colors[zone]);
usb_buf[0x09 + index * 3] = RGBGetGValue(colors[zone]);
usb_buf[0x0A + index * 3] = RGBGetBValue(colors[zone]);
hid_write(dev, usb_buf, HP_OMEN_30L_BUFFER_SIZE);
}
else
{
usb_buf[0x31] = 0x0A;
usb_buf[0x39] = hp_zones[zone].speed;
// Theme is custom by default, but if we could select a theme through the UI,
// we would set it in usb_buf[0x38] here and ignore the custom colors vector
unsigned char theme = HP_OMEN_30L_THEME_CUSTOM;
usb_buf[0x38] = theme;
if (theme == HP_OMEN_30L_THEME_CUSTOM)
{
usb_buf[0x04] = (unsigned char)colors.size();
for(unsigned int i = 0; i < (unsigned int)colors.size(); i++)
{
usb_buf[0x05] = i + 1;
usb_buf[0x08 + index * 3] = RGBGetRValue(colors[i]);
usb_buf[0x09 + index * 3] = RGBGetGValue(colors[i]);
usb_buf[0x0A + index * 3] = RGBGetBValue(colors[i]);
hid_write(dev, usb_buf, HP_OMEN_30L_BUFFER_SIZE);
}
}
else
{
hid_write(dev, usb_buf, HP_OMEN_30L_BUFFER_SIZE);
}
}
}
@@ -0,0 +1,95 @@
/*---------------------------------------------------------*\
| HPOmen30LController.h |
| |
| Driver for HP Omen 30L |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include <string>
#include <vector>
#include <hidapi.h>
#include "RGBController.h"
typedef struct
{
unsigned char value;
unsigned char mode;
unsigned char speed;
unsigned char brightness;
} hp_zone;
enum
{
HP_OMEN_30L_STATIC = 0x01, /* Static effect channel */
HP_OMEN_30L_DIRECT = 0x04, /* Direct for effects plugin */
HP_OMEN_30L_OFF = 0x05, /* Turns off the led */
HP_OMEN_30L_BREATHING = 0x06, /* Breathing effect channel */
HP_OMEN_30L_COLOR_CYCLE = 0x07, /* Color cycle effect channel */
HP_OMEN_30L_BLINKING = 0x08, /* Blinking effect channel */
HP_OMEN_30L_WAVE = 0x09, /* Wave effect channel */
HP_OMEN_30L_RADIAL = 0x0A, /* Radial effect channel */
};
enum
{
HP_OMEN_30L_SPEED_SLOW = 0x01, /* Slow speed */
HP_OMEN_30L_SPEED_MED = 0x02, /* Normal speed */
HP_OMEN_30L_SPEED_FAST = 0x03, /* Fast speed */
};
enum
{
HP_OMEN_30L_LOGO_ZONE = 0x01,
HP_OMEN_30L_BAR_ZONE = 0x02,
HP_OMEN_30L_FAN_ZONE = 0x03,
HP_OMEN_30L_CPU_ZONE = 0x04,
HP_OMEN_30L_BOT_FAN_ZONE = 0x05,
HP_OMEN_30L_MID_FAN_ZONE = 0x06,
HP_OMEN_30L_TOP_FAN_ZONE = 0x07,
};
enum
{
HP_OMEN_30L_POWER_ON = 0x01, /* Settings for powered on */
HP_OMEN_30L_POWER_SUSPEND = 0x02, /* Settings for suspended */
};
enum
{
HP_OMEN_30L_THEME_CUSTOM = 0x00,
HP_OMEN_30L_THEME_GALAXY = 0x01,
HP_OMEN_30L_THEME_VOLCANO = 0x02,
HP_OMEN_30L_THEME_JUNGLE = 0x03,
HP_OMEN_30L_THEME_OCEAN = 0x04,
HP_OMEN_30L_THEME_UNICORN = 0x05,
};
class HPOmen30LController
{
public:
HPOmen30LController(hid_device* dev_handle, const char* path);
~HPOmen30LController();
char* GetDeviceName();
std::string GetEffectChannelString(unsigned char channel);
std::string GetFirmwareVersionString();
std::string GetLocationString();
std::string GetSerialString();
void SetZoneMode(int zone,unsigned char mode, unsigned char speed, unsigned char brightness);
void SetZoneColor(int zone, std::vector<RGBColor> colors);
private:
char device_name[32];
hid_device* dev;
std::string location;
std::vector<hp_zone> hp_zones;
void SendZoneUpdate(int zone, std::vector<RGBColor> colors);
};
@@ -0,0 +1,39 @@
/*---------------------------------------------------------*\
| HPOmen30LControllerDetect.cpp |
| |
| Detector for HP Omen 30L |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include <hidapi.h>
#include "Detector.h"
#include "HPOmen30LController.h"
#include "RGBController_HPOmen30L.h"
#define HP_OMEN_30L_VID 0x103C
#define HP_OMEN_30L_PID 0x84FD
/******************************************************************************************\
* *
* DetectHPOmen30LController *
* *
* Tests the USB address to see if an HP Omen 30L controller exists there. *
* *
\******************************************************************************************/
void DetectHPOmen30LController(hid_device_info* info, const std::string&)
{
hid_device* dev = hid_open_path(info->path);
if(dev)
{
HPOmen30LController* controller = new HPOmen30LController(dev, info->path);
RGBController_HPOmen30L* rgb_controller = new RGBController_HPOmen30L(controller);
// Constructor sets the name
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
}
REGISTER_HID_DETECTOR("HP Omen 30L", DetectHPOmen30LController, HP_OMEN_30L_VID, HP_OMEN_30L_PID);
@@ -0,0 +1,292 @@
/*---------------------------------------------------------*\
| RGBController_HPOmen30L.cpp |
| |
| RGBController for HP Omen 30L |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "RGBController_HPOmen30L.h"
/**------------------------------------------------------------------*\
@name HP Omen 30L
@category Motherboard
@type USB
@save :x:
@direct :white_check_mark:
@effects :white_check_mark:
@detectors DetectHPOmen30LController
@comment
\*-------------------------------------------------------------------*/
RGBController_HPOmen30L::RGBController_HPOmen30L(HPOmen30LController* controller_ptr)
{
controller = controller_ptr;
name = "HP Omen 30L";
vendor = "HP";
type = DEVICE_TYPE_MOTHERBOARD;
description = "HP Omen 30L Device";
location = controller->GetLocationString();
mode Direct;
Direct.name = "Direct";
Direct.value = HP_OMEN_30L_DIRECT;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Direct.color_mode = MODE_COLORS_PER_LED;
Direct.brightness_min = 0;
Direct.brightness_max = 100;
Direct.brightness = 100;
modes.push_back(Direct);
mode Static;
Static.name = "Static";
Static.value = HP_OMEN_30L_STATIC;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Static.color_mode = MODE_COLORS_PER_LED;
Static.brightness_min = 0;
Static.brightness_max = 100;
Static.brightness = 100;
modes.push_back(Static);
mode Off;
Off.name = "Off";
Off.value = HP_OMEN_30L_OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = HP_OMEN_30L_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Breathing.speed_min = HP_OMEN_30L_SPEED_SLOW;
Breathing.speed_max = HP_OMEN_30L_SPEED_FAST;
Breathing.speed = HP_OMEN_30L_SPEED_MED;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.colors_min = 1;
Breathing.colors_max = 6;
Breathing.colors.resize(4);
Breathing.brightness_min = 0;
Breathing.brightness_max = 100;
Breathing.brightness = 100;
modes.push_back(Breathing);
mode ColorCycle;
ColorCycle.name = "Color Cycle";
ColorCycle.value = HP_OMEN_30L_COLOR_CYCLE;
ColorCycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
ColorCycle.speed_min = HP_OMEN_30L_SPEED_SLOW;
ColorCycle.speed_max = HP_OMEN_30L_SPEED_FAST;
ColorCycle.speed = HP_OMEN_30L_SPEED_MED;
ColorCycle.color_mode = MODE_COLORS_MODE_SPECIFIC;
ColorCycle.colors_min = 1;
ColorCycle.colors_max = 6;
ColorCycle.colors.resize(4);
ColorCycle.brightness_min = 0;
ColorCycle.brightness_max = 100;
ColorCycle.brightness = 100;
modes.push_back(ColorCycle);
mode Blinking;
Blinking.name = "Blinking";
Blinking.value = HP_OMEN_30L_BLINKING;
Blinking.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Blinking.speed_min = HP_OMEN_30L_SPEED_SLOW;
Blinking.speed_max = HP_OMEN_30L_SPEED_FAST;
Blinking.speed = HP_OMEN_30L_SPEED_MED;
Blinking.color_mode = MODE_COLORS_MODE_SPECIFIC;
Blinking.colors_min = 1;
Blinking.colors_max = 6;
Blinking.colors.resize(4);
Blinking.brightness_min = 0;
Blinking.brightness_max = 100;
Blinking.brightness = 100;
modes.push_back(Blinking);
mode Wave;
Wave.name = "Wave";
Wave.value = HP_OMEN_30L_WAVE;
Wave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Wave.speed_min = HP_OMEN_30L_SPEED_SLOW;
Wave.speed_max = HP_OMEN_30L_SPEED_FAST;
Wave.speed = HP_OMEN_30L_SPEED_MED;
Wave.color_mode = MODE_COLORS_MODE_SPECIFIC;
Wave.colors_min = 6;
Wave.colors_max = 6;
Wave.colors.resize(6);
Wave.brightness_min = 0;
Wave.brightness_max = 100;
Wave.brightness = 100;
modes.push_back(Wave);
mode Radial;
Radial.name = "Radial";
Radial.value = HP_OMEN_30L_RADIAL;
Radial.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Radial.speed_min = HP_OMEN_30L_SPEED_SLOW;
Radial.speed_max = HP_OMEN_30L_SPEED_FAST;
Radial.speed = HP_OMEN_30L_SPEED_MED;
Radial.color_mode = MODE_COLORS_MODE_SPECIFIC;
Radial.colors_min = 1;
Radial.colors_max = 6;
Radial.colors.resize(4);
Radial.brightness_min = 0;
Radial.brightness_max = 100;
Radial.brightness = 100;
modes.push_back(Radial);
SetupZones();
}
RGBController_HPOmen30L::~RGBController_HPOmen30L()
{
delete controller;
}
void RGBController_HPOmen30L::SetupZones()
{
/*---------------------------------------------------------*\
| Set up zones |
\*---------------------------------------------------------*/
zone logo_zone;
logo_zone.name = "Omen Logo";
logo_zone.type = ZONE_TYPE_SINGLE;
logo_zone.leds_min = 1;
logo_zone.leds_max = 1;
logo_zone.leds_count = 1;
logo_zone.matrix_map = NULL;
zones.push_back(logo_zone);
zone light_bar;
light_bar.name = "Light Bar";
light_bar.type = ZONE_TYPE_SINGLE;
light_bar.leds_min = 1;
light_bar.leds_max = 1;
light_bar.leds_count = 1;
light_bar.matrix_map = NULL;
zones.push_back(light_bar);
zone ring_zone;
ring_zone.name = "Front Fan";
ring_zone.type = ZONE_TYPE_SINGLE;
ring_zone.leds_min = 1;
ring_zone.leds_max = 1;
ring_zone.leds_count = 1;
ring_zone.matrix_map = NULL;
zones.push_back(ring_zone);
zone cpu_zone;
cpu_zone.name = "CPU Cooler";
cpu_zone.type = ZONE_TYPE_SINGLE;
cpu_zone.leds_min = 1;
cpu_zone.leds_max = 1;
cpu_zone.leds_count = 1;
cpu_zone.matrix_map = NULL;
zones.push_back(cpu_zone);
zone bot_fan;
bot_fan.name = "Front Bottom Fan";
bot_fan.type = ZONE_TYPE_SINGLE;
bot_fan.leds_min = 1;
bot_fan.leds_max = 1;
bot_fan.leds_count = 1;
bot_fan.matrix_map = NULL;
zones.push_back(bot_fan);
zone mid_fan;
mid_fan.name = "Front Middle Fan";
mid_fan.type = ZONE_TYPE_SINGLE;
mid_fan.leds_min = 1;
mid_fan.leds_max = 1;
mid_fan.leds_count = 1;
mid_fan.matrix_map = NULL;
zones.push_back(mid_fan);
zone top_fan;
top_fan.name = "Front Top Fan";
top_fan.type = ZONE_TYPE_SINGLE;
top_fan.leds_min = 1;
top_fan.leds_max = 1;
top_fan.leds_count = 1;
top_fan.matrix_map = NULL;
zones.push_back(top_fan);
/*---------------------------------------------------------*\
| Set up LEDs |
\*---------------------------------------------------------*/
led logo_led;
logo_led.name = "Logo LED";
leds.push_back(logo_led);
led bar_led;
bar_led.name = "Bar LED";
leds.push_back(bar_led);
led fan_led;
fan_led.name = "Fan LED";
leds.push_back(fan_led);
led cpu_led;
cpu_led.name = "CPU LED";
leds.push_back(cpu_led);
led bot_fan_led;
bot_fan_led.name = "Bottom Fan LED";
leds.push_back(bot_fan_led);
led mid_fan_led;
bot_fan_led.name = "Middle Fan LED";
leds.push_back(bot_fan_led);
led top_fan_led;
bot_fan_led.name = "Top Fan LED";
leds.push_back(bot_fan_led);
SetupColors();
}
void RGBController_HPOmen30L::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_HPOmen30L::DeviceUpdateLEDs()
{
for(unsigned int i = 0; i < zones.size(); i++)
{
if(modes[active_mode].value == HP_OMEN_30L_STATIC ||
modes[active_mode].value == HP_OMEN_30L_DIRECT ||
modes[active_mode].value == HP_OMEN_30L_OFF)
{
controller->SetZoneColor(i, colors);
}
else
{
controller->SetZoneColor(i, modes[active_mode].colors);
}
}
}
void RGBController_HPOmen30L::UpdateZoneLEDs(int zone)
{
controller->SetZoneColor(zone,colors);
}
void RGBController_HPOmen30L::UpdateSingleLED(int led)
{
UpdateZoneLEDs(led);
}
void RGBController_HPOmen30L::DeviceUpdateMode()
{
for(unsigned int i = 0; i < zones.size(); i++)
{
controller->SetZoneMode(i, modes[active_mode].value, modes[active_mode].speed, modes[active_mode].brightness);
}
DeviceUpdateLEDs();
}
@@ -0,0 +1,33 @@
/*---------------------------------------------------------*\
| RGBController_HPOmen30L.h |
| |
| RGBController for HP Omen 30L |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#pragma once
#include "RGBController.h"
#include "HPOmen30LController.h"
class RGBController_HPOmen30L : public RGBController
{
public:
RGBController_HPOmen30L(HPOmen30LController* controller_ptr);
~RGBController_HPOmen30L();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void DeviceUpdateMode();
private:
HPOmen30LController* controller;
};