mirror of
https://github.com/wessel-novacustom/clevo-keyboard.git
synced 2024-11-15 03:34:01 +01:00
Implement temporal behaviour to work around KDE bug
This commit is contained in:
parent
7a38834265
commit
40f46087f5
|
@ -55,7 +55,7 @@ static struct key_entry clevo_keymap[] = {
|
||||||
{ KE_KEY, CLEVO_EVENT_KB_LEDS_TOGGLE, { KEY_KBDILLUMTOGGLE } },
|
{ KE_KEY, CLEVO_EVENT_KB_LEDS_TOGGLE, { KEY_KBDILLUMTOGGLE } },
|
||||||
{ KE_KEY, CLEVO_EVENT_KB_LEDS_CYCLE_MODE, { KEY_LIGHTS_TOGGLE } },
|
{ KE_KEY, CLEVO_EVENT_KB_LEDS_CYCLE_MODE, { KEY_LIGHTS_TOGGLE } },
|
||||||
// Single cycle key (white only versions)
|
// Single cycle key (white only versions)
|
||||||
{ KE_KEY, CLEVO_EVENT_KB_LEDS_CYCLE_BRIGHTNESS, { KEY_KBDILLUMTOGGLE } }, //FIXME Cycle in driver or toggle in desktop environment?
|
{ KE_KEY, CLEVO_EVENT_KB_LEDS_CYCLE_BRIGHTNESS, { KEY_KBDILLUMTOGGLE } },
|
||||||
|
|
||||||
// Touchpad
|
// Touchpad
|
||||||
// The weirdly named touchpad toggle key that is implemented as KEY_F21 "everywhere"
|
// The weirdly named touchpad toggle key that is implemented as KEY_F21 "everywhere"
|
||||||
|
|
|
@ -87,7 +87,7 @@ static void clevo_leds_set_brightness(struct led_classdev *led_cdev __always_unu
|
||||||
led_cdev->brightness = brightness;
|
led_cdev->brightness = brightness;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clevo_leds_set_brightness_mc(struct led_classdev *led_cdev, enum led_brightness brightness) {
|
/*static void clevo_leds_set_brightness_mc(struct led_classdev *led_cdev, enum led_brightness brightness) {
|
||||||
int ret;
|
int ret;
|
||||||
u32 zone, color;
|
u32 zone, color;
|
||||||
struct led_classdev_mc *mcled_cdev = lcdev_to_mccdev(led_cdev);
|
struct led_classdev_mc *mcled_cdev = lcdev_to_mccdev(led_cdev);
|
||||||
|
@ -111,6 +111,40 @@ static void clevo_leds_set_brightness_mc(struct led_classdev *led_cdev, enum led
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
led_cdev->brightness = brightness;
|
led_cdev->brightness = brightness;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
// Temprary fix for KDE: KDE does only set one kbd_backlight brightness value, this version of the
|
||||||
|
// function uses clevos built in brightness setting to set the whole keyboard brightness at once.
|
||||||
|
// -> use clevo_evaluate_set_brightness() to set overall brightness via firmware instead of scaling
|
||||||
|
// the RGB values
|
||||||
|
// -> update all clevo_mcled_cdevs brightness levels to refect that the firmware method sets the
|
||||||
|
// the whole keyboard brightness and not just one zone
|
||||||
|
// This is a temporary fix until KDE handles multiple keyboard backlights correctly
|
||||||
|
static struct led_classdev_mc clevo_mcled_cdevs[3]; // forward declaration
|
||||||
|
static void clevo_leds_set_brightness_mc(struct led_classdev *led_cdev, enum led_brightness brightness) {
|
||||||
|
int ret;
|
||||||
|
u32 zone, color;
|
||||||
|
struct led_classdev_mc *mcled_cdev = lcdev_to_mccdev(led_cdev);
|
||||||
|
|
||||||
|
ret = clevo_evaluate_set_brightness(brightness);
|
||||||
|
if (ret) {
|
||||||
|
pr_debug("clevo_leds_set_brightness_mc(): clevo_evaluate_set_brightness() failed\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
clevo_mcled_cdevs[0].brightness = brightness;
|
||||||
|
clevo_mcled_cdevs[1].brightness = brightness;
|
||||||
|
clevo_mcled_cdevs[2].brightness = brightness;
|
||||||
|
|
||||||
|
zone = mcled_cdev->subled_info[0].channel;
|
||||||
|
|
||||||
|
color = (mcled_cdev->subled_info[0].intensity << 16) +
|
||||||
|
(mcled_cdev->subled_info[1].intensity << 8) +
|
||||||
|
mcled_cdev->subled_info[2].intensity;
|
||||||
|
|
||||||
|
ret = clevo_evaluate_set_color(zone, color);
|
||||||
|
if (ret) {
|
||||||
|
pr_debug("clevo_leds_set_brightness_mc(): clevo_evaluate_set_color() failed\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct led_classdev clevo_led_cdev = {
|
static struct led_classdev clevo_led_cdev = {
|
||||||
|
|
Loading…
Reference in a new issue