Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.

Commit 63e7de7

Browse files
committed
Map gauge key to "open tcc key combo"
1 parent e236eec commit 63e7de7

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

src/clevo_keyboard.h

+23-13
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
#define CLEVO_EVENT_RFKILL1 0x85
4242
#define CLEVO_EVENT_RFKILL2 0x86
4343

44+
#define CLEVO_EVENT_GAUGE_KEY 0x59
45+
4446
#define CLEVO_KB_MODE_DEFAULT 0 // "CUSTOM"/Static Color
4547

4648
static struct clevo_interfaces_t {
@@ -248,27 +250,35 @@ static u8 param_kbd_backlight_mode = CLEVO_KB_MODE_DEFAULT;
248250
module_param_cb(kbd_backlight_mode, &param_ops_mode_ops, &param_kbd_backlight_mode, S_IRUSR);
249251
MODULE_PARM_DESC(kbd_backlight_mode, "Set the keyboard backlight mode");
250252

253+
static void clevo_send_cc_combo(void)
254+
{
255+
// Special key combination. Opens TCC by default when installed.
256+
input_report_key(clevo_keyboard_driver.input_device, KEY_LEFTMETA, 1);
257+
input_report_key(clevo_keyboard_driver.input_device, KEY_LEFTALT, 1);
258+
input_report_key(clevo_keyboard_driver.input_device, KEY_F6, 1);
259+
input_sync(clevo_keyboard_driver.input_device);
260+
input_report_key(clevo_keyboard_driver.input_device, KEY_F6, 0);
261+
input_report_key(clevo_keyboard_driver.input_device, KEY_LEFTALT, 0);
262+
input_report_key(clevo_keyboard_driver.input_device, KEY_LEFTMETA, 0);
263+
input_sync(clevo_keyboard_driver.input_device);
264+
}
265+
251266
static void clevo_keyboard_event_callb(u32 event)
252267
{
253268
u32 key_event = event;
254269

255270
TUXEDO_DEBUG("Clevo event: %0#6x\n", event);
256271

257272
switch (key_event) {
273+
case CLEVO_EVENT_GAUGE_KEY:
274+
clevo_send_cc_combo();
275+
break;
258276
case CLEVO_EVENT_KB_LEDS_CYCLE_MODE:
259-
if (clevo_leds_get_backlight_type() == CLEVO_KB_BACKLIGHT_TYPE_FIXED_COLOR) {
260-
// Special key combination. Opens TCC by default when installed.
261-
input_report_key(clevo_keyboard_driver.input_device, KEY_LEFTMETA, 1);
262-
input_report_key(clevo_keyboard_driver.input_device, KEY_LEFTALT, 1);
263-
input_report_key(clevo_keyboard_driver.input_device, KEY_F6, 1);
264-
input_sync(clevo_keyboard_driver.input_device);
265-
input_report_key(clevo_keyboard_driver.input_device, KEY_F6, 0);
266-
input_report_key(clevo_keyboard_driver.input_device, KEY_LEFTALT, 0);
267-
input_report_key(clevo_keyboard_driver.input_device, KEY_LEFTMETA, 0);
268-
input_sync(clevo_keyboard_driver.input_device);
269-
} else {
270-
set_next_color_whole_kb();
271-
}
277+
if (clevo_leds_get_backlight_type() == CLEVO_KB_BACKLIGHT_TYPE_FIXED_COLOR) {
278+
clevo_send_cc_combo();
279+
} else {
280+
set_next_color_whole_kb();
281+
}
272282
break;
273283
case CLEVO_EVENT_KB_LEDS_CYCLE_BRIGHTNESS:
274284
clevo_leds_notify_brightness_change_extern();

0 commit comments

Comments
 (0)