summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlo Caione <carlo@endlessm.com>2018-01-03 18:23:25 +0000
committerPhaedrus Leeds <matthew.leeds@endlessm.com>2020-09-03 14:38:40 -0700
commit13d403a64f94470c826cf2e60d76a7572b1f75b6 (patch)
tree0f08a13a05f636ef7b59498798cf8e7d676fdf1c
parentfb48bed631dee21ca7f4c6b61b7bfff6efad5910 (diff)
downloadgnome-settings-daemon-fix-errors-on-kbd-unplug.tar.gz
power: Do not compute percentage on keyboard disappearingfix-errors-on-kbd-unplug
When the module in charge of the keyboard backlight is rmmod-ed, upower emits a new signal to communicate to gsd that we don't have backlight anymore. This signal is carrying (value == -1, max == 0). In this case we do not want to calculate the new brightness. Signed-off-by: Carlo Caione <carlo@endlessm.com> Note 2020-09-03: Based on discussion on the Endless bug tracker, the steps to reproduce this are to unplug a Filco USB keyboard from a Mission One, but perhaps it's applicable on other hardware as well. The original PR for this was https://github.com/endlessm/gnome-settings-daemon/pull/43 - mwleeds
-rw-r--r--plugins/power/gsd-power-manager.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index 0e65bd2a..c6630929 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -1547,10 +1547,12 @@ upower_kbd_proxy_signal_cb (GDBusProxy *proxy,
return;
manager->kbd_brightness_now = brightness;
- percentage = ABS_TO_PERCENTAGE (0,
- manager->kbd_brightness_max,
- manager->kbd_brightness_now);
- backlight_iface_emit_changed (manager, GSD_POWER_DBUS_INTERFACE_KEYBOARD, percentage, source);
+ if (brightness != -1) {
+ percentage = ABS_TO_PERCENTAGE (0,
+ manager->kbd_brightness_max,
+ manager->kbd_brightness_now);
+ backlight_iface_emit_changed (manager, GSD_POWER_DBUS_INTERFACE_KEYBOARD, percentage, source);
+ }
}
static gboolean