Index: apps/plugins/lib/helper.c =================================================================== --- apps/plugins/lib/helper.c (Revision 19940) +++ apps/plugins/lib/helper.c (Arbeitskopie) @@ -22,19 +22,35 @@ #include "plugin.h" #include "helper.h" -/* Force the backlight on */ -void backlight_force_on(void) +/* Values of the backlight related setting for 'always on' and 'always off' */ +#define BACKLIGHT_ON 0 +#define BACKLIGHT_OFF (-1) + +/* Force the backlight to the new value */ +static void backlight_set(int newvalue) { if(!rb) return; - if (rb->global_settings->backlight_timeout > 0) - rb->backlight_set_timeout(0); + if (rb->global_settings->backlight_timeout != newvalue) + rb->backlight_set_timeout(newvalue); #if CONFIG_CHARGING - if (rb->global_settings->backlight_timeout_plugged > 0) - rb->backlight_set_timeout_plugged(0); + if (rb->global_settings->backlight_timeout_plugged != newvalue) + rb->backlight_set_timeout_plugged(newvalue); #endif /* CONFIG_CHARGING */ } +/* Force the backlight on */ +void backlight_force_on(void) +{ + backlight_set(BACKLIGHT_ON); +} + +/* Force the backlight off */ +void backlight_force_off(void) +{ + backlight_set(BACKLIGHT_OFF); +} + /* Reset backlight operation to its settings */ void backlight_use_settings(void) { @@ -48,19 +64,32 @@ } #ifdef HAVE_REMOTE_LCD -/* Force the backlight on */ -void remote_backlight_force_on(void) +/* Force the remote backlight to the new value */ +static void remote_backlight_set(int newvalue) { if (!rb) return; - if (rb->global_settings->remote_backlight_timeout > 0) - rb->remote_backlight_set_timeout(0); + if (rb->global_settings->remote_backlight_timeout != newvalue) + rb->remote_backlight_set_timeout(newvalue); #if CONFIG_CHARGING - if (rb->global_settings->remote_backlight_timeout_plugged > 0) - rb->remote_backlight_set_timeout_plugged(0); + if (rb->global_settings->remote_backlight_timeout_plugged != newvalue) + rb->remote_backlight_set_timeout_plugged(newvalue); #endif /* CONFIG_CHARGING */ } +/* Force the remote backlight on */ +void remote_backlight_force_on(void) +{ + remote_backlight_set(BACKLIGHT_ON); +} + +/* Force the remote backlight off */ +void remote_backlight_force_off(void) +{ + remote_backlight_set(BACKLIGHT_OFF); +} + + /* Reset backlight operation to its settings */ void remote_backlight_use_settings(void) { @@ -76,15 +105,27 @@ #endif /* HAVE_REMOTE_LCD */ #ifdef HAVE_BUTTON_LIGHT -/* Force the buttonlight on */ -void buttonlight_force_on(void) +/* Force the buttonlight to the new value */ +static void buttonlight_set(int newvalue) { if (!rb) return; - if (rb->global_settings->buttonlight_timeout > 0) - rb->buttonlight_set_timeout(0); + if (rb->global_settings->buttonlight_timeout != newvalue) + rb->buttonlight_set_timeout(newvalue); } +/* Force the buttonlight on */ +void buttonlight_force_on(void) +{ + buttonlight_set(BACKLIGHT_ON); +} + +/* Force the buttonlight off */ +void buttonlight_force_off(void) +{ + buttonlight_set(BACKLIGHT_OFF); +} + /* Reset buttonlight operation to its settings */ void buttonlight_use_settings(void) { Index: apps/plugins/lib/helper.h =================================================================== --- apps/plugins/lib/helper.h (Revision 19940) +++ apps/plugins/lib/helper.h (Arbeitskopie) @@ -27,13 +27,16 @@ * Backlight on/off operations */ void backlight_force_on(void); +void backlight_force_off(void); void backlight_use_settings(void); #ifdef HAVE_REMOTE_LCD void remote_backlight_force_on(void); +void remote_backlight_force_off(void); void remote_backlight_use_settings(void); #endif #ifdef HAVE_BUTTON_LIGHT void buttonlight_force_on(void); +void buttonlight_force_off(void); void buttonlight_use_settings(void); #endif