Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add led indicator for display is dimmed state
If the display brightness difference between display on and dimmed is too
small to notice, use low intensity led pattern as dimmed indicator.
  • Loading branch information
spiiroin committed Apr 11, 2014
1 parent c749d9f commit 49cf409
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
6 changes: 6 additions & 0 deletions builtin-gconf.c
Expand Up @@ -1500,6 +1500,12 @@ static const setting_t gconf_defaults[] =
.type = "b",
.def = "false",
},
{
// no define; used by mce display module
.key = "/system/osso/dsm/leds/PatternDisplayDimmed",
.type = "b",
.def = "true",
},
{
// MCE_GCONF_PROXIMITY_PS_ENABLED_PATH @ proximity.h
.key = "/system/osso/dsm/proximity/ps_enabled",
Expand Down
4 changes: 4 additions & 0 deletions inifiles/hybris-led.ini
Expand Up @@ -12,6 +12,7 @@
# 4 only show pattern if the display is off, or if in acting dead
# 5 always show pattern, even if LED disabled
# 6 Like 0, but automatically disable after display on
# 7 show pattern even when the display is dim
# [2] Timeout in seconds before pattern is disabled, 0 for infinite
# [3] OnPeriod in milliseconds
# [4] OffPeriod in milliseconds
Expand All @@ -26,6 +27,9 @@ PatternDeviceOn=254;0;0;0;0;0000ff
PatternDeviceSoftOff=253;0;0;0;0;00ffff
# 00ffff=cyan

PatternDisplayDimmed=252;7;0;0;0;001f1f
# 001f1f=low intensity cyan

PatternPowerOn=10;3;0;0;0;bfbfbf
#bfbfbf = grey75

Expand Down
10 changes: 10 additions & 0 deletions modules/display.c
Expand Up @@ -1954,6 +1954,16 @@ static void mdy_brightness_set_dim_level(void)
mdy_brightness_level_display_dim, new_brightness);
mdy_brightness_level_display_dim = new_brightness;
}

int delta = (mdy_brightness_level_display_on -
mdy_brightness_level_display_dim);
int limit = mdy_brightness_level_maximum * 10 / 100;

execute_datapipe_output_triggers(delta < limit ?
&led_pattern_activate_pipe :
&led_pattern_deactivate_pipe,
"PatternDisplayDimmed",
USE_INDATA);
}

static void mdy_brightness_set_on_level(gint hbm_and_level)
Expand Down
5 changes: 5 additions & 0 deletions modules/led.c
Expand Up @@ -1235,6 +1235,11 @@ static void led_update_active_pattern(void)
(new_active_pattern->policy == 5))
break;

/* Show pattern with visibility 7 if display is dimmed */
if( new_active_pattern->policy == 7 &&
display_state == MCE_DISPLAY_DIM )
break;

/* Acting dead behaviour */
if (system_state == MCE_STATE_ACTDEAD) {
/* If we're in acting dead,
Expand Down

0 comments on commit 49cf409

Please sign in to comment.