Skip to content

Commit

Permalink
Start led pattern when killing lipstick
Browse files Browse the repository at this point in the history
Configure "killing lipstick" led pattern. Needs to have higher priority
than "problems with lipstick ipc" patterns, but lower than "problems
with frame buffer sleep/wakeup".

The led pattern is started when mce tries to make lipstick dump core.
And stopped when lipstick process dies - or when even SIGKILL does
not result in death of lipstick.

[mce] Start led pattern when killing lipstick
  • Loading branch information
spiiroin committed Apr 8, 2014
1 parent 1a4f5df commit 19624ed
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 3 deletions.
6 changes: 6 additions & 0 deletions builtin-gconf.c
Expand Up @@ -1482,6 +1482,12 @@ static const setting_t gconf_defaults[] =
.type = "b",
.def = "true",
},
{
// no define; used by mce display module
.key = "/system/osso/dsm/leds/PatternKillingLipstick",
.type = "b",
.def = "true",
},
{
// no define; used by mce event input
.key = "/system/osso/dsm/leds/PatternTouchInputBlocked",
Expand Down
9 changes: 6 additions & 3 deletions inifiles/debug-led.ini
Expand Up @@ -28,13 +28,16 @@
PatternDisplayResumeFailed=11;5;0;100;100;ffff00

# No reply to UI start dbus ipc -> green
PatternDisplayUnblankFailed=12;5;0;100;100;00ff00
PatternDisplayUnblankFailed=13;5;0;100;100;00ff00

# No reply to UI stop dbus ipc -> red
PatternDisplayBlankFailed=12;5;0;100;100;ff0000
PatternDisplayBlankFailed=13;5;0;100;100;ff0000

# Frame buffer does not go to sleep -> cyan
PatternDisplaySuspendFailed=11;5;0;100;100;00ffff

# Attempting to core dump lipstick -> Magenta
PatternKillingLipstick=12;5;0;100;100;ff00ff

# Touch input blocked after wakeup -> blue
PatternTouchInputBlocked=13;5;0;100;100;0000ff
PatternTouchInputBlocked=14;5;0;100;100;0000ff
35 changes: 35 additions & 0 deletions modules/display.c
Expand Up @@ -402,6 +402,7 @@ static void mdy_waitfb_thread_stop(waitfb_t *self);
* LIPSTICK_KILLER
* ------------------------------------------------------------------------- */

static void mdy_lipstick_killer_enable_led(bool enable);
static gboolean mdy_lipstick_killer_verify_cb(gpointer aptr);
static gboolean mdy_lipstick_killer_kill_cb(gpointer aptr);
static gboolean mdy_lipstick_killer_core_cb(gpointer aptr);
Expand Down Expand Up @@ -3488,6 +3489,27 @@ static int mdy_lipstick_killer_pid = -1;
/** Currently active lipstick killer timer id */
static guint mdy_lipstick_killer_id = 0;

/** Enable/Disable lipstick killer led pattern
*
* @param enable true to start the led, false to stop it
*/
static void mdy_lipstick_killer_enable_led(bool enable)
{
static bool enabled = false;

if( enabled == enable )
goto EXIT;

enabled = enable;
execute_datapipe_output_triggers(enabled ?
&led_pattern_activate_pipe :
&led_pattern_deactivate_pipe,
"PatternKillingLipstick",
USE_INDATA);
EXIT:
return;
}

/** Timer for verifying that lipstick has exited after kill signal
*
* @param aptr Process identifier as void pointer
Expand All @@ -3509,6 +3531,9 @@ static gboolean mdy_lipstick_killer_verify_cb(gpointer aptr)
mce_log(LL_ERR, "lipstick is not responsive and killing it failed");

EXIT:
/* Stop the led pattern even if we can't kill lipstick process */
mdy_lipstick_killer_enable_led(false);

return FALSE;
}

Expand Down Expand Up @@ -3557,6 +3582,9 @@ static gboolean mdy_lipstick_killer_kill_cb(gpointer aptr)
}

EXIT:
/* Keep led pattern active if verify timer was scheduled */
mdy_lipstick_killer_enable_led(mdy_lipstick_killer_id != 0);

return FALSE;
}

Expand Down Expand Up @@ -3610,6 +3638,10 @@ static gboolean mdy_lipstick_killer_core_cb(gpointer aptr)
mdy_lipstick_killer_kill_cb,
GINT_TO_POINTER(pid));
EXIT:

/* Start led pattern active if kill timer was scheduled */
mdy_lipstick_killer_enable_led(mdy_lipstick_killer_id != 0);

return FALSE;
}

Expand Down Expand Up @@ -3658,6 +3690,9 @@ static void mdy_lipstick_killer_cancel(void)
mdy_lipstick_killer_id = 0;
mce_log(LL_DEBUG, "cancelled lipstick killer");
}

/* In any case stop the led pattern */
mdy_lipstick_killer_enable_led(false);
}

/* ========================================================================= *
Expand Down

0 comments on commit 19624ed

Please sign in to comment.