const gchar *g_module_check_init(GModule *module) { (void)module; /* Get initial state of datapipes */ call_state = datapipe_get_gint(call_state_pipe); alarm_ui_state = datapipe_get_gint(alarm_ui_state_pipe); display_state = display_state_get(); submode = datapipe_get_gint(submode_pipe); /* Append triggers/filters to datapipes */ append_input_trigger_to_datapipe(&call_state_pipe, call_state_trigger); append_input_trigger_to_datapipe(&alarm_ui_state_pipe, alarm_ui_state_trigger); append_output_trigger_to_datapipe(&display_state_pipe, display_state_trigger); append_output_trigger_to_datapipe(&submode_pipe, submode_trigger); /* PS enabled setting */ mce_gconf_notifier_add(MCE_GCONF_PROXIMITY_PATH, MCE_GCONF_PROXIMITY_PS_ENABLED_PATH, use_ps_conf_cb, &use_ps_conf_id); mce_gconf_get_bool(MCE_GCONF_PROXIMITY_PS_ENABLED_PATH, &use_ps_conf_value); /* enable/disable sensor based on initial conditions */ update_proximity_monitor(); return NULL; }
const gchar *g_module_check_init(GModule *module) { (void)module; /* Get initial state of datapipes */ call_state = datapipe_get_gint(call_state_pipe); alarm_ui_state = datapipe_get_gint(alarm_ui_state_pipe); display_state = display_state_get(); submode = datapipe_get_gint(submode_pipe); /* Append triggers/filters to datapipes */ append_input_trigger_to_datapipe(&call_state_pipe, call_state_trigger); append_input_trigger_to_datapipe(&alarm_ui_state_pipe, alarm_ui_state_trigger); append_output_trigger_to_datapipe(&display_state_pipe, display_state_trigger); append_output_trigger_to_datapipe(&submode_pipe, submode_trigger); /* PS enabled setting */ mce_setting_track_bool(MCE_SETTING_PROXIMITY_PS_ENABLED, &use_ps_conf_value, MCE_DEFAULT_PROXIMITY_PS_ENABLED, use_ps_conf_cb, &use_ps_conf_id); /* PS acts as LID sensor */ mce_setting_track_bool(MCE_SETTING_PROXIMITY_PS_ACTS_AS_LID, &ps_acts_as_lid, MCE_DEFAULT_PROXIMITY_PS_ACTS_AS_LID, use_ps_conf_cb, &ps_acts_as_lid_conf_id); /* If the proximity sensor input is used for toggling * lid state, we must take care not to leave proximity * tracking to covered state. */ if( ps_acts_as_lid ) report_proximity(COVER_OPEN); /* enable/disable sensor based on initial conditions */ update_proximity_monitor(); return NULL; }
/** Install datapipe triggers/filters */ static void fba_datapipe_init(void) { /* Get intial display state */ display_state = display_state_get(); /* Append triggers/filters to datapipes */ append_filter_to_datapipe(&display_brightness_pipe, display_brightness_filter); append_filter_to_datapipe(&led_brightness_pipe, led_brightness_filter); append_filter_to_datapipe(&lpm_brightness_pipe, lpm_brightness_filter); append_filter_to_datapipe(&key_backlight_pipe, key_backlight_filter); append_output_trigger_to_datapipe(&display_state_next_pipe, display_state_next_trigger); append_output_trigger_to_datapipe(&display_state_pipe, display_state_trigger); }
/** * Datapipe filter for inactivity * * @param data The unfiltered inactivity state; * TRUE if the device is inactive, * FALSE if the device is active * @return The filtered inactivity state; * TRUE if the device is inactive, * FALSE if the device is active */ static gpointer device_inactive_filter(gpointer data) { static gboolean old_device_inactive = FALSE; alarm_ui_state_t alarm_ui_state = datapipe_get_gint(alarm_ui_state_pipe); submode_t submode = mce_get_submode_int32(); cover_state_t proximity_state = proximity_state_get(); display_state_t display_state = display_state_get(); system_state_t system_state = datapipe_get_gint(system_state_pipe); call_state_t call_state = datapipe_get_gint(call_state_pipe); device_inactive = GPOINTER_TO_INT(data); /* nothing to filter if we are already inactive */ if( device_inactive ) goto EXIT; /* Never filter inactivity if display is in dimmed state. * * Whether we have arrived to dimmed state via expected or * unexpected routes, the touch input is active and ui side * event eater will ignore only the first event. If we do * not allow activity (and turn on the display) we will get * ui interaction in odd looking dimmed state that then gets * abruptly ended by blanking timer. */ if( display_state == MCE_DISPLAY_DIM ) goto EXIT; /* system state must be USER or ACT DEAD */ switch( system_state ) { case MCE_STATE_USER: case MCE_STATE_ACTDEAD: break; default: mce_log(LL_DEBUG, "system_state != USER|ACTDEAD" "; ignoring activity"); device_inactive = TRUE; goto EXIT; } /* tklock must be off, or there must be alarms or calls */ if( submode & MCE_TKLOCK_SUBMODE ) { gboolean have_alarms = FALSE; gboolean have_calls = FALSE; gboolean display_on = FALSE; switch( alarm_ui_state ) { case MCE_ALARM_UI_RINGING_INT32: case MCE_ALARM_UI_VISIBLE_INT32: have_alarms = TRUE; break; default: break; } switch( call_state ) { case CALL_STATE_RINGING: case CALL_STATE_ACTIVE: have_calls = TRUE; default: break; } if( display_state == MCE_DISPLAY_ON ) display_on = TRUE; if( !display_on && !have_alarms && !have_calls ) { mce_log(LL_DEBUG, "tklock enabled, no alarms or calls;" " ignoring activity"); device_inactive = TRUE; goto EXIT; } } /* if proximity is covered, display must not be off */ if( proximity_state == COVER_CLOSED ) { switch( display_state ) { case MCE_DISPLAY_OFF: case MCE_DISPLAY_LPM_OFF: case MCE_DISPLAY_LPM_ON: case MCE_DISPLAY_POWER_UP: case MCE_DISPLAY_POWER_DOWN: mce_log(LL_DEBUG, "display=off, proximity=covered; ignoring activity"); device_inactive = TRUE; goto EXIT; default: case MCE_DISPLAY_UNDEF: case MCE_DISPLAY_DIM: case MCE_DISPLAY_ON: break; } } EXIT: /* React to activity */ if( !device_inactive ) { call_activity_callbacks(); setup_inactivity_timeout(); } /* Handle inactivity state change */ if( old_device_inactive != device_inactive ) { old_device_inactive = device_inactive; send_inactivity_status(NULL); } /* Return filtered activity state */ return GINT_TO_POINTER(device_inactive); }