Skip to content

Commit

Permalink
Always log double tap and power key event processing in devel builds
Browse files Browse the repository at this point in the history
This needs to be scaled down once all power key and double tap wake
up problems have been resolved.
  • Loading branch information
spiiroin committed Feb 4, 2014
1 parent e76f087 commit 3856fa0
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 17 deletions.
7 changes: 7 additions & 0 deletions Makefile
Expand Up @@ -71,6 +71,9 @@ endif
endif
PKG_CONFIG ?= pkg-config

# Whether to enable DEVEL release logging
ENABLE_DEVEL_LOGGING ?= y

# Whether to use sensorfw for ALS/PS
ENABLE_SENSORFW ?= y

Expand Down Expand Up @@ -245,6 +248,10 @@ ifeq ($(ENABLE_DOUBLETAP_EMULATION),y)
CPPFLAGS += -DENABLE_DOUBLETAP_EMULATION
endif

ifeq ($(ENABLE_DEVEL_LOGGING),y)
CPPFLAGS += -DENABLE_DEVEL_LOGGING
endif

# C Compiler
CFLAGS += -std=c99

Expand Down
27 changes: 20 additions & 7 deletions event-input.c
Expand Up @@ -1180,6 +1180,21 @@ static gboolean touchscreen_iomon_cb(gpointer data, gsize bytes_read)
return flush;
}

/** Proximity state enum to human readable string
*/
static const char *proximity_state_repr(cover_state_t state)
{
const char *repr = "unknown";
switch( state ) {
case COVER_UNDEF: repr = "undefined"; break;
case COVER_CLOSED: repr = "covered"; break;
case COVER_OPEN: repr = "not covered"; break;
default:
break;
}
return repr;
}

static gboolean doubletap_iomon_cb(gpointer data, gsize bytes_read)
{
struct input_event *ev = data;
Expand All @@ -1197,16 +1212,14 @@ static gboolean doubletap_iomon_cb(gpointer data, gsize bytes_read)
cover_state_t proximity_sensor_state =
datapipe_get_gint(proximity_sensor_pipe);

mce_log(LL_DEVEL, "[doubletap] while proximity=%s",
proximity_state_repr(proximity_sensor_state));

if( proximity_sensor_state == COVER_CLOSED ) {
/* As we should disable double tap detector rather
* than filtering the events with proximity state.
* Emit one warning then switch to debug logging */
static loglevel_t lev = LL_WARN;
mce_log(lev, "IGNORING DOUBLETAP");
lev = LL_DEBUG;
mce_log(LL_DEVEL, "[doubletap] ignored");
}
else {
mce_log(LL_NOTICE, "FORWARDING DOUBLETAP");
mce_log(LL_DEVEL, "[doubletap] forwarded");
/* Mimic N9 style gesture event for which we
* already have logic in place */
ev->type = EV_MSC;
Expand Down
7 changes: 7 additions & 0 deletions mce-log.h
Expand Up @@ -38,6 +38,13 @@ typedef enum {
LL_DEBUG = 7, /**< Useful when debugging */

LL_DEFAULT = LL_WARN, /**< Default log level */

#ifdef ENABLE_DEVEL_LOGGING
LL_DEVEL = LL_CRIT, /**< Log by default on devel build */
#else
LL_DEVEL = LL_NOTICE, /**< Otherwise verbose mode needed */
#endif

} loglevel_t;

void mce_log_add_pattern(const char *pat);
Expand Down
17 changes: 8 additions & 9 deletions powerkey.c
Expand Up @@ -163,6 +163,9 @@ static void powerkey_wakelock_rethink(void)
static void generic_powerkey_handler(poweraction_t action,
gchar *dbus_signal)
{
mce_log(LL_DEVEL, "action=%d, signal=%s", (int)action,
dbus_signal ?: "n/a");

alarm_ui_state_t alarm_ui_state =
datapipe_get_gint(alarm_ui_state_pipe);
submode_t submode = mce_get_submode_int32();
Expand All @@ -182,13 +185,9 @@ static void generic_powerkey_handler(poweraction_t action,
* or if we're in alarm state
*/
if ((submode & MCE_TKLOCK_SUBMODE) == 0) {
mce_log(LL_WARN,
"Requesting shutdown (action: %d)",
action);

mce_log(LL_DEVEL, "Requesting shutdown");
request_normal_shutdown();
}

break;

case POWER_SOFT_POWEROFF:
Expand All @@ -214,7 +213,7 @@ static void generic_powerkey_handler(poweraction_t action,
* or powering up will bounce back to display off
* once initial the off->on transition finishes */

mce_log(LL_DEBUG, "display -> off + lock");
mce_log(LL_DEVEL, "display -> off, ui -> locked");

/* Do the locking before turning display off.
*
Expand All @@ -234,7 +233,7 @@ static void generic_powerkey_handler(poweraction_t action,
/* If the display is not fully powered on, always
* request MCE_DISPLAY_ON */

mce_log(LL_DEBUG, "display -> on");
mce_log(LL_DEVEL, "display -> on");
execute_datapipe(&display_state_req_pipe,
GINT_TO_POINTER(MCE_DISPLAY_ON),
USE_INDATA, CACHE_INDATA);
Expand Down Expand Up @@ -619,7 +618,7 @@ static void powerkey_trigger(gconstpointer const data)
if ((ev != NULL) && (ev->code == KEY_POWER)) {
/* If set, the [power] key was pressed */
if (ev->value == 1) {
mce_log(LL_DEBUG, "[power] pressed");
mce_log(LL_DEVEL, "[powerkey] pressed");

/* Are we waiting for a doublepress? */
if (doublepress_timeout_cb_id != 0) {
Expand All @@ -636,7 +635,7 @@ static void powerkey_trigger(gconstpointer const data)
setup_powerkey_timeout(longdelay);
}
} else if (ev->value == 0) {
mce_log(LL_DEBUG, "[power] released");
mce_log(LL_DEVEL, "[powerkey] released");

/* Short key press */
if (powerkey_timeout_cb_id != 0) {
Expand Down
2 changes: 1 addition & 1 deletion rpm/mce.spec
Expand Up @@ -50,7 +50,7 @@ This package contains test suite for mce

%build
./verify_version
make %{?jobs:-j%jobs}
make %{?jobs:-j%jobs} %{!?qa_stage_devel:ENABLE_DEVEL_LOGGING=n}

%install
rm -rf %{buildroot}
Expand Down

0 comments on commit 3856fa0

Please sign in to comment.