Exemplo n.º 1
0
Arquivo: proximity.c Projeto: g7/mce
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;
}
Exemplo n.º 2
0
const gchar *g_module_check_init(GModule *module)
{
	(void)module;

	/* Append triggers/filters to datapipes */
	append_output_trigger_to_datapipe(&battery_level_pipe,
					  battery_level_trigger);
	append_output_trigger_to_datapipe(&charger_state_pipe,
					  charger_state_trigger);
	append_output_trigger_to_datapipe(&thermal_state_pipe,
					  thermal_state_trigger);

	/* Power saving mode setting */
	/* Since we've set a default, error handling is unnecessary */
	mce_gconf_notifier_add(MCE_GCONF_EM_PATH,
			       MCE_GCONF_PSM_PATH,
			       psm_gconf_cb,
			       &psm_gconf_cb_id);

	mce_gconf_get_bool(MCE_GCONF_PSM_PATH,
			   &power_saving_mode);

	/* Forced power saving mode setting */
	/* Since we've set a default, error handling is unnecessary */
	mce_gconf_notifier_add(MCE_GCONF_EM_PATH,
			       MCE_GCONF_FORCED_PSM_PATH,
			       psm_gconf_cb,
			       &force_psm_gconf_cb_id);

	mce_gconf_get_bool(MCE_GCONF_FORCED_PSM_PATH,
			   &force_psm);

	/* Power saving mode threshold */
	/* Since we've set a default, error handling is unnecessary */
	mce_gconf_notifier_add(MCE_GCONF_EM_PATH,
			       MCE_GCONF_PSM_THRESHOLD_PATH,
			       psm_gconf_cb,
			       &psm_threshold_gconf_cb_id);

	mce_gconf_get_int(MCE_GCONF_PSM_THRESHOLD_PATH,
			  &psm_threshold);

	/* Add dbus handlers */
	mce_psm_init_dbus();

	return NULL;
}
Exemplo n.º 3
0
/** Get initial GConf values and start tracking changes
 */
static void memnotify_gconf_init(void)
{
    /* memnotify.warning.used level */
    mce_gconf_notifier_add(MCE_GCONF_MEMNOTIFY_WARNING_PATH,
                           MCE_GCONF_MEMNOTIFY_WARNING_USED,
                           memnotify_gconf_cb,
                           &memnotify_gconf_warning_used_id);

    mce_gconf_get_int(MCE_GCONF_MEMNOTIFY_WARNING_USED,
                      &memnotify_limit[MEMNOTIFY_LEVEL_WARNING].mnl_used);

    /* memnotify.warning.active level */
    mce_gconf_notifier_add(MCE_GCONF_MEMNOTIFY_WARNING_PATH,
                           MCE_GCONF_MEMNOTIFY_WARNING_ACTIVE,
                           memnotify_gconf_cb,
                           &memnotify_gconf_warning_active_id);

    mce_gconf_get_int(MCE_GCONF_MEMNOTIFY_WARNING_ACTIVE,
                      &memnotify_limit[MEMNOTIFY_LEVEL_WARNING].mnl_active);

    /* memnotify.critical.used level */
    mce_gconf_notifier_add(MCE_GCONF_MEMNOTIFY_CRITICAL_PATH,
                           MCE_GCONF_MEMNOTIFY_CRITICAL_USED,
                           memnotify_gconf_cb,
                           &memnotify_gconf_critical_used_id);

    mce_gconf_get_int(MCE_GCONF_MEMNOTIFY_CRITICAL_USED,
                      &memnotify_limit[MEMNOTIFY_LEVEL_CRITICAL].mnl_used);

    /* memnotify.critical.active level */
    mce_gconf_notifier_add(MCE_GCONF_MEMNOTIFY_CRITICAL_PATH,
                           MCE_GCONF_MEMNOTIFY_CRITICAL_ACTIVE,
                           memnotify_gconf_cb,
                           &memnotify_gconf_critical_active_id);

    mce_gconf_get_int(MCE_GCONF_MEMNOTIFY_CRITICAL_ACTIVE,
                      &memnotify_limit[MEMNOTIFY_LEVEL_CRITICAL].mnl_active);

    memnotify_status_show_triggers();
}
Exemplo n.º 4
0
const gchar *g_module_check_init(GModule *module)
{
        (void)module;

        /* Config from ini-files */
        dbltap_ctrl_path = mce_conf_get_string(MCE_CONF_DOUBLETAP_GROUP,
                                               MCE_CONF_DOUBLETAP_CONTROL_PATH,
                                               NULL);

        dbltap_enable_val = mce_conf_get_string(MCE_CONF_DOUBLETAP_GROUP,
                                                MCE_CONF_DOUBLETAP_ENABLE_VALUE,
                                                "1");

        dbltap_disable_val = mce_conf_get_string(MCE_CONF_DOUBLETAP_GROUP,
                                                 MCE_CONF_DOUBLETAP_DISABLE_VALUE,
                                                 "0");

        if( !dbltap_ctrl_path || !dbltap_enable_val || !dbltap_disable_val ) {
                mce_log(LL_NOTICE, "no double tap wakeup controls defined");
                goto EXIT;
        }

        dbltap_probe_sleep_mode_controls();

        /* Runtime configuration settings */
        mce_gconf_notifier_add(MCE_GCONF_DOUBLETAP_PATH,
                               MCE_GCONF_DOUBLETAP_MODE,
                               dbltap_mode_gconf_cb,
                               &dbltap_mode_gconf_id);

        gint mode = DBLTAP_ENABLE_DEFAULT;
        mce_gconf_get_int(MCE_GCONF_DOUBLETAP_MODE, &mode);
        dbltap_mode = mode;

        /* Append triggers/filters to datapipes */
        append_output_trigger_to_datapipe(&proximity_sensor_pipe,
                                          dbltap_proximity_trigger);
        append_output_trigger_to_datapipe(&proximity_blank_pipe,
                                          dbltap_proximity_blank_trigger);
        append_output_trigger_to_datapipe(&lid_cover_policy_pipe,
                                          dbltap_lid_cover_policy_trigger);

        /* Get initial state of datapipes */
        dbltap_ps_state = datapipe_get_gint(proximity_sensor_pipe);
        dbltap_ps_blank = datapipe_get_gint(proximity_blank_pipe);
        dbltap_lid_cover_policy = datapipe_get_gint(lid_cover_policy_pipe);

        /* enable/disable double tap wakeups based on initial conditions */
        dbltap_rethink();
EXIT:
        return NULL;
}
Exemplo n.º 5
0
const gchar *g_module_check_init(GModule *module)
{
	(void)module;

	/* Read lux ramps from configuration */
	als_filter_load_config(&lut_display);
	als_filter_load_config(&lut_led);
	als_filter_load_config(&lut_key);

	/* Get intial display state */
	display_state = datapipe_get_gint(display_state_pipe);

	/* 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(&key_backlight_pipe,
				  key_backlight_filter);
	append_output_trigger_to_datapipe(&display_state_pipe,
					  display_state_trigger);

	/* Add dbus method call handlers */
	mce_dbus_handler_add(MCE_REQUEST_IF,
			     MCE_REQ_ALS_ENABLE,
			     NULL,
			     DBUS_MESSAGE_TYPE_METHOD_CALL,
			     als_enable_req_dbus_cb);

	mce_dbus_handler_add(MCE_REQUEST_IF,
			     MCE_REQ_ALS_DISABLE,
			     NULL,
			     DBUS_MESSAGE_TYPE_METHOD_CALL,
			     als_disable_req_dbus_cb);

	mce_dbus_handler_add(MCE_REQUEST_IF,
			     MCE_COLOR_PROFILE_GET,
			     NULL,
			     DBUS_MESSAGE_TYPE_METHOD_CALL,
			     color_profile_get_req_dbus_cb);

	mce_dbus_handler_add(MCE_REQUEST_IF,
			     MCE_COLOR_PROFILE_IDS_GET,
			     NULL,
			     DBUS_MESSAGE_TYPE_METHOD_CALL,
			     color_profile_ids_get_req_dbus_cb);

	mce_dbus_handler_add(MCE_REQUEST_IF,
			     MCE_COLOR_PROFILE_CHANGE_REQ,
			     NULL,
			     DBUS_MESSAGE_TYPE_METHOD_CALL,
			     color_profile_change_req_dbus_cb);

	/* ALS enabled setting */
	mce_gconf_notifier_add(MCE_GCONF_DISPLAY_PATH,
			       MCE_GCONF_DISPLAY_ALS_ENABLED_PATH,
			       use_als_gconf_cb,
			       &use_als_gconf_id);
	mce_gconf_get_bool(MCE_GCONF_DISPLAY_ALS_ENABLED_PATH,
			   &use_als_flag);

	/* Color profile setting */
	mce_gconf_notifier_add(MCE_GCONF_DISPLAY_PATH,
			       MCE_GCONF_DISPLAY_COLOR_PROFILE_PATH,
			       color_profile_gconf_cb,
			       &color_profile_gconf_id);
	if( init_color_profiles() )
		init_current_color_profile();

	rethink_als_status();

	return NULL;
}