Beispiel #1
0
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;
}
Beispiel #2
0
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;
}
Beispiel #3
0
/**
 * Init function for the powerkey component
 *
 * @return TRUE on success, FALSE on failure
 */
gboolean mce_powerkey_init(void)
{
	gboolean status = FALSE;
	gchar *tmp = NULL;

	/* Append triggers/filters to datapipes */
	append_input_trigger_to_datapipe(&keypress_pipe,
					 powerkey_trigger);

	/* req_trigger_powerkey_event */
	if (mce_dbus_handler_add(MCE_REQUEST_IF,
				 MCE_TRIGGER_POWERKEY_EVENT_REQ,
				 NULL,
				 DBUS_MESSAGE_TYPE_METHOD_CALL,
				 trigger_powerkey_event_req_dbus_cb) == NULL)
		goto EXIT;

	/* Get configuration options */
	longdelay = mce_conf_get_int(MCE_CONF_POWERKEY_GROUP,
				     MCE_CONF_POWERKEY_LONG_DELAY,
				     DEFAULT_POWER_LONG_DELAY);
	mediumdelay = mce_conf_get_int(MCE_CONF_POWERKEY_GROUP,
				       MCE_CONF_POWERKEY_MEDIUM_DELAY,
				       DEFAULT_POWER_MEDIUM_DELAY);
	tmp = mce_conf_get_string(MCE_CONF_POWERKEY_GROUP,
				  MCE_CONF_POWERKEY_SHORT_ACTION,
				  "");

	/* Since we've set a default, error handling is unnecessary */
	(void)parse_action(tmp, &shortpresssignal, &shortpressaction);
	g_free(tmp);

	tmp = mce_conf_get_string(MCE_CONF_POWERKEY_GROUP,
				  MCE_CONF_POWERKEY_LONG_ACTION,
				  "");

	/* Since we've set a default, error handling is unnecessary */
	(void)parse_action(tmp, &longpresssignal, &longpressaction);
	g_free(tmp);

	doublepressdelay = mce_conf_get_int(MCE_CONF_POWERKEY_GROUP,
					    MCE_CONF_POWERKEY_DOUBLE_DELAY,
					    DEFAULT_POWER_DOUBLE_DELAY);
	tmp = mce_conf_get_string(MCE_CONF_POWERKEY_GROUP,
				  MCE_CONF_POWERKEY_DOUBLE_ACTION,
				  "");

	/* Since we've set a default, error handling is unnecessary */
	(void)parse_action(tmp, &doublepresssignal, &doublepressaction);
	g_free(tmp);

	status = TRUE;

EXIT:
	return status;
}