Exemplo n.º 1
0
/**
 * Update the proximity monitoring
 */
static void update_proximity_monitor(void)
{
    static gboolean old_enable = FALSE;

    /* Default to keeping the proximity sensor always enabled. */
    gboolean enable = TRUE;

    if( !use_ps_conf_value ) {
        enable = FALSE;

        if( ps_acts_as_lid )
            report_lid_input(COVER_UNDEF);
        else
            report_proximity(COVER_OPEN);
    }

    if( old_enable == enable )
        goto EXIT;

    if( (old_enable = enable) ) {
        enable_proximity_monitor();
    } else {
        disable_proximity_monitor();
    }

EXIT:
    return;
}
Exemplo n.º 2
0
void g_module_unload(GModule *module)
{
    (void)module;

    /* Stop tracking setting changes  */
    mce_setting_notifier_remove(use_ps_conf_id),
                                use_ps_conf_id = 0;

    mce_setting_notifier_remove(ps_acts_as_lid_conf_id),
                                ps_acts_as_lid_conf_id = 0;

    /* Remove triggers/filters from datapipes */
    remove_output_trigger_from_datapipe(&display_state_pipe,
                                        display_state_trigger);
    remove_input_trigger_from_datapipe(&alarm_ui_state_pipe,
                                       alarm_ui_state_trigger);
    remove_input_trigger_from_datapipe(&call_state_pipe,
                                       call_state_trigger);
    remove_output_trigger_from_datapipe(&submode_pipe,
                                        submode_trigger);

    /* Disable proximity monitoring to remove callbacks
     * to unloaded module */
    disable_proximity_monitor();
    return;
}
Exemplo n.º 3
0
Arquivo: proximity.c Projeto: g7/mce
/**
 * Update the proximity monitoring
 */
static void update_proximity_monitor(void)
{
	static gboolean old_enable = FALSE;

	gboolean enable = FALSE;
	gboolean fake_open = FALSE;

	/* Default to keeping the proximity sensor always enabled. */
	enable = TRUE;

	if( !use_ps_conf_value ) {
		fake_open = TRUE;
		enable = FALSE;
	}

	if( old_enable == enable )
		goto EXIT;

	if( (old_enable = enable) ) {
		enable_proximity_monitor();
	} else {
		disable_proximity_monitor();
	}

EXIT:
	if( !enable && fake_open )
		report_proximity(COVER_OPEN);
}