Skip to content

Commit 7a4eb4d

Browse files
solarkennedyCalcProgrammer1
authored andcommitted
Add support for TUXEDO laptop lightbar (ITE 8291 rev 0.03)
1 parent 4c3ddcc commit 7a4eb4d

5 files changed

Lines changed: 376 additions & 0 deletions

File tree

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
/*---------------------------------------------------------*\
2+
| ClevoLightbarController.cpp |
3+
| |
4+
| Driver for Clevo laptop lightbar (ITE 8291 rev 0.03) |
5+
| Protocol based on tuxedo-drivers ite_8291_lb module |
6+
| |
7+
| Kyle Cascade (kyle@cascade.family) 16 Jan 2026 |
8+
| |
9+
| This file is part of the OpenRGB project |
10+
| SPDX-License-Identifier: GPL-2.0-or-later |
11+
\*---------------------------------------------------------*/
12+
13+
#include "ClevoLightbarController.h"
14+
#include <cstring>
15+
16+
ClevoLightbarController::ClevoLightbarController(hid_device* dev_handle, const hid_device_info& info)
17+
{
18+
dev = dev_handle;
19+
location = info.path;
20+
}
21+
22+
ClevoLightbarController::~ClevoLightbarController()
23+
{
24+
hid_close(dev);
25+
}
26+
27+
std::string ClevoLightbarController::GetDeviceLocation()
28+
{
29+
return("HID: " + location);
30+
}
31+
32+
std::string ClevoLightbarController::GetSerialString()
33+
{
34+
wchar_t serial_string[128];
35+
int ret = hid_get_serial_number_string(dev, serial_string, 128);
36+
37+
if(ret != 0)
38+
{
39+
return("");
40+
}
41+
42+
std::wstring return_wstring = serial_string;
43+
std::string return_string(return_wstring.begin(), return_wstring.end());
44+
45+
return(return_string);
46+
}
47+
48+
void ClevoLightbarController::WriteControl(unsigned char* data)
49+
{
50+
hid_send_feature_report(dev, data, CLEVO_LIGHTBAR_REPORT_SIZE);
51+
}
52+
53+
void ClevoLightbarController::TurnOn()
54+
{
55+
/*---------------------------------------------------------*\
56+
| Not required for 0x7001 - device turns on when setting |
57+
| color/brightness |
58+
\*---------------------------------------------------------*/
59+
}
60+
61+
void ClevoLightbarController::TurnOff()
62+
{
63+
/*---------------------------------------------------------*\
64+
| Turn off sequence for device 0x7001 |
65+
\*---------------------------------------------------------*/
66+
unsigned char buf[CLEVO_LIGHTBAR_REPORT_SIZE];
67+
68+
memset(buf, 0x00, CLEVO_LIGHTBAR_REPORT_SIZE);
69+
buf[0] = 0x12;
70+
buf[2] = 0x03;
71+
WriteControl(buf);
72+
73+
memset(buf, 0x00, CLEVO_LIGHTBAR_REPORT_SIZE);
74+
buf[0] = 0x08;
75+
buf[1] = 0x05;
76+
WriteControl(buf);
77+
78+
memset(buf, 0x00, CLEVO_LIGHTBAR_REPORT_SIZE);
79+
buf[0] = 0x08;
80+
buf[1] = 0x01;
81+
WriteControl(buf);
82+
83+
memset(buf, 0x00, CLEVO_LIGHTBAR_REPORT_SIZE);
84+
buf[0] = 0x1A;
85+
buf[7] = 0x01;
86+
WriteControl(buf);
87+
}
88+
89+
void ClevoLightbarController::SetColor(unsigned char red, unsigned char green, unsigned char blue)
90+
{
91+
/*---------------------------------------------------------*\
92+
| Set color: 0x14 0x00 0x01 R G B 0x00 0x00 |
93+
\*---------------------------------------------------------*/
94+
unsigned char buf[CLEVO_LIGHTBAR_REPORT_SIZE];
95+
96+
memset(buf, 0x00, CLEVO_LIGHTBAR_REPORT_SIZE);
97+
buf[0] = 0x14;
98+
buf[1] = 0x00;
99+
buf[2] = 0x01;
100+
buf[3] = red;
101+
buf[4] = green;
102+
buf[5] = blue;
103+
104+
WriteControl(buf);
105+
}
106+
107+
void ClevoLightbarController::SetBrightness(unsigned char brightness)
108+
{
109+
/*---------------------------------------------------------*\
110+
| Set brightness (mono mode): |
111+
| 0x08 0x22 0x01 0x01 brightness 0x01 0x00 0x00 |
112+
\*---------------------------------------------------------*/
113+
unsigned char buf[CLEVO_LIGHTBAR_REPORT_SIZE];
114+
115+
memset(buf, 0x00, CLEVO_LIGHTBAR_REPORT_SIZE);
116+
buf[0] = 0x08;
117+
buf[1] = 0x22;
118+
buf[2] = 0x01;
119+
buf[3] = 0x01;
120+
buf[4] = brightness;
121+
buf[5] = 0x01;
122+
123+
WriteControl(buf);
124+
}
125+
126+
void ClevoLightbarController::SetMode(unsigned char mode, unsigned char brightness, unsigned char speed)
127+
{
128+
/*---------------------------------------------------------*\
129+
| Currently only direct (mono) mode is implemented |
130+
| Breathing mode would be: 0x08 0x22 0x02 speed brightness |
131+
\*---------------------------------------------------------*/
132+
(void)mode;
133+
(void)speed;
134+
135+
SetBrightness(brightness);
136+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*---------------------------------------------------------*\
2+
| ClevoLightbarController.h |
3+
| |
4+
| Driver for Clevo laptop lightbar (ITE 8291 rev 0.03) |
5+
| |
6+
| Kyle Cascade (kyle@cascade.family) 16 Jan 2026 |
7+
| |
8+
| This file is part of the OpenRGB project |
9+
| SPDX-License-Identifier: GPL-2.0-or-later |
10+
\*---------------------------------------------------------*/
11+
12+
#pragma once
13+
14+
#include "RGBController.h"
15+
#include <string>
16+
#include <hidapi.h>
17+
18+
#define CLEVO_LIGHTBAR_REPORT_SIZE 8
19+
#define CLEVO_LIGHTBAR_BRIGHTNESS_MIN 0
20+
#define CLEVO_LIGHTBAR_BRIGHTNESS_MAX 100
21+
#define CLEVO_LIGHTBAR_SPEED_MIN 1
22+
#define CLEVO_LIGHTBAR_SPEED_MAX 10
23+
#define CLEVO_LIGHTBAR_SPEED_DEFAULT 5
24+
25+
enum
26+
{
27+
CLEVO_LIGHTBAR_MODE_DIRECT = 0,
28+
CLEVO_LIGHTBAR_MODE_BREATHING = 1,
29+
CLEVO_LIGHTBAR_MODE_OFF = 2
30+
};
31+
32+
class ClevoLightbarController
33+
{
34+
public:
35+
ClevoLightbarController(hid_device* dev_handle, const hid_device_info& info);
36+
~ClevoLightbarController();
37+
38+
std::string GetDeviceLocation();
39+
std::string GetSerialString();
40+
41+
void SetColor(unsigned char red, unsigned char green, unsigned char blue);
42+
void SetBrightness(unsigned char brightness);
43+
void SetMode(unsigned char mode, unsigned char brightness, unsigned char speed);
44+
void TurnOn();
45+
void TurnOff();
46+
47+
private:
48+
hid_device* dev;
49+
std::string location;
50+
51+
void WriteControl(unsigned char* data);
52+
};
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*---------------------------------------------------------*\
2+
| ClevoLightbarControllerDetect.cpp |
3+
| |
4+
| Detector for Clevo laptop lightbar (ITE 8291 rev 0.03) |
5+
| |
6+
| Kyle Cascade (kyle@cascade.family) 16 Jan 2026 |
7+
| |
8+
| This file is part of the OpenRGB project |
9+
| SPDX-License-Identifier: GPL-2.0-or-later |
10+
\*---------------------------------------------------------*/
11+
12+
#include "Detector.h"
13+
#include "ClevoLightbarController.h"
14+
#include "RGBController_ClevoLightbar.h"
15+
#include "RGBController.h"
16+
#include <hidapi.h>
17+
18+
/*-----------------------------------------------------*\
19+
| ITE Tech vendor ID |
20+
\*-----------------------------------------------------*/
21+
#define ITE_VID 0x048D
22+
23+
/*-----------------------------------------------------*\
24+
| CLEVO Lightbar product ID |
25+
\*-----------------------------------------------------*/
26+
#define CLEVO_LIGHTBAR_PID 0x7001
27+
28+
void DetectClevoLightbarControllers(hid_device_info* info, const std::string& name)
29+
{
30+
hid_device* dev = hid_open_path(info->path);
31+
32+
if(dev)
33+
{
34+
ClevoLightbarController* controller = new ClevoLightbarController(dev, *info);
35+
RGBController_ClevoLightbar* rgb_controller = new RGBController_ClevoLightbar(controller);
36+
rgb_controller->name = name;
37+
38+
ResourceManager::get()->RegisterRGBController(rgb_controller);
39+
}
40+
}
41+
42+
REGISTER_HID_DETECTOR_PU("CLEVO Lightbar", DetectClevoLightbarControllers, ITE_VID, CLEVO_LIGHTBAR_PID, 0xFF03, 0x02);
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
/*---------------------------------------------------------*\
2+
| RGBController_ClevoLightbar.cpp |
3+
| |
4+
| Generic RGB Interface for Clevo laptop lightbar |
5+
| |
6+
| Kyle Cascade (kyle@cascade.family) 16 Jan 2026 |
7+
| |
8+
| This file is part of the OpenRGB project |
9+
| SPDX-License-Identifier: GPL-2.0-or-later |
10+
\*---------------------------------------------------------*/
11+
12+
#include "RGBController_ClevoLightbar.h"
13+
14+
/**------------------------------------------------------------------*\
15+
@name CLEVO Lightbar
16+
@category LEDStrip
17+
@type USB
18+
@save :x:
19+
@direct :white_check_mark:
20+
@effects :x:
21+
@detectors DetectClevoLightbarControllers
22+
@comment
23+
\*-------------------------------------------------------------------*/
24+
25+
RGBController_ClevoLightbar::RGBController_ClevoLightbar(ClevoLightbarController* controller_ptr)
26+
{
27+
controller = controller_ptr;
28+
29+
name = "CLEVO Lightbar";
30+
vendor = "CLEVO Computers";
31+
type = DEVICE_TYPE_LEDSTRIP;
32+
description = "CLEVO Laptop Lightbar";
33+
location = controller->GetDeviceLocation();
34+
serial = controller->GetSerialString();
35+
36+
mode Direct;
37+
Direct.name = "Direct";
38+
Direct.value = CLEVO_LIGHTBAR_MODE_DIRECT;
39+
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
40+
Direct.color_mode = MODE_COLORS_PER_LED;
41+
Direct.brightness_min = CLEVO_LIGHTBAR_BRIGHTNESS_MIN;
42+
Direct.brightness_max = CLEVO_LIGHTBAR_BRIGHTNESS_MAX;
43+
Direct.brightness = CLEVO_LIGHTBAR_BRIGHTNESS_MAX;
44+
modes.push_back(Direct);
45+
46+
mode Off;
47+
Off.name = "Off";
48+
Off.value = CLEVO_LIGHTBAR_MODE_OFF;
49+
Off.flags = 0;
50+
Off.color_mode = MODE_COLORS_NONE;
51+
modes.push_back(Off);
52+
53+
SetupZones();
54+
}
55+
56+
RGBController_ClevoLightbar::~RGBController_ClevoLightbar()
57+
{
58+
delete controller;
59+
}
60+
61+
void RGBController_ClevoLightbar::SetupZones()
62+
{
63+
zone lightbar_zone;
64+
lightbar_zone.name = "Lightbar";
65+
lightbar_zone.type = ZONE_TYPE_SINGLE;
66+
lightbar_zone.leds_min = 1;
67+
lightbar_zone.leds_max = 1;
68+
lightbar_zone.leds_count = 1;
69+
lightbar_zone.matrix_map = NULL;
70+
zones.push_back(lightbar_zone);
71+
72+
led lightbar_led;
73+
lightbar_led.name = "Lightbar";
74+
leds.push_back(lightbar_led);
75+
76+
SetupColors();
77+
}
78+
79+
void RGBController_ClevoLightbar::ResizeZone(int /*zone*/, int /*new_size*/)
80+
{
81+
/*---------------------------------------------------------*\
82+
| This device does not support resizing zones |
83+
\*---------------------------------------------------------*/
84+
}
85+
86+
void RGBController_ClevoLightbar::DeviceUpdateLEDs()
87+
{
88+
unsigned char red = RGBGetRValue(colors[0]);
89+
unsigned char green = RGBGetGValue(colors[0]);
90+
unsigned char blue = RGBGetBValue(colors[0]);
91+
92+
controller->SetColor(red, green, blue);
93+
controller->SetBrightness(modes[active_mode].brightness);
94+
}
95+
96+
void RGBController_ClevoLightbar::UpdateZoneLEDs(int /*zone*/)
97+
{
98+
DeviceUpdateLEDs();
99+
}
100+
101+
void RGBController_ClevoLightbar::UpdateSingleLED(int /*led*/)
102+
{
103+
DeviceUpdateLEDs();
104+
}
105+
106+
void RGBController_ClevoLightbar::DeviceUpdateMode()
107+
{
108+
if(modes[active_mode].value == CLEVO_LIGHTBAR_MODE_OFF)
109+
{
110+
controller->TurnOff();
111+
}
112+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*---------------------------------------------------------*\
2+
| RGBController_ClevoLightbar.h |
3+
| |
4+
| Generic RGB Interface for Clevo laptop lightbar |
5+
| |
6+
| Kyle Cascade (kyle@cascade.family) 16 Jan 2026 |
7+
| |
8+
| This file is part of the OpenRGB project |
9+
| SPDX-License-Identifier: GPL-2.0-or-later |
10+
\*---------------------------------------------------------*/
11+
12+
#pragma once
13+
14+
#include "RGBController.h"
15+
#include "ClevoLightbarController.h"
16+
17+
class RGBController_ClevoLightbar : public RGBController
18+
{
19+
public:
20+
RGBController_ClevoLightbar(ClevoLightbarController* controller_ptr);
21+
~RGBController_ClevoLightbar();
22+
23+
void SetupZones();
24+
void ResizeZone(int zone, int new_size);
25+
26+
void DeviceUpdateLEDs();
27+
void UpdateZoneLEDs(int zone);
28+
void UpdateSingleLED(int led);
29+
30+
void DeviceUpdateMode();
31+
32+
private:
33+
ClevoLightbarController* controller;
34+
};

0 commit comments

Comments
 (0)