Skip to content

Commit

Permalink
csd-power-manager: Assume a keyboard backlight max-value of 0 to
Browse files Browse the repository at this point in the history
mean that adjustment is unsupported.

Fixes #324.
  • Loading branch information
mtwebster committed Oct 1, 2024
1 parent d97f923 commit 5227d11
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions plugins/power/csd-power-manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -4737,6 +4737,16 @@ handle_method_call_keyboard (CsdPowerManager *manager,
guint percentage;
GError *error = NULL;

if (manager->priv->kbd_brightness_max == 0) {
error = g_error_new (CSD_POWER_MANAGER_ERROR,
CSD_POWER_MANAGER_ERROR_NOT_SUPPORTED,
"Keyboard backlight control is not supported");

g_dbus_method_invocation_return_gerror (invocation, error);
g_error_free (error);
return;
}

if (g_strcmp0 (method_name, "GetPercentage") == 0) {
g_debug ("keyboard get percentage");
ret = upower_kbd_get_percentage (manager, &error);
Expand Down
3 changes: 2 additions & 1 deletion plugins/power/csd-power-manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ typedef struct

enum
{
CSD_POWER_MANAGER_ERROR_FAILED
CSD_POWER_MANAGER_ERROR_FAILED,
CSD_POWER_MANAGER_ERROR_NOT_SUPPORTED
};

GType csd_power_manager_get_type (void);
Expand Down

0 comments on commit 5227d11

Please sign in to comment.