Skip to content

Commit

Permalink
[buttonbacklight] Implement button backlight policy. JB#39838
Browse files Browse the repository at this point in the history
Devices designed with Android in mind can have menu/home/back
buttons in front face. In some devices these buttons are
practically invisible unless the underlying button backlight is
turned on.

Add D-Bus interface that can used by applications and/or
lipstick for requesting and tracking button backlight state.

Implement policy that turns button backlight on when:
- Related sysfs controls have been defined in mce configuration
- At least one D-Bus client has requested backlight
- Display is powered up
- Lockscreen is not active

Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed Oct 6, 2017
1 parent fa90d2e commit 74e962b
Show file tree
Hide file tree
Showing 8 changed files with 902 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .depend
Expand Up @@ -570,6 +570,24 @@ modules/bluetooth.pic.o:\
mce-log.h\
mce.h\

modules/buttonbacklight.o:\
modules/buttonbacklight.c\
builtin-gconf.h\
datapipe.h\
mce-conf.h\
mce-dbus.h\
mce-log.h\
mce.h\

modules/buttonbacklight.pic.o:\
modules/buttonbacklight.c\
builtin-gconf.h\
datapipe.h\
mce-conf.h\
mce-dbus.h\
mce-log.h\
mce.h\

modules/callstate.o:\
modules/callstate.c\
builtin-gconf.h\
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Expand Up @@ -160,6 +160,7 @@ MODULES += $(MODULE_DIR)/battery-bme.so
MODULES += $(MODULE_DIR)/battery-upower.so
MODULES += $(MODULE_DIR)/bluetooth.so
MODULES += $(MODULE_DIR)/battery-statefs.so
MODULES += $(MODULE_DIR)/buttonbacklight.so
MODULES += $(MODULE_DIR)/display.so
MODULES += $(MODULE_DIR)/usbmode.so
MODULES += $(MODULE_DIR)/doubletap.so
Expand Down Expand Up @@ -574,6 +575,7 @@ NORMALIZE_USES_SPC =\
modules/battery-upower.c\
modules/battery-statefs.c\
modules/bluetooth.c\
modules/buttonbacklight.c\
modules/callstate.c\
modules/callstate.h\
modules/camera.h\
Expand Down
7 changes: 7 additions & 0 deletions inifiles/buttonbacklight.ini
@@ -0,0 +1,7 @@
# Configuration file for MCE - android buttons backlight control

[ButtonBacklight]

ControlPath=/sys/class/leds/button-backlight/brightness
ControlValueEnable=1
ControlValueDisable=0
2 changes: 1 addition & 1 deletion inifiles/mce.ini
Expand Up @@ -16,7 +16,7 @@ ModulePath=/usr/lib/mce/modules
# to avoid unnecessary brightness fluctuations on mce startup
#
# Note: the name should not include the "lib"-prefix
Modules=radiostates;filter-brightness-als;display;keypad;led;battery-statefs;inactivity;alarm;callstate;audiorouting;proximity;powersavemode;cpu-keepalive;doubletap;packagekit;sensor-gestures;bluetooth;memnotify;usbmode
Modules=radiostates;filter-brightness-als;display;keypad;led;battery-statefs;inactivity;alarm;callstate;audiorouting;proximity;powersavemode;cpu-keepalive;doubletap;packagekit;sensor-gestures;bluetooth;memnotify;usbmode;buttonbacklight

[KeyPad]

Expand Down
16 changes: 16 additions & 0 deletions mce-conf.h
Expand Up @@ -45,4 +45,20 @@ const gchar * const *mce_conf_get_touchscreen_event_drivers(void);
const gchar * const *mce_conf_get_keyboard_event_drivers(void);
const gchar * const *mce_conf_get_blacklisted_event_drivers(void);

/* ========================================================================= *
* Constant related to button backlight configuration
* ========================================================================= */

/** Name of the display backlight configuration group */
# define MCE_CONF_BUTTON_BACKLIGHT_GROUP "ButtonBacklight"

/** Path to button backlight control file */
# define MCE_CONF_BUTTON_BACKLIGHT_CONTROL_PATH "ControlPath"

/** Value to write when enabling button backlight */
# define MCE_CONF_BUTTON_BACKLIGHT_CONTROL_VALUE_ENABLE "ControlValueEnable"

/** Value to write when disabling button backlight */
# define MCE_CONF_BUTTON_BACKLIGHT_CONTROL_VALUE_DISABLE "ControlValueDisable"

#endif /* _MCE_CONF_H_ */

0 comments on commit 74e962b

Please sign in to comment.