From 5fadb870e850b0866fa7a4a3f5f15017330e8718 Mon Sep 17 00:00:00 2001 From: Simo Piiroinen Date: Wed, 28 Feb 2018 13:06:58 +0200 Subject: [PATCH] [datapipe] Unify naming. Contributes to JB#22475 Use "datapipe_" prefix for all functions: datapipe_add_filter <- append_filter_to_datapipe datapipe_add_input_trigger <- append_input_trigger_to_datapipe datapipe_add_output_trigger <- append_output_trigger_to_datapipe datapipe_exec_filters <- execute_datapipe_filters datapipe_exec_full <- execute_datapipe datapipe_exec_input_triggers <- execute_datapipe_input_triggers datapipe_exec_output_triggers <- execute_datapipe_output_triggers datapipe_free <- free_datapipe datapipe_init <- setup_datapipe datapipe_remove_filter <- remove_filter_from_datapipe datapipe_remove_input_trigger <- remove_input_trigger_from_datapipe datapipe_remove_output_trigger <- remove_output_trigger_from_datapipe Datapipes that are used for solely for requesting state changes (i.e. do not themselves have a state) have a verb in the name: display_state_request_pipe <- display_state_req_pipe led_pattern_activate_pipe (no change) led_pattern_deactivate_pipe (no change) tklock_request_pipe <- tk_lock_pipe Datapipes that are used solely process input events without having a persistent state have "event" in the name: heartbeat_event_pipe <- heartbeat_pipe ignore_incoming_call_event_pipe <- ignore_incoming_call_pipe inactivity_event_pipe <- device_inactive_event_pipe keypress_event_pipe <- keypress_pipe resume_detected_event_pipe <- device_resumed_pipe touchscreen_event_pipe <- touchscreen_pipe user_activity_event_pipe <- user_activity_pipe Datapipes dealing with brightness have "brightness" included in the name: display_brightness_pipe (no change) key_backlight_brightness_pipe <- key_backlight_pipe led_brightness_pipe (no change) lpm_brightness_pipe (no change) Datapipes dealing with sensors have "sensor" in name and the one holding unfiltered data is called "actual": lid_sensor_actual_pipe <- lid_cover_sensor_pipe lid_sensor_filtered_pipe <- lid_cover_policy_pipe lid_sensor_is_working_pipe (no change) light_sensor_actual_pipe <- ambient_light_sensor_pipe light_sensor_filtered_pipe <- ambient_light_level_pipe light_sensor_poll_request_pipe <- ambient_light_poll_pipe orientation_sensor_actual_pipe <- orientation_sensor_pipe proximity_sensor_actual_pipe <- proximity_sensor_pipe Datapipes that have enumerated state reflect the enumeration type in datapipe name: alarm_ui_state_pipe (no change) audio_route_pipe (no change) battery_status_pipe (no change) bluez_service_state_pipe <- bluez_available_pipe call_state_pipe (no change) call_type_pipe (no change) camera_button_state_pipe <- camera_button_pipe charger_state_pipe (no change) compositor_service_state_pipe <- compositor_available_pipe devicelock_service_state_pipe <- devicelock_available_pipe devicelock_state_pipe <- device_lock_state_pipe display_state_curr_pipe <- display_state_pipe display_state_next_pipe (no change) dsme_service_state_pipe <- dsme_available_pipe jack_sense_state_pipe <- jack_sense_pipe keyboard_available_state_pipe <- keyboard_available_pipe keyboard_slide_state_pipe <- keyboard_slide_pipe lens_cover_state_pipe <- lens_cover_pipe lipstick_service_state_pipe <- lipstick_available_pipe lockkey_state_pipe <- lockkey_pipe ngfd_service_state_pipe <- ngfd_available_pipe submode_pipe (no change) system_state_pipe (no change) thermal_state_pipe (no change) uiexception_type_pipe <- exception_state_pipe usb_cable_state_pipe <- usb_cable_pipe usbmoded_service_state_pipe <- usbmoded_available_pipe Datapipes that have boolean state should answer an "is" question: device_inactive_pipe <- device_inactive_state_pipe interaction_expected_pipe (no change) keypad_grab_active_pipe (no change) keypad_grab_wanted_pipe (no change) master_radio_enabled_pipe <- master_radio_pipe music_playback_ongoing_pipe <- music_playback_pipe osupdate_running_pipe <- update_mode_pipe packagekit_locked_pipe (no change) power_saving_mode_active_pipe <- power_saving_mode_pipe proximity_blanked_pipe <- proximity_blank_pipe shutting_down_pipe (no change) touch_detected_pipe (no change) touch_grab_active_pipe (no change) touch_grab_wanted_pipe (no change) Datapipes that have integer state should answer and "what is" question: battery_level_pipe (no change) inactivity_delay_pipe <- inactivity_timeout_pipe Rename datapipe related callback functions and variables similarly as what was done to datapipes. Define submode bitmasks as submode_t enumeration instead of using gint type and preprocessor constants. Change the value naming from MCE_xxx_SUBMODE to MCE_SUBMODE_xxx. Change call_type_t enumeration value naming from xxx_CALL to CALL_TYPE_xxx. Change system_state_t enumeration value naming from MCE_STATE_xxx to MCE_SYSTEM_STATE_xxx. Fix setting up of power_saving_mode_active_pipe, master_radio_enabled_pipe and lens_cover_state_pipe so that initial values of appropriate type are used. Switch lockkey_state_pipe value from gboolean to key_state_t type. Signed-off-by: Simo Piiroinen --- datapipe.c | 752 ++++++++-------- datapipe.h | 160 ++-- event-input.c | 212 +++-- event-switches.c | 146 ++- homekey.dot | 2 +- mce-common.c | 2 +- mce-dbus.c | 32 +- mce-dsme.c | 94 +- mce-dsme.h | 2 +- mce-hbtimer.c | 35 +- mce-io.c | 6 +- mce.h | 137 ++- modetransition.c | 46 +- modules/alarm.c | 6 +- modules/audiorouting.c | 14 +- modules/battery-bme.c | 82 +- modules/battery-statefs.c | 59 +- modules/battery-upower.c | 56 +- modules/bluetooth.c | 20 +- modules/buttonbacklight.c | 30 +- modules/callstate.c | 38 +- modules/camera.c | 22 +- modules/display.c | 632 ++++++------- modules/doubletap.c | 52 +- modules/filter-brightness-als.c | 108 +-- modules/inactivity.c | 93 +- modules/keypad.c | 76 +- modules/led.c | 66 +- modules/packagekit.c | 28 +- modules/powersavemode.c | 30 +- modules/proximity.c | 68 +- modules/radiostates.c | 12 +- modules/sensor-gestures.c | 96 +- modules/usbmode.c | 32 +- powerkey.c | 224 ++--- tests/ut/ut_display.c | 314 +++---- tests/ut/ut_display_blanking_inhibit.c | 14 +- tests/ut/ut_display_filter.c | 12 +- tests/ut/ut_display_stm.c | 20 +- tklock.c | 1148 ++++++++++++------------ 40 files changed, 2506 insertions(+), 2472 deletions(-) diff --git a/datapipe.c b/datapipe.c index 319bd4e9..daddcdc4 100644 --- a/datapipe.c +++ b/datapipe.c @@ -39,10 +39,10 @@ datapipe_struct led_brightness_pipe; datapipe_struct lpm_brightness_pipe; /** State of device; read only */ -datapipe_struct device_inactive_state_pipe; +datapipe_struct device_inactive_pipe; /** Device inactivity events; read only */ -datapipe_struct device_inactive_event_pipe; +datapipe_struct inactivity_event_pipe; /** LED pattern to activate; read only */ datapipe_struct led_pattern_activate_pipe; @@ -51,22 +51,22 @@ datapipe_struct led_pattern_activate_pipe; datapipe_struct led_pattern_deactivate_pipe; /** resumed from suspend notification; read only */ -datapipe_struct device_resumed_pipe; +datapipe_struct resume_detected_event_pipe; /** Non-synthetized user activity; read only */ -datapipe_struct user_activity_pipe; +datapipe_struct user_activity_event_pipe; /** State of display; read only */ -datapipe_struct display_state_pipe; +datapipe_struct display_state_curr_pipe; /** Desired state of display; write only */ -datapipe_struct display_state_req_pipe; +datapipe_struct display_state_request_pipe; /** Next (non-transitional) state of display; read only */ datapipe_struct display_state_next_pipe; /** exceptional ui state; read write */ -datapipe_struct exception_state_pipe; +datapipe_struct uiexception_type_pipe; /** * Display brightness; @@ -76,49 +76,49 @@ datapipe_struct exception_state_pipe; datapipe_struct display_brightness_pipe; /** Key backlight */ -datapipe_struct key_backlight_pipe; +datapipe_struct key_backlight_brightness_pipe; /** A key has been pressed */ -datapipe_struct keypress_pipe; +datapipe_struct keypress_event_pipe; /** Touchscreen activity took place */ -datapipe_struct touchscreen_pipe; +datapipe_struct touchscreen_event_pipe; /** The lock-key has been pressed; read only */ -datapipe_struct lockkey_pipe; +datapipe_struct lockkey_state_pipe; /** Keyboard open/closed; read only */ -datapipe_struct keyboard_slide_pipe; +datapipe_struct keyboard_slide_state_pipe; /** Keyboard available; read only */ -datapipe_struct keyboard_available_pipe; +datapipe_struct keyboard_available_state_pipe; /** Lid sensor is working state; read/write */ datapipe_struct lid_sensor_is_working_pipe; /** Lid cover sensor open/closed; read only */ -datapipe_struct lid_cover_sensor_pipe; +datapipe_struct lid_sensor_actual_pipe; /** Lid cover policy state; read only */ -datapipe_struct lid_cover_policy_pipe; +datapipe_struct lid_sensor_filtered_pipe; /** Lens cover open/closed; read only */ -datapipe_struct lens_cover_pipe; +datapipe_struct lens_cover_state_pipe; /** Proximity sensor; read only */ -datapipe_struct proximity_sensor_pipe; +datapipe_struct proximity_sensor_actual_pipe; /** Ambient light sensor; read only */ -datapipe_struct ambient_light_sensor_pipe; +datapipe_struct light_sensor_actual_pipe; /** Filtered ambient light level; read only */ -datapipe_struct ambient_light_level_pipe; +datapipe_struct light_sensor_filtered_pipe; /** Temporary ambient light sensor enable; read/write */ -datapipe_struct ambient_light_poll_pipe; +datapipe_struct light_sensor_poll_request_pipe; /** Orientation sensor; read only */ -datapipe_struct orientation_sensor_pipe; +datapipe_struct orientation_sensor_actual_pipe; /** The alarm UI state */ datapipe_struct alarm_ui_state_pipe; @@ -127,7 +127,7 @@ datapipe_struct alarm_ui_state_pipe; datapipe_struct system_state_pipe; /** Enable/disable radios */ -datapipe_struct master_radio_pipe; +datapipe_struct master_radio_enabled_pipe; /** The device submode */ datapipe_struct submode_pipe; @@ -140,13 +140,13 @@ datapipe_struct call_state_pipe; * Note: Related actions happen when true is executed on the * datapipe, but the cached value always remains at false. */ -datapipe_struct ignore_incoming_call_pipe; +datapipe_struct ignore_incoming_call_event_pipe; /** The call type */ datapipe_struct call_type_pipe; /** The touchscreen/keypad lock state */ -datapipe_struct tk_lock_pipe; +datapipe_struct tklock_request_pipe; /** UI side is in a state where user interaction is expected */ datapipe_struct interaction_expected_pipe; @@ -161,61 +161,61 @@ datapipe_struct battery_status_pipe; datapipe_struct battery_level_pipe; /** Camera button; read only */ -datapipe_struct camera_button_pipe; +datapipe_struct camera_button_state_pipe; /** The inactivity timeout; read only */ -datapipe_struct inactivity_timeout_pipe; +datapipe_struct inactivity_delay_pipe; /** Audio routing state; read only */ datapipe_struct audio_route_pipe; /** USB cable has been connected/disconnected; read only */ -datapipe_struct usb_cable_pipe; +datapipe_struct usb_cable_state_pipe; /** A jack connector has been connected/disconnected; read only */ -datapipe_struct jack_sense_pipe; +datapipe_struct jack_sense_state_pipe; /** Power save mode is active; read only */ -datapipe_struct power_saving_mode_pipe; +datapipe_struct power_saving_mode_active_pipe; /** Thermal state; read only */ datapipe_struct thermal_state_pipe; /** Heartbeat; read only */ -datapipe_struct heartbeat_pipe; +datapipe_struct heartbeat_event_pipe; /** compositor availability; read only */ -datapipe_struct compositor_available_pipe; +datapipe_struct compositor_service_state_pipe; /** lipstick availability; read only */ -datapipe_struct lipstick_available_pipe; +datapipe_struct lipstick_service_state_pipe; /** devicelock availability; read only */ -datapipe_struct devicelock_available_pipe; +datapipe_struct devicelock_service_state_pipe; /** usbmoded availability; read only */ -datapipe_struct usbmoded_available_pipe; +datapipe_struct usbmoded_service_state_pipe; /** ngfd availability; read only */ -datapipe_struct ngfd_available_pipe; +datapipe_struct ngfd_service_state_pipe; /** dsme availability; read only */ -datapipe_struct dsme_available_pipe; +datapipe_struct dsme_service_state_pipe; /** bluez availability; read only */ -datapipe_struct bluez_available_pipe; +datapipe_struct bluez_service_state_pipe; /** PackageKit Locked status; read only */ datapipe_struct packagekit_locked_pipe; /** Update mode active status; read only */ -datapipe_struct update_mode_pipe; +datapipe_struct osupdate_running_pipe; /** Shutting down; read only */ datapipe_struct shutting_down_pipe; /** Device Lock state; read only */ -datapipe_struct device_lock_state_pipe; +datapipe_struct devicelock_state_pipe; /** touchscreen input detected; read only */ datapipe_struct touch_detected_pipe; @@ -233,10 +233,10 @@ datapipe_struct keypad_grab_wanted_pipe; datapipe_struct keypad_grab_active_pipe; /** music playback active; read only */ -datapipe_struct music_playback_pipe; +datapipe_struct music_playback_ongoing_pipe; /** proximity blanking; read only */ -datapipe_struct proximity_blank_pipe; +datapipe_struct proximity_blanked_pipe; /** * Execute the input triggers of a datapipe @@ -248,9 +248,9 @@ datapipe_struct proximity_blank_pipe; * @param cache_indata CACHE_INDATA to cache the indata, * DONT_CACHE_INDATA to keep the old data */ -void execute_datapipe_input_triggers(datapipe_struct *const datapipe, - gpointer const indata, - const data_source_t use_cache) +void datapipe_exec_input_triggers(datapipe_struct *const datapipe, + gpointer const indata, + const data_source_t use_cache) { void (*trigger)(gconstpointer const input); gpointer data; @@ -259,7 +259,7 @@ void execute_datapipe_input_triggers(datapipe_struct *const datapipe, if (datapipe == NULL) { /* Potential memory leak! */ mce_log(LL_ERR, - "execute_datapipe_input_triggers() called " + "datapipe_exec_input_triggers() called " "without a valid datapipe"); goto EXIT; } @@ -284,9 +284,9 @@ void execute_datapipe_input_triggers(datapipe_struct *const datapipe, * USE_INDATA to use indata * @return The processed data */ -gconstpointer execute_datapipe_filters(datapipe_struct *const datapipe, - gpointer indata, - const data_source_t use_cache) +gconstpointer datapipe_exec_filters(datapipe_struct *const datapipe, + gpointer indata, + const data_source_t use_cache) { gpointer (*filter)(gpointer input); gpointer data; @@ -295,7 +295,7 @@ gconstpointer execute_datapipe_filters(datapipe_struct *const datapipe, if (datapipe == NULL) { mce_log(LL_ERR, - "execute_datapipe_filters() called " + "datapipe_exec_filters() called " "without a valid datapipe"); goto EXIT; } @@ -332,9 +332,9 @@ gconstpointer execute_datapipe_filters(datapipe_struct *const datapipe, * @param use_cache USE_CACHE to use data from cache, * USE_INDATA to use indata */ -void execute_datapipe_output_triggers(const datapipe_struct *const datapipe, - gconstpointer indata, - const data_source_t use_cache) +void datapipe_exec_output_triggers(const datapipe_struct *const datapipe, + gconstpointer indata, + const data_source_t use_cache) { void (*trigger)(gconstpointer input); gconstpointer data; @@ -342,7 +342,7 @@ void execute_datapipe_output_triggers(const datapipe_struct *const datapipe, if (datapipe == NULL) { mce_log(LL_ERR, - "execute_datapipe_output_triggers() called " + "datapipe_exec_output_triggers() called " "without a valid datapipe"); goto EXIT; } @@ -369,16 +369,16 @@ void execute_datapipe_output_triggers(const datapipe_struct *const datapipe, * DONT_CACHE_INDATA to keep the old data * @return The processed data */ -gconstpointer execute_datapipe(datapipe_struct *const datapipe, - gpointer indata, - const data_source_t use_cache, - const caching_policy_t cache_indata) +gconstpointer datapipe_exec_full(datapipe_struct *const datapipe, + gpointer indata, + const data_source_t use_cache, + const caching_policy_t cache_indata) { gconstpointer outdata = NULL; if (datapipe == NULL) { mce_log(LL_ERR, - "execute_datapipe() called " + "datapipe_exec_full() called " "without a valid datapipe"); goto EXIT; } @@ -396,13 +396,13 @@ gconstpointer execute_datapipe(datapipe_struct *const datapipe, } /* Execute input value callbacks */ - execute_datapipe_input_triggers(datapipe, indata, USE_INDATA); + datapipe_exec_input_triggers(datapipe, indata, USE_INDATA); /* Determine output value */ if (datapipe->read_only == READ_ONLY) { outdata = indata; } else { - outdata = execute_datapipe_filters(datapipe, indata, USE_INDATA); + outdata = datapipe_exec_filters(datapipe, indata, USE_INDATA); } /* Optionally cache the value at the output stage */ @@ -415,7 +415,7 @@ gconstpointer execute_datapipe(datapipe_struct *const datapipe, } /* Execute output value callbacks */ - execute_datapipe_output_triggers(datapipe, outdata, USE_INDATA); + datapipe_exec_output_triggers(datapipe, outdata, USE_INDATA); EXIT: return outdata; @@ -427,26 +427,26 @@ gconstpointer execute_datapipe(datapipe_struct *const datapipe, * @param datapipe The datapipe to manipulate * @param filter The filter to add to the datapipe */ -void append_filter_to_datapipe(datapipe_struct *const datapipe, - gpointer (*filter)(gpointer data)) +void datapipe_add_filter(datapipe_struct *const datapipe, + gpointer (*filter)(gpointer data)) { if (datapipe == NULL) { mce_log(LL_ERR, - "append_filter_to_datapipe() called " + "datapipe_add_filter() called " "without a valid datapipe"); goto EXIT; } if (filter == NULL) { mce_log(LL_ERR, - "append_filter_to_datapipe() called " + "datapipe_add_filter() called " "without a valid filter"); goto EXIT; } if (datapipe->read_only == READ_ONLY) { mce_log(LL_ERR, - "append_filter_to_datapipe() called " + "datapipe_add_filter() called " "on read only datapipe"); goto EXIT; } @@ -464,28 +464,28 @@ void append_filter_to_datapipe(datapipe_struct *const datapipe, * @param datapipe The datapipe to manipulate * @param filter The filter to remove from the datapipe */ -void remove_filter_from_datapipe(datapipe_struct *const datapipe, - gpointer (*filter)(gpointer data)) +void datapipe_remove_filter(datapipe_struct *const datapipe, + gpointer (*filter)(gpointer data)) { guint oldlen; if (datapipe == NULL) { mce_log(LL_ERR, - "remove_filter_from_datapipe() called " + "datapipe_remove_filter() called " "without a valid datapipe"); goto EXIT; } if (filter == NULL) { mce_log(LL_ERR, - "remove_filter_from_datapipe() called " + "datapipe_remove_filter() called " "without a valid filter"); goto EXIT; } if (datapipe->read_only == READ_ONLY) { mce_log(LL_ERR, - "remove_filter_from_datapipe() called " + "datapipe_remove_filter() called " "on read only datapipe"); goto EXIT; } @@ -511,19 +511,19 @@ void remove_filter_from_datapipe(datapipe_struct *const datapipe, * @param datapipe The datapipe to manipulate * @param trigger The trigger to add to the datapipe */ -void append_input_trigger_to_datapipe(datapipe_struct *const datapipe, - void (*trigger)(gconstpointer data)) +void datapipe_add_input_trigger(datapipe_struct *const datapipe, + void (*trigger)(gconstpointer data)) { if (datapipe == NULL) { mce_log(LL_ERR, - "append_input_trigger_to_datapipe() called " + "datapipe_add_input_trigger() called " "without a valid datapipe"); goto EXIT; } if (trigger == NULL) { mce_log(LL_ERR, - "append_input_trigger_to_datapipe() called " + "datapipe_add_input_trigger() called " "without a valid trigger"); goto EXIT; } @@ -542,21 +542,21 @@ void append_input_trigger_to_datapipe(datapipe_struct *const datapipe, * @param datapipe The datapipe to manipulate * @param trigger The trigger to remove from the datapipe */ -void remove_input_trigger_from_datapipe(datapipe_struct *const datapipe, - void (*trigger)(gconstpointer data)) +void datapipe_remove_input_trigger(datapipe_struct *const datapipe, + void (*trigger)(gconstpointer data)) { guint oldlen; if (datapipe == NULL) { mce_log(LL_ERR, - "remove_input_trigger_from_datapipe() called " + "datapipe_remove_input_trigger() called " "without a valid datapipe"); goto EXIT; } if (trigger == NULL) { mce_log(LL_ERR, - "remove_input_trigger_from_datapipe() called " + "datapipe_remove_input_trigger() called " "without a valid trigger"); goto EXIT; } @@ -583,19 +583,19 @@ void remove_input_trigger_from_datapipe(datapipe_struct *const datapipe, * @param datapipe The datapipe to manipulate * @param trigger The trigger to add to the datapipe */ -void append_output_trigger_to_datapipe(datapipe_struct *const datapipe, - void (*trigger)(gconstpointer data)) +void datapipe_add_output_trigger(datapipe_struct *const datapipe, + void (*trigger)(gconstpointer data)) { if (datapipe == NULL) { mce_log(LL_ERR, - "append_output_trigger_to_datapipe() called " + "datapipe_add_output_trigger() called " "without a valid datapipe"); goto EXIT; } if (trigger == NULL) { mce_log(LL_ERR, - "append_output_trigger_to_datapipe() called " + "datapipe_add_output_trigger() called " "without a valid trigger"); goto EXIT; } @@ -614,21 +614,21 @@ void append_output_trigger_to_datapipe(datapipe_struct *const datapipe, * @param datapipe The datapipe to manipulate * @param trigger The trigger to remove from the datapipe */ -void remove_output_trigger_from_datapipe(datapipe_struct *const datapipe, - void (*trigger)(gconstpointer data)) +void datapipe_remove_output_trigger(datapipe_struct *const datapipe, + void (*trigger)(gconstpointer data)) { guint oldlen; if (datapipe == NULL) { mce_log(LL_ERR, - "remove_output_trigger_from_datapipe() called " + "datapipe_remove_output_trigger() called " "without a valid datapipe"); goto EXIT; } if (trigger == NULL) { mce_log(LL_ERR, - "remove_output_trigger_from_datapipe() called " + "datapipe_remove_output_trigger() called " "without a valid trigger"); goto EXIT; } @@ -661,14 +661,14 @@ void remove_output_trigger_from_datapipe(datapipe_struct *const datapipe, * or 0 if only passing pointers or data as pointers * @param initial_data Initial cache content */ -void setup_datapipe(datapipe_struct *const datapipe, - const read_only_policy_t read_only, - const cache_free_policy_t free_cache, - const gsize datasize, gpointer initial_data) +void datapipe_init(datapipe_struct *const datapipe, + const read_only_policy_t read_only, + const cache_free_policy_t free_cache, + const gsize datasize, gpointer initial_data) { if (datapipe == NULL) { mce_log(LL_ERR, - "setup_datapipe() called " + "datapipe_init() called " "without a valid datapipe"); goto EXIT; } @@ -690,11 +690,11 @@ void setup_datapipe(datapipe_struct *const datapipe, * * @param datapipe The datapipe to manipulate */ -void free_datapipe(datapipe_struct *const datapipe) +void datapipe_free(datapipe_struct *const datapipe) { if (datapipe == NULL) { mce_log(LL_ERR, - "free_datapipe() called " + "datapipe_free() called " "without a valid datapipe"); goto EXIT; } @@ -702,19 +702,19 @@ void free_datapipe(datapipe_struct *const datapipe) /* Warn about still registered filters/triggers */ if (datapipe->filters != NULL) { mce_log(LL_INFO, - "free_datapipe() called on a datapipe that " + "datapipe_free() called on a datapipe that " "still has registered filter(s)"); } if (datapipe->input_triggers != NULL) { mce_log(LL_INFO, - "free_datapipe() called on a datapipe that " + "datapipe_free() called on a datapipe that " "still has registered input_trigger(s)"); } if (datapipe->output_triggers != NULL) { mce_log(LL_INFO, - "free_datapipe() called on a datapipe that " + "datapipe_free() called on a datapipe that " "still has registered output_trigger(s)"); } @@ -730,213 +730,213 @@ void free_datapipe(datapipe_struct *const datapipe) */ void mce_datapipe_init(void) { - setup_datapipe(&system_state_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(MCE_STATE_UNDEF)); - setup_datapipe(&master_radio_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(0)); - setup_datapipe(&call_state_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(CALL_STATE_NONE)); - setup_datapipe(&ignore_incoming_call_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(false)); - setup_datapipe(&call_type_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(NORMAL_CALL)); - setup_datapipe(&alarm_ui_state_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(MCE_ALARM_UI_INVALID_INT32)); - setup_datapipe(&submode_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(MCE_NORMAL_SUBMODE)); - setup_datapipe(&display_state_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(MCE_DISPLAY_UNDEF)); - setup_datapipe(&display_state_req_pipe, READ_WRITE, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(MCE_DISPLAY_UNDEF)); - setup_datapipe(&display_state_next_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(MCE_DISPLAY_UNDEF)); - setup_datapipe(&exception_state_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(UIEXC_NONE)); - setup_datapipe(&display_brightness_pipe, READ_WRITE, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(3)); - setup_datapipe(&led_brightness_pipe, READ_WRITE, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(0)); - setup_datapipe(&lpm_brightness_pipe, READ_WRITE, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(0)); - setup_datapipe(&led_pattern_activate_pipe, READ_ONLY, FREE_CACHE, - 0, NULL); - setup_datapipe(&device_resumed_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, NULL); - setup_datapipe(&led_pattern_deactivate_pipe, READ_ONLY, FREE_CACHE, - 0, NULL); - setup_datapipe(&user_activity_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, NULL); - setup_datapipe(&key_backlight_pipe, READ_WRITE, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(0)); - setup_datapipe(&keypress_pipe, READ_ONLY, FREE_CACHE, - sizeof (struct input_event), NULL); - setup_datapipe(&touchscreen_pipe, READ_ONLY, FREE_CACHE, - sizeof (struct input_event), NULL); - setup_datapipe(&device_inactive_state_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(TRUE)); - setup_datapipe(&device_inactive_event_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(TRUE)); - setup_datapipe(&lockkey_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(0)); - setup_datapipe(&keyboard_slide_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(COVER_CLOSED)); - setup_datapipe(&keyboard_available_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(COVER_CLOSED)); - setup_datapipe(&lid_sensor_is_working_pipe, READ_ONLY, - DONT_FREE_CACHE, 0, GINT_TO_POINTER(FALSE)); - setup_datapipe(&lid_cover_sensor_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(COVER_UNDEF)); - setup_datapipe(&lid_cover_policy_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(COVER_UNDEF)); - setup_datapipe(&lens_cover_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(0)); - setup_datapipe(&proximity_sensor_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(COVER_OPEN)); - setup_datapipe(&ambient_light_sensor_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(400)); - setup_datapipe(&ambient_light_level_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(400)); - setup_datapipe(&ambient_light_poll_pipe, READ_WRITE, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(false)); - setup_datapipe(&orientation_sensor_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(MCE_ORIENTATION_UNDEFINED)); - setup_datapipe(&tk_lock_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(LOCK_UNDEF)); - setup_datapipe(&interaction_expected_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(false)); - setup_datapipe(&charger_state_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(CHARGER_STATE_UNDEF)); - setup_datapipe(&battery_status_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(BATTERY_STATUS_UNDEF)); - setup_datapipe(&battery_level_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(BATTERY_LEVEL_INITIAL)); - setup_datapipe(&camera_button_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(CAMERA_BUTTON_UNDEF)); - setup_datapipe(&inactivity_timeout_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(DEFAULT_INACTIVITY_TIMEOUT)); - setup_datapipe(&audio_route_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(AUDIO_ROUTE_UNDEF)); - setup_datapipe(&usb_cable_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(USB_CABLE_UNDEF)); - setup_datapipe(&jack_sense_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(COVER_UNDEF)); - setup_datapipe(&power_saving_mode_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(0)); - setup_datapipe(&thermal_state_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(THERMAL_STATE_UNDEF)); - setup_datapipe(&heartbeat_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(0)); - setup_datapipe(&compositor_available_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(SERVICE_STATE_UNDEF)); - setup_datapipe(&lipstick_available_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(SERVICE_STATE_UNDEF)); - setup_datapipe(&devicelock_available_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(SERVICE_STATE_UNDEF)); - setup_datapipe(&usbmoded_available_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(SERVICE_STATE_UNDEF)); - setup_datapipe(&ngfd_available_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(SERVICE_STATE_UNDEF)); - - setup_datapipe(&dsme_available_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(SERVICE_STATE_UNDEF)); - - setup_datapipe(&bluez_available_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(SERVICE_STATE_UNDEF)); - - setup_datapipe(&packagekit_locked_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(FALSE)); - setup_datapipe(&update_mode_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(FALSE)); - setup_datapipe(&shutting_down_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(FALSE)); - setup_datapipe(&device_lock_state_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(DEVICE_LOCK_UNDEFINED)); - setup_datapipe(&touch_detected_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(FALSE)); - setup_datapipe(&touch_grab_wanted_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(FALSE)); - setup_datapipe(&touch_grab_active_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(FALSE)); - setup_datapipe(&keypad_grab_wanted_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(FALSE)); - setup_datapipe(&keypad_grab_active_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(FALSE)); - setup_datapipe(&music_playback_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(FALSE)); - setup_datapipe(&proximity_blank_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(FALSE)); + datapipe_init(&system_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(MCE_SYSTEM_STATE_UNDEF)); + datapipe_init(&master_radio_enabled_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(FALSE)); + datapipe_init(&call_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(CALL_STATE_NONE)); + datapipe_init(&ignore_incoming_call_event_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(false)); + datapipe_init(&call_type_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(CALL_TYPE_NORMAL)); + datapipe_init(&alarm_ui_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(MCE_ALARM_UI_INVALID_INT32)); + datapipe_init(&submode_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(MCE_SUBMODE_NORMAL)); + datapipe_init(&display_state_curr_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(MCE_DISPLAY_UNDEF)); + datapipe_init(&display_state_request_pipe, READ_WRITE, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(MCE_DISPLAY_UNDEF)); + datapipe_init(&display_state_next_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(MCE_DISPLAY_UNDEF)); + datapipe_init(&uiexception_type_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(UIEXCEPTION_TYPE_NONE)); + datapipe_init(&display_brightness_pipe, READ_WRITE, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(3)); + datapipe_init(&led_brightness_pipe, READ_WRITE, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(0)); + datapipe_init(&lpm_brightness_pipe, READ_WRITE, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(0)); + datapipe_init(&led_pattern_activate_pipe, READ_ONLY, FREE_CACHE, + 0, NULL); + datapipe_init(&resume_detected_event_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, NULL); + datapipe_init(&led_pattern_deactivate_pipe, READ_ONLY, FREE_CACHE, + 0, NULL); + datapipe_init(&user_activity_event_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, NULL); + datapipe_init(&key_backlight_brightness_pipe, READ_WRITE, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(0)); + datapipe_init(&keypress_event_pipe, READ_ONLY, FREE_CACHE, + sizeof (struct input_event), NULL); + datapipe_init(&touchscreen_event_pipe, READ_ONLY, FREE_CACHE, + sizeof (struct input_event), NULL); + datapipe_init(&device_inactive_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(TRUE)); + datapipe_init(&inactivity_event_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(TRUE)); + datapipe_init(&lockkey_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(KEY_STATE_UNDEF)); + datapipe_init(&keyboard_slide_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(COVER_CLOSED)); + datapipe_init(&keyboard_available_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(COVER_CLOSED)); + datapipe_init(&lid_sensor_is_working_pipe, READ_ONLY, + DONT_FREE_CACHE, 0, GINT_TO_POINTER(FALSE)); + datapipe_init(&lid_sensor_actual_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(COVER_UNDEF)); + datapipe_init(&lid_sensor_filtered_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(COVER_UNDEF)); + datapipe_init(&lens_cover_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(COVER_CLOSED)); + datapipe_init(&proximity_sensor_actual_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(COVER_OPEN)); + datapipe_init(&light_sensor_actual_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(400)); + datapipe_init(&light_sensor_filtered_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(400)); + datapipe_init(&light_sensor_poll_request_pipe, READ_WRITE, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(false)); + datapipe_init(&orientation_sensor_actual_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(MCE_ORIENTATION_UNDEFINED)); + datapipe_init(&tklock_request_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(TKLOCK_REQUEST_UNDEF)); + datapipe_init(&interaction_expected_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(false)); + datapipe_init(&charger_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(CHARGER_STATE_UNDEF)); + datapipe_init(&battery_status_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(BATTERY_STATUS_UNDEF)); + datapipe_init(&battery_level_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(BATTERY_LEVEL_INITIAL)); + datapipe_init(&camera_button_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(CAMERA_BUTTON_UNDEF)); + datapipe_init(&inactivity_delay_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(DEFAULT_INACTIVITY_DELAY)); + datapipe_init(&audio_route_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(AUDIO_ROUTE_UNDEF)); + datapipe_init(&usb_cable_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(USB_CABLE_UNDEF)); + datapipe_init(&jack_sense_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(COVER_UNDEF)); + datapipe_init(&power_saving_mode_active_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(FALSE)); + datapipe_init(&thermal_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(THERMAL_STATE_UNDEF)); + datapipe_init(&heartbeat_event_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(0)); + datapipe_init(&compositor_service_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(SERVICE_STATE_UNDEF)); + datapipe_init(&lipstick_service_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(SERVICE_STATE_UNDEF)); + datapipe_init(&devicelock_service_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(SERVICE_STATE_UNDEF)); + datapipe_init(&usbmoded_service_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(SERVICE_STATE_UNDEF)); + datapipe_init(&ngfd_service_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(SERVICE_STATE_UNDEF)); + + datapipe_init(&dsme_service_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(SERVICE_STATE_UNDEF)); + + datapipe_init(&bluez_service_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(SERVICE_STATE_UNDEF)); + + datapipe_init(&packagekit_locked_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(FALSE)); + datapipe_init(&osupdate_running_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(FALSE)); + datapipe_init(&shutting_down_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(FALSE)); + datapipe_init(&devicelock_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(DEVICELOCK_STATE_UNDEFINED)); + datapipe_init(&touch_detected_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(FALSE)); + datapipe_init(&touch_grab_wanted_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(FALSE)); + datapipe_init(&touch_grab_active_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(FALSE)); + datapipe_init(&keypad_grab_wanted_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(FALSE)); + datapipe_init(&keypad_grab_active_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(FALSE)); + datapipe_init(&music_playback_ongoing_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(FALSE)); + datapipe_init(&proximity_blanked_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(FALSE)); } /** Free all datapipes */ void mce_datapipe_quit(void) { - free_datapipe(&thermal_state_pipe); - free_datapipe(&power_saving_mode_pipe); - free_datapipe(&jack_sense_pipe); - free_datapipe(&usb_cable_pipe); - free_datapipe(&audio_route_pipe); - free_datapipe(&inactivity_timeout_pipe); - free_datapipe(&battery_level_pipe); - free_datapipe(&camera_button_pipe); - free_datapipe(&battery_status_pipe); - free_datapipe(&charger_state_pipe); - free_datapipe(&interaction_expected_pipe); - free_datapipe(&tk_lock_pipe); - free_datapipe(&proximity_sensor_pipe); - free_datapipe(&ambient_light_sensor_pipe); - free_datapipe(&ambient_light_level_pipe); - free_datapipe(&ambient_light_poll_pipe); - free_datapipe(&orientation_sensor_pipe); - free_datapipe(&lens_cover_pipe); - free_datapipe(&lid_sensor_is_working_pipe); - free_datapipe(&lid_cover_sensor_pipe); - free_datapipe(&lid_cover_policy_pipe); - free_datapipe(&keyboard_slide_pipe); - free_datapipe(&keyboard_available_pipe); - free_datapipe(&lockkey_pipe); - free_datapipe(&device_inactive_state_pipe); - free_datapipe(&device_inactive_event_pipe); - free_datapipe(&touchscreen_pipe); - free_datapipe(&keypress_pipe); - free_datapipe(&key_backlight_pipe); - free_datapipe(&user_activity_pipe); - free_datapipe(&led_pattern_deactivate_pipe); - free_datapipe(&led_pattern_activate_pipe); - free_datapipe(&device_resumed_pipe); - free_datapipe(&led_brightness_pipe); - free_datapipe(&lpm_brightness_pipe); - free_datapipe(&display_brightness_pipe); - free_datapipe(&display_state_pipe); - free_datapipe(&display_state_req_pipe); - free_datapipe(&display_state_next_pipe); - free_datapipe(&exception_state_pipe); - free_datapipe(&submode_pipe); - free_datapipe(&alarm_ui_state_pipe); - free_datapipe(&call_type_pipe); - free_datapipe(&call_state_pipe); - free_datapipe(&ignore_incoming_call_pipe); - free_datapipe(&master_radio_pipe); - free_datapipe(&system_state_pipe); - free_datapipe(&heartbeat_pipe); - free_datapipe(&compositor_available_pipe); - free_datapipe(&lipstick_available_pipe); - free_datapipe(&devicelock_available_pipe); - free_datapipe(&usbmoded_available_pipe); - free_datapipe(&ngfd_available_pipe); - free_datapipe(&dsme_available_pipe); - free_datapipe(&bluez_available_pipe); - free_datapipe(&packagekit_locked_pipe); - free_datapipe(&update_mode_pipe); - free_datapipe(&shutting_down_pipe); - free_datapipe(&device_lock_state_pipe); - free_datapipe(&touch_grab_active_pipe); - free_datapipe(&touch_grab_wanted_pipe); - free_datapipe(&touch_detected_pipe); - free_datapipe(&keypad_grab_active_pipe); - free_datapipe(&keypad_grab_wanted_pipe); - free_datapipe(&music_playback_pipe); - free_datapipe(&proximity_blank_pipe); + datapipe_free(&thermal_state_pipe); + datapipe_free(&power_saving_mode_active_pipe); + datapipe_free(&jack_sense_state_pipe); + datapipe_free(&usb_cable_state_pipe); + datapipe_free(&audio_route_pipe); + datapipe_free(&inactivity_delay_pipe); + datapipe_free(&battery_level_pipe); + datapipe_free(&camera_button_state_pipe); + datapipe_free(&battery_status_pipe); + datapipe_free(&charger_state_pipe); + datapipe_free(&interaction_expected_pipe); + datapipe_free(&tklock_request_pipe); + datapipe_free(&proximity_sensor_actual_pipe); + datapipe_free(&light_sensor_actual_pipe); + datapipe_free(&light_sensor_filtered_pipe); + datapipe_free(&light_sensor_poll_request_pipe); + datapipe_free(&orientation_sensor_actual_pipe); + datapipe_free(&lens_cover_state_pipe); + datapipe_free(&lid_sensor_is_working_pipe); + datapipe_free(&lid_sensor_actual_pipe); + datapipe_free(&lid_sensor_filtered_pipe); + datapipe_free(&keyboard_slide_state_pipe); + datapipe_free(&keyboard_available_state_pipe); + datapipe_free(&lockkey_state_pipe); + datapipe_free(&device_inactive_pipe); + datapipe_free(&inactivity_event_pipe); + datapipe_free(&touchscreen_event_pipe); + datapipe_free(&keypress_event_pipe); + datapipe_free(&key_backlight_brightness_pipe); + datapipe_free(&user_activity_event_pipe); + datapipe_free(&led_pattern_deactivate_pipe); + datapipe_free(&led_pattern_activate_pipe); + datapipe_free(&resume_detected_event_pipe); + datapipe_free(&led_brightness_pipe); + datapipe_free(&lpm_brightness_pipe); + datapipe_free(&display_brightness_pipe); + datapipe_free(&display_state_curr_pipe); + datapipe_free(&display_state_request_pipe); + datapipe_free(&display_state_next_pipe); + datapipe_free(&uiexception_type_pipe); + datapipe_free(&submode_pipe); + datapipe_free(&alarm_ui_state_pipe); + datapipe_free(&call_type_pipe); + datapipe_free(&call_state_pipe); + datapipe_free(&ignore_incoming_call_event_pipe); + datapipe_free(&master_radio_enabled_pipe); + datapipe_free(&system_state_pipe); + datapipe_free(&heartbeat_event_pipe); + datapipe_free(&compositor_service_state_pipe); + datapipe_free(&lipstick_service_state_pipe); + datapipe_free(&devicelock_service_state_pipe); + datapipe_free(&usbmoded_service_state_pipe); + datapipe_free(&ngfd_service_state_pipe); + datapipe_free(&dsme_service_state_pipe); + datapipe_free(&bluez_service_state_pipe); + datapipe_free(&packagekit_locked_pipe); + datapipe_free(&osupdate_running_pipe); + datapipe_free(&shutting_down_pipe); + datapipe_free(&devicelock_state_pipe); + datapipe_free(&touch_grab_active_pipe); + datapipe_free(&touch_grab_wanted_pipe); + datapipe_free(&touch_detected_pipe); + datapipe_free(&keypad_grab_active_pipe); + datapipe_free(&keypad_grab_wanted_pipe); + datapipe_free(&music_playback_ongoing_pipe); + datapipe_free(&proximity_blanked_pipe); } /** Convert submode_t bitmap changes to human readable string @@ -951,16 +951,16 @@ const char *submode_change_repr(submode_t prev, submode_t curr) static const struct { submode_t bit; const char *name; } lut[] = { - { MCE_INVALID_SUBMODE, "INVALID" }, - { MCE_TKLOCK_SUBMODE, "TKLOCK" }, - { MCE_EVEATER_SUBMODE, "EVEATER" }, - { MCE_BOOTUP_SUBMODE, "BOOTUP" }, - { MCE_TRANSITION_SUBMODE, "TRANSITION" }, - { MCE_AUTORELOCK_SUBMODE, "AUTORELOCK" }, - { MCE_VISUAL_TKLOCK_SUBMODE, "VISUAL_TKLOCK" }, - { MCE_POCKET_SUBMODE, "POCKET" }, - { MCE_PROXIMITY_TKLOCK_SUBMODE, "PROXIMITY_TKLOCK" }, - { MCE_MALF_SUBMODE, "MALF" }, + { MCE_SUBMODE_INVALID, "INVALID" }, + { MCE_SUBMODE_TKLOCK, "TKLOCK" }, + { MCE_SUBMODE_EVEATER, "EVEATER" }, + { MCE_SUBMODE_BOOTUP, "BOOTUP" }, + { MCE_SUBMODE_TRANSITION, "TRANSITION" }, + { MCE_SUBMODE_AUTORELOCK, "AUTORELOCK" }, + { MCE_SUBMODE_VISUAL_TKLOCK, "VISUAL_TKLOCK" }, + { MCE_SUBMODE_POCKET, "POCKET" }, + { MCE_SUBMODE_PROXIMITY_TKLOCK, "PROXIMITY_TKLOCK" }, + { MCE_SUBMODE_MALF, "MALF" }, { 0,0 } }; @@ -1019,96 +1019,96 @@ const char *system_state_repr(system_state_t state) const char *res = "UNKNOWN"; switch( state ) { - case MCE_STATE_UNDEF: res = "UNDEF"; break; - case MCE_STATE_SHUTDOWN: res = "SHUTDOWN"; break; - case MCE_STATE_USER: res = "USER"; break; - case MCE_STATE_ACTDEAD: res = "ACTDEAD"; break; - case MCE_STATE_REBOOT: res = "REBOOT"; break; - case MCE_STATE_BOOT: res = "BOOT"; break; + case MCE_SYSTEM_STATE_UNDEF: res = "UNDEF"; break; + case MCE_SYSTEM_STATE_SHUTDOWN: res = "SHUTDOWN"; break; + case MCE_SYSTEM_STATE_USER: res = "USER"; break; + case MCE_SYSTEM_STATE_ACTDEAD: res = "ACTDEAD"; break; + case MCE_SYSTEM_STATE_REBOOT: res = "REBOOT"; break; + case MCE_SYSTEM_STATE_BOOT: res = "BOOT"; break; default: break; } return res; } -/** Convert device_lock_state_t enum to human readable string +/** Convert devicelock_state_t enum to human readable string * - * @param state device_lock_state_t enumeration value + * @param state devicelock_state_t enumeration value * * @return human readable representation of state */ -const char *device_lock_state_repr(device_lock_state_t state) +const char *devicelock_state_repr(devicelock_state_t state) { const char *res = "unknown"; switch( state ) { - case DEVICE_LOCK_UNLOCKED: res = "unlocked"; break; - case DEVICE_LOCK_LOCKED: res = "locked"; break; - case DEVICE_LOCK_UNDEFINED: res = "undefined"; break; + case DEVICELOCK_STATE_UNLOCKED: res = "unlocked"; break; + case DEVICELOCK_STATE_LOCKED: res = "locked"; break; + case DEVICELOCK_STATE_UNDEFINED: res = "undefined"; break; default: break; } return res; } -/** Convert uiexctype_t enum to human readable string +/** Convert uiexception_type_t enum to human readable string * - * Note that while uiexctype_t actually is a bitmask + * Note that while uiexception_type_t actually is a bitmask * and this function is expected to be used in situations * where at maximum one bit is set. * - * @param state uiexctype_t exception stata + * @param type uiexception_type_t exception stata * - * @return human readable representation of state + * @return human readable representation of type */ -const char *uiexctype_repr(uiexctype_t state) +const char *uiexception_type_repr(uiexception_type_t type) { const char *res = "unknown"; - switch( state ) { - case UIEXC_NONE: res = "none"; break; - case UIEXC_LINGER: res = "linger"; break; - case UIEXC_CALL: res = "call"; break; - case UIEXC_ALARM: res = "alarm"; break; - case UIEXC_NOTIF: res = "notif"; break; - case UIEXC_NOANIM: res = "noanim"; break; + switch( type ) { + case UIEXCEPTION_TYPE_NONE: res = "none"; break; + case UIEXCEPTION_TYPE_LINGER: res = "linger"; break; + case UIEXCEPTION_TYPE_CALL: res = "call"; break; + case UIEXCEPTION_TYPE_ALARM: res = "alarm"; break; + case UIEXCEPTION_TYPE_NOTIF: res = "notif"; break; + case UIEXCEPTION_TYPE_NOANIM: res = "noanim"; break; default: break; } return res; } -/** Convert uiexctype_t enum to dbus argument string +/** Convert uiexception_type_t enum to dbus argument string * - * Note that while uiexctype_t actually is a bitmask + * Note that while uiexception_type_t actually is a bitmask * and this function is expected to be used in situations * where at maximum one bit is set. * - * @param state uiexctype_t exception stata + * @param type uiexception_type_t exception stata * - * @return representation of state for use over dbus + * @return representation of type for use over dbus */ -const char *uiexctype_to_dbus(uiexctype_t state) +const char *uiexception_type_to_dbus(uiexception_type_t type) { const char *res = MCE_BLANKING_POLICY_DEFAULT_STRING; - switch( state ) { - case UIEXC_NOTIF: - case UIEXC_NOANIM: + switch( type ) { + case UIEXCEPTION_TYPE_NOTIF: + case UIEXCEPTION_TYPE_NOANIM: res = MCE_BLANKING_POLICY_NOTIFICATION_STRING; break; - case UIEXC_ALARM: + case UIEXCEPTION_TYPE_ALARM: res = MCE_BLANKING_POLICY_ALARM_STRING; break; - case UIEXC_CALL: + case UIEXCEPTION_TYPE_CALL: res = MCE_BLANKING_POLICY_CALL_STRING; break; - case UIEXC_LINGER: + case UIEXCEPTION_TYPE_LINGER: res = MCE_BLANKING_POLICY_LINGER_STRING; break; - case UIEXC_NONE: + case UIEXCEPTION_TYPE_NONE: break; default: @@ -1229,25 +1229,25 @@ const char *charger_state_to_dbus(charger_state_t state) return res; } -/** Convert lock_state_t enum to human readable string +/** Convert tklock_request_t enum to human readable string * - * @param state lock_state_t enumeration value + * @param state tklock_request_t enumeration value * * @return human readable representation of state */ -const char *lock_state_repr(lock_state_t state) +const char *tklock_request_repr(tklock_request_t state) { const char *res = "unknown"; switch( state ) { - case LOCK_UNDEF: res = "undef"; break; - case LOCK_OFF: res = "off"; break; - case LOCK_OFF_DELAYED: res = "off_delayed"; break; - case LOCK_OFF_PROXIMITY: res = "off_proximity"; break; - case LOCK_ON: res = "on"; break; - case LOCK_ON_DIMMED: res = "on_dimmed"; break; - case LOCK_ON_PROXIMITY: res = "on_proximity"; break; - case LOCK_TOGGLE: res = "toggle"; break; - case LOCK_ON_DELAYED: res = "on_delayed"; break; + case TKLOCK_REQUEST_UNDEF: res = "undef"; break; + case TKLOCK_REQUEST_OFF: res = "off"; break; + case TKLOCK_REQUEST_OFF_DELAYED: res = "off_delayed"; break; + case TKLOCK_REQUEST_OFF_PROXIMITY: res = "off_proximity"; break; + case TKLOCK_REQUEST_ON: res = "on"; break; + case TKLOCK_REQUEST_ON_DIMMED: res = "on_dimmed"; break; + case TKLOCK_REQUEST_ON_PROXIMITY: res = "on_proximity"; break; + case TKLOCK_REQUEST_TOGGLE: res = "toggle"; break; + case TKLOCK_REQUEST_ON_DELAYED: res = "on_delayed"; break; default: break; } return res; @@ -1392,11 +1392,11 @@ const char *call_state_repr(call_state_t state) static const mce_translation_t call_type_translation[] = { { - .number = NORMAL_CALL, + .number = CALL_TYPE_NORMAL, .string = MCE_NORMAL_CALL }, { - .number = EMERGENCY_CALL, + .number = CALL_TYPE_EMERGENCY, .string = MCE_EMERGENCY_CALL }, { /* MCE_INVALID_TRANSLATION marks the end of this array */ @@ -1494,6 +1494,18 @@ const char *orientation_state_repr(orientation_state_t state) return name; } +const char *key_state_repr(key_state_t state) +{ + const char *repr = "UNKNOWN"; + switch( state ) { + case KEY_STATE_UNDEF: repr = "UNDEF"; break; + case KEY_STATE_RELEASED: repr = "RELEASED"; break; + case KEY_STATE_PRESSED: repr = "PRESSED"; break; + default: break; + } + return repr; +} + void datapipe_handlers_install(datapipe_handler_t *bindings) { if( !bindings ) @@ -1504,16 +1516,16 @@ void datapipe_handlers_install(datapipe_handler_t *bindings) continue; if( bindings[i].filter_cb ) - append_filter_to_datapipe(bindings[i].datapipe, - bindings[i].filter_cb); + datapipe_add_filter(bindings[i].datapipe, + bindings[i].filter_cb); if( bindings[i].input_cb ) - append_input_trigger_to_datapipe(bindings[i].datapipe, - bindings[i].input_cb); + datapipe_add_input_trigger(bindings[i].datapipe, + bindings[i].input_cb); if( bindings[i].output_cb ) - append_output_trigger_to_datapipe(bindings[i].datapipe, - bindings[i].output_cb); + datapipe_add_output_trigger(bindings[i].datapipe, + bindings[i].output_cb); bindings[i].bound = true; } @@ -1531,16 +1543,16 @@ void datapipe_handlers_remove(datapipe_handler_t *bindings) continue; if( bindings[i].filter_cb ) - remove_filter_from_datapipe(bindings[i].datapipe, - bindings[i].filter_cb); + datapipe_remove_filter(bindings[i].datapipe, + bindings[i].filter_cb); if( bindings[i].input_cb ) - remove_input_trigger_from_datapipe(bindings[i].datapipe, - bindings[i].input_cb); + datapipe_remove_input_trigger(bindings[i].datapipe, + bindings[i].input_cb); if( bindings[i].output_cb ) - remove_output_trigger_from_datapipe(bindings[i].datapipe, - bindings[i].output_cb); + datapipe_remove_output_trigger(bindings[i].datapipe, + bindings[i].output_cb); bindings[i].bound = false; } diff --git a/datapipe.h b/datapipe.h index 9f6bcaf9..805eed34 100644 --- a/datapipe.h +++ b/datapipe.h @@ -24,20 +24,20 @@ #include #include -/** Device lock states used in device_lock_state_pipe */ +/** Device lock states used in devicelock_state_pipe */ typedef enum { /** Device lock is not active */ - DEVICE_LOCK_UNLOCKED = 0, + DEVICELOCK_STATE_UNLOCKED = 0, /** Device lock is active */ - DEVICE_LOCK_LOCKED = 1, + DEVICELOCK_STATE_LOCKED = 1, /** Initial startup value; from mce p.o.v. equals not active */ - DEVICE_LOCK_UNDEFINED = 2, -} device_lock_state_t; + DEVICELOCK_STATE_UNDEFINED = 2, +} devicelock_state_t; -const char *device_lock_state_repr(device_lock_state_t state); +const char *devicelock_state_repr(devicelock_state_t state); /** * Datapipe structure @@ -90,70 +90,70 @@ typedef enum { /* Available datapipes */ extern datapipe_struct led_brightness_pipe; extern datapipe_struct lpm_brightness_pipe; -extern datapipe_struct device_inactive_state_pipe; -extern datapipe_struct device_inactive_event_pipe; +extern datapipe_struct device_inactive_pipe; +extern datapipe_struct inactivity_event_pipe; extern datapipe_struct led_pattern_activate_pipe; extern datapipe_struct led_pattern_deactivate_pipe; -extern datapipe_struct device_resumed_pipe; -extern datapipe_struct user_activity_pipe; -extern datapipe_struct display_state_pipe; -extern datapipe_struct display_state_req_pipe; +extern datapipe_struct resume_detected_event_pipe; +extern datapipe_struct user_activity_event_pipe; +extern datapipe_struct display_state_curr_pipe; +extern datapipe_struct display_state_request_pipe; extern datapipe_struct display_state_next_pipe; -extern datapipe_struct exception_state_pipe; +extern datapipe_struct uiexception_type_pipe; extern datapipe_struct display_brightness_pipe; -extern datapipe_struct key_backlight_pipe; -extern datapipe_struct keypress_pipe; -extern datapipe_struct touchscreen_pipe; -extern datapipe_struct lockkey_pipe; -extern datapipe_struct keyboard_slide_pipe; -extern datapipe_struct keyboard_available_pipe; +extern datapipe_struct key_backlight_brightness_pipe; +extern datapipe_struct keypress_event_pipe; +extern datapipe_struct touchscreen_event_pipe; +extern datapipe_struct lockkey_state_pipe; +extern datapipe_struct keyboard_slide_state_pipe; +extern datapipe_struct keyboard_available_state_pipe; extern datapipe_struct lid_sensor_is_working_pipe; -extern datapipe_struct lid_cover_sensor_pipe; -extern datapipe_struct lid_cover_policy_pipe; -extern datapipe_struct lens_cover_pipe; -extern datapipe_struct proximity_sensor_pipe; -extern datapipe_struct ambient_light_sensor_pipe; -extern datapipe_struct ambient_light_level_pipe; -extern datapipe_struct ambient_light_poll_pipe; -extern datapipe_struct orientation_sensor_pipe; +extern datapipe_struct lid_sensor_actual_pipe; +extern datapipe_struct lid_sensor_filtered_pipe; +extern datapipe_struct lens_cover_state_pipe; +extern datapipe_struct proximity_sensor_actual_pipe; +extern datapipe_struct light_sensor_actual_pipe; +extern datapipe_struct light_sensor_filtered_pipe; +extern datapipe_struct light_sensor_poll_request_pipe; +extern datapipe_struct orientation_sensor_actual_pipe; extern datapipe_struct alarm_ui_state_pipe; extern datapipe_struct system_state_pipe; -extern datapipe_struct master_radio_pipe; +extern datapipe_struct master_radio_enabled_pipe; extern datapipe_struct submode_pipe; extern datapipe_struct call_state_pipe; -extern datapipe_struct ignore_incoming_call_pipe; +extern datapipe_struct ignore_incoming_call_event_pipe; extern datapipe_struct call_type_pipe; -extern datapipe_struct tk_lock_pipe; +extern datapipe_struct tklock_request_pipe; extern datapipe_struct interaction_expected_pipe; extern datapipe_struct charger_state_pipe; extern datapipe_struct battery_status_pipe; extern datapipe_struct battery_level_pipe; -extern datapipe_struct camera_button_pipe; -extern datapipe_struct inactivity_timeout_pipe; +extern datapipe_struct camera_button_state_pipe; +extern datapipe_struct inactivity_delay_pipe; extern datapipe_struct audio_route_pipe; -extern datapipe_struct usb_cable_pipe; -extern datapipe_struct jack_sense_pipe; -extern datapipe_struct power_saving_mode_pipe; +extern datapipe_struct usb_cable_state_pipe; +extern datapipe_struct jack_sense_state_pipe; +extern datapipe_struct power_saving_mode_active_pipe; extern datapipe_struct thermal_state_pipe; -extern datapipe_struct heartbeat_pipe; -extern datapipe_struct compositor_available_pipe; -extern datapipe_struct lipstick_available_pipe; -extern datapipe_struct devicelock_available_pipe; -extern datapipe_struct usbmoded_available_pipe; -extern datapipe_struct ngfd_available_pipe; -extern datapipe_struct dsme_available_pipe; -extern datapipe_struct bluez_available_pipe; +extern datapipe_struct heartbeat_event_pipe; +extern datapipe_struct compositor_service_state_pipe; +extern datapipe_struct lipstick_service_state_pipe; +extern datapipe_struct devicelock_service_state_pipe; +extern datapipe_struct usbmoded_service_state_pipe; +extern datapipe_struct ngfd_service_state_pipe; +extern datapipe_struct dsme_service_state_pipe; +extern datapipe_struct bluez_service_state_pipe; extern datapipe_struct packagekit_locked_pipe; -extern datapipe_struct update_mode_pipe; +extern datapipe_struct osupdate_running_pipe; extern datapipe_struct shutting_down_pipe; -extern datapipe_struct device_lock_state_pipe; +extern datapipe_struct devicelock_state_pipe; extern datapipe_struct touch_detected_pipe; extern datapipe_struct touch_grab_wanted_pipe; extern datapipe_struct touch_grab_active_pipe; extern datapipe_struct keypad_grab_wanted_pipe; extern datapipe_struct keypad_grab_active_pipe; -extern datapipe_struct music_playback_pipe; -extern datapipe_struct proximity_blank_pipe; +extern datapipe_struct music_playback_ongoing_pipe; +extern datapipe_struct proximity_blanked_pipe; /* Data retrieval */ @@ -173,43 +173,43 @@ extern datapipe_struct proximity_blank_pipe; #define datapipe_get_gpointer(_datapipe) ((_datapipe).cached_data) /* Datapipe execution */ -void execute_datapipe_input_triggers(datapipe_struct *const datapipe, - gpointer const indata, - const data_source_t use_cache); -gconstpointer execute_datapipe_filters(datapipe_struct *const datapipe, - gpointer indata, - const data_source_t use_cache); -void execute_datapipe_output_triggers(const datapipe_struct *const datapipe, - gconstpointer indata, - const data_source_t use_cache); -gconstpointer execute_datapipe(datapipe_struct *const datapipe, - gpointer indata, - const data_source_t use_cache, - const caching_policy_t cache_indata); +void datapipe_exec_input_triggers(datapipe_struct *const datapipe, + gpointer const indata, + const data_source_t use_cache); +gconstpointer datapipe_exec_filters(datapipe_struct *const datapipe, + gpointer indata, + const data_source_t use_cache); +void datapipe_exec_output_triggers(const datapipe_struct *const datapipe, + gconstpointer indata, + const data_source_t use_cache); +gconstpointer datapipe_exec_full(datapipe_struct *const datapipe, + gpointer indata, + const data_source_t use_cache, + const caching_policy_t cache_indata); /* Filters */ -void append_filter_to_datapipe(datapipe_struct *const datapipe, - gpointer (*filter)(gpointer data)); -void remove_filter_from_datapipe(datapipe_struct *const datapipe, - gpointer (*filter)(gpointer data)); +void datapipe_add_filter(datapipe_struct *const datapipe, + gpointer (*filter)(gpointer data)); +void datapipe_remove_filter(datapipe_struct *const datapipe, + gpointer (*filter)(gpointer data)); /* Input triggers */ -void append_input_trigger_to_datapipe(datapipe_struct *const datapipe, - void (*trigger)(gconstpointer data)); -void remove_input_trigger_from_datapipe(datapipe_struct *const datapipe, - void (*trigger)(gconstpointer data)); +void datapipe_add_input_trigger(datapipe_struct *const datapipe, + void (*trigger)(gconstpointer data)); +void datapipe_remove_input_trigger(datapipe_struct *const datapipe, + void (*trigger)(gconstpointer data)); /* Output triggers */ -void append_output_trigger_to_datapipe(datapipe_struct *const datapipe, - void (*trigger)(gconstpointer data)); -void remove_output_trigger_from_datapipe(datapipe_struct *const datapipe, - void (*trigger)(gconstpointer data)); +void datapipe_add_output_trigger(datapipe_struct *const datapipe, + void (*trigger)(gconstpointer data)); +void datapipe_remove_output_trigger(datapipe_struct *const datapipe, + void (*trigger)(gconstpointer data)); -void setup_datapipe(datapipe_struct *const datapipe, - const read_only_policy_t read_only, - const cache_free_policy_t free_cache, - const gsize datasize, gpointer initial_data); -void free_datapipe(datapipe_struct *const datapipe); +void datapipe_init(datapipe_struct *const datapipe, + const read_only_policy_t read_only, + const cache_free_policy_t free_cache, + const gsize datasize, gpointer initial_data); +void datapipe_free(datapipe_struct *const datapipe); /* Binding arrays */ @@ -267,9 +267,9 @@ void mce_datapipe_quit(void); * because during already ongoing transition something \ * else might be already queued up and we want't the \ * last request to reach the queue to "win". */ \ - execute_datapipe(&display_state_req_pipe,\ - GINT_TO_POINTER(req_target),\ - USE_INDATA, CACHE_OUTDATA);\ + datapipe_exec_full(&display_state_request_pipe,\ + GINT_TO_POINTER(req_target),\ + USE_INDATA, CACHE_OUTDATA);\ } while(0) #endif /* _DATAPIPE_H_ */ diff --git a/event-input.c b/event-input.c index d39ca762..0c45be88 100644 --- a/event-input.c +++ b/event-input.c @@ -433,7 +433,7 @@ static void evin_ts_policy_changed (evin_input_grab static void evin_ts_grab_wanted_cb (gconstpointer data); static void evin_ts_grab_touch_detected_cb (gconstpointer data); -static void evin_ts_grab_display_state_cb (gconstpointer data); +static void evin_ts_grab_display_state_curr_cb (gconstpointer data); static void evin_ts_grab_setting_cb (GConfClient *const client, const guint id, GConfEntry *const entry, gpointer const data); @@ -577,15 +577,15 @@ evin_gpio_key_disable(unsigned key) static void evin_gpio_submode_trigger(gconstpointer data) { - static submode_t old_submode = MCE_NORMAL_SUBMODE; + static submode_t old_submode = MCE_SUBMODE_NORMAL; submode_t submode = GPOINTER_TO_INT(data); /* If the tklock is enabled, disable the camera focus interrupts, * since we don't use them anyway */ if( evin_gpio_key_disable_exists ) { - submode_t tklock_prev = (old_submode & MCE_TKLOCK_SUBMODE); - submode_t tklock_curr = (submode & MCE_TKLOCK_SUBMODE); + submode_t tklock_prev = (old_submode & MCE_SUBMODE_TKLOCK); + submode_t tklock_curr = (submode & MCE_SUBMODE_TKLOCK); if( tklock_prev != tklock_curr ) { if( tklock_curr ) @@ -1914,8 +1914,8 @@ evin_iomon_generate_activity(struct input_event *ev, bool cooked, bool raw) if( raw ) { if( t_raw != t ) { t_raw = t; - execute_datapipe_output_triggers(&user_activity_pipe, - ev, USE_INDATA); + datapipe_exec_output_triggers(&user_activity_event_pipe, + ev, USE_INDATA); } } @@ -1923,11 +1923,11 @@ evin_iomon_generate_activity(struct input_event *ev, bool cooked, bool raw) if( cooked ) { submode_t submode = mce_get_submode_int32(); - if( t_cooked != t || (submode & MCE_EVEATER_SUBMODE) ) { + if( t_cooked != t || (submode & MCE_SUBMODE_EVEATER) ) { t_cooked = t; - execute_datapipe(&device_inactive_event_pipe, - GINT_TO_POINTER(FALSE), - USE_INDATA, CACHE_OUTDATA); + datapipe_exec_full(&inactivity_event_pipe, + GINT_TO_POINTER(FALSE), + USE_INDATA, CACHE_OUTDATA); } } @@ -1967,10 +1967,10 @@ evin_iomon_sw_gestures_allowed(void) goto EXIT; } - display_state_t display_state = - datapipe_get_gint(display_state_pipe); + display_state_t display_state_curr = + datapipe_get_gint(display_state_curr_pipe); - switch( display_state ) { + switch( display_state_curr ) { case MCE_DISPLAY_OFF: case MCE_DISPLAY_LPM_OFF: case MCE_DISPLAY_LPM_ON: @@ -2037,16 +2037,16 @@ evin_iomon_touchscreen_cb(mce_io_mon_t *iomon, gpointer data, gsize bytes_read) /* Power key up event from touch screen -> double tap gesture event */ if( ev->type == EV_KEY && ev->code == KEY_POWER && ev->value == 0 ) { - cover_state_t proximity_sensor_state = - datapipe_get_gint(proximity_sensor_pipe); + cover_state_t proximity_sensor_actual = + datapipe_get_gint(proximity_sensor_actual_pipe); - cover_state_t lid_cover_policy_state = - datapipe_get_gint(lid_cover_policy_pipe); + cover_state_t lid_sensor_filtered = + datapipe_get_gint(lid_sensor_filtered_pipe); mce_log(LL_DEVEL, "[doubletap] as power key event; " "proximity=%s, lid=%s", - proximity_state_repr(proximity_sensor_state), - proximity_state_repr(lid_cover_policy_state)); + proximity_state_repr(proximity_sensor_actual), + proximity_state_repr(lid_sensor_filtered)); /* Mimic N9 style gesture event for which we * already have logic in place. Possible filtering @@ -2070,7 +2070,7 @@ evin_iomon_touchscreen_cb(mce_io_mon_t *iomon, gpointer data, gsize bytes_read) submode_t submode = mce_get_submode_int32(); /* If the event eater is active, don't send anything */ - if( submode & MCE_EVEATER_SUBMODE ) + if( submode & MCE_SUBMODE_EVEATER ) goto EXIT; if( ev->type == EV_MSC && ev->code == MSC_GESTURE ) { @@ -2079,14 +2079,14 @@ evin_iomon_touchscreen_cb(mce_io_mon_t *iomon, gpointer data, gsize bytes_read) evin_iomon_generate_activity(ev, false, true); /* But otherwise are handled in powerkey.c. */ - execute_datapipe(&keypress_pipe, &ev, - USE_INDATA, DONT_CACHE_INDATA); + datapipe_exec_full(&keypress_event_pipe, &ev, + USE_INDATA, DONT_CACHE_INDATA); } else if( (ev->type == EV_ABS && ev->code == ABS_PRESSURE) || (ev->type == EV_KEY && ev->code == BTN_TOUCH ) ) { /* Only send pressure events */ - execute_datapipe(&touchscreen_pipe, &ev, - USE_INDATA, DONT_CACHE_INDATA); + datapipe_exec_full(&touchscreen_event_pipe, &ev, + USE_INDATA, DONT_CACHE_INDATA); } EXIT: @@ -2170,9 +2170,11 @@ evin_iomon_keypress_cb(mce_io_mon_t *iomon, gpointer data, gsize bytes_read) } } if ((ev->code == KEY_SCREENLOCK) && (ev->value != 2)) { - (void)execute_datapipe(&lockkey_pipe, - GINT_TO_POINTER(ev->value), - USE_INDATA, CACHE_INDATA); + key_state_t key_state = ev->value ? + KEY_STATE_PRESSED : KEY_STATE_RELEASED; + (void)datapipe_exec_full(&lockkey_state_pipe, + GINT_TO_POINTER(key_state), + USE_INDATA, CACHE_INDATA); } /* For now there's no reason to cache the keypress @@ -2190,11 +2192,11 @@ evin_iomon_keypress_cb(mce_io_mon_t *iomon, gpointer data, gsize bytes_read) */ if (((ev->code != KEY_CAMERA_FOCUS) && (ev->code != KEY_SCREENLOCK) && - ((((submode & MCE_EVEATER_SUBMODE) == 0) && + ((((submode & MCE_SUBMODE_EVEATER) == 0) && (ev->value == 1)) || (ev->value == 0))) && - ((submode & MCE_PROXIMITY_TKLOCK_SUBMODE) == 0)) { - (void)execute_datapipe(&keypress_pipe, &ev, - USE_INDATA, DONT_CACHE_INDATA); + ((submode & MCE_SUBMODE_PROXIMITY_TKLOCK) == 0)) { + (void)datapipe_exec_full(&keypress_event_pipe, &ev, + USE_INDATA, DONT_CACHE_INDATA); } } @@ -2202,7 +2204,11 @@ evin_iomon_keypress_cb(mce_io_mon_t *iomon, gpointer data, gsize bytes_read) switch (ev->code) { case SW_CAMERA_LENS_COVER: if (ev->value != 2) { - (void)execute_datapipe(&lens_cover_pipe, GINT_TO_POINTER(ev->value ? COVER_CLOSED : COVER_OPEN), USE_INDATA, CACHE_INDATA); + cover_state_t cover_state = ev->value ? + COVER_CLOSED : COVER_OPEN; + datapipe_exec_full(&lens_cover_state_pipe, + GINT_TO_POINTER(cover_state), + USE_INDATA, CACHE_INDATA); } /* Don't generate activity on COVER_CLOSED */ @@ -2213,7 +2219,11 @@ evin_iomon_keypress_cb(mce_io_mon_t *iomon, gpointer data, gsize bytes_read) case SW_KEYPAD_SLIDE: if (ev->value != 2) { - (void)execute_datapipe(&keyboard_slide_pipe, GINT_TO_POINTER(ev->value ? COVER_CLOSED : COVER_OPEN), USE_INDATA, CACHE_INDATA); + cover_state_t cover_state = ev->value ? + COVER_CLOSED : COVER_OPEN; + datapipe_exec_full(&keyboard_slide_state_pipe, + GINT_TO_POINTER(cover_state), + USE_INDATA, CACHE_INDATA); evin_iomon_keyboard_state_update(); } @@ -2225,7 +2235,11 @@ evin_iomon_keypress_cb(mce_io_mon_t *iomon, gpointer data, gsize bytes_read) case SW_FRONT_PROXIMITY: if (ev->value != 2) { - (void)execute_datapipe(&proximity_sensor_pipe, GINT_TO_POINTER(ev->value ? COVER_CLOSED : COVER_OPEN), USE_INDATA, CACHE_INDATA); + cover_state_t cover_state = ev->value ? + COVER_CLOSED : COVER_OPEN; + datapipe_exec_full(&proximity_sensor_actual_pipe, + GINT_TO_POINTER(cover_state), + USE_INDATA, CACHE_INDATA); } break; @@ -2235,7 +2249,11 @@ evin_iomon_keypress_cb(mce_io_mon_t *iomon, gpointer data, gsize bytes_read) case SW_LINEOUT_INSERT: case SW_VIDEOOUT_INSERT: if (ev->value != 2) { - (void)execute_datapipe(&jack_sense_pipe, GINT_TO_POINTER(ev->value ? COVER_CLOSED : COVER_OPEN), USE_INDATA, CACHE_INDATA); + cover_state_t cover_state = ev->value ? + COVER_CLOSED : COVER_OPEN; + datapipe_exec_full(&jack_sense_state_pipe, + GINT_TO_POINTER(cover_state), + USE_INDATA, CACHE_INDATA); } break; @@ -2244,14 +2262,14 @@ evin_iomon_keypress_cb(mce_io_mon_t *iomon, gpointer data, gsize bytes_read) /* hammerhead magnetic lid sensor; Feed in to the * same datapipe as N770 sliding cover uses */ if( ev->value ) { - execute_datapipe(&lid_cover_sensor_pipe, - GINT_TO_POINTER(COVER_CLOSED), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&lid_sensor_actual_pipe, + GINT_TO_POINTER(COVER_CLOSED), + USE_INDATA, CACHE_INDATA); } else { - execute_datapipe(&lid_cover_sensor_pipe, - GINT_TO_POINTER(COVER_OPEN), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&lid_sensor_actual_pipe, + GINT_TO_POINTER(COVER_OPEN), + USE_INDATA, CACHE_INDATA); } break; @@ -2505,24 +2523,24 @@ evin_iomon_switch_states_update_iter_cb(gpointer io_monitor, gpointer user_data) ecode = evin_event_mapper_rlookup_switch(SW_CAMERA_LENS_COVER); if( test_bit(ecode, featurelist) ) { state = test_bit(ecode, statelist) ? COVER_CLOSED : COVER_OPEN; - execute_datapipe(&lens_cover_pipe, GINT_TO_POINTER(state), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&lens_cover_state_pipe, GINT_TO_POINTER(state), + USE_INDATA, CACHE_INDATA); } /* Check initial keypad slide state */ ecode = evin_event_mapper_rlookup_switch(SW_KEYPAD_SLIDE); if( test_bit(ecode, featurelist) ) { state = test_bit(ecode, statelist) ? COVER_CLOSED : COVER_OPEN; - execute_datapipe(&keyboard_slide_pipe, GINT_TO_POINTER(state), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&keyboard_slide_state_pipe, GINT_TO_POINTER(state), + USE_INDATA, CACHE_INDATA); } /* Check initial front proximity state */ ecode = evin_event_mapper_rlookup_switch(SW_FRONT_PROXIMITY); if( test_bit(ecode, featurelist) ) { state = test_bit(ecode, statelist) ? COVER_CLOSED : COVER_OPEN; - execute_datapipe(&proximity_sensor_pipe, GINT_TO_POINTER(state), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&proximity_sensor_actual_pipe, GINT_TO_POINTER(state), + USE_INDATA, CACHE_INDATA); } /* Check initial lid sensor state */ @@ -2531,12 +2549,12 @@ evin_iomon_switch_states_update_iter_cb(gpointer io_monitor, gpointer user_data) state = test_bit(ecode, statelist) ? COVER_CLOSED : COVER_OPEN; mce_log(LL_DEVEL, "SW_LID initial state = %s", cover_state_repr(state)); - execute_datapipe(&lid_cover_sensor_pipe, GINT_TO_POINTER(state), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&lid_sensor_actual_pipe, GINT_TO_POINTER(state), + USE_INDATA, CACHE_INDATA); } /* Need to consider more than one switch state when setting the - * initial value of the jack_sense_pipe */ + * initial value of the jack_sense_state_pipe */ bool have = false; int value = 0; @@ -2559,8 +2577,8 @@ evin_iomon_switch_states_update_iter_cb(gpointer io_monitor, gpointer user_data) if( have ) { state = value ? COVER_CLOSED : COVER_OPEN; - execute_datapipe(&jack_sense_pipe, GINT_TO_POINTER(state), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&jack_sense_state_pipe, GINT_TO_POINTER(state), + USE_INDATA, CACHE_INDATA); } EXIT: @@ -2675,9 +2693,9 @@ evin_iomon_keyboard_state_update(void) cover_state_t state = available ? COVER_OPEN : COVER_CLOSED; - execute_datapipe(&keyboard_available_pipe, - GINT_TO_POINTER(state), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&keyboard_available_state_pipe, + GINT_TO_POINTER(state), + USE_INDATA, CACHE_INDATA); } /** Scan /dev/input for input event devices @@ -2908,9 +2926,9 @@ evin_touchstate_update_cb(gpointer aptr) goto EXIT; mce_log(LL_DEBUG, "touch_detected=%s", touching ? "true" : "false"); - execute_datapipe(&touch_detected_pipe, - GINT_TO_POINTER(touching), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&touch_detected_pipe, + GINT_TO_POINTER(touching), + USE_INDATA, CACHE_INDATA); EXIT: return FALSE; @@ -3200,11 +3218,11 @@ static guint evin_ts_grab_release_delay_setting_id = 0; static void evin_ts_grab_set_led_raw(bool enabled) { - execute_datapipe_output_triggers(enabled ? - &led_pattern_activate_pipe : - &led_pattern_deactivate_pipe, - MCE_LED_PATTERN_TOUCH_INPUT_BLOCKED, - USE_INDATA); + datapipe_exec_output_triggers(enabled ? + &led_pattern_activate_pipe : + &led_pattern_deactivate_pipe, + MCE_LED_PATTERN_TOUCH_INPUT_BLOCKED, + USE_INDATA); } /** Handle delayed input grab led pattern activation @@ -3261,7 +3279,7 @@ evin_ts_grab_rethink_led(void) { bool enable = false; - switch( datapipe_get_gint(display_state_pipe) ) + switch( datapipe_get_gint(display_state_curr_pipe) ) { case MCE_DISPLAY_ON: case MCE_DISPLAY_DIM: @@ -3292,9 +3310,9 @@ evin_ts_grab_set_active(gboolean grab) GINT_TO_POINTER(grab)); // STATE MACHINE -> OUTPUT DATAPIPE - execute_datapipe(&touch_grab_active_pipe, - GINT_TO_POINTER(grab), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&touch_grab_active_pipe, + GINT_TO_POINTER(grab), + USE_INDATA, CACHE_INDATA); EXIT: return; @@ -3437,19 +3455,19 @@ evin_ts_grab_touch_detected_cb(gconstpointer data) * @param data Display state as void pointer */ static void -evin_ts_grab_display_state_cb(gconstpointer data) +evin_ts_grab_display_state_curr_cb(gconstpointer data) { - static display_state_t display_state = MCE_DISPLAY_UNDEF; + static display_state_t display_state_curr = MCE_DISPLAY_UNDEF; - display_state_t prev = display_state; - display_state = GPOINTER_TO_INT(data); + display_state_t prev = display_state_curr; + display_state_curr = GPOINTER_TO_INT(data); - if( display_state == prev ) + if( display_state_curr == prev ) goto EXIT; - mce_log(LL_DEBUG, "display_state=%s", display_state_repr(display_state)); + mce_log(LL_DEBUG, "display_state_curr=%s", display_state_repr(display_state_curr)); - switch( display_state ) { + switch( display_state_curr ) { case MCE_DISPLAY_POWER_DOWN: case MCE_DISPLAY_OFF: case MCE_DISPLAY_LPM_ON: @@ -3547,9 +3565,9 @@ evin_kp_grab_set_active(gboolean grab) GINT_TO_POINTER(grab)); // STATE MACHINE -> OUTPUT DATAPIPE - execute_datapipe(&keypad_grab_active_pipe, - GINT_TO_POINTER(grab), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&keypad_grab_active_pipe, + GINT_TO_POINTER(grab), + USE_INDATA, CACHE_INDATA); EXIT: return; @@ -3913,16 +3931,16 @@ mce_input_init(void) #endif /* Append triggers/filters to datapipes */ - append_output_trigger_to_datapipe(&submode_pipe, - evin_gpio_submode_trigger); - append_output_trigger_to_datapipe(&display_state_pipe, - evin_ts_grab_display_state_cb); - append_output_trigger_to_datapipe(&touch_detected_pipe, - evin_ts_grab_touch_detected_cb); - append_output_trigger_to_datapipe(&touch_grab_wanted_pipe, - evin_ts_grab_wanted_cb); - append_output_trigger_to_datapipe(&keypad_grab_wanted_pipe, - evin_kp_grab_wanted_cb); + datapipe_add_output_trigger(&submode_pipe, + evin_gpio_submode_trigger); + datapipe_add_output_trigger(&display_state_curr_pipe, + evin_ts_grab_display_state_curr_cb); + datapipe_add_output_trigger(&touch_detected_pipe, + evin_ts_grab_touch_detected_cb); + datapipe_add_output_trigger(&touch_grab_wanted_pipe, + evin_ts_grab_wanted_cb); + datapipe_add_output_trigger(&keypad_grab_wanted_pipe, + evin_kp_grab_wanted_cb); /* Register input device directory monitor */ if( !evin_devdir_monitor_init() ) @@ -3952,16 +3970,16 @@ mce_input_exit(void) #endif /* Remove triggers/filters from datapipes */ - remove_output_trigger_from_datapipe(&submode_pipe, - evin_gpio_submode_trigger); - remove_output_trigger_from_datapipe(&display_state_pipe, - evin_ts_grab_display_state_cb); - remove_output_trigger_from_datapipe(&touch_detected_pipe, - evin_ts_grab_touch_detected_cb); - remove_output_trigger_from_datapipe(&touch_grab_wanted_pipe, - evin_ts_grab_wanted_cb); - remove_output_trigger_from_datapipe(&keypad_grab_wanted_pipe, - evin_kp_grab_wanted_cb); + datapipe_remove_output_trigger(&submode_pipe, + evin_gpio_submode_trigger); + datapipe_remove_output_trigger(&display_state_curr_pipe, + evin_ts_grab_display_state_curr_cb); + datapipe_remove_output_trigger(&touch_detected_pipe, + evin_ts_grab_touch_detected_cb); + datapipe_remove_output_trigger(&touch_grab_wanted_pipe, + evin_ts_grab_wanted_cb); + datapipe_remove_output_trigger(&keypad_grab_wanted_pipe, + evin_kp_grab_wanted_cb); /* Remove input device directory monitor */ evin_devdir_monitor_quit(); diff --git a/event-switches.c b/event-switches.c index 0dbc9c22..a49c7a47 100644 --- a/event-switches.c +++ b/event-switches.c @@ -46,7 +46,7 @@ static gboolean cam_focus_disable_exists = FALSE; static gconstpointer cam_launch_iomon_id = NULL; /** ID for the lid cover I/O monitor */ -static gconstpointer lid_cover_iomon_id = NULL; +static gconstpointer lid_sensor_actual_iomon_id = NULL; /** ID for the proximity sensor I/O monitor */ static gconstpointer proximity_sensor_iomon_id = NULL; @@ -92,8 +92,8 @@ static gboolean generic_activity_iomon_cb(mce_io_mon_t *iomon, gpointer data, gs (void)bytes_read; /* Generate activity */ - execute_datapipe(&device_inactive_event_pipe, GINT_TO_POINTER(FALSE), - USE_INDATA, CACHE_OUTDATA); + datapipe_exec_full(&inactivity_event_pipe, GINT_TO_POINTER(FALSE), + USE_INDATA, CACHE_OUTDATA); return FALSE; } @@ -120,13 +120,13 @@ static gboolean camera_launch_button_iomon_cb(mce_io_mon_t *iomon, gpointer data } /* Generate activity */ - execute_datapipe(&device_inactive_event_pipe, GINT_TO_POINTER(FALSE), - USE_INDATA, CACHE_OUTDATA); + datapipe_exec_full(&inactivity_event_pipe, GINT_TO_POINTER(FALSE), + USE_INDATA, CACHE_OUTDATA); /* Update camera button state */ - (void)execute_datapipe(&camera_button_pipe, - GINT_TO_POINTER(camera_button_state), - USE_INDATA, CACHE_INDATA); + (void)datapipe_exec_full(&camera_button_state_pipe, + GINT_TO_POINTER(camera_button_state), + USE_INDATA, CACHE_INDATA); return FALSE; } @@ -140,21 +140,19 @@ static gboolean camera_launch_button_iomon_cb(mce_io_mon_t *iomon, gpointer data */ static gboolean lockkey_iomon_cb(mce_io_mon_t *iomon, gpointer data, gsize bytes_read) { - gint lockkey_state; + key_state_t lockkey_state = KEY_STATE_RELEASED; (void)iomon; (void)bytes_read; if (!strncmp(data, MCE_FLICKER_KEY_ACTIVE, strlen(MCE_FLICKER_KEY_ACTIVE))) { - lockkey_state = 1; - } else { - lockkey_state = 0; + lockkey_state = KEY_STATE_PRESSED; } - (void)execute_datapipe(&lockkey_pipe, - GINT_TO_POINTER(lockkey_state), - USE_INDATA, CACHE_INDATA); + (void)datapipe_exec_full(&lockkey_state_pipe, + GINT_TO_POINTER(lockkey_state), + USE_INDATA, CACHE_INDATA); return FALSE; } @@ -177,16 +175,16 @@ static gboolean kbd_slide_iomon_cb(mce_io_mon_t *iomon, gpointer data, gsize byt slide_state = COVER_OPEN; /* Generate activity */ - execute_datapipe(&device_inactive_event_pipe, - GINT_TO_POINTER(FALSE), - USE_INDATA, CACHE_OUTDATA); + datapipe_exec_full(&inactivity_event_pipe, + GINT_TO_POINTER(FALSE), + USE_INDATA, CACHE_OUTDATA); } else { slide_state = COVER_CLOSED; } - (void)execute_datapipe(&keyboard_slide_pipe, - GINT_TO_POINTER(slide_state), - USE_INDATA, CACHE_INDATA); + (void)datapipe_exec_full(&keyboard_slide_state_pipe, + GINT_TO_POINTER(slide_state), + USE_INDATA, CACHE_INDATA); return FALSE; } @@ -198,27 +196,27 @@ static gboolean kbd_slide_iomon_cb(mce_io_mon_t *iomon, gpointer data, gsize byt * @param bytes_read Unused * @return Always returns FALSE to return remaining data (if any) */ -static gboolean lid_cover_iomon_cb(mce_io_mon_t *iomon, gpointer data, gsize bytes_read) +static gboolean lid_sensor_actual_iomon_cb(mce_io_mon_t *iomon, gpointer data, gsize bytes_read) { - cover_state_t lid_cover_state; + cover_state_t lid_state; (void)iomon; (void)bytes_read; if (!strncmp(data, MCE_LID_COVER_OPEN, strlen(MCE_LID_COVER_OPEN))) { - lid_cover_state = COVER_OPEN; + lid_state = COVER_OPEN; /* Generate activity */ - execute_datapipe(&device_inactive_event_pipe, - GINT_TO_POINTER(FALSE), - USE_INDATA, CACHE_OUTDATA); + datapipe_exec_full(&inactivity_event_pipe, + GINT_TO_POINTER(FALSE), + USE_INDATA, CACHE_OUTDATA); } else { - lid_cover_state = COVER_CLOSED; + lid_state = COVER_CLOSED; } - (void)execute_datapipe(&lid_cover_sensor_pipe, - GINT_TO_POINTER(lid_cover_state), - USE_INDATA, CACHE_INDATA); + (void)datapipe_exec_full(&lid_sensor_actual_pipe, + GINT_TO_POINTER(lid_state), + USE_INDATA, CACHE_INDATA); return FALSE; } @@ -232,21 +230,21 @@ static gboolean lid_cover_iomon_cb(mce_io_mon_t *iomon, gpointer data, gsize byt */ static gboolean proximity_sensor_iomon_cb(mce_io_mon_t *iomon, gpointer data, gsize bytes_read) { - cover_state_t proximity_sensor_state; + cover_state_t proximity_sensor_actual; (void)iomon; (void)bytes_read; if (!strncmp(data, MCE_PROXIMITY_SENSOR_OPEN, strlen(MCE_PROXIMITY_SENSOR_OPEN))) { - proximity_sensor_state = COVER_OPEN; + proximity_sensor_actual = COVER_OPEN; } else { - proximity_sensor_state = COVER_CLOSED; + proximity_sensor_actual = COVER_CLOSED; } - (void)execute_datapipe(&proximity_sensor_pipe, - GINT_TO_POINTER(proximity_sensor_state), - USE_INDATA, CACHE_INDATA); + (void)datapipe_exec_full(&proximity_sensor_actual_pipe, + GINT_TO_POINTER(proximity_sensor_actual), + USE_INDATA, CACHE_INDATA); return FALSE; } @@ -273,12 +271,12 @@ static gboolean usb_cable_iomon_cb(mce_io_mon_t *iomon, gpointer data, gsize byt } /* Generate activity */ - execute_datapipe(&device_inactive_event_pipe, GINT_TO_POINTER(FALSE), - USE_INDATA, CACHE_OUTDATA); + datapipe_exec_full(&inactivity_event_pipe, GINT_TO_POINTER(FALSE), + USE_INDATA, CACHE_OUTDATA); - (void)execute_datapipe(&usb_cable_pipe, - GINT_TO_POINTER(cable_state), - USE_INDATA, CACHE_INDATA); + (void)datapipe_exec_full(&usb_cable_state_pipe, + GINT_TO_POINTER(cable_state), + USE_INDATA, CACHE_INDATA); return FALSE; } @@ -301,16 +299,16 @@ static gboolean lens_cover_iomon_cb(mce_io_mon_t *iomon, gpointer data, gsize by lens_cover_state = COVER_OPEN; /* Generate activity */ - execute_datapipe(&device_inactive_event_pipe, - GINT_TO_POINTER(FALSE), - USE_INDATA, CACHE_OUTDATA); + datapipe_exec_full(&inactivity_event_pipe, + GINT_TO_POINTER(FALSE), + USE_INDATA, CACHE_OUTDATA); } else { lens_cover_state = COVER_CLOSED; } - (void)execute_datapipe(&lens_cover_pipe, - GINT_TO_POINTER(lens_cover_state), - USE_INDATA, CACHE_INDATA); + (void)datapipe_exec_full(&lens_cover_state_pipe, + GINT_TO_POINTER(lens_cover_state), + USE_INDATA, CACHE_INDATA); return FALSE; } @@ -321,9 +319,9 @@ static gboolean lens_cover_iomon_cb(mce_io_mon_t *iomon, gpointer data, gsize by * @note Only gives reasonable readings when the proximity sensor is enabled * @return TRUE on success, FALSE on failure */ -static gboolean update_proximity_sensor_state(void) +static gboolean update_proximity_sensor(void) { - cover_state_t proximity_sensor_state; + cover_state_t proximity_sensor_actual; gboolean status = FALSE; gchar *tmp = NULL; @@ -334,14 +332,14 @@ static gboolean update_proximity_sensor_state(void) if (!strncmp(tmp, MCE_PROXIMITY_SENSOR_OPEN, strlen(MCE_PROXIMITY_SENSOR_OPEN))) { - proximity_sensor_state = COVER_OPEN; + proximity_sensor_actual = COVER_OPEN; } else { - proximity_sensor_state = COVER_CLOSED; + proximity_sensor_actual = COVER_CLOSED; } - (void)execute_datapipe(&proximity_sensor_pipe, - GINT_TO_POINTER(proximity_sensor_state), - USE_INDATA, CACHE_INDATA); + (void)datapipe_exec_full(&proximity_sensor_actual_pipe, + GINT_TO_POINTER(proximity_sensor_actual), + USE_INDATA, CACHE_INDATA); g_free(tmp); @@ -362,7 +360,7 @@ static void update_proximity_monitor(void) (alarm_ui_state == MCE_ALARM_UI_VISIBLE_INT32) || (alarm_ui_state == MCE_ALARM_UI_RINGING_INT32)) { mce_write_string_to_file(MCE_PROXIMITY_SENSOR_DISABLE_PATH, "0"); - (void)update_proximity_sensor_state(); + (void)update_proximity_sensor(); } else { mce_write_string_to_file(MCE_PROXIMITY_SENSOR_DISABLE_PATH, "1"); } @@ -402,20 +400,20 @@ static void alarm_ui_state_trigger(gconstpointer const data) */ static void submode_trigger(gconstpointer data) { - static submode_t old_submode = MCE_NORMAL_SUBMODE; + static submode_t old_submode = MCE_SUBMODE_NORMAL; submode_t submode = GPOINTER_TO_INT(data); /* If the tklock is enabled, disable the camera focus interrupts, * since we don't use them anyway */ - if ((submode & MCE_TKLOCK_SUBMODE) != 0) { - if ((old_submode & MCE_TKLOCK_SUBMODE) == 0) { + if ((submode & MCE_SUBMODE_TKLOCK) != 0) { + if ((old_submode & MCE_SUBMODE_TKLOCK) == 0) { if ((cam_focus_disable_exists == TRUE) && (cam_focus_iomon_id != NULL)) mce_write_string_to_file(MCE_CAM_FOCUS_DISABLE_PATH, "1"); } } else { - if ((old_submode & MCE_TKLOCK_SUBMODE) != 0) { + if ((old_submode & MCE_SUBMODE_TKLOCK) != 0) { if (cam_focus_disable_exists == TRUE) mce_write_string_to_file(MCE_CAM_FOCUS_DISABLE_PATH, "0"); } @@ -475,12 +473,12 @@ gboolean mce_switches_init(void) gboolean status = FALSE; /* 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(&submode_pipe, - submode_trigger); + datapipe_add_input_trigger(&call_state_pipe, + call_state_trigger); + datapipe_add_input_trigger(&alarm_ui_state_pipe, + alarm_ui_state_trigger); + datapipe_add_output_trigger(&submode_pipe, + submode_trigger); /* Register I/O monitors */ lockkey_iomon_id = @@ -499,9 +497,9 @@ gboolean mce_switches_init(void) mce_switches_add_iomon(MCE_CAM_LAUNCH_STATE_PATH, camera_launch_button_iomon_cb); - lid_cover_iomon_id = + lid_sensor_actual_iomon_id = mce_switches_add_iomon(MCE_LID_COVER_STATE_PATH, - lid_cover_iomon_cb); + lid_sensor_actual_iomon_cb); proximity_sensor_iomon_id = mce_switches_add_iomon(MCE_PROXIMITY_SENSOR_STATE_PATH, @@ -551,12 +549,12 @@ gboolean mce_switches_init(void) void mce_switches_exit(void) { /* Remove triggers/filters from datapipes */ - remove_output_trigger_from_datapipe(&submode_pipe, - submode_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); + datapipe_remove_output_trigger(&submode_pipe, + submode_trigger); + datapipe_remove_input_trigger(&alarm_ui_state_pipe, + alarm_ui_state_trigger); + datapipe_remove_input_trigger(&call_state_pipe, + call_state_trigger); /* Unregister I/O monitors */ mce_switches_rem_iomon_all(); diff --git a/homekey.dot b/homekey.dot index aa34ca7a..0959e333 100644 --- a/homekey.dot +++ b/homekey.dot @@ -30,7 +30,7 @@ digraph home_key_state_machine { WAIT_PRESS -> WAIT_UNBLANK [label=" pressed==true\l"]; WAIT_UNBLANK -> WAIT_RELEASE [label=" display_state_next!=on\l"]; - WAIT_UNBLANK -> SEND_SIGNAL [label=" display_state==on\l"]; + WAIT_UNBLANK -> SEND_SIGNAL [label=" display_state_curr==on\l"]; SEND_SIGNAL -> WAIT_RELEASE [label=" (always)\l"]; WAIT_RELEASE -> WAIT_PRESS [label=" pressed==false\l"]; } diff --git a/mce-common.c b/mce-common.c index 9e7cb8a3..6bc442e9 100644 --- a/mce-common.c +++ b/mce-common.c @@ -587,7 +587,7 @@ static datapipe_handler_t common_datapipe_handlers[] = { // output triggers { - .datapipe = &usb_cable_pipe, + .datapipe = &usb_cable_state_pipe, .output_cb = common_datapipe_usb_cable_state_cb, }, { diff --git a/mce-dbus.c b/mce-dbus.c index d394bc0b..0035e97a 100644 --- a/mce-dbus.c +++ b/mce-dbus.c @@ -1020,9 +1020,9 @@ peerinfo_enter_state(peerinfo_t *self) case PEERSTATE_RUNNING: if( self->pi_datapipe ) { - execute_datapipe(self->pi_datapipe, - GINT_TO_POINTER(SERVICE_STATE_RUNNING), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(self->pi_datapipe, + GINT_TO_POINTER(SERVICE_STATE_RUNNING), + USE_INDATA, CACHE_INDATA); } peerinfo_handle_methods(self); break; @@ -1076,9 +1076,9 @@ peerinfo_leave_state(peerinfo_t *self) case PEERSTATE_RUNNING: if( self->pi_datapipe ) { - execute_datapipe(self->pi_datapipe, - GINT_TO_POINTER(SERVICE_STATE_STOPPED), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(self->pi_datapipe, + GINT_TO_POINTER(SERVICE_STATE_STOPPED), + USE_INDATA, CACHE_INDATA); } break; @@ -1360,9 +1360,9 @@ peerinfo_set_datapipe(peerinfo_t *self, datapipe_struct *datapipe) if( (self->pi_datapipe = datapipe) ) { if( peerinfo_get_state(self) == PEERSTATE_RUNNING ) { - execute_datapipe(self->pi_datapipe, - GINT_TO_POINTER(SERVICE_STATE_RUNNING), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(self->pi_datapipe, + GINT_TO_POINTER(SERVICE_STATE_RUNNING), + USE_INDATA, CACHE_INDATA); } } } @@ -1774,33 +1774,33 @@ static struct { { .name = DSME_DBUS_SERVICE, - .datapipe = &dsme_available_pipe, + .datapipe = &dsme_service_state_pipe, }, { .name = "org.bluez", - .datapipe = &bluez_available_pipe, + .datapipe = &bluez_service_state_pipe, }, { .name = COMPOSITOR_SERVICE, - .datapipe = &compositor_available_pipe, + .datapipe = &compositor_service_state_pipe, }, { /* Note: due to lipstick==compositor assumption lipstick * service name must be probed after compositor */ .name = LIPSTICK_SERVICE, - .datapipe = &lipstick_available_pipe, + .datapipe = &lipstick_service_state_pipe, }, { .name = DEVICELOCK_SERVICE, - .datapipe = &devicelock_available_pipe, + .datapipe = &devicelock_service_state_pipe, }, { .name = USB_MODED_DBUS_SERVICE, - .datapipe = &usbmoded_available_pipe, + .datapipe = &usbmoded_service_state_pipe, }, { .name = "com.nokia.NonGraphicFeedback1.Backend", - .datapipe = &ngfd_available_pipe, + .datapipe = &ngfd_service_state_pipe, }, { .name = 0, diff --git a/mce-dsme.c b/mce-dsme.c index ef76b1b1..c51cc5ee 100644 --- a/mce-dsme.c +++ b/mce-dsme.c @@ -54,11 +54,11 @@ static guint mce_dsme_socket_recv_id = 0; /** ID for delayed state transition reporting timer */ static guint mce_dsme_transition_id = 0; -/** Availability of dsme; from dsme_available_pipe */ -static service_state_t dsme_available = SERVICE_STATE_UNDEF; +/** Availability of dsme; from dsme_service_state_pipe */ +static service_state_t dsme_service_state = SERVICE_STATE_UNDEF; /** System state from dsme; fed to system_state_pipe */ -static system_state_t system_state = MCE_STATE_UNDEF; +static system_state_t system_state = MCE_SYSTEM_STATE_UNDEF; /** Shutdown warning from dsme; fed to shutting_down_pipe */ static bool mce_dsme_shutting_down_flag = false; @@ -140,7 +140,7 @@ static void mce_dsme_dbus_quit(void); * DATAPIPE_TRACKING * ------------------------------------------------------------------------- */ -static void mce_dsme_datapipe_dsme_available_cb (gconstpointer data); +static void mce_dsme_datapipe_dsme_service_state_cb (gconstpointer data); static void mce_dsme_datapipe_system_state_cb (gconstpointer data); static void mce_dsme_datapipe_init(void); @@ -213,27 +213,27 @@ static const char *mce_dsme_msg_type_repr(int type) */ static system_state_t mce_dsme_normalise_system_state(dsme_state_t dsmestate) { - system_state_t state = MCE_STATE_UNDEF; + system_state_t state = MCE_SYSTEM_STATE_UNDEF; switch (dsmestate) { case DSME_STATE_SHUTDOWN: - state = MCE_STATE_SHUTDOWN; + state = MCE_SYSTEM_STATE_SHUTDOWN; break; case DSME_STATE_USER: - state = MCE_STATE_USER; + state = MCE_SYSTEM_STATE_USER; break; case DSME_STATE_ACTDEAD: - state = MCE_STATE_ACTDEAD; + state = MCE_SYSTEM_STATE_ACTDEAD; break; case DSME_STATE_REBOOT: - state = MCE_STATE_REBOOT; + state = MCE_SYSTEM_STATE_REBOOT; break; case DSME_STATE_BOOT: - state = MCE_STATE_BOOT; + state = MCE_SYSTEM_STATE_BOOT; break; case DSME_STATE_NOT_SET: @@ -375,8 +375,8 @@ static void mce_dsme_processwd_pong(void) mce_dsme_worker_ping(); /* Execute hearbeat actions even if ping-pong ipc failed */ - execute_datapipe(&heartbeat_pipe, GINT_TO_POINTER(0), - USE_INDATA, DONT_CACHE_INDATA); + datapipe_exec_full(&heartbeat_event_pipe, GINT_TO_POINTER(0), + USE_INDATA, DONT_CACHE_INDATA); } /** @@ -439,7 +439,7 @@ void mce_dsme_request_powerup(void) */ void mce_dsme_request_reboot(void) { - if( datapipe_get_gint(update_mode_pipe) ) { + if( datapipe_get_gint(osupdate_running_pipe) ) { mce_log(LL_WARN, "reboot blocked; os update in progress"); goto EXIT; } @@ -457,7 +457,7 @@ void mce_dsme_request_reboot(void) */ void mce_dsme_request_normal_shutdown(void) { - if( datapipe_get_gint(update_mode_pipe) ) { + if( datapipe_get_gint(osupdate_running_pipe) ) { mce_log(LL_WARN, "shutdown blocked; os update in progress"); goto EXIT; } @@ -487,7 +487,7 @@ static gboolean mce_dsme_transition_cb(gpointer data) mce_dsme_transition_id = 0; - mce_rem_submode_int32(MCE_TRANSITION_SUBMODE); + mce_rem_submode_int32(MCE_SUBMODE_TRANSITION); return FALSE; } @@ -510,7 +510,7 @@ static void mce_dsme_transition_schedule(void) mce_dsme_transition_cancel(); /* Check if we have transition to end */ - if( !(mce_get_submode_int32() & MCE_TRANSITION_SUBMODE) ) + if( !(mce_get_submode_int32() & MCE_SUBMODE_TRANSITION) ) goto EXIT; #if TRANSITION_DELAY > 0 @@ -561,9 +561,9 @@ static void mce_dsme_set_shutting_down(bool shutting_down) if( !mce_dsme_shutting_down_flag ) mce_dsme_socket_connect(); - execute_datapipe(&shutting_down_pipe, - GINT_TO_POINTER(mce_dsme_shutting_down_flag), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&shutting_down_pipe, + GINT_TO_POINTER(mce_dsme_shutting_down_flag), + USE_INDATA, CACHE_INDATA); EXIT: return; @@ -641,9 +641,9 @@ static gboolean mce_dsme_socket_recv_cb(GIOChannel *source, } else if( (msg2 = DSMEMSG_CAST(DSM_MSGTYPE_STATE_CHANGE_IND, msg)) ) { system_state_t state = mce_dsme_normalise_system_state(msg2->state); - execute_datapipe(&system_state_pipe, - GINT_TO_POINTER(state), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&system_state_pipe, + GINT_TO_POINTER(state), + USE_INDATA, CACHE_INDATA); } else { mce_log(LL_DEBUG, "Unhandled message type %s (0x%x) received from DSME", @@ -692,7 +692,7 @@ static bool mce_dsme_socket_connect(void) goto EXIT; /* No new connections unless dsme dbus service is up */ - if( dsme_available != SERVICE_STATE_RUNNING ) + if( dsme_service_state != SERVICE_STATE_RUNNING ) goto EXIT; /* Already connected ? */ @@ -885,20 +885,20 @@ static void mce_dsme_dbus_quit(void) * * @param data DSME D-Bus service availability (as a void pointer) */ -static void mce_dsme_datapipe_dsme_available_cb(gconstpointer const data) +static void mce_dsme_datapipe_dsme_service_state_cb(gconstpointer const data) { - service_state_t prev = dsme_available; - dsme_available = GPOINTER_TO_INT(data); + service_state_t prev = dsme_service_state; + dsme_service_state = GPOINTER_TO_INT(data); - if( dsme_available == prev ) + if( dsme_service_state == prev ) goto EXIT; mce_log(LL_DEVEL, "DSME dbus service: %s -> %s", service_state_repr(prev), - service_state_repr(dsme_available)); + service_state_repr(dsme_service_state)); /* Re-evaluate dsmesock connection */ - if( dsme_available == SERVICE_STATE_RUNNING ) + if( dsme_service_state == SERVICE_STATE_RUNNING ) mce_dsme_socket_connect(); EXIT: @@ -924,23 +924,23 @@ static void mce_dsme_datapipe_system_state_cb(gconstpointer data) system_state_repr(prev), system_state_repr(system_state)); - /* Set transition submode unless coming from MCE_STATE_UNDEF */ - if( prev != MCE_STATE_UNDEF ) - mce_add_submode_int32(MCE_TRANSITION_SUBMODE); + /* Set transition submode unless coming from MCE_SYSTEM_STATE_UNDEF */ + if( prev != MCE_SYSTEM_STATE_UNDEF ) + mce_add_submode_int32(MCE_SUBMODE_TRANSITION); /* Handle LED patterns */ switch( system_state ) { - case MCE_STATE_USER: - execute_datapipe_output_triggers(&led_pattern_activate_pipe, - MCE_LED_PATTERN_DEVICE_ON, - USE_INDATA); + case MCE_SYSTEM_STATE_USER: + datapipe_exec_output_triggers(&led_pattern_activate_pipe, + MCE_LED_PATTERN_DEVICE_ON, + USE_INDATA); break; - case MCE_STATE_SHUTDOWN: - case MCE_STATE_REBOOT: - execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, - MCE_LED_PATTERN_DEVICE_ON, - USE_INDATA); + case MCE_SYSTEM_STATE_SHUTDOWN: + case MCE_SYSTEM_STATE_REBOOT: + datapipe_exec_output_triggers(&led_pattern_deactivate_pipe, + MCE_LED_PATTERN_DEVICE_ON, + USE_INDATA); break; default: @@ -949,15 +949,15 @@ static void mce_dsme_datapipe_system_state_cb(gconstpointer data) /* Handle shutdown flag */ switch( system_state ) { - case MCE_STATE_ACTDEAD: - case MCE_STATE_USER: + case MCE_SYSTEM_STATE_ACTDEAD: + case MCE_SYSTEM_STATE_USER: /* Re-entry to actdead/user also means shutdown * has been cancelled */ mce_dsme_set_shutting_down(false); break; - case MCE_STATE_SHUTDOWN: - case MCE_STATE_REBOOT: + case MCE_SYSTEM_STATE_SHUTDOWN: + case MCE_SYSTEM_STATE_REBOOT: mce_dsme_set_shutting_down(true); break; @@ -979,8 +979,8 @@ static datapipe_handler_t mce_dsme_datapipe_handlers[] = }, // output triggers { - .datapipe = &dsme_available_pipe, - .output_cb = mce_dsme_datapipe_dsme_available_cb, + .datapipe = &dsme_service_state_pipe, + .output_cb = mce_dsme_datapipe_dsme_service_state_cb, }, // sentinel { diff --git a/mce-dsme.h b/mce-dsme.h index 51909b6a..cad76739 100644 --- a/mce-dsme.h +++ b/mce-dsme.h @@ -23,7 +23,7 @@ #include -/** How long to delay removal of MCE_TRANSITION_SUBMODE after +/** How long to delay removal of MCE_SUBMODE_TRANSITION after * receiving system state change from dsme * * <0 -> immediately diff --git a/mce-hbtimer.c b/mce-hbtimer.c index a37c78a0..5dba7c2b 100644 --- a/mce-hbtimer.c +++ b/mce-hbtimer.c @@ -174,14 +174,14 @@ static void mht_connection_close (void); * DATAPIPE_HANDLERS * ------------------------------------------------------------------------- */ -/** Availability of dsme; from dsme_available_pipe */ -static service_state_t dsme_available = SERVICE_STATE_UNDEF; +/** Availability of dsme; from dsme_service_state_pipe */ +static service_state_t dsme_service_state = SERVICE_STATE_UNDEF; /** Device is shutting down; assume false */ static bool shutting_down = false; -static void mht_datapipe_dsme_available_cb (gconstpointer data); -static void mht_datapipe_device_resumed_cb (gconstpointer data); +static void mht_datapipe_dsme_service_state_cb (gconstpointer data); +static void mht_datapipe_resume_detected_event_cb (gconstpointer data); static void mht_datapipe_shutting_down_cb (gconstpointer data); static void mht_datapipe_init(void); @@ -955,7 +955,7 @@ mht_connection_close(void) * ========================================================================= */ /** Resumed from suspend notification */ -static void mht_datapipe_device_resumed_cb(gconstpointer data) +static void mht_datapipe_resume_detected_event_cb(gconstpointer data) { (void) data; @@ -966,19 +966,19 @@ static void mht_datapipe_device_resumed_cb(gconstpointer data) /** Datapipe trigger for dsme availability */ -static void mht_datapipe_dsme_available_cb(gconstpointer const data) +static void mht_datapipe_dsme_service_state_cb(gconstpointer const data) { - service_state_t prev = dsme_available; - dsme_available = GPOINTER_TO_INT(data); + service_state_t prev = dsme_service_state; + dsme_service_state = GPOINTER_TO_INT(data); - if( dsme_available == prev ) + if( dsme_service_state == prev ) goto EXIT; mce_log(LL_DEBUG, "DSME dbus service: %s -> %s", service_state_repr(prev), - service_state_repr(dsme_available)); + service_state_repr(dsme_service_state)); - if( dsme_available == SERVICE_STATE_RUNNING ) + if( dsme_service_state == SERVICE_STATE_RUNNING ) mht_connection_open(); else mht_connection_close(); @@ -997,7 +997,8 @@ static void mht_datapipe_shutting_down_cb(gconstpointer data) if( shutting_down == prev ) goto EXIT; - mce_log(LL_DEBUG, "shutting_down = %d -> %d", prev, shutting_down); + mce_log(LL_DEBUG, "shutting_down = %d -> %d", + prev, shutting_down); /* Loss of iphb connection is expected during shutdown */ @@ -1010,15 +1011,15 @@ static datapipe_handler_t mht_datapipe_handlers[] = { // output triggers { - .datapipe = &device_resumed_pipe, - .output_cb = mht_datapipe_device_resumed_cb, + .datapipe = &resume_detected_event_pipe, + .output_cb = mht_datapipe_resume_detected_event_cb, }, { - .datapipe = &dsme_available_pipe, - .output_cb = mht_datapipe_dsme_available_cb, + .datapipe = &dsme_service_state_pipe, + .output_cb = mht_datapipe_dsme_service_state_cb, }, { - .datapipe = &shutting_down_pipe, + .datapipe = &shutting_down_pipe, .output_cb = mht_datapipe_shutting_down_cb, }, diff --git a/mce-io.c b/mce-io.c index e800f98a..1cc930de 100644 --- a/mce-io.c +++ b/mce-io.c @@ -175,9 +175,9 @@ static void io_detect_resume(void) skip / 1000, skip % 1000); // notify in case some timers need re-evaluating - execute_datapipe_output_triggers(&device_resumed_pipe, - &prev, - USE_INDATA); + datapipe_exec_output_triggers(&resume_detected_event_pipe, + &prev, + USE_INDATA); EXIT: return; diff --git a/mce.h b/mce.h index b113d066..4913ac5b 100644 --- a/mce.h +++ b/mce.h @@ -168,52 +168,42 @@ typedef enum { const char *alarm_state_repr(alarm_ui_state_t state); /** System sub-modes; several of these can be active at once */ -typedef gint submode_t; +typedef enum { + /** Submode invalid */ + MCE_SUBMODE_INVALID = (1 << 31), + /** No submodes enabled */ + MCE_SUBMODE_NORMAL = 0, + /** Touchscreen/Keypad lock enabled */ + MCE_SUBMODE_TKLOCK = (1 << 0), + /** Event eater enabled */ + MCE_SUBMODE_EVEATER = (1 << 1), + /** Bootup in progress */ + MCE_SUBMODE_BOOTUP = (1 << 3), + /** State transition in progress */ + MCE_SUBMODE_TRANSITION = (1 << 4), + /** Touchscreen/Keypad autorelock active */ + MCE_SUBMODE_AUTORELOCK = (1 << 5), + /** Visual Touchscreen/Keypad active */ + MCE_SUBMODE_VISUAL_TKLOCK = (1 << 6), + /** Proximity is used to protect from accidental events */ + MCE_SUBMODE_POCKET = (1 << 7), + /** Touchscreen/Keypad lock is enabled based on proximity state */ + MCE_SUBMODE_PROXIMITY_TKLOCK = (1 << 8), + /** Device is in MALF state */ + MCE_SUBMODE_MALF = (1 << 9), +} submode_t; const char *submode_change_repr(submode_t prev, submode_t curr); const char *submode_repr(submode_t submode); -/** Submode invalid */ -#define MCE_INVALID_SUBMODE (1 << 31) - -/** No submodes enabled */ -#define MCE_NORMAL_SUBMODE 0 - -/** Touchscreen/Keypad lock enabled */ -#define MCE_TKLOCK_SUBMODE (1 << 0) - -/** Event eater enabled */ -#define MCE_EVEATER_SUBMODE (1 << 1) - -/** Bootup in progress */ -#define MCE_BOOTUP_SUBMODE (1 << 3) - -/** State transition in progress */ -#define MCE_TRANSITION_SUBMODE (1 << 4) - -/** Touchscreen/Keypad autorelock active */ -#define MCE_AUTORELOCK_SUBMODE (1 << 5) - -/** Visual Touchscreen/Keypad active */ -#define MCE_VISUAL_TKLOCK_SUBMODE (1 << 6) - -/** Proximity is used to protect from accidental events */ -#define MCE_POCKET_SUBMODE (1 << 7) - -/** Touchscreen/Keypad lock is enabled based on proximity state */ -#define MCE_PROXIMITY_TKLOCK_SUBMODE (1 << 8) - -/** Device is in MALF state */ -#define MCE_MALF_SUBMODE (1 << 9) - /** System state */ typedef enum { - MCE_STATE_UNDEF = -1, /**< System state not set */ - MCE_STATE_SHUTDOWN = 0, /**< System is in shutdown state */ - MCE_STATE_USER = 2, /**< System is in user state */ - MCE_STATE_ACTDEAD = 5, /**< System is in acting dead state */ - MCE_STATE_REBOOT = 6, /**< System is in reboot state */ - MCE_STATE_BOOT = 9 /**< System is in bootup state */ + MCE_SYSTEM_STATE_UNDEF = -1, /**< System state not set */ + MCE_SYSTEM_STATE_SHUTDOWN = 0, /**< System is in shutdown state */ + MCE_SYSTEM_STATE_USER = 2, /**< System is in user state */ + MCE_SYSTEM_STATE_ACTDEAD = 5, /**< System is in acting dead state */ + MCE_SYSTEM_STATE_REBOOT = 6, /**< System is in reboot state */ + MCE_SYSTEM_STATE_BOOT = 9, /**< System is in bootup state */ } system_state_t; const char *system_state_repr(system_state_t state); @@ -241,11 +231,11 @@ call_state_t call_state_from_dbus(const char *name); /** Call type */ typedef enum { /** Invalid call type */ - INVALID_CALL = MCE_INVALID_TRANSLATION, + CALL_TYPE_INVALID = MCE_INVALID_TRANSLATION, /** The call is a normal call */ - NORMAL_CALL = 0, + CALL_TYPE_NORMAL = 0, /** The call is an emergency call */ - EMERGENCY_CALL = 1 + CALL_TYPE_EMERGENCY = 1 } call_type_t; const char *call_type_repr(call_type_t type); @@ -281,26 +271,26 @@ const char *proximity_state_repr(cover_state_t state); /** Lock state */ typedef enum { /** Lock state not set */ - LOCK_UNDEF = -1, + TKLOCK_REQUEST_UNDEF = -1, /** Lock is disabled */ - LOCK_OFF = 0, + TKLOCK_REQUEST_OFF = 0, /** Delayed unlock; write only */ - LOCK_OFF_DELAYED = 1, + TKLOCK_REQUEST_OFF_DELAYED = 1, /** Lock is disabled, but autorelock isn't disabled; write only */ - LOCK_OFF_PROXIMITY = 2, + TKLOCK_REQUEST_OFF_PROXIMITY = 2, /** Lock is enabled */ - LOCK_ON = 3, + TKLOCK_REQUEST_ON = 3, /** Dimmed lock; write only */ - LOCK_ON_DIMMED = 4, + TKLOCK_REQUEST_ON_DIMMED = 4, /** Enable proximity lock (no UI); write only */ - LOCK_ON_PROXIMITY = 5, + TKLOCK_REQUEST_ON_PROXIMITY = 5, /** Toggle lock state; write only */ - LOCK_TOGGLE = 6, + TKLOCK_REQUEST_TOGGLE = 6, /** Delayed lock; write only */ - LOCK_ON_DELAYED = 7 -} lock_state_t; + TKLOCK_REQUEST_ON_DELAYED = 7, +} tklock_request_t; -const char *lock_state_repr(lock_state_t state); +const char *tklock_request_repr(tklock_request_t state); /** Assumed initial battery level */ #define BATTERY_LEVEL_INITIAL 100 @@ -369,16 +359,16 @@ typedef enum { /** Exceptional UI status */ typedef enum { - UIEXC_NONE = 0, - UIEXC_LINGER = 1<<0, - UIEXC_CALL = 1<<1, - UIEXC_ALARM = 1<<2, - UIEXC_NOTIF = 1<<3, - UIEXC_NOANIM = 1<<4, -} uiexctype_t; + UIEXCEPTION_TYPE_NONE = 0, + UIEXCEPTION_TYPE_LINGER = 1<<0, + UIEXCEPTION_TYPE_CALL = 1<<1, + UIEXCEPTION_TYPE_ALARM = 1<<2, + UIEXCEPTION_TYPE_NOTIF = 1<<3, + UIEXCEPTION_TYPE_NOANIM = 1<<4, +} uiexception_type_t; -const char *uiexctype_repr(uiexctype_t state); -const char *uiexctype_to_dbus(uiexctype_t state); +const char *uiexception_type_repr(uiexception_type_t type); +const char *uiexception_type_to_dbus(uiexception_type_t type); /** D-Bus service availability */ typedef enum { @@ -403,6 +393,15 @@ typedef enum const char *orientation_state_repr(orientation_state_t state); +/** Key pressed/realease state */ +typedef enum { + KEY_STATE_UNDEF = -1, + KEY_STATE_RELEASED = 0, + KEY_STATE_PRESSED = 1, +} key_state_t; + +const char *key_state_repr(key_state_t state); + /* XXX: use HAL */ /** Does the device have a flicker key? */ @@ -415,7 +414,7 @@ extern gboolean has_flicker_key; * * Used in case the display module doesn't load for some reason */ -#define DEFAULT_INACTIVITY_TIMEOUT 33 +#define DEFAULT_INACTIVITY_DELAY 33 submode_t mce_get_submode_int32(void); gboolean mce_add_submode_int32(const submode_t submode); @@ -427,14 +426,8 @@ void mce_quit_mainloop(void); void mce_signal_handlers_remove(void); #define display_state_get() ({\ - gint res = GPOINTER_TO_INT(display_state_pipe.cached_data);\ - mce_log(LL_DEBUG, "display_state=%d", res);\ - res;\ -}) - -#define proximity_state_get() ({\ - gint res = GPOINTER_TO_INT(proximity_sensor_pipe.cached_data);\ - mce_log(LL_DEBUG, "proximity_state=%d", res);\ + gint res = GPOINTER_TO_INT(display_state_curr_pipe.cached_data);\ + mce_log(LL_DEBUG, "display_state_curr=%d", res);\ res;\ }) diff --git a/modetransition.c b/modetransition.c index 754dbc4d..496cde45 100644 --- a/modetransition.c +++ b/modetransition.c @@ -49,8 +49,8 @@ static gboolean mce_set_submode_int32(const submode_t submode) mce_log(LL_NOTICE, "submode change: %s", submode_change_repr(old_submode, submode)); - execute_datapipe(&submode_pipe, GINT_TO_POINTER(submode), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&submode_pipe, GINT_TO_POINTER(submode), + USE_INDATA, CACHE_INDATA); EXIT: return TRUE; } @@ -101,24 +101,24 @@ submode_t mce_get_submode_int32(void) */ static void system_state_trigger(gconstpointer data) { - static system_state_t old_system_state = MCE_STATE_UNDEF; + static system_state_t old_system_state = MCE_SYSTEM_STATE_UNDEF; system_state_t system_state = GPOINTER_TO_INT(data); switch (system_state) { - case MCE_STATE_USER: + case MCE_SYSTEM_STATE_USER: break; - case MCE_STATE_SHUTDOWN: - case MCE_STATE_REBOOT: + case MCE_SYSTEM_STATE_SHUTDOWN: + case MCE_SYSTEM_STATE_REBOOT: /* Actions to perform when shutting down/rebooting */ switch( old_system_state ) { - case MCE_STATE_USER: - case MCE_STATE_BOOT: - case MCE_STATE_UNDEF: - case MCE_STATE_ACTDEAD: - execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_DEVICE_ON, USE_INDATA); - execute_datapipe_output_triggers(&led_pattern_activate_pipe, MCE_LED_PATTERN_POWER_OFF, USE_INDATA); + case MCE_SYSTEM_STATE_USER: + case MCE_SYSTEM_STATE_BOOT: + case MCE_SYSTEM_STATE_UNDEF: + case MCE_SYSTEM_STATE_ACTDEAD: + datapipe_exec_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_DEVICE_ON, USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_activate_pipe, MCE_LED_PATTERN_POWER_OFF, USE_INDATA); break; default: @@ -129,8 +129,8 @@ static void system_state_trigger(gconstpointer data) * user mode, ui side will do shutdown animation. * Unblank the screen to make it visible. */ switch( old_system_state ) { - case MCE_STATE_USER: - case MCE_STATE_ACTDEAD: + case MCE_SYSTEM_STATE_USER: + case MCE_SYSTEM_STATE_ACTDEAD: mce_datapipe_req_display_state(MCE_DISPLAY_ON); break; @@ -139,10 +139,10 @@ static void system_state_trigger(gconstpointer data) } break; - case MCE_STATE_ACTDEAD: + case MCE_SYSTEM_STATE_ACTDEAD: break; - case MCE_STATE_UNDEF: + case MCE_SYSTEM_STATE_UNDEF: goto EXIT; default: @@ -169,8 +169,8 @@ gboolean mce_mode_init(void) gboolean status = FALSE; /* Append triggers/filters to datapipes */ - append_output_trigger_to_datapipe(&system_state_pipe, - system_state_trigger); + datapipe_add_output_trigger(&system_state_pipe, + system_state_trigger); /* If the bootup file exists, mce has crashed / restarted; * since it exists in /var/run it will be removed when we reboot. @@ -181,14 +181,14 @@ gboolean mce_mode_init(void) if (g_access(MCE_BOOTUP_FILENAME, F_OK) == -1) { if (errno == ENOENT) { mce_log(LL_DEBUG, "Bootup mode enabled"); - mce_add_submode_int32(MCE_TRANSITION_SUBMODE); + mce_add_submode_int32(MCE_SUBMODE_TRANSITION); errno = 0; (void)mce_write_string_to_file(MCE_BOOTUP_FILENAME, ENABLED_STRING); if (g_access(MALF_FILENAME, F_OK) == 0) { - mce_add_submode_int32(MCE_MALF_SUBMODE); + mce_add_submode_int32(MCE_SUBMODE_MALF); mce_log(LL_DEBUG, "Malf mode enabled"); if (g_access(MCE_MALF_FILENAME, F_OK) == -1) { if (errno != ENOENT) { @@ -211,7 +211,7 @@ gboolean mce_mode_init(void) } else { if (g_access(MALF_FILENAME, F_OK) == 0) { if (g_access(MCE_MALF_FILENAME, F_OK) == 0) { - mce_add_submode_int32(MCE_MALF_SUBMODE); + mce_add_submode_int32(MCE_SUBMODE_MALF); mce_log(LL_DEBUG, "Malf mode enabled"); } } else if ((errno == ENOENT) && @@ -234,8 +234,8 @@ gboolean mce_mode_init(void) void mce_mode_exit(void) { /* Remove triggers/filters from datapipes */ - remove_output_trigger_from_datapipe(&system_state_pipe, - system_state_trigger); + datapipe_remove_output_trigger(&system_state_pipe, + system_state_trigger); return; } diff --git a/modules/alarm.c b/modules/alarm.c index 442ea590..19c8365a 100644 --- a/modules/alarm.c +++ b/modules/alarm.c @@ -104,9 +104,9 @@ static void alarm_sync_state_to_datapipe(alarm_ui_state_t state) goto EXIT; mce_log(LL_DEVEL, "alarm state = %s", alarm_state_repr(state)); - execute_datapipe(&alarm_ui_state_pipe, - GINT_TO_POINTER(state), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&alarm_ui_state_pipe, + GINT_TO_POINTER(state), + USE_INDATA, CACHE_INDATA); EXIT: return; diff --git a/modules/audiorouting.c b/modules/audiorouting.c index 4b814d5b..09246005 100644 --- a/modules/audiorouting.c +++ b/modules/audiorouting.c @@ -534,18 +534,18 @@ static gboolean actions_dbus_cb(DBusMessage *sig) volume_limit_inputsound <= 0); EXIT: - if( datapipe_get_gint(music_playback_pipe) != playback ) { + if( datapipe_get_gint(music_playback_ongoing_pipe) != playback ) { mce_log(LL_DEVEL, "music playback: %d", playback); - execute_datapipe(&music_playback_pipe, - GINT_TO_POINTER(playback), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&music_playback_ongoing_pipe, + GINT_TO_POINTER(playback), + USE_INDATA, CACHE_INDATA); } if( datapipe_get_gint(audio_route_pipe) != audio_route ) { mce_log(LL_DEVEL, "audio route: %d", audio_route); - execute_datapipe(&audio_route_pipe, - GINT_TO_POINTER(audio_route), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&audio_route_pipe, + GINT_TO_POINTER(audio_route), + USE_INDATA, CACHE_INDATA); } return TRUE; diff --git a/modules/battery-bme.c b/modules/battery-bme.c index c16fea83..2a460156 100644 --- a/modules/battery-bme.c +++ b/modules/battery-bme.c @@ -60,12 +60,12 @@ static gboolean battery_full_dbus_cb(DBusMessage *const msg) mce_log(LL_DEBUG, "Received battery full signal"); - execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_CHARGING, USE_INDATA); - execute_datapipe_output_triggers(&led_pattern_activate_pipe, MCE_LED_PATTERN_BATTERY_FULL, USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_CHARGING, USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_activate_pipe, MCE_LED_PATTERN_BATTERY_FULL, USE_INDATA); - execute_datapipe(&battery_status_pipe, - GINT_TO_POINTER(BATTERY_STATUS_FULL), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&battery_status_pipe, + GINT_TO_POINTER(BATTERY_STATUS_FULL), + USE_INDATA, CACHE_INDATA); status = TRUE; @@ -88,11 +88,11 @@ static gboolean battery_ok_dbus_cb(DBusMessage *const msg) mce_log(LL_DEBUG, "Received battery ok signal"); -// execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_LOW, USE_INDATA); +// datapipe_exec_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_LOW, USE_INDATA); - execute_datapipe(&battery_status_pipe, - GINT_TO_POINTER(BATTERY_STATUS_OK), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&battery_status_pipe, + GINT_TO_POINTER(BATTERY_STATUS_OK), + USE_INDATA, CACHE_INDATA); status = TRUE; @@ -115,11 +115,11 @@ static gboolean battery_low_dbus_cb(DBusMessage *const msg) mce_log(LL_DEBUG, "Received battery low signal"); -// execute_datapipe_output_triggers(&led_pattern_activate_pipe, MCE_LED_PATTERN_BATTERY_LOW, USE_INDATA); +// datapipe_exec_output_triggers(&led_pattern_activate_pipe, MCE_LED_PATTERN_BATTERY_LOW, USE_INDATA); - execute_datapipe(&battery_status_pipe, - GINT_TO_POINTER(BATTERY_STATUS_LOW), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&battery_status_pipe, + GINT_TO_POINTER(BATTERY_STATUS_LOW), + USE_INDATA, CACHE_INDATA); status = TRUE; @@ -142,9 +142,9 @@ static gboolean battery_empty_dbus_cb(DBusMessage *const msg) mce_log(LL_DEBUG, "Received battery empty signal"); - execute_datapipe(&battery_status_pipe, - GINT_TO_POINTER(BATTERY_STATUS_EMPTY), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&battery_status_pipe, + GINT_TO_POINTER(BATTERY_STATUS_EMPTY), + USE_INDATA, CACHE_INDATA); status = TRUE; @@ -229,9 +229,9 @@ static gboolean battery_state_changed_dbus_cb(DBusMessage *const msg) "Percentage: %d", percentage); - execute_datapipe(&battery_level_pipe, - GINT_TO_POINTER(percentage), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&battery_level_pipe, + GINT_TO_POINTER(percentage), + USE_INDATA, CACHE_INDATA); status = TRUE; @@ -257,15 +257,15 @@ static gboolean charger_charging_on_dbus_cb(DBusMessage *const msg) /* Only update the charger state if needed */ if (old_charger_state == FALSE) { - execute_datapipe(&charger_state_pipe, GINT_TO_POINTER(TRUE), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&charger_state_pipe, GINT_TO_POINTER(TRUE), + USE_INDATA, CACHE_INDATA); } /* In case these are active; there's no harm to call them anyway */ - execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_FULL, USE_INDATA); -// execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_LOW, USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_FULL, USE_INDATA); +// datapipe_exec_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_LOW, USE_INDATA); - execute_datapipe_output_triggers(&led_pattern_activate_pipe, MCE_LED_PATTERN_BATTERY_CHARGING, USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_activate_pipe, MCE_LED_PATTERN_BATTERY_CHARGING, USE_INDATA); status = TRUE; @@ -291,12 +291,12 @@ static gboolean charger_charging_off_dbus_cb(DBusMessage *const msg) /* Only update the charger state if needed */ if (old_charger_state == TRUE) { - execute_datapipe(&charger_state_pipe, GINT_TO_POINTER(FALSE), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&charger_state_pipe, GINT_TO_POINTER(FALSE), + USE_INDATA, CACHE_INDATA); } /* In case these are active; there's no harm to call them anyway */ - execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_CHARGING, USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_CHARGING, USE_INDATA); status = TRUE; @@ -322,17 +322,17 @@ static gboolean charger_charging_failed_dbus_cb(DBusMessage *const msg) /* Only update the charger state if needed */ if (old_charger_state == TRUE) { - execute_datapipe(&charger_state_pipe, GINT_TO_POINTER(FALSE), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&charger_state_pipe, GINT_TO_POINTER(FALSE), + USE_INDATA, CACHE_INDATA); } /* In case these are active; there's no harm to call them anyway */ - execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_FULL, USE_INDATA); - execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_CHARGING, USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_FULL, USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_CHARGING, USE_INDATA); /* Generate activity */ - execute_datapipe(&device_inactive_event_pipe, GINT_TO_POINTER(FALSE), - USE_INDATA, CACHE_OUTDATA); + datapipe_exec_full(&inactivity_event_pipe, GINT_TO_POINTER(FALSE), + USE_INDATA, CACHE_OUTDATA); status = TRUE; @@ -357,8 +357,8 @@ static gboolean charger_connected_dbus_cb(DBusMessage *const msg) if (cached_charger_connected != 1) { /* Generate activity */ - execute_datapipe(&device_inactive_event_pipe, - GINT_TO_POINTER(FALSE), + datapipe_exec_full(&inactivity_event_pipe, + GINT_TO_POINTER(FALSE), USE_INDATA, CACHE_OUTDATA); cached_charger_connected = 1; } @@ -387,18 +387,18 @@ static gboolean charger_disconnected_dbus_cb(DBusMessage *const msg) /* Only update the charger state if needed */ if (old_charger_state == TRUE) { - execute_datapipe(&charger_state_pipe, GINT_TO_POINTER(FALSE), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&charger_state_pipe, GINT_TO_POINTER(FALSE), + USE_INDATA, CACHE_INDATA); } /* In case these are active; there's no harm to call them anyway */ - execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_FULL, USE_INDATA); - execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_CHARGING, USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_FULL, USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_CHARGING, USE_INDATA); if (cached_charger_connected != 0) { /* Generate activity */ - execute_datapipe(&device_inactive_event_pipe, - GINT_TO_POINTER(FALSE), + datapipe_exec_full(&inactivity_event_pipe, + GINT_TO_POINTER(FALSE), USE_INDATA, CACHE_OUTDATA); cached_charger_connected = 0; } diff --git a/modules/battery-statefs.c b/modules/battery-statefs.c index 08b0e94e..d09161b8 100644 --- a/modules/battery-statefs.c +++ b/modules/battery-statefs.c @@ -403,7 +403,8 @@ static void bsf_datapipe_shutting_down_cb(gconstpointer data) if( shutting_down == prev ) goto EXIT; - mce_log(LL_DEBUG, "shutting_down = %d -> %d", prev, shutting_down); + mce_log(LL_DEBUG, "shutting_down = %d -> %d", + prev, shutting_down); /* Loss of statefs files is expected during shutdown */ @@ -728,24 +729,24 @@ mcebat_update_cb(gpointer user_data) charger_state_repr(mcebat.charger)); /* Charger connected state */ - execute_datapipe(&charger_state_pipe, GINT_TO_POINTER(mcebat.charger), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&charger_state_pipe, GINT_TO_POINTER(mcebat.charger), + USE_INDATA, CACHE_INDATA); /* Charging led pattern */ if( mcebat.charger == CHARGER_STATE_ON ) { - execute_datapipe_output_triggers(&led_pattern_activate_pipe, - MCE_LED_PATTERN_BATTERY_CHARGING, - USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_activate_pipe, + MCE_LED_PATTERN_BATTERY_CHARGING, + USE_INDATA); } else { - execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, - MCE_LED_PATTERN_BATTERY_CHARGING, - USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_deactivate_pipe, + MCE_LED_PATTERN_BATTERY_CHARGING, + USE_INDATA); } /* Generate activity */ - execute_datapipe(&device_inactive_event_pipe, GINT_TO_POINTER(FALSE), - USE_INDATA, CACHE_OUTDATA); + datapipe_exec_full(&inactivity_event_pipe, GINT_TO_POINTER(FALSE), + USE_INDATA, CACHE_OUTDATA); } if( mcebat.status != prev.status ) { @@ -755,35 +756,35 @@ mcebat_update_cb(gpointer user_data) /* Battery full led pattern */ if( mcebat.status == BATTERY_STATUS_FULL ) { - execute_datapipe_output_triggers(&led_pattern_activate_pipe, - MCE_LED_PATTERN_BATTERY_FULL, - USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_activate_pipe, + MCE_LED_PATTERN_BATTERY_FULL, + USE_INDATA); } else { - execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, - MCE_LED_PATTERN_BATTERY_FULL, - USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_deactivate_pipe, + MCE_LED_PATTERN_BATTERY_FULL, + USE_INDATA); } #if SUPPORT_BATTERY_LOW_LED_PATTERN /* Battery low led pattern */ if( mcebat.status == BATTERY_STATUS_LOW || mcebat.status == BATTERY_STATUS_EMPTY ) { - execute_datapipe_output_triggers(&led_pattern_activate_pipe, - MCE_LED_PATTERN_BATTERY_LOW, - USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_activate_pipe, + MCE_LED_PATTERN_BATTERY_LOW, + USE_INDATA); } else { - execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, - MCE_LED_PATTERN_BATTERY_LOW, - USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_deactivate_pipe, + MCE_LED_PATTERN_BATTERY_LOW, + USE_INDATA); } #endif /* SUPPORT_BATTERY_LOW_LED_PATTERN */ /* Battery charge state */ - execute_datapipe(&battery_status_pipe, - GINT_TO_POINTER(mcebat.status), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&battery_status_pipe, + GINT_TO_POINTER(mcebat.status), + USE_INDATA, CACHE_INDATA); } @@ -791,9 +792,9 @@ mcebat_update_cb(gpointer user_data) mce_log(LL_NOTICE, "level: %d -> %d", prev.level, mcebat.level); /* Battery charge percentage */ - execute_datapipe(&battery_level_pipe, - GINT_TO_POINTER(mcebat.level), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&battery_level_pipe, + GINT_TO_POINTER(mcebat.level), + USE_INDATA, CACHE_INDATA); } cleanup: diff --git a/modules/battery-upower.c b/modules/battery-upower.c index 0586cc52..686c62e7 100644 --- a/modules/battery-upower.c +++ b/modules/battery-upower.c @@ -696,24 +696,24 @@ mcebat_update_cb(gpointer user_data) charger_state_repr(mcebat.charger)); /* Charger connected state */ - execute_datapipe(&charger_state_pipe, GINT_TO_POINTER(mcebat.charger), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&charger_state_pipe, GINT_TO_POINTER(mcebat.charger), + USE_INDATA, CACHE_INDATA); /* Charging led pattern */ if( mcebat.charger == CHARGER_STATE_ON ) { - execute_datapipe_output_triggers(&led_pattern_activate_pipe, - MCE_LED_PATTERN_BATTERY_CHARGING, - USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_activate_pipe, + MCE_LED_PATTERN_BATTERY_CHARGING, + USE_INDATA); } else { - execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, - MCE_LED_PATTERN_BATTERY_CHARGING, - USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_deactivate_pipe, + MCE_LED_PATTERN_BATTERY_CHARGING, + USE_INDATA); } /* Generate activity */ - execute_datapipe(&device_inactive_event_pipe, GINT_TO_POINTER(FALSE), - USE_INDATA, CACHE_OUTDATA); + datapipe_exec_full(&inactivity_event_pipe, GINT_TO_POINTER(FALSE), + USE_INDATA, CACHE_OUTDATA); } if( mcebat.status != prev.status ) { @@ -721,35 +721,35 @@ mcebat_update_cb(gpointer user_data) /* Battery full led pattern */ if( mcebat.status == BATTERY_STATUS_FULL ) { - execute_datapipe_output_triggers(&led_pattern_activate_pipe, - MCE_LED_PATTERN_BATTERY_FULL, - USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_activate_pipe, + MCE_LED_PATTERN_BATTERY_FULL, + USE_INDATA); } else { - execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, - MCE_LED_PATTERN_BATTERY_FULL, - USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_deactivate_pipe, + MCE_LED_PATTERN_BATTERY_FULL, + USE_INDATA); } #if SUPPORT_BATTERY_LOW_LED_PATTERN /* Battery low led pattern */ if( mcebat.status == BATTERY_STATUS_LOW || mcebat.status == BATTERY_STATUS_EMPTY ) { - execute_datapipe_output_triggers(&led_pattern_activate_pipe, - MCE_LED_PATTERN_BATTERY_LOW, - USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_activate_pipe, + MCE_LED_PATTERN_BATTERY_LOW, + USE_INDATA); } else { - execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, - MCE_LED_PATTERN_BATTERY_LOW, - USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_deactivate_pipe, + MCE_LED_PATTERN_BATTERY_LOW, + USE_INDATA); } #endif /* SUPPORT_BATTERY_LOW_LED_PATTERN */ /* Battery charge state */ - execute_datapipe(&battery_status_pipe, - GINT_TO_POINTER(mcebat.status), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&battery_status_pipe, + GINT_TO_POINTER(mcebat.status), + USE_INDATA, CACHE_INDATA); } @@ -757,9 +757,9 @@ mcebat_update_cb(gpointer user_data) mce_log(LL_INFO, "level: %d -> %d", prev.level, mcebat.level); /* Battery charge percentage */ - execute_datapipe(&battery_level_pipe, - GINT_TO_POINTER(mcebat.level), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&battery_level_pipe, + GINT_TO_POINTER(mcebat.level), + USE_INDATA, CACHE_INDATA); } /* Clear the timer id and do not repeat */ diff --git a/modules/bluetooth.c b/modules/bluetooth.c index b7ffe425..750bb0eb 100644 --- a/modules/bluetooth.c +++ b/modules/bluetooth.c @@ -272,26 +272,26 @@ static void bluetooth_dbus_quit(void) * DATAPIPE_TRACKING * ========================================================================= */ -/** Availability of bluez; from bluez_available_pipe */ -static service_state_t bluez_available = SERVICE_STATE_UNDEF; +/** Availability of bluez; from bluez_service_state_pipe */ +static service_state_t bluez_service_state = SERVICE_STATE_UNDEF; /** Datapipe trigger for bluez availability * * @param data bluez D-Bus service availability (as a void pointer) */ -static void bluetooth_datapipe_bluez_available_cb(gconstpointer const data) +static void bluetooth_datapipe_bluez_service_state_cb(gconstpointer const data) { - service_state_t prev = bluez_available; - bluez_available = GPOINTER_TO_INT(data); + service_state_t prev = bluez_service_state; + bluez_service_state = GPOINTER_TO_INT(data); - if( bluez_available == prev ) + if( bluez_service_state == prev ) goto EXIT; mce_log(LL_DEVEL, "bluez dbus service: %s -> %s", service_state_repr(prev), - service_state_repr(bluez_available)); + service_state_repr(bluez_service_state)); - switch( bluez_available ) { + switch( bluez_service_state ) { case SERVICE_STATE_RUNNING: case SERVICE_STATE_STOPPED: bluetooth_suspend_block_start(); @@ -310,8 +310,8 @@ static datapipe_handler_t bluetooth_datapipe_handlers[] = { // output triggers { - .datapipe = &bluez_available_pipe, - .output_cb = bluetooth_datapipe_bluez_available_cb, + .datapipe = &bluez_service_state_pipe, + .output_cb = bluetooth_datapipe_bluez_service_state_cb, }, // sentinel { diff --git a/modules/buttonbacklight.c b/modules/buttonbacklight.c index 4e850daf..fe55a859 100644 --- a/modules/buttonbacklight.c +++ b/modules/buttonbacklight.c @@ -90,7 +90,7 @@ static void bbl_state_rethink (void); * ------------------------------------------------------------------------- */ static void bbl_datapipe_system_state_cb (gconstpointer data); -static void bbl_datapipe_display_state_cb (gconstpointer data); +static void bbl_datapipe_display_state_curr_cb(gconstpointer data); static void bbl_datapipe_submode_cb (gconstpointer data); static void bbl_datapipes_init (void); static void bbl_datapipes_quit (void); @@ -131,13 +131,13 @@ G_MODULE_EXPORT void g_module_unload (GModule *module); * ========================================================================= */ /** Current system state; undefined initially */ -static system_state_t system_state = MCE_STATE_UNDEF; +static system_state_t system_state = MCE_SYSTEM_STATE_UNDEF; /** Current display state; undefined initially */ -static display_state_t display_state = MCE_DISPLAY_UNDEF; +static display_state_t display_state_curr = MCE_DISPLAY_UNDEF; /** Current submode: Initialized to invalid placeholder value */ -static submode_t submode = MCE_INVALID_SUBMODE; +static submode_t submode = MCE_SUBMODE_INVALID; /** Current backlight state: unknown initially */ static tristate_t backlight_state = TRISTATE_UNKNOWN; @@ -261,14 +261,14 @@ bbl_state_rethink(void) /* Device running in USER mode ? */ switch( system_state ) { - case MCE_STATE_USER: + case MCE_SYSTEM_STATE_USER: break; default: goto EXIT; } /* Display is ON or DIM */ - switch( display_state ) { + switch( display_state_curr ) { case MCE_DISPLAY_ON: case MCE_DISPLAY_DIM: break; @@ -277,7 +277,7 @@ bbl_state_rethink(void) } /* Lokcscreen is not active ? */ - if( submode & (MCE_TKLOCK_SUBMODE | MCE_INVALID_SUBMODE) ) + if( submode & (MCE_SUBMODE_TKLOCK | MCE_SUBMODE_INVALID) ) goto EXIT; /* Button backlight should be enabled */ @@ -319,17 +319,17 @@ bbl_datapipe_system_state_cb(gconstpointer data) * @param data display state (as void pointer) */ static void -bbl_datapipe_display_state_cb(gconstpointer data) +bbl_datapipe_display_state_curr_cb(gconstpointer data) { - display_state_t prev = display_state; - display_state = GPOINTER_TO_INT(data); + display_state_t prev = display_state_curr; + display_state_curr = GPOINTER_TO_INT(data); - if( display_state == prev ) + if( display_state_curr == prev ) goto EXIT; - mce_log(LL_DEBUG, "display_state = %s -> %s", + mce_log(LL_DEBUG, "display_state_curr = %s -> %s", display_state_repr(prev), - display_state_repr(display_state)); + display_state_repr(display_state_curr)); bbl_state_rethink(); @@ -366,8 +366,8 @@ static datapipe_handler_t bbl_datapipe_handlers[] = .output_cb = bbl_datapipe_system_state_cb, }, { - .datapipe = &display_state_pipe, - .output_cb = bbl_datapipe_display_state_cb, + .datapipe = &display_state_curr_pipe, + .output_cb = bbl_datapipe_display_state_curr_cb, }, { .datapipe = &submode_pipe, diff --git a/modules/callstate.c b/modules/callstate.c index 3d85b5c5..86831ea4 100644 --- a/modules/callstate.c +++ b/modules/callstate.c @@ -195,7 +195,7 @@ ofono_callstate_to_mce(const char *name) */ static call_type_t ofono_calltype_to_mce(bool emergency) { - return emergency ? EMERGENCY_CALL : NORMAL_CALL; + return emergency ? CALL_TYPE_EMERGENCY : CALL_TYPE_NORMAL; } /* ========================================================================= * @@ -243,7 +243,7 @@ static void ofono_vcall_merge_emergency(ofono_vcall_t *self, bool emergency) { if( emergency ) - self->type = EMERGENCY_CALL; + self->type = CALL_TYPE_EMERGENCY; } /** Merge state data from oFono voice call object to another @@ -273,8 +273,8 @@ ofono_vcall_merge_vcall(ofono_vcall_t *self, const ofono_vcall_t *that) } /* if any call is emergency, we have emergency call */ - if( that->type == EMERGENCY_CALL ) - self->type = EMERGENCY_CALL; + if( that->type == CALL_TYPE_EMERGENCY ) + self->type = CALL_TYPE_EMERGENCY; } /** Create oFono voice call object @@ -291,7 +291,7 @@ ofono_vcall_create(const char *path) self->name = g_strdup(path); self->probed = false; self->state = CALL_STATE_INVALID; - self->type = NORMAL_CALL; + self->type = CALL_TYPE_NORMAL; mce_log(LL_DEBUG, "vcall=%s", self->name); return self; @@ -1219,7 +1219,7 @@ xofono_name_owner_get(void) static const ofono_vcall_t clients_vcall_def = { .state = CALL_STATE_NONE, - .type = NORMAL_CALL, + .type = CALL_TYPE_NORMAL, }; /** Enumeration callback for ignoring incoming calls @@ -1509,14 +1509,14 @@ change_call_state_dbus_cb(DBusMessage *const msg) /* Convert call type to enum */ curr.type = call_type_parse(type); - if( curr.type == INVALID_CALL ) { + if( curr.type == CALL_TYPE_INVALID ) { mce_log(LL_WARN, "Invalid call type received; request ignored"); goto EXIT; } /* reject no-call emergency calls ... */ if( curr.state == CALL_STATE_NONE ) - curr.type = NORMAL_CALL; + curr.type = CALL_TYPE_NORMAL; mce_log(LL_DEBUG, "Client call state changed: %s:%s -> %s:%s", call_state_repr(prev.state), @@ -1650,13 +1650,13 @@ call_state_rethink_now(void) static ofono_vcall_t previous = { .state = CALL_STATE_INVALID, - .type = NORMAL_CALL, + .type = CALL_TYPE_NORMAL, }; ofono_vcall_t combined = { .state = CALL_STATE_NONE, - .type = NORMAL_CALL, + .type = CALL_TYPE_NORMAL, }; /* consider simulated call state */ @@ -1696,13 +1696,13 @@ call_state_rethink_now(void) send_call_state(NULL, state_str, type_str); - execute_datapipe(&call_state_pipe, - GINT_TO_POINTER(call_state), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&call_state_pipe, + GINT_TO_POINTER(call_state), + USE_INDATA, CACHE_INDATA); - execute_datapipe(&call_type_pipe, - GINT_TO_POINTER(call_type), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&call_type_pipe, + GINT_TO_POINTER(call_type), + USE_INDATA, CACHE_INDATA); EXIT: return changed; @@ -1854,7 +1854,7 @@ static void mce_callstate_quit_dbus(void) * @param data call state (as void pointer) */ static void -callstate_datapipe_ignore_incoming_call_cb(gconstpointer data) +callstate_datapipe_ignore_incoming_call_event_cb(gconstpointer data) { bool ignore_incoming_call = GPOINTER_TO_INT(data); @@ -1877,8 +1877,8 @@ static datapipe_handler_t callstate_datapipe_handlers[] = { // output triggers { - .datapipe = &ignore_incoming_call_pipe, - .output_cb = callstate_datapipe_ignore_incoming_call_cb, + .datapipe = &ignore_incoming_call_event_pipe, + .output_cb = callstate_datapipe_ignore_incoming_call_event_cb, }, // sentinel { diff --git a/modules/camera.c b/modules/camera.c index 5fb10d4e..b5530e30 100644 --- a/modules/camera.c +++ b/modules/camera.c @@ -98,13 +98,13 @@ static gboolean camera_active_state_iomon_input_cb(mce_io_mon_t *iomon, gpointer (void)bytes_read; if (!strncmp(data, MCE_CAMERA_ACTIVE, strlen(MCE_CAMERA_ACTIVE))) { - execute_datapipe_output_triggers(&led_pattern_activate_pipe, - MCE_LED_PATTERN_CAMERA, - USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_activate_pipe, + MCE_LED_PATTERN_CAMERA, + USE_INDATA); } else { - execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, - MCE_LED_PATTERN_CAMERA, - USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_deactivate_pipe, + MCE_LED_PATTERN_CAMERA, + USE_INDATA); } return FALSE; @@ -123,8 +123,8 @@ static gboolean camera_popout_state_iomon_input_cb(mce_io_mon_t *iomon, gpointer (void)bytes_read; /* Generate activity */ - execute_datapipe(&device_inactive_event_pipe, GINT_TO_POINTER(FALSE), - USE_INDATA, CACHE_OUTDATA); + datapipe_exec_full(&inactivity_event_pipe, GINT_TO_POINTER(FALSE), + USE_INDATA, CACHE_OUTDATA); if (popout_unlock == FALSE) goto EXIT; @@ -133,9 +133,9 @@ static gboolean camera_popout_state_iomon_input_cb(mce_io_mon_t *iomon, gpointer if (!strncmp(data, MCE_CAMERA_POPPED_OUT, strlen(MCE_CAMERA_POPPED_OUT))) { /* Request delayed unlock of touchscreen/keypad lock */ - (void)execute_datapipe(&tk_lock_pipe, - GINT_TO_POINTER(LOCK_OFF_DELAYED), - USE_INDATA, CACHE_INDATA); + (void)datapipe_exec_full(&tklock_request_pipe, + GINT_TO_POINTER(TKLOCK_REQUEST_OFF_DELAYED), + USE_INDATA, CACHE_INDATA); } EXIT: diff --git a/modules/display.c b/modules/display.c index c5c9113f..8b2bee99 100644 --- a/modules/display.c +++ b/modules/display.c @@ -377,23 +377,23 @@ static void mdy_datapipe_packagekit_locked_cb(gconstpointer data) static void mdy_datapipe_system_state_cb(gconstpointer data); static void mdy_datapipe_submode_cb(gconstpointer data); static void mdy_datapipe_interaction_expected_cb(gconstpointer data); -static void mdy_datapipe_mdy_datapipe_lid_cover_policy_cb(gconstpointer data); +static void mdy_datapipe_lid_sensor_filtered_cb(gconstpointer data); static gpointer mdy_datapipe_display_state_filter_cb(gpointer data); -static void mdy_datapipe_display_state_cb(gconstpointer data); +static void mdy_datapipe_display_state_curr_cb(gconstpointer data); static void mdy_datapipe_display_state_next_cb(gconstpointer data); -static void mdy_datapipe_keyboard_slide_input_cb(gconstpointer const data); +static void mdy_datapipe_keyboard_slide_input_state_cb(gconstpointer const data); static void mdy_datapipe_display_brightness_cb(gconstpointer data); static void mdy_datapipe_lpm_brightness_cb(gconstpointer data); static void mdy_datapipe_display_state_req_cb(gconstpointer data); static void mdy_datapipe_audio_route_cb(gconstpointer data); static void mdy_datapipe_charger_state_cb(gconstpointer data); -static void mdy_datapipe_exception_state_cb(gconstpointer data); +static void mdy_datapipe_uiexception_type_cb(gconstpointer data); static void mdy_datapipe_alarm_ui_state_cb(gconstpointer data); -static void mdy_datapipe_proximity_sensor_cb(gconstpointer data); -static void mdy_datapipe_power_saving_mode_cb(gconstpointer data); +static void mdy_datapipe_proximity_sensor_actual_cb(gconstpointer data); +static void mdy_datapipe_power_saving_mode_active_cb(gconstpointer data); static void mdy_datapipe_call_state_trigger_cb(gconstpointer data); static void mdy_datapipe_device_inactive_cb(gconstpointer data); -static void mdy_datapipe_orientation_state_cb(gconstpointer data); +static void mdy_datapipe_orientation_sensor_actual_cb(gconstpointer data); static void mdy_datapipe_shutting_down_cb(gconstpointer aptr); static void mdy_datapipe_init(void); @@ -490,7 +490,7 @@ static void mdy_poweron_led_rethink_schedule(void); #define ACTDEAD_MAX_OFF_TIMEOUT 15 static bool mdy_blanking_from_lockscreen(void); -static void mdy_blanking_update_inactivity_timeout(void); +static void mdy_blanking_update_device_inactive_delay(void); static gboolean mdy_blanking_can_blank_from_low_power_mode(void); // display timer: ON -> DIM @@ -738,8 +738,8 @@ static void mdy_fbsusp_led_start_timer(mdy_fbsusp_led_state_t req static const char *mdy_stm_state_name(stm_state_t state); // react to systemui availability changes -static void mdy_datapipe_compositor_available_cb(gconstpointer aptr); -static void mdy_datapipe_lipstick_available_cb(gconstpointer aptr); +static void mdy_datapipe_compositor_service_state_cb(gconstpointer aptr); +static void mdy_datapipe_lipstick_service_state_cb(gconstpointer aptr); // whether there is unhandled compositor availability change static void mdy_stm_set_compositor_availability_changed(bool changed); @@ -770,7 +770,7 @@ static bool mdy_stm_is_fb_resume_finished(void); static void mdy_stm_release_wakelock(void); static void mdy_stm_acquire_wakelock(void); -// display_state changing +// display state changing static void mdy_stm_push_target_change(display_state_t next_state); static bool mdy_stm_pull_target_change(void); static void mdy_stm_finish_target_change(void); @@ -850,7 +850,7 @@ static void mdy_dbus_quit(void); static gboolean mdy_flagfiles_desktop_ready_cb(gpointer user_data); static void mdy_flagfiles_bootstate_cb(const char *path, const char *file, gpointer data); static void mdy_flagfiles_init_done_cb(const char *path, const char *file, gpointer data); -static void mdy_flagfiles_update_mode_cb(const char *path, const char *file, gpointer data); +static void mdy_flagfiles_osupdate_running_cb(const char *path, const char *file, gpointer data); static void mdy_flagfiles_start_tracking(void); static void mdy_flagfiles_stop_tracking(void); @@ -994,10 +994,10 @@ static gboolean mdy_init_done = FALSE; static filewatcher_t *mdy_init_done_watcher = 0; /** Is the update-mode flag file present in the file system */ -static gboolean mdy_update_mode = FALSE; +static gboolean mdy_osupdate_running = FALSE; /** Content change watcher for the update-mode flag file */ -static filewatcher_t *mdy_update_mode_watcher = 0; +static filewatcher_t *mdy_osupdate_running_watcher = 0; /* ------------------------------------------------------------------------- * * DYNAMIC_SETTINGS @@ -1234,7 +1234,7 @@ static void mdy_datapipe_packagekit_locked_cb(gconstpointer data) } /* Cached system state */ -static system_state_t system_state = MCE_STATE_UNDEF; +static system_state_t system_state = MCE_SYSTEM_STATE_UNDEF; /** * Handle system_state_pipe notifications @@ -1270,7 +1270,7 @@ static void mdy_datapipe_system_state_cb(gconstpointer data) } /* Assume we are in mode transition when mce starts up */ -static submode_t submode = MCE_TRANSITION_SUBMODE; +static submode_t submode = MCE_SUBMODE_TRANSITION; /** * Handle submode_pipe notifications @@ -1288,11 +1288,11 @@ static void mdy_datapipe_submode_cb(gconstpointer data) mce_log(LL_DEBUG, "submode = %d", submode); /* Rethink dim/blank timers if tklock state changed */ - if( (prev ^ submode) & MCE_TKLOCK_SUBMODE ) + if( (prev ^ submode) & MCE_SUBMODE_TKLOCK ) mdy_blanking_rethink_timers(false); - submode_t old_trans = prev & MCE_TRANSITION_SUBMODE; - submode_t new_trans = submode & MCE_TRANSITION_SUBMODE; + submode_t old_trans = prev & MCE_SUBMODE_TRANSITION; + submode_t new_trans = submode & MCE_SUBMODE_TRANSITION; if( old_trans && !new_trans ) { /* End of transition; stable state reached */ @@ -1329,32 +1329,32 @@ static void mdy_datapipe_interaction_expected_cb(gconstpointer data) /** Cache Lid cover policy state; assume unknown */ -static cover_state_t lid_cover_policy_state = COVER_UNDEF; +static cover_state_t lid_sensor_filtered = COVER_UNDEF; -/** Change notifications from lid_cover_policy_pipe +/** Change notifications from lid_sensor_filtered_pipe */ -static void mdy_datapipe_mdy_datapipe_lid_cover_policy_cb(gconstpointer data) +static void mdy_datapipe_lid_sensor_filtered_cb(gconstpointer data) { - cover_state_t prev = lid_cover_policy_state; - lid_cover_policy_state = GPOINTER_TO_INT(data); + cover_state_t prev = lid_sensor_filtered; + lid_sensor_filtered = GPOINTER_TO_INT(data); - if( lid_cover_policy_state == prev ) + if( lid_sensor_filtered == prev ) goto EXIT; - mce_log(LL_DEBUG, "lid_cover_policy_state = %s -> %s", + mce_log(LL_DEBUG, "lid_sensor_filtered = %s -> %s", cover_state_repr(prev), - cover_state_repr(lid_cover_policy_state)); + cover_state_repr(lid_sensor_filtered)); EXIT: return; } /* Cached current display state */ -static display_state_t display_state = MCE_DISPLAY_UNDEF; +static display_state_t display_state_curr = MCE_DISPLAY_UNDEF; /* Cached target display state */ static display_state_t display_state_next = MCE_DISPLAY_UNDEF; -/** Filter display_state_req_pipe changes +/** Filter display_state_request_pipe changes * * @param data The unfiltered display state stored in a pointer * @@ -1372,7 +1372,7 @@ static gpointer mdy_datapipe_display_state_filter_cb(gpointer data) } /* Handle update-mode override */ - if( mdy_update_mode ) { + if( mdy_osupdate_running ) { next_state = MCE_DISPLAY_ON; goto UPDATE; } @@ -1404,28 +1404,28 @@ static gpointer mdy_datapipe_display_state_filter_cb(gpointer data) } /* Allow display off / no change */ - if( next_state == MCE_DISPLAY_OFF || next_state == display_state ) + if( next_state == MCE_DISPLAY_OFF || next_state == display_state_curr ) goto UPDATE; /* Keep existing state if display on requests are made during * mce/device startup and device shutdown/reboot. */ - if( system_state == MCE_STATE_UNDEF ) { + if( system_state == MCE_SYSTEM_STATE_UNDEF ) { /* But initial state = ON/OFF selection at display plugin * initialization must still be allowed */ - if( display_state == MCE_DISPLAY_UNDEF ) { + if( display_state_curr == MCE_DISPLAY_UNDEF ) { if( next_state != MCE_DISPLAY_ON ) next_state = MCE_DISPLAY_OFF; } else { mce_log(LL_WARN, "reject display mode request at start up"); - next_state = display_state; + next_state = display_state_curr; } } - else if( (submode & MCE_TRANSITION_SUBMODE) && - ( system_state == MCE_STATE_SHUTDOWN || - system_state == MCE_STATE_REBOOT ) ) { + else if( (submode & MCE_SUBMODE_TRANSITION) && + ( system_state == MCE_SYSTEM_STATE_SHUTDOWN || + system_state == MCE_SYSTEM_STATE_REBOOT ) ) { mce_log(LL_WARN, "reject display mode request at shutdown/reboot"); - next_state = display_state; + next_state = display_state_curr; } UPDATE: @@ -1438,12 +1438,12 @@ static gpointer mdy_datapipe_display_state_filter_cb(gpointer data) /* Note: An attempt to keep the current state can lead into this * datapipe input filter returning transiend power up/down * or undefined states. These must be ignored at the datapipe - * output handler display_state_req_pipe(). */ + * output handler display_state_request_pipe(). */ return GINT_TO_POINTER(next_state); } -/** Handle display_state_req_pipe notifications +/** Handle display_state_request_pipe notifications * * This is where display state transition starts * @@ -1471,7 +1471,7 @@ static void mdy_datapipe_display_state_req_cb(gconstpointer data) /* Any "no-change" transient state requests practically * have to be side effects of display state request * filtering - no need to make fuzz about them */ - if( next_state == display_state ) + if( next_state == display_state_curr ) break; mce_log(LL_WARN, "%s is not valid target state; ignoring", @@ -1480,18 +1480,18 @@ static void mdy_datapipe_display_state_req_cb(gconstpointer data) } } -/** Handle display_state_pipe notifications +/** Handle display_state_curr_pipe notifications * * This is where display state transition ends * * @param data The display state stored in a pointer */ -static void mdy_datapipe_display_state_cb(gconstpointer data) +static void mdy_datapipe_display_state_curr_cb(gconstpointer data) { - display_state_t prev = display_state; - display_state = GPOINTER_TO_INT(data); + display_state_t prev = display_state_curr; + display_state_curr = GPOINTER_TO_INT(data); - if( display_state == prev ) + if( display_state_curr == prev ) goto EXIT; mdy_statistics_update(); @@ -1529,24 +1529,24 @@ static void mdy_datapipe_display_state_next_cb(gconstpointer data) } /** Keypad slide input state; assume closed */ -static cover_state_t kbd_slide_input_state = COVER_CLOSED; +static cover_state_t keyboard_slide_input_state = COVER_CLOSED; -/** Change notifications from keyboard_slide_pipe +/** Change notifications from keyboard_slide_state_pipe */ -static void mdy_datapipe_keyboard_slide_input_cb(gconstpointer const data) +static void mdy_datapipe_keyboard_slide_input_state_cb(gconstpointer const data) { - cover_state_t prev = kbd_slide_input_state; - kbd_slide_input_state = GPOINTER_TO_INT(data); + cover_state_t prev = keyboard_slide_input_state; + keyboard_slide_input_state = GPOINTER_TO_INT(data); - if( kbd_slide_input_state == COVER_UNDEF ) - kbd_slide_input_state = COVER_CLOSED; + if( keyboard_slide_input_state == COVER_UNDEF ) + keyboard_slide_input_state = COVER_CLOSED; - if( kbd_slide_input_state == prev ) + if( keyboard_slide_input_state == prev ) goto EXIT; - mce_log(LL_DEVEL, "kbd_slide_input_state = %s -> %s", + mce_log(LL_DEVEL, "keyboard_slide_input_state = %s -> %s", cover_state_repr(prev), - cover_state_repr(kbd_slide_input_state)); + cover_state_repr(keyboard_slide_input_state)); /* force blanking reprogramming */ mdy_blanking_rethink_timers(true); @@ -1556,20 +1556,20 @@ static void mdy_datapipe_keyboard_slide_input_cb(gconstpointer const data) } /** Keypad available output state; assume unknown */ -static cover_state_t kbd_available_state = COVER_UNDEF; +static cover_state_t keyboard_available_state = COVER_UNDEF; static void -mdy_datapipe_keyboard_available_cb(gconstpointer const data) +mdy_datapipe_keyboard_available_state_cb(gconstpointer const data) { - cover_state_t prev = kbd_available_state; - kbd_available_state = GPOINTER_TO_INT(data); + cover_state_t prev = keyboard_available_state; + keyboard_available_state = GPOINTER_TO_INT(data); - if( kbd_available_state == prev ) + if( keyboard_available_state == prev ) goto EXIT; - mce_log(LL_DEBUG, "kbd_available_state = %s -> %s", + mce_log(LL_DEBUG, "keyboard_available_state = %s -> %s", cover_state_repr(prev), - cover_state_repr(kbd_available_state)); + cover_state_repr(keyboard_available_state)); /* force blanking reprogramming */ mdy_blanking_rethink_timers(true); @@ -1676,19 +1676,19 @@ static void mdy_datapipe_charger_state_cb(gconstpointer data) } /** Cached exceptional ui state */ -static uiexctype_t exception_state = UIEXC_NONE; +static uiexception_type_t uiexception_type = UIEXCEPTION_TYPE_NONE; -/** Handle exception_state_pipe notifications +/** Handle uiexception_type_pipe notifications */ -static void mdy_datapipe_exception_state_cb(gconstpointer data) +static void mdy_datapipe_uiexception_type_cb(gconstpointer data) { - uiexctype_t prev = exception_state; - exception_state = GPOINTER_TO_INT(data); + uiexception_type_t prev = uiexception_type; + uiexception_type = GPOINTER_TO_INT(data); - if( exception_state == prev ) + if( uiexception_type == prev ) goto EXIT; - mce_log(LL_DEBUG, "exception_state = %d", exception_state); + mce_log(LL_DEBUG, "uiexception_type = %d", uiexception_type); // normal on->dim->blank might not be applicable mdy_blanking_rethink_timers(false); @@ -1733,22 +1733,22 @@ static void mdy_datapipe_alarm_ui_state_cb(gconstpointer data) } /** Cached proximity sensor state */ -static cover_state_t proximity_state = COVER_UNDEF; +static cover_state_t proximity_sensor_actual = COVER_UNDEF; -/** Handle proximity_sensor_pipe notifications +/** Handle proximity_sensor_actual_pipe notifications * * @param data Unused */ -static void mdy_datapipe_proximity_sensor_cb(gconstpointer data) +static void mdy_datapipe_proximity_sensor_actual_cb(gconstpointer data) { - cover_state_t prev = proximity_state; - proximity_state = GPOINTER_TO_INT(data); + cover_state_t prev = proximity_sensor_actual; + proximity_sensor_actual = GPOINTER_TO_INT(data); - if( proximity_state == prev ) + if( proximity_sensor_actual == prev ) goto EXIT; - mce_log(LL_DEBUG, "proximity_state = %s", - proximity_state_repr(proximity_state)); + mce_log(LL_DEBUG, "proximity_sensor_actual = %s", + proximity_state_repr(proximity_sensor_actual)); /* handle toggling between LPM_ON and LPM_OFF */ mdy_blanking_rethink_proximity(); @@ -1758,35 +1758,36 @@ static void mdy_datapipe_proximity_sensor_cb(gconstpointer data) } /** Cached power saving mode state */ -static gboolean power_saving_mode = MCE_DEFAULT_EM_ENABLE_PSM; +static gboolean power_saving_mode_active = MCE_DEFAULT_EM_ENABLE_PSM; -/** Handle power_saving_mode_pipe notifications +/** Handle power_saving_mode_active_pipe notifications * * @param data Unused */ -static void mdy_datapipe_power_saving_mode_cb(gconstpointer data) +static void mdy_datapipe_power_saving_mode_active_cb(gconstpointer data) { - gboolean prev = power_saving_mode; - power_saving_mode = GPOINTER_TO_INT(data); + gboolean prev = power_saving_mode_active; + power_saving_mode_active = GPOINTER_TO_INT(data); - if( power_saving_mode == prev ) + if( power_saving_mode_active == prev ) goto EXIT; - mce_log(LL_DEBUG, "power_saving_mode = %d", power_saving_mode); + mce_log(LL_DEBUG, "power_saving_mode_active = %d", + power_saving_mode_active); - if( power_saving_mode ) { + if( power_saving_mode_active ) { /* Override the CABC mode and brightness setting */ mdy_psm_cabc_mode = DEFAULT_PSM_CABC_MODE; mdy_psm_disp_brightness = mce_xlat_int(1,100, 1,20, mdy_brightness_setting); - execute_datapipe(&display_brightness_pipe, - GINT_TO_POINTER(mdy_psm_disp_brightness), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&display_brightness_pipe, + GINT_TO_POINTER(mdy_psm_disp_brightness), + USE_INDATA, CACHE_INDATA); - execute_datapipe(&lpm_brightness_pipe, - GINT_TO_POINTER(mdy_psm_disp_brightness), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&lpm_brightness_pipe, + GINT_TO_POINTER(mdy_psm_disp_brightness), + USE_INDATA, CACHE_INDATA); mdy_cabc_mode_set(mdy_psm_cabc_mode); } else { @@ -1794,13 +1795,13 @@ static void mdy_datapipe_power_saving_mode_cb(gconstpointer data) mdy_psm_cabc_mode = NULL; mdy_psm_disp_brightness = -1; - execute_datapipe(&display_brightness_pipe, - GINT_TO_POINTER(mdy_brightness_setting), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&display_brightness_pipe, + GINT_TO_POINTER(mdy_brightness_setting), + USE_INDATA, CACHE_INDATA); - execute_datapipe(&lpm_brightness_pipe, - GINT_TO_POINTER(mdy_brightness_setting), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&lpm_brightness_pipe, + GINT_TO_POINTER(mdy_brightness_setting), + USE_INDATA, CACHE_INDATA); mdy_cabc_mode_set(mdy_cabc_mode); } @@ -1837,7 +1838,7 @@ static void mdy_datapipe_call_state_trigger_cb(gconstpointer data) /** Cached inactivity state */ static gboolean device_inactive = FALSE; -/** Handle device_inactive_state_pipe notifications +/** Handle device_inactive_pipe notifications * * @param data The inactivity stored in a pointer; * TRUE if the device is inactive, @@ -1861,7 +1862,7 @@ static void mdy_datapipe_device_inactive_cb(gconstpointer data) * the next on->dim transition to use longer timeout */ mdy_blanking_trigger_adaptive_dimming(); - switch( display_state ) { + switch( display_state_curr ) { case MCE_DISPLAY_ON: /* Explicitly reset the display dim timer */ mdy_blanking_rethink_timers(true); @@ -1891,26 +1892,26 @@ static void mdy_datapipe_device_inactive_cb(gconstpointer data) } /** Cached Orientation Sensor value */ -static orientation_state_t orientation_state = MCE_ORIENTATION_UNDEFINED; +static orientation_state_t orientation_sensor_actual = MCE_ORIENTATION_UNDEFINED; -/** Handle orientation_sensor_pipe notifications +/** Handle orientation_sensor_actual_pipe notifications * * @param data The orientation state stored in a pointer */ -static void mdy_datapipe_orientation_state_cb(gconstpointer data) +static void mdy_datapipe_orientation_sensor_actual_cb(gconstpointer data) { - orientation_state_t prev = orientation_state; - orientation_state = GPOINTER_TO_INT(data); + orientation_state_t prev = orientation_sensor_actual; + orientation_sensor_actual = GPOINTER_TO_INT(data); - if( orientation_state == prev ) + if( orientation_sensor_actual == prev ) goto EXIT; - mce_log(LL_DEBUG, "orientation_state = %s", - orientation_state_repr(orientation_state)); + mce_log(LL_DEBUG, "orientation_sensor_actual = %s", + orientation_state_repr(orientation_sensor_actual)); /* Ignore sensor power up/down */ if( prev == MCE_ORIENTATION_UNDEFINED || - orientation_state == MCE_ORIENTATION_UNDEFINED ) + orientation_sensor_actual == MCE_ORIENTATION_UNDEFINED ) goto EXIT; mdy_orientation_generate_activity(); @@ -1950,29 +1951,29 @@ static datapipe_handler_t mdy_datapipe_handlers[] = { // input triggers { - .datapipe = &display_state_pipe, - .input_cb = mdy_datapipe_display_state_cb, + .datapipe = &display_state_curr_pipe, + .input_cb = mdy_datapipe_display_state_curr_cb, }, { .datapipe = &display_state_next_pipe, .input_cb = mdy_datapipe_display_state_next_cb, }, { - .datapipe = &keyboard_slide_pipe, - .input_cb = mdy_datapipe_keyboard_slide_input_cb, + .datapipe = &keyboard_slide_state_pipe, + .input_cb = mdy_datapipe_keyboard_slide_input_state_cb, }, // input filters { - .datapipe = &display_state_req_pipe, + .datapipe = &display_state_request_pipe, .filter_cb = mdy_datapipe_display_state_filter_cb, }, // output triggers { - .datapipe = &keyboard_available_pipe, - .output_cb = mdy_datapipe_keyboard_available_cb, + .datapipe = &keyboard_available_state_pipe, + .output_cb = mdy_datapipe_keyboard_available_state_cb, }, { - .datapipe = &display_state_req_pipe, + .datapipe = &display_state_request_pipe, .output_cb = mdy_datapipe_display_state_req_cb, }, { @@ -1992,8 +1993,8 @@ static datapipe_handler_t mdy_datapipe_handlers[] = .output_cb = mdy_datapipe_system_state_cb, }, { - .datapipe = &orientation_sensor_pipe, - .output_cb = mdy_datapipe_orientation_state_cb, + .datapipe = &orientation_sensor_actual_pipe, + .output_cb = mdy_datapipe_orientation_sensor_actual_cb, }, { .datapipe = &submode_pipe, @@ -2004,7 +2005,7 @@ static datapipe_handler_t mdy_datapipe_handlers[] = .output_cb = mdy_datapipe_interaction_expected_cb, }, { - .datapipe = &device_inactive_state_pipe, + .datapipe = &device_inactive_pipe, .output_cb = mdy_datapipe_device_inactive_cb, }, { @@ -2012,20 +2013,20 @@ static datapipe_handler_t mdy_datapipe_handlers[] = .output_cb = mdy_datapipe_call_state_trigger_cb, }, { - .datapipe = &power_saving_mode_pipe, - .output_cb = mdy_datapipe_power_saving_mode_cb, + .datapipe = &power_saving_mode_active_pipe, + .output_cb = mdy_datapipe_power_saving_mode_active_cb, }, { - .datapipe = &proximity_sensor_pipe, - .output_cb = mdy_datapipe_proximity_sensor_cb, + .datapipe = &proximity_sensor_actual_pipe, + .output_cb = mdy_datapipe_proximity_sensor_actual_cb, }, { .datapipe = &alarm_ui_state_pipe, .output_cb = mdy_datapipe_alarm_ui_state_cb, }, { - .datapipe = &exception_state_pipe, - .output_cb = mdy_datapipe_exception_state_cb, + .datapipe = &uiexception_type_pipe, + .output_cb = mdy_datapipe_uiexception_type_cb, }, { .datapipe = &audio_route_pipe, @@ -2037,16 +2038,16 @@ static datapipe_handler_t mdy_datapipe_handlers[] = }, { - .datapipe = &compositor_available_pipe, - .output_cb = mdy_datapipe_compositor_available_cb, + .datapipe = &compositor_service_state_pipe, + .output_cb = mdy_datapipe_compositor_service_state_cb, }, { - .datapipe = &lipstick_available_pipe, - .output_cb = mdy_datapipe_lipstick_available_cb, + .datapipe = &lipstick_service_state_pipe, + .output_cb = mdy_datapipe_lipstick_service_state_cb, }, { - .datapipe = &lid_cover_policy_pipe, - .output_cb = mdy_datapipe_mdy_datapipe_lid_cover_policy_cb, + .datapipe = &lid_sensor_filtered_pipe, + .output_cb = mdy_datapipe_lid_sensor_filtered_cb, }, { .datapipe = &shutting_down_pipe, @@ -2121,10 +2122,10 @@ static void mdy_fbdev_rethink(void) goto EXIT; // do not close during os update - if( mdy_update_mode ) + if( mdy_osupdate_running ) goto EXIT; - if( system_state == MCE_STATE_ACTDEAD ) { + if( system_state == MCE_SYSTEM_STATE_ACTDEAD ) { // or when there are act dead alarms switch( alarm_ui_state ) { case MCE_ALARM_UI_RINGING_INT32: @@ -2134,7 +2135,7 @@ static void mdy_fbdev_rethink(void) break; } } - else if( system_state != MCE_STATE_USER ) { + else if( system_state != MCE_SYSTEM_STATE_USER ) { // or we are not in USER/ACT_DEAD goto EXIT; } @@ -2143,9 +2144,9 @@ static void mdy_fbdev_rethink(void) // clear the display when something potentially has left // stale ui on screen - we skip it if the display is not // firmly in powered up state - if( display_state != display_state_next ) + if( display_state_curr != display_state_next ) goto EXIT; - if( !mdy_stm_display_state_needs_power(display_state) ) + if( !mdy_stm_display_state_needs_power(display_state_curr) ) goto EXIT; can_close = true; @@ -2258,14 +2259,14 @@ static void mdy_hbm_rethink(void) goto EXIT; /* should not occur, but do nothing while in transition */ - if( display_state == MCE_DISPLAY_POWER_DOWN || - display_state == MCE_DISPLAY_POWER_UP ) { + if( display_state_curr == MCE_DISPLAY_POWER_DOWN || + display_state_curr == MCE_DISPLAY_POWER_UP ) { mce_log(LL_WARN, "hbm mode setting wile in transition"); goto EXIT; } /* If the display is off or dimmed, disable HBM */ - if( display_state != MCE_DISPLAY_ON ) { + if( display_state_curr != MCE_DISPLAY_ON ) { if (mdy_hbm_level_written != 0) { mdy_hbm_set_level(0); } @@ -2562,13 +2563,13 @@ static void mdy_brightness_fade_continue_with_als(fader_type_t fader_type) } /* The display state must be stable too */ - if( display_state_next != display_state ) + if( display_state_next != display_state_curr ) goto EXIT; /* Target level depends on the display state */ int level = mdy_brightness_fade_end_level; - switch( display_state ) { + switch( display_state_curr ) { case MCE_DISPLAY_LPM_ON: level = mdy_brightness_level_display_lpm; break; @@ -3062,11 +3063,11 @@ static void mdy_brightness_set_dim_level(void) * FIXME: When ui side dimming is working, the led pattern * hack should be removed altogether. */ - execute_datapipe_output_triggers(compositor_fade_level > 0 ? - &led_pattern_activate_pipe : - &led_pattern_deactivate_pipe, - MCE_LED_PATTERN_DISPLAY_DIMMED, - USE_INDATA); + datapipe_exec_output_triggers(compositor_fade_level > 0 ? + &led_pattern_activate_pipe : + &led_pattern_deactivate_pipe, + MCE_LED_PATTERN_DISPLAY_DIMMED, + USE_INDATA); /* Update ui side fader opacity value */ mdy_ui_dimming_set_level(compositor_fade_level); @@ -3206,18 +3207,18 @@ static void mdy_ui_dimming_rethink(void) * 1) display state transition starts * 2) als tuning changes mdy_ui_dimming_level * - * When (1) happens, both display_state and display_state_next + * When (1) happens, both display_state_curr and display_state_next * hold stable states. * * If (2) happens during display power up/down, the - * display_state variable can hold transitient + * display_state_curr variable can hold transitient * MCE_DISPLAY_POWER_UP/DOWN states. */ /* Assume that ui side dimming should not occur */ dbus_int32_t dimming_curr = 0; - if( display_state == MCE_DISPLAY_POWER_DOWN || + if( display_state_curr == MCE_DISPLAY_POWER_DOWN || display_state_next == MCE_DISPLAY_OFF || display_state_next == MCE_DISPLAY_LPM_OFF ) { /* At or entering powered off state -> keep current state */ @@ -3238,19 +3239,19 @@ static void mdy_ui_dimming_rethink(void) /* Assume the change is due to ALS tuning */ dbus_int32_t duration = mdy_brightness_fade_duration_als_ms; - if( display_state == MCE_DISPLAY_POWER_UP ) { + if( display_state_curr == MCE_DISPLAY_POWER_UP ) { /* Leaving powered off state -> use unblank duration */ duration = mdy_brightness_fade_duration_unblank_ms; } - else if( display_state == MCE_DISPLAY_POWER_DOWN ) { + else if( display_state_curr == MCE_DISPLAY_POWER_DOWN ) { /* Entering powered off state -> use blank duration */ duration = mdy_brightness_fade_duration_blank_ms; } - else if( display_state != display_state_next ) { + else if( display_state_curr != display_state_next ) { /* Ongoing display state transition that does not need * or has not yet entered transient state */ - if( display_state == MCE_DISPLAY_OFF || - display_state == MCE_DISPLAY_LPM_OFF ) { + if( display_state_curr == MCE_DISPLAY_OFF || + display_state_curr == MCE_DISPLAY_LPM_OFF ) { /* Leaving powered off state -> use unblank duration */ duration = mdy_brightness_fade_duration_unblank_ms; } @@ -3392,11 +3393,11 @@ static void mdy_poweron_led_rethink(void) mce_log(LL_DEBUG, "%s MCE_LED_PATTERN_POWER_ON", want_led ? "activate" : "deactivate"); - execute_datapipe_output_triggers(want_led ? - &led_pattern_activate_pipe : - &led_pattern_deactivate_pipe, - MCE_LED_PATTERN_POWER_ON, - USE_INDATA); + datapipe_exec_output_triggers(want_led ? + &led_pattern_activate_pipe : + &led_pattern_deactivate_pipe, + MCE_LED_PATTERN_POWER_ON, + USE_INDATA); } /** Timer id for delayed POWER_ON led state evaluation */ @@ -3442,7 +3443,7 @@ static void mdy_poweron_led_rethink_schedule(void) */ static bool mdy_blanking_from_lockscreen(void) { - return (submode & MCE_TKLOCK_SUBMODE) && !interaction_expected; + return (submode & MCE_SUBMODE_TKLOCK) && !interaction_expected; } /** Re-calculate inactivity timeout @@ -3450,23 +3451,24 @@ static bool mdy_blanking_from_lockscreen(void) * This function should be called whenever the variables used * in the calculation are changed. */ -static void mdy_blanking_update_inactivity_timeout(void) +static void mdy_blanking_update_device_inactive_delay(void) { /* Inactivity should be signaled around the time when the display * should have dimmed and blanked - even if the actual blanking is * blocked by blanking pause and/or blanking inhibit mode. */ - gint inactivity_timeout = (mdy_blanking_get_default_dimming_delay() + - mdy_blank_timeout); + gint prev = datapipe_get_gint(inactivity_delay_pipe); + gint curr = (mdy_blanking_get_default_dimming_delay() + + mdy_blank_timeout); - if( datapipe_get_gint(inactivity_timeout_pipe) == inactivity_timeout ) + if( prev == curr ) goto EXIT; - mce_log(LL_DEBUG, "inactivity_timeout = %d", inactivity_timeout); + mce_log(LL_DEBUG, "device_inactive_delay = %d", curr); - execute_datapipe(&inactivity_timeout_pipe, - GINT_TO_POINTER(inactivity_timeout), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&inactivity_delay_pipe, + GINT_TO_POINTER(curr), + USE_INDATA, CACHE_INDATA); EXIT: return; } @@ -3483,7 +3485,7 @@ static gboolean mdy_blanking_can_blank_from_low_power_mode(void) return TRUE; // always allow in MALF - if( submode & MCE_MALF_SUBMODE ) + if( submode & MCE_SUBMODE_MALF ) return TRUE; // always allow during active call @@ -3492,7 +3494,7 @@ static gboolean mdy_blanking_can_blank_from_low_power_mode(void) #if 0 // for reference, old logic: allow after proximity tklock set - if( submode & MCE_PROXIMITY_TKLOCK_SUBMODE ) + if( submode & MCE_SUBMODE_PROXIMITY_TKLOCK ) return TRUE; #else // TODO: we need proximity locking back in, for now just allow it @@ -3514,7 +3516,7 @@ static gint mdy_blanking_get_default_dimming_delay(void) gint dim_timeout = mdy_disp_dim_timeout_default; /* Use different setting if hw kbd is available */ - if( kbd_available_state == COVER_OPEN && + if( keyboard_available_state == COVER_OPEN && mdy_disp_dim_timeout_keyboard > 0 ) { dim_timeout = mdy_disp_dim_timeout_keyboard; } @@ -3525,7 +3527,7 @@ static gint mdy_blanking_get_default_dimming_delay(void) dim_timeout = boot_delay; /* In act dead mode blanking timeouts are capped */ - if( system_state == MCE_STATE_ACTDEAD ) { + if( system_state == MCE_SYSTEM_STATE_ACTDEAD ) { if( dim_timeout > ACTDEAD_MAX_DIM_TIMEOUT ) dim_timeout = ACTDEAD_MAX_DIM_TIMEOUT; } @@ -3574,7 +3576,7 @@ static gboolean mdy_blanking_dim_cb(gpointer data) /* If device is in MALF state skip dimming since systemui * isn't working yet */ - if( submode & MCE_MALF_SUBMODE ) + if( submode & MCE_SUBMODE_MALF ) display = MCE_DISPLAY_OFF; mce_datapipe_req_display_state(display); @@ -3705,7 +3707,7 @@ static gboolean mdy_blanking_off_cb(gpointer data) display_state_t next_state = MCE_DISPLAY_OFF; /* Use lpm on, if starting from on/dim and tklock is already set */ - switch( display_state ) { + switch( display_state_curr ) { case MCE_DISPLAY_ON: case MCE_DISPLAY_DIM: if( lipstick_service_state != SERVICE_STATE_RUNNING ) @@ -3761,10 +3763,10 @@ static void mdy_blanking_schedule_off(void) goto EXIT; } - if( exception_state & UIEXC_CALL ) { + if( uiexception_type & UIEXCEPTION_TYPE_CALL ) { /* During calls: Use unadjusted default timeout */ } - else if( system_state == MCE_STATE_ACTDEAD ) { + else if( system_state == MCE_SYSTEM_STATE_ACTDEAD ) { /* Utilize the same configurable blanking delay as * what is used for the lockscreen, but cap it to a * sensible maximum value. */ @@ -3773,7 +3775,7 @@ static void mdy_blanking_schedule_off(void) if( timeout > ACTDEAD_MAX_OFF_TIMEOUT ) timeout = ACTDEAD_MAX_OFF_TIMEOUT; } - else if( display_state == MCE_DISPLAY_LPM_OFF ) { + else if( display_state_curr == MCE_DISPLAY_LPM_OFF ) { timeout = mdy_blank_from_lpm_off_timeout; } else if( mdy_blanking_from_lockscreen() ) { @@ -3787,7 +3789,7 @@ static void mdy_blanking_schedule_off(void) } /* Blanking pause can optionally stay in dimmed state */ - if( display_state == MCE_DISPLAY_DIM && + if( display_state_curr == MCE_DISPLAY_DIM && mdy_blanking_is_paused() && mdy_blanking_pause_can_dim() ) { mdy_blanking_cancel_off(); @@ -3987,7 +3989,7 @@ static void mdy_blanking_add_pause_client(const gchar *name) } // display must be on - switch( display_state ) { + switch( display_state_curr ) { case MCE_DISPLAY_ON: // always allowed break; @@ -4005,7 +4007,7 @@ static void mdy_blanking_add_pause_client(const gchar *name) } // and tklock off - if( submode & MCE_TKLOCK_SUBMODE ) { + if( submode & MCE_SUBMODE_TKLOCK ) { mce_log(LL_WARN, "blanking pause request from`%s ignored';" " tklock on", name); goto EXIT; @@ -4121,7 +4123,7 @@ static bool mdy_adaptive_dimming_is_enabled(void) { bool enabled = false; - if( system_state != MCE_STATE_USER ) + if( system_state != MCE_SYSTEM_STATE_USER ) goto EXIT; if( !mdy_adaptive_dimming_enabled ) @@ -4255,7 +4257,7 @@ static bool mdy_blanking_inhibit_off_p(void) /* Blanking inhibit is explicitly ignored in act dead */ switch( system_state ) { - case MCE_STATE_ACTDEAD: + case MCE_SYSTEM_STATE_ACTDEAD: goto EXIT; default: @@ -4280,7 +4282,7 @@ static bool mdy_blanking_inhibit_off_p(void) /* Evaluate kbd slide related blanking inhibit policy */ switch( mdy_kbd_slide_inhibit_mode ) { case KBD_SLIDE_INHIBIT_STAY_DIM_WHEN_OPEN: - if( kbd_slide_input_state == COVER_OPEN ) + if( keyboard_slide_input_state == COVER_OPEN ) inhibit = true; break; @@ -4302,7 +4304,7 @@ static bool mdy_blanking_inhibit_dim_p(void) /* Blanking inhibit is explicitly ignored in act dead */ switch( system_state ) { - case MCE_STATE_ACTDEAD: + case MCE_SYSTEM_STATE_ACTDEAD: goto EXIT; default: @@ -4327,7 +4329,7 @@ static bool mdy_blanking_inhibit_dim_p(void) /* Evaluate kbd slide related blanking inhibit policy */ switch( mdy_kbd_slide_inhibit_mode ) { case KBD_SLIDE_INHIBIT_STAY_ON_WHEN_OPEN: - if( kbd_slide_input_state == COVER_OPEN ) + if( keyboard_slide_input_state == COVER_OPEN ) inhibit = true; break; @@ -4345,14 +4347,14 @@ static void mdy_blanking_rethink_timers(bool force) { // TRIGGERS: // submode <- mdy_datapipe_submode_cb() - // display_state <- mdy_display_state_changed() + // display_state_curr<- mdy_display_state_changed() // audio_route <- mdy_datapipe_audio_route_cb() // charger_state <- mdy_datapipe_charger_state_cb() - // exception_state <- mdy_datapipe_exception_state_cb() + // uiexception_type <- mdy_datapipe_uiexception_type_cb() // call_state <- mdy_datapipe_call_state_trigger_cb() // // INPUTS: - // proximity_state <- mdy_datapipe_proximity_sensor_cb() + // proximity_sensor_actual <- mdy_datapipe_proximity_sensor_actual_cb() // mdy_blanking_inhibit_mode <- mdy_setting_cb() // mdy_blanking_is_paused() @@ -4360,7 +4362,7 @@ static void mdy_blanking_rethink_timers(bool force) static cover_state_t prev_proximity_state = COVER_UNDEF; - static uiexctype_t prev_exception_state = UIEXC_NONE; + static uiexception_type_t prev_uiexception_type = UIEXCEPTION_TYPE_NONE; static call_state_t prev_call_state = CALL_STATE_NONE; @@ -4380,16 +4382,16 @@ static void mdy_blanking_rethink_timers(bool force) if( prev_charger_state != charger_state ) force = true; - if( prev_exception_state != exception_state ) + if( prev_uiexception_type != uiexception_type ) force = true; if( prev_call_state != call_state ) force = true; - if( prev_proximity_state != proximity_state ) + if( prev_proximity_state != proximity_sensor_actual ) force = true; - if( prev_display_state != display_state ) { + if( prev_display_state != display_state_curr ) { force = true; /* Stop blanking pause period, unless toggling between @@ -4398,8 +4400,8 @@ static void mdy_blanking_rethink_timers(bool force) if( (prev_display_state == MCE_DISPLAY_ON || prev_display_state == MCE_DISPLAY_DIM) && - (display_state == MCE_DISPLAY_ON || - display_state == MCE_DISPLAY_DIM) && + (display_state_curr == MCE_DISPLAY_ON || + display_state_curr == MCE_DISPLAY_DIM) && mdy_blanking_is_paused() && mdy_blanking_pause_can_dim() ) { // keep existing blanking pause timer alive @@ -4410,7 +4412,7 @@ static void mdy_blanking_rethink_timers(bool force) } // handle adaptive blanking states - switch( display_state ) { + switch( display_state_curr ) { default: case MCE_DISPLAY_UNDEF: case MCE_DISPLAY_OFF: @@ -4445,13 +4447,13 @@ static void mdy_blanking_rethink_timers(bool force) if( mdy_disp_never_blank ) goto EXIT; - if( exception_state & ~UIEXC_CALL ) { + if( uiexception_type & ~UIEXCEPTION_TYPE_CALL ) { /* exceptional ui states other than * call ui -> no dim/blank timers */ goto EXIT; } - switch( display_state ) { + switch( display_state_curr ) { case MCE_DISPLAY_OFF: break; @@ -4464,7 +4466,7 @@ static void mdy_blanking_rethink_timers(bool force) break; case MCE_DISPLAY_DIM: - if( mdy_update_mode ) + if( mdy_osupdate_running ) break; if( mdy_blanking_inhibit_off_p() ) break; @@ -4476,14 +4478,14 @@ static void mdy_blanking_rethink_timers(bool force) case MCE_DISPLAY_ON: /* In update mode auto-blanking must not occur. */ - if( mdy_update_mode ) + if( mdy_osupdate_running ) break; /* All exceptional states apart from active call * should block auto-blanking. */ - if( exception_state ) { + if( uiexception_type ) { /* Not call related -> block auto-blanking */ - if( exception_state & ~UIEXC_CALL ) + if( uiexception_type & ~UIEXCEPTION_TYPE_CALL ) break; /* Incoming call -> block auto-blanking */ @@ -4493,14 +4495,14 @@ static void mdy_blanking_rethink_timers(bool force) /* Even during during active calls we do not want * to interfere with proximity blanking */ if( audio_route == AUDIO_ROUTE_HANDSET && - proximity_state == COVER_CLOSED ) + proximity_sensor_actual == COVER_CLOSED ) break; } /* In act-dead mode & co blanking inhibit modes are * ignored and display is blanked without going through * the dimming step */ - if( system_state != MCE_STATE_USER ) { + if( system_state != MCE_SYSTEM_STATE_USER ) { mdy_blanking_schedule_off(); break; } @@ -4513,7 +4515,7 @@ static void mdy_blanking_rethink_timers(bool force) * lockscreen and/or device lock is active, normal * dimming rules must be applied during active calls. */ - if( tklock_mode && !(exception_state & UIEXC_CALL) ) { + if( tklock_mode && !(uiexception_type & UIEXCEPTION_TYPE_CALL) ) { if( !mdy_blanking_from_tklock_disabled ) mdy_blanking_schedule_off(); break; @@ -4539,9 +4541,9 @@ static void mdy_blanking_rethink_timers(bool force) } EXIT: - prev_display_state = display_state; - prev_proximity_state = proximity_state; - prev_exception_state = exception_state; + prev_display_state = display_state_curr; + prev_proximity_state = proximity_sensor_actual; + prev_uiexception_type = uiexception_type; prev_call_state = call_state; prev_charger_state = charger_state; prev_audio_route = audio_route; @@ -4554,17 +4556,17 @@ static void mdy_blanking_rethink_timers(bool force) */ static void mdy_blanking_rethink_proximity(void) { - switch( display_state ) { + switch( display_state_curr ) { case MCE_DISPLAY_LPM_ON: - if( proximity_state == COVER_CLOSED ) + if( proximity_sensor_actual == COVER_CLOSED ) mce_datapipe_req_display_state(MCE_DISPLAY_LPM_OFF); else mdy_blanking_schedule_lpm_off(); break; case MCE_DISPLAY_LPM_OFF: - if( proximity_state == COVER_OPEN && - lid_cover_policy_state != COVER_CLOSED ) + if( proximity_sensor_actual == COVER_OPEN && + lid_sensor_filtered != COVER_CLOSED ) mce_datapipe_req_display_state(MCE_DISPLAY_LPM_ON); else mdy_blanking_schedule_off(); @@ -4626,7 +4628,7 @@ static void mdy_blanking_rethink_afterboot_delay(void) if( mdy_bootstate != BOOTSTATE_USER ) goto DONE; - if( system_state != MCE_STATE_USER ) + if( system_state != MCE_SYSTEM_STATE_USER ) goto DONE; /* Lipstick has started */ @@ -5299,11 +5301,11 @@ static void compositor_led_set_active(compositor_led_t led, bool active) active ? "activate" : "deactivate", compositor_led_pattern[led]); - execute_datapipe_output_triggers((compositor_led_active[led] = active) ? - &led_pattern_activate_pipe : - &led_pattern_deactivate_pipe, - compositor_led_pattern[led], - USE_INDATA); + datapipe_exec_output_triggers((compositor_led_active[led] = active) ? + &led_pattern_activate_pipe : + &led_pattern_deactivate_pipe, + compositor_led_pattern[led], + USE_INDATA); EXIT: return; } @@ -6565,11 +6567,11 @@ static int mdy_autosuspend_get_allowed_level(void) /* Exceptional situations without separate state * management block late suspend */ - if( exception_state & (UIEXC_NOTIF|UIEXC_LINGER) ) + if( uiexception_type & (UIEXCEPTION_TYPE_NOTIF|UIEXCEPTION_TYPE_LINGER) ) block_late = true; /* no late suspend in ACTDEAD etc */ - if( system_state != MCE_STATE_USER ) + if( system_state != MCE_SYSTEM_STATE_USER ) block_late = true; /* no late suspend during bootup */ @@ -6589,7 +6591,7 @@ static int mdy_autosuspend_get_allowed_level(void) block_early = true; /* no suspend during update mode */ - if( mdy_update_mode ) + if( mdy_osupdate_running ) block_early = true; /* do not suspend while ui side might still be drawing */ @@ -6607,7 +6609,7 @@ static int mdy_autosuspend_get_allowed_level(void) break; case SUSPEND_POLICY_DISABLE_ON_CHARGER: - if( system_state == MCE_STATE_USER && + if( system_state == MCE_SYSTEM_STATE_USER && charger_state == CHARGER_STATE_ON ) block_early = true; break; @@ -6664,9 +6666,9 @@ static void mdy_autosuspend_setting_cb(GConfClient *const client, const guint id */ static void mdy_orientation_changed_cb(int state) { - execute_datapipe(&orientation_sensor_pipe, - GINT_TO_POINTER(state), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&orientation_sensor_actual_pipe, + GINT_TO_POINTER(state), + USE_INDATA, CACHE_INDATA); } /** Generate user activity from orientation sensor input @@ -6678,7 +6680,7 @@ static void mdy_orientation_generate_activity(void) goto EXIT; /* Display must be on/dimmed */ - switch( display_state ) { + switch( display_state_curr ) { case MCE_DISPLAY_ON: case MCE_DISPLAY_DIM: break; @@ -6688,9 +6690,9 @@ static void mdy_orientation_generate_activity(void) } mce_log(LL_DEBUG, "orientation change; generate activity"); - execute_datapipe(&device_inactive_event_pipe, - GINT_TO_POINTER(FALSE), - USE_INDATA, CACHE_OUTDATA); + datapipe_exec_full(&inactivity_event_pipe, + GINT_TO_POINTER(FALSE), + USE_INDATA, CACHE_OUTDATA); EXIT: return; @@ -6771,7 +6773,7 @@ static void mdy_orientation_sensor_rethink(void) static void mdy_display_state_changed(void) { /* Disable blanking pause if display != ON */ - switch( display_state ) { + switch( display_state_curr ) { case MCE_DISPLAY_ON: break; @@ -6796,7 +6798,7 @@ static void mdy_display_state_changed(void) * Should turn in to big nop if there are no changes. */ - switch( display_state ) { + switch( display_state_curr ) { case MCE_DISPLAY_OFF: case MCE_DISPLAY_LPM_OFF: /* Blanking or already blanked -> set zero brightness */ @@ -6835,14 +6837,14 @@ static void mdy_display_state_changed(void) /** Handle end of display state transition * * After the state machine has finished display state - * tranistion, it gets broadcast to display_state_pipe + * tranistion, it gets broadcast to display_state_curr_pipe * via this function. * - * Actions for this will be executed in display_state_pipe + * Actions for this will be executed in display_state_curr_pipe * output trigger mdy_display_state_changed(). * * @param prev_state previous display state - * @param display_state state transferred to + * @param display_state_curr state transferred to */ static void mdy_display_state_enter(display_state_t prev_state, display_state_t next_state) @@ -6857,15 +6859,15 @@ static void mdy_display_state_enter(display_state_t prev_state, mdy_brightness_als_fade_allowed = true; } - /* Restore display_state_pipe to valid value */ - display_state_pipe.cached_data = GINT_TO_POINTER(next_state); + /* Restore display_state_curr_pipe to valid value */ + display_state_curr_pipe.cached_data = GINT_TO_POINTER(next_state); /* Run display state change triggers */ mce_log(LL_CRUCIAL, "current display state = %s", display_state_repr(next_state)); - execute_datapipe(&display_state_pipe, - GINT_TO_POINTER(next_state), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&display_state_curr_pipe, + GINT_TO_POINTER(next_state), + USE_INDATA, CACHE_INDATA); /* Deal with new stable display state */ mdy_display_state_changed(); @@ -6874,7 +6876,7 @@ static void mdy_display_state_enter(display_state_t prev_state, /** Handle start of display state transition * * @param prev_state display state before transition - * @param display_state target state to transfer to + * @param display_state_curr target state to transfer to */ static void mdy_display_state_leave(display_state_t prev_state, display_state_t next_state) @@ -6938,15 +6940,15 @@ static void mdy_display_state_leave(display_state_t prev_state, } /* Broadcast the final target of this transition; note that this - * happens while display_state_pipe still holds the previous + * happens while display_state_curr_pipe still holds the previous * (non-transitional) state */ mce_log(LL_NOTICE, "target display state = %s", display_state_repr(next_state)); - execute_datapipe(&display_state_next_pipe, - GINT_TO_POINTER(next_state), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&display_state_next_pipe, + GINT_TO_POINTER(next_state), + USE_INDATA, CACHE_INDATA); - /* Invalidate display_state_pipe when making transitions + /* Invalidate display_state_curr_pipe when making transitions * that need to wait for external parties */ if( have_power != need_power ) { display_state_t state = @@ -6954,10 +6956,10 @@ static void mdy_display_state_leave(display_state_t prev_state, mce_log(LL_CRUCIAL, "current display state = %s", display_state_repr(state)); - display_state_pipe.cached_data = GINT_TO_POINTER(state); - execute_datapipe(&display_state_pipe, - display_state_pipe.cached_data, - USE_INDATA, CACHE_INDATA); + display_state_curr_pipe.cached_data = GINT_TO_POINTER(state); + datapipe_exec_full(&display_state_curr_pipe, + display_state_curr_pipe.cached_data, + USE_INDATA, CACHE_INDATA); } } @@ -6985,17 +6987,17 @@ static void mdy_fbsusp_led_set(mdy_fbsusp_led_state_t req) break; } - execute_datapipe_output_triggers(blanking ? - &led_pattern_activate_pipe : - &led_pattern_deactivate_pipe, - MCE_LED_PATTERN_DISPLAY_SUSPEND_FAILED, - USE_INDATA); + datapipe_exec_output_triggers(blanking ? + &led_pattern_activate_pipe : + &led_pattern_deactivate_pipe, + MCE_LED_PATTERN_DISPLAY_SUSPEND_FAILED, + USE_INDATA); - execute_datapipe_output_triggers(unblanking ? - &led_pattern_activate_pipe : - &led_pattern_deactivate_pipe, - MCE_LED_PATTERN_DISPLAY_RESUME_FAILED, - USE_INDATA); + datapipe_exec_output_triggers(unblanking ? + &led_pattern_activate_pipe : + &led_pattern_deactivate_pipe, + MCE_LED_PATTERN_DISPLAY_RESUME_FAILED, + USE_INDATA); } /** Timer id for fbdev suspend/resume is taking too long */ @@ -7108,7 +7110,7 @@ static const char *mdy_stm_state_name(stm_state_t state) /** react to compositor availability changes */ -static void mdy_datapipe_compositor_available_cb(gconstpointer aptr) +static void mdy_datapipe_compositor_service_state_cb(gconstpointer aptr) { static service_state_t service = SERVICE_STATE_UNDEF; @@ -7118,7 +7120,7 @@ static void mdy_datapipe_compositor_available_cb(gconstpointer aptr) if( service == prev ) goto EXIT; - mce_log(LL_DEVEL, "compositor_available = %s -> %s", + mce_log(LL_DEVEL, "compositor_service_state = %s -> %s", service_state_repr(prev), service_state_repr(service)); @@ -7165,7 +7167,7 @@ static void mdy_datapipe_compositor_available_cb(gconstpointer aptr) /** react to systemui availability changes */ -static void mdy_datapipe_lipstick_available_cb(gconstpointer aptr) +static void mdy_datapipe_lipstick_service_state_cb(gconstpointer aptr) { service_state_t prev = lipstick_service_state; lipstick_service_state = GPOINTER_TO_INT(aptr); @@ -7173,7 +7175,7 @@ static void mdy_datapipe_lipstick_available_cb(gconstpointer aptr) if( lipstick_service_state == prev ) goto EXIT; - mce_log(LL_DEVEL, "lipstick_available = %s -> %s", + mce_log(LL_DEVEL, "lipstick_service_state = %s -> %s", service_state_repr(prev), service_state_repr(lipstick_service_state)); @@ -7990,10 +7992,10 @@ static void mdy_statistics_update(void) mdy_statistics_data[prev_state].time_ms += (now - prev_update); - if( prev_state != display_state ) - mdy_statistics_data[display_state].entries += 1; + if( prev_state != display_state_curr ) + mdy_statistics_data[display_state_curr].entries += 1; - prev_state = display_state; + prev_state = display_state_curr; prev_update = now; } @@ -8254,8 +8256,8 @@ static void mdy_governor_rethink(void) int governor_want = GOVERNOR_INTERACTIVE; /* Use default when in transitional states */ - if( system_state != MCE_STATE_USER && - system_state != MCE_STATE_ACTDEAD ) { + if( system_state != MCE_SYSTEM_STATE_USER && + system_state != MCE_SYSTEM_STATE_ACTDEAD ) { governor_want = GOVERNOR_DEFAULT; } @@ -8399,8 +8401,8 @@ static gboolean mdy_dbus_send_blanking_inhibit_status(DBusMessage *const method_ * blanking inhibit is active. This should catch things like * stay-on inhibit modes, update mode, never-blank mode, etc */ - if( display_state == MCE_DISPLAY_ON || - display_state == MCE_DISPLAY_DIM ) { + if( display_state_curr == MCE_DISPLAY_ON || + display_state_curr == MCE_DISPLAY_DIM ) { if( !mdy_blanking_off_cb_id && !mdy_blanking_dim_cb_id ) curr = true; } @@ -8408,7 +8410,7 @@ static gboolean mdy_dbus_send_blanking_inhibit_status(DBusMessage *const method_ /* The stay-dim inhibit modes do not prevent dimming, so those need * to be taken into account separately. */ - if( display_state == MCE_DISPLAY_ON && mdy_blanking_dim_cb_id ) { + if( display_state_curr == MCE_DISPLAY_ON && mdy_blanking_dim_cb_id ) { if( mdy_blanking_inhibit_dim_p() ) curr = true; } @@ -8510,7 +8512,7 @@ static gboolean mdy_dbus_send_display_status(DBusMessage *const method_call) switch( display_state_next ) { case MCE_DISPLAY_ON: case MCE_DISPLAY_DIM: - if( display_state != display_state_next ) + if( display_state_curr != display_state_next ) goto EXIT; break; @@ -8572,7 +8574,7 @@ static const char *mdy_dbus_get_reason_to_block_display_on(void) const char *reason = 0; /* display off? */ - switch( display_state ) { + switch( display_state_curr ) { default: case MCE_DISPLAY_OFF: case MCE_DISPLAY_LPM_OFF: @@ -8590,8 +8592,8 @@ static const char *mdy_dbus_get_reason_to_block_display_on(void) /* system state must be USER or ACT DEAD */ switch( system_state ) { - case MCE_STATE_USER: - case MCE_STATE_ACTDEAD: + case MCE_SYSTEM_STATE_USER: + case MCE_SYSTEM_STATE_ACTDEAD: break; default: reason = "system_state != USER|ACTDEAD"; @@ -8619,13 +8621,13 @@ static const char *mdy_dbus_get_reason_to_block_display_on(void) } /* lid closed? */ - if( lid_cover_policy_state == COVER_CLOSED ) { + if( lid_sensor_filtered == COVER_CLOSED ) { reason = "lid closed"; goto EXIT; } /* proximity covered? */ - if( proximity_state == COVER_CLOSED ) { + if( proximity_sensor_actual == COVER_CLOSED ) { reason = "proximity covered"; goto EXIT; } @@ -8731,9 +8733,9 @@ static gboolean mdy_dbus_handle_display_off_req(DBusMessage *const msg) if( !dbus_message_get_no_reply(msg) ) dbus_send_message(dbus_new_method_reply(msg)); - execute_datapipe(&tk_lock_pipe, - GINT_TO_POINTER(LOCK_ON), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&tklock_request_pipe, + GINT_TO_POINTER(TKLOCK_REQUEST_ON), + USE_INDATA, CACHE_INDATA); mdy_dbus_handle_display_state_req(MCE_DISPLAY_OFF); @@ -8757,7 +8759,7 @@ static gboolean mdy_dbus_handle_display_lpm_req(DBusMessage *const msg) mce_dbus_get_message_sender_ident(msg)); /* Ignore lpm requests if there are active calls / alarms */ - if( exception_state & (UIEXC_CALL | UIEXC_ALARM) ) { + if( uiexception_type & (UIEXCEPTION_TYPE_CALL | UIEXCEPTION_TYPE_ALARM) ) { reason = "call or alarm active"; request = current; lock_ui = false; @@ -8792,9 +8794,9 @@ static gboolean mdy_dbus_handle_display_lpm_req(DBusMessage *const msg) } if( lock_ui ) { - execute_datapipe(&tk_lock_pipe, - GINT_TO_POINTER(LOCK_ON), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&tklock_request_pipe, + GINT_TO_POINTER(TKLOCK_REQUEST_ON), + USE_INDATA, CACHE_INDATA); } mdy_dbus_handle_display_state_req(request); @@ -9233,12 +9235,12 @@ static gboolean mdy_dbus_handle_desktop_started_sig(DBusMessage *const msg) mce_log(LL_NOTICE, "Received desktop startup notification"); mce_log(LL_DEBUG, "deactivate MCE_LED_PATTERN_POWER_ON"); - execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, - MCE_LED_PATTERN_POWER_ON, USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_deactivate_pipe, + MCE_LED_PATTERN_POWER_ON, USE_INDATA); - mce_rem_submode_int32(MCE_BOOTUP_SUBMODE); + mce_rem_submode_int32(MCE_SUBMODE_BOOTUP); - mce_rem_submode_int32(MCE_MALF_SUBMODE); + mce_rem_submode_int32(MCE_SUBMODE_MALF); if (g_access(MCE_MALF_FILENAME, F_OK) == 0) { g_remove(MCE_MALF_FILENAME); } @@ -9274,7 +9276,7 @@ static mce_dbus_handler_t mdy_dbus_handlers[] = .name = MCE_DISPLAY_SIG, .type = DBUS_MESSAGE_TYPE_SIGNAL, .args = - " \n" + " \n" }, { .interface = MCE_SIGNAL_IF, @@ -9314,7 +9316,7 @@ static mce_dbus_handler_t mdy_dbus_handlers[] = .type = DBUS_MESSAGE_TYPE_METHOD_CALL, .callback = mdy_dbus_handle_display_status_get_req, .args = - " \n" + " \n" }, { .interface = MCE_REQUEST_IF, @@ -9483,7 +9485,7 @@ static void mdy_flagfiles_init_done_cb(const char *path, * @param file name of the flag file * @param data (not used) */ -static void mdy_flagfiles_update_mode_cb(const char *path, +static void mdy_flagfiles_osupdate_running_cb(const char *path, const char *file, gpointer data) { @@ -9494,14 +9496,14 @@ static void mdy_flagfiles_update_mode_cb(const char *path, gboolean flag = access(full, F_OK) ? FALSE : TRUE; - if( mdy_update_mode != flag ) { - mdy_update_mode = flag; + if( mdy_osupdate_running != flag ) { + mdy_osupdate_running = flag; /* Log by default as it might help analyzing upgrade problems */ - mce_log(LL_WARN, "update_mode flag file present: %s", - mdy_update_mode ? "true" : "false"); + mce_log(LL_WARN, "osupdate_running flag file present: %s", + mdy_osupdate_running ? "true" : "false"); - if( mdy_update_mode ) { + if( mdy_osupdate_running ) { /* Issue display on request when update mode starts */ mce_datapipe_req_display_state(MCE_DISPLAY_ON); } @@ -9513,9 +9515,9 @@ static void mdy_flagfiles_update_mode_cb(const char *path, mdy_blanking_rethink_timers(true); /* broadcast change within mce */ - execute_datapipe(&update_mode_pipe, - GINT_TO_POINTER(mdy_update_mode), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&osupdate_running_pipe, + GINT_TO_POINTER(mdy_osupdate_running), + USE_INDATA, CACHE_INDATA); } } @@ -9587,8 +9589,8 @@ static void mdy_flagfiles_start_tracking(void) /* if the update directory exits, track flag file presense */ if( access(update_dir, F_OK) == 0 ) { - mdy_update_mode_watcher = filewatcher_create(update_dir, update_flag, - mdy_flagfiles_update_mode_cb, + mdy_osupdate_running_watcher = filewatcher_create(update_dir, update_flag, + mdy_flagfiles_osupdate_running_cb, 0, 0); } @@ -9634,9 +9636,9 @@ static void mdy_flagfiles_start_tracking(void) mdy_bootstate = BOOTSTATE_USER; } - if( mdy_update_mode_watcher ) { + if( mdy_osupdate_running_watcher ) { /* evaluate the initial state of update-mode flag file */ - filewatcher_force_trigger(mdy_update_mode_watcher); + filewatcher_force_trigger(mdy_osupdate_running_watcher); } } @@ -9644,7 +9646,7 @@ static void mdy_flagfiles_start_tracking(void) */ static void mdy_flagfiles_stop_tracking(void) { - filewatcher_delete(mdy_update_mode_watcher), mdy_update_mode_watcher = 0; + filewatcher_delete(mdy_osupdate_running_watcher), mdy_osupdate_running_watcher = 0; filewatcher_delete(mdy_init_done_watcher), mdy_init_done_watcher = 0; @@ -9766,7 +9768,7 @@ static void mdy_setting_cb(GConfClient *const gcc, const guint id, } else if (id == mdy_blank_timeout_setting_id) { mdy_blank_timeout = gconf_value_get_int(gcv); - mdy_blanking_update_inactivity_timeout(); + mdy_blanking_update_device_inactive_delay(); /* Reprogram blanking timers */ mdy_blanking_rethink_timers(true); @@ -9795,14 +9797,14 @@ static void mdy_setting_cb(GConfClient *const gcc, const guint id, else if (id == mdy_use_low_power_mode_setting_id) { mdy_use_low_power_mode = gconf_value_get_bool(gcv); - if (((display_state == MCE_DISPLAY_LPM_OFF) || - (display_state == MCE_DISPLAY_LPM_ON)) && + if (((display_state_curr == MCE_DISPLAY_LPM_OFF) || + (display_state_curr == MCE_DISPLAY_LPM_ON)) && ((mdy_low_power_mode_supported == FALSE) || (mdy_use_low_power_mode == FALSE) || (mdy_blanking_can_blank_from_low_power_mode() == TRUE))) { mce_datapipe_req_display_state(MCE_DISPLAY_OFF); } - else if ((display_state == MCE_DISPLAY_OFF) && + else if ((display_state_curr == MCE_DISPLAY_OFF) && (mdy_use_low_power_mode == TRUE) && (mdy_blanking_can_blank_from_low_power_mode() == FALSE) && (mdy_low_power_mode_supported == TRUE)) { @@ -10038,9 +10040,9 @@ static void mdy_setting_sanitize_brightness_levels(void) /* Then execute through the brightness pipe too; this will update * the mdy_brightness_level_display_on & mdy_brightness_level_display_dim * values. */ - execute_datapipe(&display_brightness_pipe, - GINT_TO_POINTER(mdy_brightness_setting), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&display_brightness_pipe, + GINT_TO_POINTER(mdy_brightness_setting), + USE_INDATA, CACHE_INDATA); mce_log(LL_DEBUG, "mdy_brightness_level_display_on = %d", mdy_brightness_level_display_on); @@ -10049,9 +10051,9 @@ static void mdy_setting_sanitize_brightness_levels(void) /* And drive the display brightness setting value through lpm datapipe * too. This will update the mdy_brightness_level_display_lpm value. */ - execute_datapipe(&lpm_brightness_pipe, - GINT_TO_POINTER(mdy_brightness_setting), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&lpm_brightness_pipe, + GINT_TO_POINTER(mdy_brightness_setting), + USE_INDATA, CACHE_INDATA); } static void mdy_setting_sanitize_dim_timeouts(bool force_update) @@ -10081,7 +10083,7 @@ static void mdy_setting_sanitize_dim_timeouts(bool force_update) mdy_blanking_reset_adaptive_dimming_delay(); /* Update inactivity timeout */ - mdy_blanking_update_inactivity_timeout(); + mdy_blanking_update_device_inactive_delay(); } /** Get initial setting values and start tracking changes diff --git a/modules/doubletap.c b/modules/doubletap.c index 21575c00..4b7513c2 100644 --- a/modules/doubletap.c +++ b/modules/doubletap.c @@ -25,10 +25,10 @@ static guint dbltap_mode_setting_id = 0; static cover_state_t dbltap_ps_state = COVER_UNDEF; /** Latest reported proximity blanking */ -static bool dbltap_ps_blank = false; +static bool dbltap_ps_blanked = false; /** Latest reported lid sensor policy decision */ -static cover_state_t dbltap_lid_cover_policy = COVER_UNDEF; +static cover_state_t dbltap_lid_sensor_filtered = COVER_UNDEF; /** Path to doubletap wakeup control file */ static char *dbltap_ctrl_path = 0; @@ -166,14 +166,14 @@ static void dbltap_rethink(void) * want to keep the touch detection powered up but * not reporting double taps to allow faster touch * event reporting when unblanking again. */ - if( dbltap_ps_blank ) + if( dbltap_ps_blanked ) state = DT_DISABLED_NOSLEEP; else state = DT_DISABLED; } /* Disable due to lid sensor */ - if( dbltap_lid_cover_policy == COVER_CLOSED ) + if( dbltap_lid_sensor_filtered == COVER_CLOSED ) state = DT_DISABLED; break; } @@ -196,7 +196,7 @@ static void dbltap_mode_set(dbltap_mode_t mode) * * @param data proximity state as void pointer */ -static void dbltap_proximity_trigger(gconstpointer data) +static void dbltap_proximity_sensor_actual_trigger(gconstpointer data) { cover_state_t state = GPOINTER_TO_INT(data); @@ -210,12 +210,12 @@ static void dbltap_proximity_trigger(gconstpointer data) * * @param data proximity blank as void pointer */ -static void dbltap_proximity_blank_trigger(gconstpointer data) +static void dbltap_proximity_blanked_trigger(gconstpointer data) { cover_state_t state = GPOINTER_TO_INT(data); - if( dbltap_ps_blank != state ) { - dbltap_ps_blank = state; + if( dbltap_ps_blanked != state ) { + dbltap_ps_blanked = state; dbltap_rethink(); } } @@ -224,12 +224,12 @@ static void dbltap_proximity_blank_trigger(gconstpointer data) * * @param data lid policy decision as void pointer */ -static void dbltap_lid_cover_policy_trigger(gconstpointer data) +static void dbltap_lid_sensor_filtered_trigger(gconstpointer data) { cover_state_t state = GPOINTER_TO_INT(data); - if( dbltap_lid_cover_policy != state ) { - dbltap_lid_cover_policy = state; + if( dbltap_lid_sensor_filtered != state ) { + dbltap_lid_sensor_filtered = state; dbltap_rethink(); } } @@ -350,17 +350,17 @@ const gchar *g_module_check_init(GModule *module) 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); + datapipe_add_output_trigger(&proximity_sensor_actual_pipe, + dbltap_proximity_sensor_actual_trigger); + datapipe_add_output_trigger(&proximity_blanked_pipe, + dbltap_proximity_blanked_trigger); + datapipe_add_output_trigger(&lid_sensor_filtered_pipe, + dbltap_lid_sensor_filtered_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); + dbltap_ps_state = datapipe_get_gint(proximity_sensor_actual_pipe); + dbltap_ps_blanked = datapipe_get_gint(proximity_blanked_pipe); + dbltap_lid_sensor_filtered = datapipe_get_gint(lid_sensor_filtered_pipe); /* enable/disable double tap wakeups based on initial conditions */ dbltap_rethink(); @@ -382,12 +382,12 @@ void g_module_unload(GModule *module) dbltap_mode_setting_id = 0; /* Remove triggers/filters from datapipes */ - remove_output_trigger_from_datapipe(&proximity_sensor_pipe, - dbltap_proximity_trigger); - remove_output_trigger_from_datapipe(&proximity_blank_pipe, - dbltap_proximity_blank_trigger); - remove_output_trigger_from_datapipe(&lid_cover_policy_pipe, - dbltap_lid_cover_policy_trigger); + datapipe_remove_output_trigger(&proximity_sensor_actual_pipe, + dbltap_proximity_sensor_actual_trigger); + datapipe_remove_output_trigger(&proximity_blanked_pipe, + dbltap_proximity_blanked_trigger); + datapipe_remove_output_trigger(&lid_sensor_filtered_pipe, + dbltap_lid_sensor_filtered_trigger); /* Free config strings */ g_free(dbltap_ctrl_path); diff --git a/modules/filter-brightness-als.c b/modules/filter-brightness-als.c index e619e966..cf6d8cfb 100644 --- a/modules/filter-brightness-als.c +++ b/modules/filter-brightness-als.c @@ -194,10 +194,10 @@ static void fba_als_filter_init (void); static gpointer fba_datapipe_display_brightness_filter (gpointer data); static gpointer fba_datapipe_led_brightness_filter (gpointer data); static gpointer fba_datapipe_lpm_brightness_filter (gpointer data); -static gpointer fba_datapipe_key_backlight_filter (gpointer data); -static gpointer fba_datapipe_ambient_light_poll_filter (gpointer data); +static gpointer fba_datapipe_key_backlight_brightness_filter(gpointer data); +static gpointer fba_datapipe_light_sensor_poll_request_filter(gpointer data); -static void fba_datapipe_display_state_trigger (gconstpointer data); +static void fba_datapipe_display_state_curr_trigger (gconstpointer data); static void fba_datapipe_display_state_next_trigger (gconstpointer data); static void fba_datapipe_execute_brightness_change (void); @@ -810,9 +810,9 @@ fba_inputflt_sampling_output(int lux) fba_datapipe_execute_brightness_change(); /* Feed filtered sensor data to datapipe */ - execute_datapipe(&ambient_light_level_pipe, - GINT_TO_POINTER(fba_inputflt_output_lux), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&light_sensor_filtered_pipe, + GINT_TO_POINTER(fba_inputflt_output_lux), + USE_INDATA, CACHE_INDATA); EXIT: return; } @@ -1188,14 +1188,14 @@ fba_als_filter_init(void) * DATAPIPE_TRACKING * ========================================================================= */ -/** Cached display state; tracked via fba_datapipe_display_state_trigger() */ -static display_state_t fba_display_state = MCE_DISPLAY_UNDEF; +/** Cached display state; tracked via fba_datapipe_display_state_curr_trigger() */ +static display_state_t fba_display_state_curr = MCE_DISPLAY_UNDEF; /** Cached target display state; tracked via fba_datapipe_display_state_next_trigger() */ -static display_state_t fba_display_state_next = MCE_DISPLAY_UNDEF; +static display_state_t fba_display_state_curr_next = MCE_DISPLAY_UNDEF; -/** Cached als poll state; tracked via fba_datapipe_ambient_light_poll_filter() */ -static bool fba_ambient_light_poll = false; +/** Cached als poll state; tracked via fba_datapipe_light_sensor_poll_request_filter() */ +static bool fba_light_sensor_polling = false; /** * Ambient Light Sensor filter for display brightness @@ -1301,7 +1301,7 @@ fba_datapipe_lpm_brightness_filter(gpointer data) * @return The processed brightness value */ static gpointer -fba_datapipe_key_backlight_filter(gpointer data) +fba_datapipe_key_backlight_brightness_filter(gpointer data) { int value = GPOINTER_TO_INT(data); int scale = 100; @@ -1325,19 +1325,19 @@ fba_datapipe_key_backlight_filter(gpointer data) * @return Granted sensor enable/disable bool (as void pointer) */ static gpointer -fba_datapipe_ambient_light_poll_filter(gpointer data) +fba_datapipe_light_sensor_poll_request_filter(gpointer data) { - bool prev = fba_ambient_light_poll; - fba_ambient_light_poll = GPOINTER_TO_INT(data); + bool prev = fba_light_sensor_polling; + fba_light_sensor_polling = GPOINTER_TO_INT(data); if( !fba_setting_als_enabled ) - fba_ambient_light_poll = FALSE; + fba_light_sensor_polling = FALSE; - if( fba_ambient_light_poll == prev ) + if( fba_light_sensor_polling == prev ) goto EXIT; - mce_log(LL_DEVEL, "ambient_light_poll = %s", - fba_ambient_light_poll ? "true" : "false"); + mce_log(LL_DEVEL, "light_sensor_polling = %s", + fba_light_sensor_polling ? "true" : "false"); /* Sensor status is affected only if the value changes */ fba_status_rethink(); @@ -1348,7 +1348,7 @@ fba_datapipe_ambient_light_poll_filter(gpointer data) * if the value does not change. */ fba_sensorpoll_rethink(); - return GINT_TO_POINTER(fba_ambient_light_poll); + return GINT_TO_POINTER(fba_light_sensor_polling); } /** @@ -1357,17 +1357,17 @@ fba_datapipe_ambient_light_poll_filter(gpointer data) * @param data The display stated stored in a pointer */ static void -fba_datapipe_display_state_trigger(gconstpointer data) +fba_datapipe_display_state_curr_trigger(gconstpointer data) { - display_state_t prev = fba_display_state; - fba_display_state = GPOINTER_TO_INT(data); + display_state_t prev = fba_display_state_curr; + fba_display_state_curr = GPOINTER_TO_INT(data); - if( prev == fba_display_state ) + if( prev == fba_display_state_curr ) goto EXIT; - mce_log(LL_DEBUG, "display_state: %s -> %s", + mce_log(LL_DEBUG, "display_state_curr: %s -> %s", display_state_repr(prev), - display_state_repr(fba_display_state)); + display_state_repr(fba_display_state_curr)); fba_status_rethink(); @@ -1378,15 +1378,15 @@ fba_datapipe_display_state_trigger(gconstpointer data) static void fba_datapipe_display_state_next_trigger(gconstpointer data) { - display_state_t prev = fba_display_state_next; - fba_display_state_next = GPOINTER_TO_INT(data); + display_state_t prev = fba_display_state_curr_next; + fba_display_state_curr_next = GPOINTER_TO_INT(data); - if( prev == fba_display_state_next ) + if( prev == fba_display_state_curr_next ) goto EXIT; mce_log(LL_DEBUG, "display_state_next: %s -> %s", display_state_repr(prev), - display_state_repr(fba_display_state_next)); + display_state_repr(fba_display_state_curr_next)); fba_status_rethink(); @@ -1398,14 +1398,14 @@ static void fba_datapipe_execute_brightness_change(void) { /* Re-filter the brightness */ - execute_datapipe(&display_brightness_pipe, NULL, - USE_CACHE, DONT_CACHE_INDATA); - execute_datapipe(&led_brightness_pipe, NULL, - USE_CACHE, DONT_CACHE_INDATA); - execute_datapipe(&lpm_brightness_pipe, NULL, - USE_CACHE, DONT_CACHE_INDATA); - execute_datapipe(&key_backlight_pipe, NULL, - USE_CACHE, DONT_CACHE_INDATA); + datapipe_exec_full(&display_brightness_pipe, NULL, + USE_CACHE, DONT_CACHE_INDATA); + datapipe_exec_full(&led_brightness_pipe, NULL, + USE_CACHE, DONT_CACHE_INDATA); + datapipe_exec_full(&lpm_brightness_pipe, NULL, + USE_CACHE, DONT_CACHE_INDATA); + datapipe_exec_full(&key_backlight_brightness_pipe, NULL, + USE_CACHE, DONT_CACHE_INDATA); } /** Array of datapipe handlers */ @@ -1425,12 +1425,12 @@ static datapipe_handler_t fba_datapipe_handlers[] = .filter_cb = fba_datapipe_lpm_brightness_filter, }, { - .datapipe = &key_backlight_pipe, - .filter_cb = fba_datapipe_key_backlight_filter, + .datapipe = &key_backlight_brightness_pipe, + .filter_cb = fba_datapipe_key_backlight_brightness_filter, }, { - .datapipe = &ambient_light_poll_pipe, - .filter_cb = fba_datapipe_ambient_light_poll_filter, + .datapipe = &light_sensor_poll_request_pipe, + .filter_cb = fba_datapipe_light_sensor_poll_request_filter, }, // output triggers @@ -1439,8 +1439,8 @@ static datapipe_handler_t fba_datapipe_handlers[] = .output_cb = fba_datapipe_display_state_next_trigger, }, { - .datapipe = &display_state_pipe, - .output_cb = fba_datapipe_display_state_trigger, + .datapipe = &display_state_curr_pipe, + .output_cb = fba_datapipe_display_state_curr_trigger, }, // sentinel @@ -1694,9 +1694,9 @@ fba_status_sensor_value_change_cb(int lux) fba_inputflt_sampling_input(fba_status_sensor_lux); /* Feed raw sensor data to datapipe */ - execute_datapipe(&ambient_light_sensor_pipe, - GINT_TO_POINTER(fba_status_sensor_lux), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&light_sensor_actual_pipe, + GINT_TO_POINTER(fba_status_sensor_lux), + USE_INDATA, CACHE_INDATA); } static bool @@ -1704,7 +1704,7 @@ fba_status_sensor_is_needed(void) { bool need_als = false; - switch( fba_display_state_next ) { + switch( fba_display_state_curr_next ) { case MCE_DISPLAY_ON: case MCE_DISPLAY_DIM: case MCE_DISPLAY_LPM_OFF: @@ -1733,7 +1733,7 @@ fba_status_rethink(void) bool enable_new = false; if( fba_setting_als_enabled ) - enable_new = (fba_ambient_light_poll || + enable_new = (fba_light_sensor_polling || fba_status_sensor_is_needed()); if( fba_module_unload ) @@ -1782,7 +1782,7 @@ fba_status_rethink(void) } /* Block device from suspending while temporary ALS poll is active */ - if( enable_new && fba_ambient_light_poll ) + if( enable_new && fba_light_sensor_polling ) mce_wakelock_obtain("als_poll", -1); else mce_wakelock_release("als_poll"); @@ -1814,9 +1814,9 @@ fba_sensorpoll_timer_cb(gpointer aptr) mce_log(LL_DEBUG, "als poll: %s", "timeout"); fba_sensorpoll_timer_id = 0; - execute_datapipe(&ambient_light_poll_pipe, - GINT_TO_POINTER(false), - USE_INDATA, CACHE_OUTDATA); + datapipe_exec_full(&light_sensor_poll_request_pipe, + GINT_TO_POINTER(false), + USE_INDATA, CACHE_OUTDATA); EXIT: return FALSE; } @@ -1859,7 +1859,7 @@ fba_sensorpoll_stop(void) */ static void fba_sensorpoll_rethink(void) { - if( fba_ambient_light_poll ) + if( fba_light_sensor_polling ) fba_sensorpoll_start(); else fba_sensorpoll_stop(); diff --git a/modules/inactivity.c b/modules/inactivity.c index e6beec72..dbed2470 100644 --- a/modules/inactivity.c +++ b/modules/inactivity.c @@ -105,10 +105,10 @@ static void mia_action_delete (mia_action_t *self); * DATAPIPE_TRACKING * ------------------------------------------------------------------------- */ -static void mia_datapipe_inactive_request_cb (gconstpointer data); +static void mia_datapipe_inactivity_event_cb (gconstpointer data); static void mia_datapipe_device_inactive_cb (gconstpointer data); -static void mia_datapipe_proximity_sensor_cb (gconstpointer data); -static void mia_datapipe_inactivity_timeout_cb (gconstpointer data); +static void mia_datapipe_proximity_sensor_actual_cb(gconstpointer data); +static void mia_datapipe_inactivity_delay_cb (gconstpointer data); static void mia_datapipe_submode_cb (gconstpointer data); static void mia_datapipe_alarm_ui_state_cb (gconstpointer data); static void mia_datapipe_call_state_cb (gconstpointer data); @@ -194,7 +194,7 @@ static mce_hbtimer_t *inactivity_timer_hnd = 0; static gboolean device_inactive = TRUE; /* Cached submode bitmask; assume in transition at startup */ -static submode_t submode = MCE_TRANSITION_SUBMODE; +static submode_t submode = MCE_SUBMODE_TRANSITION; /** Cached alarm ui state */ static alarm_ui_state_t alarm_ui_state = MCE_ALARM_UI_INVALID_INT32; @@ -203,16 +203,16 @@ static alarm_ui_state_t alarm_ui_state = MCE_ALARM_UI_INVALID_INT32; static call_state_t call_state = CALL_STATE_INVALID; /* Cached system state */ -static system_state_t system_state = MCE_STATE_UNDEF; +static system_state_t system_state = MCE_SYSTEM_STATE_UNDEF; /** Cached display state */ static display_state_t display_state_next = MCE_DISPLAY_UNDEF; /** Cached inactivity timeout delay [s] */ -static gint inactivity_timeout = DEFAULT_INACTIVITY_TIMEOUT; +static gint device_inactive_delay = DEFAULT_INACTIVITY_DELAY; /** Cached proximity sensor state */ -static cover_state_t proximity_state = COVER_UNDEF; +static cover_state_t proximity_sensor_actual = COVER_UNDEF; /** Cached Interaction expected state */ static bool interaction_expected = false; @@ -232,16 +232,16 @@ static const char *mia_inactivity_repr(bool inactive) */ static void mia_generate_activity(void) { - execute_datapipe(&device_inactive_event_pipe, GINT_TO_POINTER(FALSE), - USE_INDATA, CACHE_OUTDATA); + datapipe_exec_full(&inactivity_event_pipe, GINT_TO_POINTER(FALSE), + USE_INDATA, CACHE_OUTDATA); } /** Helper for switching to inactive state */ static void mia_generate_inactivity(void) { - execute_datapipe(&device_inactive_event_pipe, GINT_TO_POINTER(TRUE), - USE_INDATA, CACHE_OUTDATA); + datapipe_exec_full(&inactivity_event_pipe, GINT_TO_POINTER(TRUE), + USE_INDATA, CACHE_OUTDATA); } /* ========================================================================= * @@ -317,20 +317,20 @@ static bool mia_activity_allowed(void) /* Activity applies only when display is on */ if( display_state_next != MCE_DISPLAY_ON ) { - mce_log(LL_DEBUG, "display_state = %s; ignoring activity", + mce_log(LL_DEBUG, "display_state_curr = %s; ignoring activity", display_state_repr(display_state_next)); goto DENY; } /* Activity applies only to USER mode */ - if( system_state != MCE_STATE_USER ) { + if( system_state != MCE_SYSTEM_STATE_USER ) { mce_log(LL_DEBUG, "system_state = %s; ignoring activity", system_state_repr(system_state)); goto DENY; } /* Normally activity does not apply when lockscreen is active */ - if( submode & MCE_TKLOCK_SUBMODE ) { + if( submode & MCE_SUBMODE_TKLOCK ) { /* Active alarm */ switch( alarm_ui_state ) { @@ -372,7 +372,7 @@ static bool mia_activity_allowed(void) * TRUE if the device is inactive, * FALSE if the device is active */ -static void mia_datapipe_inactive_request_cb(gconstpointer data) +static void mia_datapipe_inactivity_event_cb(gconstpointer data) { gboolean inactive = GPOINTER_TO_INT(data); @@ -390,9 +390,9 @@ static void mia_datapipe_inactive_request_cb(gconstpointer data) goto EXIT; } - execute_datapipe(&device_inactive_state_pipe, - GINT_TO_POINTER(inactive), - USE_INDATA, CACHE_OUTDATA); + datapipe_exec_full(&device_inactive_pipe, + GINT_TO_POINTER(inactive), + USE_INDATA, CACHE_OUTDATA); EXIT: return; } @@ -429,22 +429,22 @@ static void mia_datapipe_device_inactive_cb(gconstpointer data) * * @param data proximity sensor state as void pointer */ -static void mia_datapipe_proximity_sensor_cb(gconstpointer data) +static void mia_datapipe_proximity_sensor_actual_cb(gconstpointer data) { - cover_state_t prev = proximity_state; - proximity_state = GPOINTER_TO_INT(data); + cover_state_t prev = proximity_sensor_actual; + proximity_sensor_actual = GPOINTER_TO_INT(data); - if( proximity_state == prev ) + if( proximity_sensor_actual == prev ) goto EXIT; - mce_log(LL_DEBUG, "proximity_state: %s -> %s", + mce_log(LL_DEBUG, "proximity_sensor_actual: %s -> %s", proximity_state_repr(prev), - proximity_state_repr(proximity_state)); + proximity_state_repr(proximity_sensor_actual)); /* generate activity if proximity sensor is * uncovered and there is a incoming call */ - if( proximity_state == COVER_OPEN && + if( proximity_sensor_actual == COVER_OPEN && call_state == CALL_STATE_RINGING ) { mce_log(LL_INFO, "proximity -> uncovered, call = ringing"); mia_generate_activity(); @@ -458,20 +458,20 @@ static void mia_datapipe_proximity_sensor_cb(gconstpointer data) * * @param data inactivity timeout (as void pointer) */ -static void mia_datapipe_inactivity_timeout_cb(gconstpointer data) +static void mia_datapipe_inactivity_delay_cb(gconstpointer data) { - gint prev = inactivity_timeout; - inactivity_timeout = GPOINTER_TO_INT(data); + gint prev = device_inactive_delay; + device_inactive_delay = GPOINTER_TO_INT(data); /* Sanitise timeout */ - if( inactivity_timeout <= 0 ) - inactivity_timeout = 30; + if( device_inactive_delay <= 0 ) + device_inactive_delay = 30; - if( inactivity_timeout == prev ) + if( device_inactive_delay == prev ) goto EXIT; - mce_log(LL_DEBUG, "inactivity_timeout: %d -> %d", - prev, inactivity_timeout); + mce_log(LL_DEBUG, "device_inactive_delay: %d -> %d", + prev, device_inactive_delay); /* Reprogram timer */ mia_timer_start(); @@ -553,7 +553,7 @@ static void mia_datapipe_system_state_cb(gconstpointer data) system_state_repr(prev), system_state_repr(system_state)); - if( prev == MCE_STATE_UNDEF ) + if( prev == MCE_SYSTEM_STATE_UNDEF ) mia_datapipe_check_initial_state(); EXIT: @@ -599,7 +599,7 @@ static void mia_datapipe_interaction_expected_cb(gconstpointer data) /* Generate activity to restart blanking timers if interaction * becomes expected while lockscreen is active. */ if( interaction_expected && - (submode & MCE_TKLOCK_SUBMODE) && + (submode & MCE_SUBMODE_TKLOCK) && display_state_next == MCE_DISPLAY_ON ) { mce_log(LL_DEBUG, "interaction expected; generate activity"); mia_generate_activity(); @@ -623,7 +623,7 @@ static void mia_datapipe_check_initial_state(void) * mce startup are done and the device state * is sufficiently known */ - if( system_state == MCE_STATE_UNDEF ) + if( system_state == MCE_SYSTEM_STATE_UNDEF ) goto EXIT; if( display_state_next == MCE_DISPLAY_UNDEF ) @@ -662,20 +662,20 @@ static datapipe_handler_t mia_datapipe_handlers[] = { // output triggers { - .datapipe = &device_inactive_event_pipe, - .output_cb = mia_datapipe_inactive_request_cb, + .datapipe = &inactivity_event_pipe, + .output_cb = mia_datapipe_inactivity_event_cb, }, { - .datapipe = &device_inactive_state_pipe, + .datapipe = &device_inactive_pipe, .output_cb = mia_datapipe_device_inactive_cb, }, { - .datapipe = &proximity_sensor_pipe, - .output_cb = mia_datapipe_proximity_sensor_cb, + .datapipe = &proximity_sensor_actual_pipe, + .output_cb = mia_datapipe_proximity_sensor_actual_cb, }, { - .datapipe = &inactivity_timeout_pipe, - .output_cb = mia_datapipe_inactivity_timeout_cb, + .datapipe = &inactivity_delay_pipe, + .output_cb = mia_datapipe_inactivity_delay_cb, }, { .datapipe = &submode_pipe, @@ -1178,8 +1178,9 @@ static void mia_timer_start(void) if( device_inactive ) goto EXIT; - mce_log(LL_DEBUG, "inactivity timeout in %d seconds", inactivity_timeout); - mce_hbtimer_set_period(inactivity_timer_hnd, inactivity_timeout * 1000); + mce_log(LL_DEBUG, "inactivity timeout in %d seconds", + device_inactive_delay); + mce_hbtimer_set_period(inactivity_timer_hnd, device_inactive_delay * 1000); mce_hbtimer_start(inactivity_timer_hnd); EXIT: @@ -1202,7 +1203,7 @@ static void mia_timer_init(void) { inactivity_timer_hnd = mce_hbtimer_create("inactivity-timer", - inactivity_timeout * 1000, + device_inactive_delay * 1000, mia_timer_cb, 0); } diff --git a/modules/keypad.c b/modules/keypad.c index 60ccfa3e..86e0744d 100644 --- a/modules/keypad.c +++ b/modules/keypad.c @@ -490,7 +490,7 @@ static void set_simple_backlight_brightness(guint brightness) * * @param data Backlight brightness passed as a gconstpointer */ -static void set_backlight_brightness(gconstpointer data) +static void set_key_backlight_brightness(gconstpointer data) { static gint cached_brightness = -1; gint new_brightness = GPOINTER_TO_INT(data); @@ -541,8 +541,8 @@ static void disable_key_backlight(void) { cancel_key_backlight_timeout(); - execute_datapipe(&key_backlight_pipe, GINT_TO_POINTER(0), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&key_backlight_brightness_pipe, GINT_TO_POINTER(0), + USE_INDATA, CACHE_INDATA); } /** @@ -594,16 +594,16 @@ static void enable_key_backlight(void) cancel_key_backlight_timeout(); /* Only enable the key backlight if the slide is open */ - if (datapipe_get_gint(keyboard_slide_pipe) != COVER_OPEN) + if (datapipe_get_gint(keyboard_slide_state_pipe) != COVER_OPEN) goto EXIT; setup_key_backlight_timeout(); /* If the backlight is off, turn it on */ - if (datapipe_get_guint(key_backlight_pipe) == 0) { - execute_datapipe(&key_backlight_pipe, - GINT_TO_POINTER(backlight_brightness_level_maximum), - USE_INDATA, CACHE_INDATA); + if (datapipe_get_guint(key_backlight_brightness_pipe) == 0) { + datapipe_exec_full(&key_backlight_brightness_pipe, + GINT_TO_POINTER(backlight_brightness_level_maximum), + USE_INDATA, CACHE_INDATA); } EXIT: @@ -615,7 +615,7 @@ static void enable_key_backlight(void) */ static void enable_key_backlight_policy(void) { - cover_state_t kbd_slide_state = datapipe_get_gint(keyboard_slide_pipe); + cover_state_t kbd_slide_state = datapipe_get_gint(keyboard_slide_state_pipe); system_state_t system_state = datapipe_get_gint(system_state_pipe); alarm_ui_state_t alarm_ui_state = datapipe_get_gint(alarm_ui_state_pipe); @@ -633,7 +633,7 @@ static void enable_key_backlight_policy(void) /* Only enable the key backlight in USER state * and when the alarm dialog is visible */ - if ((system_state == MCE_STATE_USER) || + if ((system_state == MCE_SYSTEM_STATE_USER) || ((alarm_ui_state == MCE_ALARM_UI_VISIBLE_INT32) || (alarm_ui_state == MCE_ALARM_UI_RINGING_INT32))) { /* If there's a key backlight timeout active, restart it, @@ -731,10 +731,10 @@ static void device_inactive_trigger(gconstpointer const data) * COVER_OPEN if the keyboard is open, * COVER_CLOSED if the keyboard is closed */ -static void keyboard_slide_trigger(gconstpointer const data) +static void keyboard_slide_state_trigger(gconstpointer const data) { if ((GPOINTER_TO_INT(data) == COVER_OPEN) && - ((mce_get_submode_int32() & MCE_TKLOCK_SUBMODE) == 0)) { + ((mce_get_submode_int32() & MCE_SUBMODE_TKLOCK) == 0)) { enable_key_backlight_policy(); } else { disable_key_backlight(); @@ -746,16 +746,16 @@ static void keyboard_slide_trigger(gconstpointer const data) * * @param data The display stated stored in a pointer */ -static void display_state_trigger(gconstpointer data) +static void display_state_curr_trigger(gconstpointer data) { static display_state_t old_display_state = MCE_DISPLAY_UNDEF; - display_state_t display_state = GPOINTER_TO_INT(data); + display_state_t display_state_curr = GPOINTER_TO_INT(data); - if (old_display_state == display_state) + if (old_display_state == display_state_curr) goto EXIT; /* Disable the key backlight if the display dims */ - switch (display_state) { + switch (display_state_curr) { case MCE_DISPLAY_OFF: case MCE_DISPLAY_LPM_OFF: case MCE_DISPLAY_LPM_ON: @@ -776,7 +776,7 @@ static void display_state_trigger(gconstpointer data) break; } - old_display_state = display_state; + old_display_state = display_state_curr; EXIT: return; @@ -794,7 +794,7 @@ static void system_state_trigger(gconstpointer data) /* If we're changing to another state than USER, * disable the key backlight */ - if (system_state != MCE_STATE_USER) + if (system_state != MCE_SYSTEM_STATE_USER) disable_key_backlight(); } @@ -846,16 +846,16 @@ const gchar *g_module_check_init(GModule *module) (void)module; /* Append triggers/filters to datapipes */ - append_output_trigger_to_datapipe(&system_state_pipe, - system_state_trigger); - append_output_trigger_to_datapipe(&key_backlight_pipe, - set_backlight_brightness); - append_output_trigger_to_datapipe(&device_inactive_state_pipe, - device_inactive_trigger); - append_output_trigger_to_datapipe(&keyboard_slide_pipe, - keyboard_slide_trigger); - append_output_trigger_to_datapipe(&display_state_pipe, - display_state_trigger); + datapipe_add_output_trigger(&system_state_pipe, + system_state_trigger); + datapipe_add_output_trigger(&key_backlight_brightness_pipe, + set_key_backlight_brightness); + datapipe_add_output_trigger(&device_inactive_pipe, + device_inactive_trigger); + datapipe_add_output_trigger(&keyboard_slide_state_pipe, + keyboard_slide_state_trigger); + datapipe_add_output_trigger(&display_state_curr_pipe, + display_state_curr_trigger); /* Get configuration options */ key_backlight_timeout = @@ -945,16 +945,16 @@ void g_module_unload(GModule *module) g_free(engine3_leds_path); /* Remove triggers/filters from datapipes */ - remove_output_trigger_from_datapipe(&display_state_pipe, - display_state_trigger); - remove_output_trigger_from_datapipe(&keyboard_slide_pipe, - keyboard_slide_trigger); - remove_output_trigger_from_datapipe(&device_inactive_state_pipe, - device_inactive_trigger); - remove_output_trigger_from_datapipe(&key_backlight_pipe, - set_backlight_brightness); - remove_output_trigger_from_datapipe(&system_state_pipe, - system_state_trigger); + datapipe_remove_output_trigger(&display_state_curr_pipe, + display_state_curr_trigger); + datapipe_remove_output_trigger(&keyboard_slide_state_pipe, + keyboard_slide_state_trigger); + datapipe_remove_output_trigger(&device_inactive_pipe, + device_inactive_trigger); + datapipe_remove_output_trigger(&key_backlight_brightness_pipe, + set_key_backlight_brightness); + datapipe_remove_output_trigger(&system_state_pipe, + system_state_trigger); /* Remove all timer sources */ cancel_key_backlight_timeout(); diff --git a/modules/led.c b/modules/led.c index 246e580f..edb8ca5f 100644 --- a/modules/led.c +++ b/modules/led.c @@ -293,10 +293,10 @@ static gchar *engine2_leds_path = NULL; static gchar *engine3_leds_path = NULL; /** Cached display state */ -static display_state_t display_state = MCE_DISPLAY_UNDEF; +static display_state_t display_state_curr = MCE_DISPLAY_UNDEF; /** Cached system state */ -static system_state_t system_state = MCE_STATE_UNDEF; +static system_state_t system_state = MCE_SYSTEM_STATE_UNDEF; /** Cached led brightness */ static gint led_brightness = 0; @@ -352,8 +352,8 @@ static void type6_lock_in_cb (void *data, void *aptr) static void type6_revert_cb (void *data, void *aptr); static void type6_deactivate_cb (void *data, void *aptr); static void led_pattern_op (GFunc cb); -static void user_activity_trigger (gconstpointer data); -static void display_state_trigger (gconstpointer data); +static void user_activity_event_trigger (gconstpointer data); +static void display_state_curr_trigger (gconstpointer data); static void led_brightness_trigger (gconstpointer data); static void led_pattern_activate_trigger (gconstpointer data); static void led_pattern_deactivate_trigger (gconstpointer data); @@ -1464,13 +1464,13 @@ static void led_update_active_pattern(void) /* Show pattern with visibility 7 if display is dimmed */ if( new_active_pattern->policy == 7 ) { - if( display_state == MCE_DISPLAY_DIM ) + if( display_state_curr == MCE_DISPLAY_DIM ) break; continue; } /* Acting dead behaviour */ - if (system_state == MCE_STATE_ACTDEAD) { + if (system_state == MCE_SYSTEM_STATE_ACTDEAD) { /* If we're in acting dead, * show patterns with visibility 4 */ @@ -1480,7 +1480,7 @@ static void led_update_active_pattern(void) /* If we're in acting dead * and the display is off, show pattern */ - if (display_off_p(display_state) && + if (display_off_p(display_state_curr) && (new_active_pattern->policy == 2)) break; @@ -1493,7 +1493,7 @@ static void led_update_active_pattern(void) /* If the display is off or in low power mode, * we can use any active pattern */ - if( display_off_p(display_state) ) + if( display_off_p(display_state_curr) ) break; /* If the pattern should be shown with screen on, use it */ @@ -1791,11 +1791,11 @@ static void led_pattern_op(GFunc cb) * * @param data Unused */ -static void user_activity_trigger(gconstpointer data) +static void user_activity_event_trigger(gconstpointer data) { (void)data; // the data is irrelevant - if( display_state == MCE_DISPLAY_ON ) + if( display_state_curr == MCE_DISPLAY_ON ) led_pattern_op(type6_revert_cb); get_monotime(&activity_time); } @@ -1805,24 +1805,24 @@ static void user_activity_trigger(gconstpointer data) * * @param data Unused */ -static void display_state_trigger(gconstpointer data) +static void display_state_curr_trigger(gconstpointer data) { - display_state_t prev = display_state; - display_state = GPOINTER_TO_INT(data); + display_state_t prev = display_state_curr; + display_state_curr = GPOINTER_TO_INT(data); struct timeval tv; - if (prev == display_state) + if (prev == display_state_curr) goto EXIT; - mce_log(LL_DEBUG, "display_state: %s -> %s", + mce_log(LL_DEBUG, "display_state_curr: %s -> %s", display_state_repr(prev), - display_state_repr(display_state)); + display_state_repr(display_state_curr)); get_monotime(&tv); timersub(&tv, &activity_time, &tv); - switch( display_state ) { + switch( display_state_curr ) { case MCE_DISPLAY_ON: if( timercmp(&tv, &activity_limit, <) ) led_pattern_op(type6_deactivate_cb); @@ -2414,9 +2414,9 @@ static gboolean init_lysti_patterns(void) init_combination_rules(); /* Set the LED brightness */ - execute_datapipe(&led_brightness_pipe, - GINT_TO_POINTER(maximum_led_brightness), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&led_brightness_pipe, + GINT_TO_POINTER(maximum_led_brightness), + USE_INDATA, CACHE_INDATA); status = TRUE; @@ -2547,9 +2547,9 @@ static gboolean init_njoy_patterns(void) } /* Set the LED brightness */ - execute_datapipe(&led_brightness_pipe, - GINT_TO_POINTER(maximum_led_brightness), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&led_brightness_pipe, + GINT_TO_POINTER(maximum_led_brightness), + USE_INDATA, CACHE_INDATA); status = TRUE; @@ -2814,9 +2814,9 @@ static gboolean init_hybris_patterns(void) init_combination_rules(); /* Set the LED brightness */ - execute_datapipe(&led_brightness_pipe, - GINT_TO_POINTER(maximum_led_brightness), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&led_brightness_pipe, + GINT_TO_POINTER(maximum_led_brightness), + USE_INDATA, CACHE_INDATA); status = TRUE; @@ -3108,16 +3108,16 @@ static datapipe_handler_t mce_led_datapipe_handlers[] = { // output triggers { - .datapipe = &user_activity_pipe, - .output_cb = user_activity_trigger, + .datapipe = &user_activity_event_pipe, + .output_cb = user_activity_event_trigger, }, { .datapipe = &system_state_pipe, .output_cb = system_state_trigger, }, { - .datapipe = &display_state_pipe, - .output_cb = display_state_trigger, + .datapipe = &display_state_curr_pipe, + .output_cb = display_state_curr_trigger, }, { .datapipe = &led_brightness_pipe, @@ -3240,9 +3240,9 @@ void g_module_unload(GModule *module) sw_breathing_quit(); /* Don't disable the LED on shutdown/reboot/acting dead */ - if ((system_state != MCE_STATE_ACTDEAD) && - (system_state != MCE_STATE_SHUTDOWN) && - (system_state != MCE_STATE_REBOOT)) { + if ((system_state != MCE_SYSTEM_STATE_ACTDEAD) && + (system_state != MCE_SYSTEM_STATE_SHUTDOWN) && + (system_state != MCE_SYSTEM_STATE_REBOOT)) { led_set_active_pattern(0); switch (get_led_type()) { diff --git a/modules/packagekit.c b/modules/packagekit.c index bd3b0803..8746ad80 100644 --- a/modules/packagekit.c +++ b/modules/packagekit.c @@ -82,7 +82,7 @@ static void xpkgkit_logging_cancel_start (void); // DATAPIPE_HANDLERS -static void xpkgkit_datapipe_update_mode_cb(gconstpointer data); +static void xpkgkit_datapipe_osupdate_running_cb(gconstpointer data); static void xpkgkit_datapipe_init (void); static void xpkgkit_datapipe_quit (void); @@ -112,9 +112,9 @@ xpkgkit_set_locked_state(bool locked) xpkgkit_is_locked = locked; mce_log(LL_DEBUG, "packagekit is %slocked", locked ? "" : "not "); - execute_datapipe(&packagekit_locked_pipe, - GINT_TO_POINTER(xpkgkit_is_locked), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&packagekit_locked_pipe, + GINT_TO_POINTER(xpkgkit_is_locked), + USE_INDATA, CACHE_INDATA); EXIT: return; @@ -485,21 +485,21 @@ static void xpkgkit_logging_cancel_start(void) * ========================================================================= */ /** Update mode is active; assume false */ -static bool update_mode = false; +static bool osupdate_running = false; -/** Change notifications for update_mode +/** Change notifications for osupdate_running */ -static void xpkgkit_datapipe_update_mode_cb(gconstpointer data) +static void xpkgkit_datapipe_osupdate_running_cb(gconstpointer data) { - bool prev = update_mode; - update_mode = GPOINTER_TO_INT(data); + bool prev = osupdate_running; + osupdate_running = GPOINTER_TO_INT(data); - if( update_mode == prev ) + if( osupdate_running == prev ) goto EXIT; - mce_log(LL_DEBUG, "update_mode = %d -> %d", prev, update_mode); + mce_log(LL_DEBUG, "osupdate_running = %d -> %d", prev, osupdate_running); - if( update_mode ) { + if( osupdate_running ) { /* When update mode gets activated, we start a systemd * service that will store journal to a persistent file * until the next reboot. */ @@ -515,8 +515,8 @@ static datapipe_handler_t xpkgkit_datapipe_handlers[] = { // output triggers { - .datapipe = &update_mode_pipe, - .output_cb = xpkgkit_datapipe_update_mode_cb, + .datapipe = &osupdate_running_pipe, + .output_cb = xpkgkit_datapipe_osupdate_running_cb, }, // sentinel diff --git a/modules/powersavemode.c b/modules/powersavemode.c index 5bda79dc..8c0c17c7 100644 --- a/modules/powersavemode.c +++ b/modules/powersavemode.c @@ -147,9 +147,9 @@ static void update_power_saving_mode(void) if (active_power_saving_mode != new_power_saving_mode) { active_power_saving_mode = new_power_saving_mode; - (void)execute_datapipe(&power_saving_mode_pipe, - GINT_TO_POINTER(active_power_saving_mode), - USE_INDATA, CACHE_INDATA); + (void)datapipe_exec_full(&power_saving_mode_active_pipe, + GINT_TO_POINTER(active_power_saving_mode), + USE_INDATA, CACHE_INDATA); send_psm_state(NULL); } } @@ -310,12 +310,12 @@ 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); + datapipe_add_output_trigger(&battery_level_pipe, + battery_level_trigger); + datapipe_add_output_trigger(&charger_state_pipe, + charger_state_trigger); + datapipe_add_output_trigger(&thermal_state_pipe, + thermal_state_trigger); /* Power saving mode setting */ /* Since we've set a default, error handling is unnecessary */ @@ -379,12 +379,12 @@ void g_module_unload(GModule *module) mce_psm_quit_dbus(); /* Remove triggers/filters from datapipes */ - remove_output_trigger_from_datapipe(&thermal_state_pipe, - thermal_state_trigger); - remove_output_trigger_from_datapipe(&battery_level_pipe, - battery_level_trigger); - remove_output_trigger_from_datapipe(&charger_state_pipe, - charger_state_trigger); + datapipe_remove_output_trigger(&thermal_state_pipe, + thermal_state_trigger); + datapipe_remove_output_trigger(&battery_level_pipe, + battery_level_trigger); + datapipe_remove_output_trigger(&charger_state_pipe, + charger_state_trigger); return; } diff --git a/modules/proximity.c b/modules/proximity.c index 957e8824..31adff64 100644 --- a/modules/proximity.c +++ b/modules/proximity.c @@ -55,10 +55,10 @@ static call_state_t call_state = CALL_STATE_INVALID; static alarm_ui_state_t alarm_ui_state = MCE_ALARM_UI_INVALID_INT32; /** Cached display state */ -static display_state_t display_state = MCE_DISPLAY_UNDEF; +static display_state_t display_state_curr = MCE_DISPLAY_UNDEF; /** Cached submode state */ -static submode_t submode = MCE_NORMAL_SUBMODE; +static submode_t submode = MCE_SUBMODE_NORMAL; /** Configuration value for use proximity sensor */ static gboolean use_ps_conf_value = MCE_DEFAULT_PROXIMITY_PS_ENABLED; @@ -79,7 +79,7 @@ static guint ps_acts_as_lid_conf_id = 0; static void report_proximity(cover_state_t state) { /* Get current proximity datapipe value */ - cover_state_t old_state = datapipe_get_gint(proximity_sensor_pipe); + cover_state_t old_state = datapipe_get_gint(proximity_sensor_actual_pipe); /* Execute datapipe if state has changed */ @@ -89,9 +89,9 @@ static void report_proximity(cover_state_t state) cover_state_repr(old_state), cover_state_repr(state)); - execute_datapipe(&proximity_sensor_pipe, - GINT_TO_POINTER(state), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&proximity_sensor_actual_pipe, + GINT_TO_POINTER(state), + USE_INDATA, CACHE_INDATA); } } @@ -101,16 +101,16 @@ static void report_proximity(cover_state_t state) */ static void report_lid_input(cover_state_t state) { - cover_state_t old_state = datapipe_get_gint(lid_cover_sensor_pipe); + cover_state_t old_state = datapipe_get_gint(lid_sensor_actual_pipe); if( state != old_state ) { mce_log(LL_CRUCIAL, "state: %s -> %s", cover_state_repr(old_state), cover_state_repr(state)); - execute_datapipe(&lid_cover_sensor_pipe, - GINT_TO_POINTER(state), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&lid_sensor_actual_pipe, + GINT_TO_POINTER(state), + USE_INDATA, CACHE_INDATA); } } @@ -121,17 +121,17 @@ static void report_lid_input(cover_state_t state) */ static void ps_sensorfw_iomon_cb(bool covered) { - cover_state_t proximity_sensor_state = COVER_UNDEF; + cover_state_t proximity_sensor_actual = COVER_UNDEF; if( covered ) - proximity_sensor_state = COVER_CLOSED; + proximity_sensor_actual = COVER_CLOSED; else - proximity_sensor_state = COVER_OPEN; + proximity_sensor_actual = COVER_OPEN; if( ps_acts_as_lid ) - report_lid_input(proximity_sensor_state); + report_lid_input(proximity_sensor_actual); else - report_proximity(proximity_sensor_state); + report_proximity(proximity_sensor_actual); return; } @@ -291,9 +291,9 @@ static void alarm_ui_state_trigger(gconstpointer const data) * * @param data The display state stored in a pointer */ -static void display_state_trigger(gconstpointer data) +static void display_state_curr_trigger(gconstpointer data) { - display_state = GPOINTER_TO_INT(data); + display_state_curr = GPOINTER_TO_INT(data); update_proximity_monitor(); } @@ -325,18 +325,18 @@ const gchar *g_module_check_init(GModule *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(); + display_state_curr = 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); + datapipe_add_input_trigger(&call_state_pipe, + call_state_trigger); + datapipe_add_input_trigger(&alarm_ui_state_pipe, + alarm_ui_state_trigger); + datapipe_add_output_trigger(&display_state_curr_pipe, + display_state_curr_trigger); + datapipe_add_output_trigger(&submode_pipe, + submode_trigger); /* PS enabled setting */ mce_setting_track_bool(MCE_SETTING_PROXIMITY_PS_ENABLED, @@ -382,14 +382,14 @@ void g_module_unload(GModule *module) 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); + datapipe_remove_output_trigger(&display_state_curr_pipe, + display_state_curr_trigger); + datapipe_remove_input_trigger(&alarm_ui_state_pipe, + alarm_ui_state_trigger); + datapipe_remove_input_trigger(&call_state_pipe, + call_state_trigger); + datapipe_remove_output_trigger(&submode_pipe, + submode_trigger); /* Disable proximity monitoring to remove callbacks * to unloaded module */ diff --git a/modules/radiostates.c b/modules/radiostates.c index e96d5396..b92aba47 100644 --- a/modules/radiostates.c +++ b/modules/radiostates.c @@ -358,7 +358,7 @@ static gboolean radio_states_change(gulong states, gulong mask) * and that all callbacks are called; the trigger inside * radiostates.c has already had all its actions performed */ - execute_datapipe(&master_radio_pipe, GINT_TO_POINTER(master), USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&master_radio_enabled_pipe, GINT_TO_POINTER(master), USE_INDATA, CACHE_INDATA); } /* After datapipe execution the radio state should @@ -419,7 +419,7 @@ static gboolean req_radio_states_change_dbus_cb(DBusMessage *const msg) * * @param data The master radio state stored in a pointer */ -static void master_radio_trigger(gconstpointer data) +static void master_radio_enabled_trigger(gconstpointer data) { gulong new_radio_states; @@ -1097,8 +1097,8 @@ const gchar *g_module_check_init(GModule *module) active_radio_states, radio_states); /* Append triggers/filters to datapipes */ - append_output_trigger_to_datapipe(&master_radio_pipe, - master_radio_trigger); + datapipe_add_output_trigger(&master_radio_enabled_pipe, + master_radio_enabled_trigger); /* Add dbus handlers */ mce_radiostates_init_dbus(); @@ -1127,8 +1127,8 @@ void g_module_unload(GModule *module) xconnman_quit(); /* Remove triggers/filters from datapipes */ - remove_output_trigger_from_datapipe(&master_radio_pipe, - master_radio_trigger); + datapipe_remove_output_trigger(&master_radio_enabled_pipe, + master_radio_enabled_trigger); return; } diff --git a/modules/sensor-gestures.c b/modules/sensor-gestures.c index be633015..d7675b7c 100644 --- a/modules/sensor-gestures.c +++ b/modules/sensor-gestures.c @@ -37,7 +37,7 @@ * ========================================================================= */ /** Cached display state */ -static display_state_t display_state = MCE_DISPLAY_UNDEF; +static display_state_t display_state_curr = MCE_DISPLAY_UNDEF; /** Cached alarm ui state */ static alarm_ui_state_t alarm_ui_state = MCE_ALARM_UI_INVALID_INT32; @@ -46,13 +46,13 @@ static alarm_ui_state_t alarm_ui_state = MCE_ALARM_UI_INVALID_INT32; static call_state_t call_state = CALL_STATE_INVALID; /** Cached raw orientation sensor value */ -static orientation_state_t orientation_state_raw = MCE_ORIENTATION_UNDEFINED; +static orientation_state_t orientation_sensor_actual = MCE_ORIENTATION_UNDEFINED; /** Cached delayed orientation sensor value */ -static orientation_state_t orientation_state_eff = MCE_ORIENTATION_UNDEFINED; +static orientation_state_t orientation_sensor_effective = MCE_ORIENTATION_UNDEFINED; -/** Timer id for delayed orientation_state_eff updating */ -static gint orientation_state_eff_id = 0; +/** Timer id for delayed orientation_sensor_effective updating */ +static gint orientation_sensor_effective_id = 0; /** Use of flipover gesture enabled */ static gboolean sg_flipover_gesture_enabled = MCE_DEFAULT_FLIPOVER_GESTURE_ENABLED; @@ -78,10 +78,10 @@ static bool sg_have_incoming_call (void); static void sg_call_state_cb (gconstpointer const data); static void sg_alarm_ui_state_cb (gconstpointer data); -static void sg_display_state_cb (gconstpointer data); -static void sg_orientation_state_update (void); -static gboolean sg_orientation_state_eff_cb (gpointer data); -static void sg_orientation_state_raw_cb (gconstpointer data); +static void sg_display_state_curr_cb (gconstpointer data); +static void sg_orientation_sensor_update(void); +static gboolean sg_orientation_sensor_effective_cb (gpointer data); +static void sg_orientation_sensor_actual_cb (gconstpointer data); static void sg_datapipe_init (void); static void sg_datapipe_quit (void); @@ -139,7 +139,7 @@ static void sg_detect_flipover_gesture(void) static bool primed = false; /* Check display state */ - if( display_state != MCE_DISPLAY_ON ) { + if( display_state_curr != MCE_DISPLAY_ON ) { primed = false; goto EXIT; } @@ -152,17 +152,17 @@ static void sg_detect_flipover_gesture(void) } /* Check for undefined orientation state */ - if( orientation_state_raw == MCE_ORIENTATION_UNDEFINED || - orientation_state_eff == MCE_ORIENTATION_UNDEFINED ) { + if( orientation_sensor_actual == MCE_ORIENTATION_UNDEFINED || + orientation_sensor_effective == MCE_ORIENTATION_UNDEFINED ) { primed = false; goto EXIT; } /* Check effective orientation state */ - if( orientation_state_eff == MCE_ORIENTATION_FACE_UP ) { + if( orientation_sensor_effective == MCE_ORIENTATION_FACE_UP ) { primed = true; } - else if( orientation_state_eff != MCE_ORIENTATION_FACE_DOWN ) { + else if( orientation_sensor_effective != MCE_ORIENTATION_FACE_DOWN ) { // nop } else if( primed ) { @@ -267,21 +267,21 @@ static void sg_alarm_ui_state_cb(gconstpointer data) return; } -/** Handle display_state_pipe notifications +/** Handle display_state_curr_pipe notifications * * @param data The display state stored in a pointer */ -static void sg_display_state_cb(gconstpointer data) +static void sg_display_state_curr_cb(gconstpointer data) { - display_state_t prev = display_state; - display_state = GPOINTER_TO_INT(data); + display_state_t prev = display_state_curr; + display_state_curr = GPOINTER_TO_INT(data); - if( display_state == prev ) + if( display_state_curr == prev ) goto EXIT; mce_log(LL_DEBUG, "display: %s -> %s", display_state_repr(prev), - display_state_repr(display_state)); + display_state_repr(display_state_curr)); sg_detect_flipover_gesture(); @@ -291,17 +291,17 @@ static void sg_display_state_cb(gconstpointer data) /** Update effective orientation state from raw sensor state */ -static void sg_orientation_state_update(void) +static void sg_orientation_sensor_update(void) { - orientation_state_t prev = orientation_state_eff; - orientation_state_eff = orientation_state_raw; + orientation_state_t prev = orientation_sensor_effective; + orientation_sensor_effective = orientation_sensor_actual; - if( orientation_state_eff == prev ) + if( orientation_sensor_effective == prev ) goto EXIT; mce_log(LL_DEBUG, "orient.eff: %s -> %s", orientation_state_repr(prev), - orientation_state_repr(orientation_state_eff)); + orientation_state_repr(orientation_sensor_effective)); sg_detect_flipover_gesture(); @@ -309,44 +309,44 @@ static void sg_orientation_state_update(void) return; } -/** Handle delayed orientation_sensor_pipe notifications +/** Handle delayed orientation_sensor_actual_pipe notifications * * @param data (unused) * * @return FALSE to stop the timer from repeating */ -static gboolean sg_orientation_state_eff_cb(gpointer data) +static gboolean sg_orientation_sensor_effective_cb(gpointer data) { (void)data; - if( !orientation_state_eff_id ) + if( !orientation_sensor_effective_id ) goto EXIT; mce_log(LL_DEBUG, "orient.eff: timer triggered"); - orientation_state_eff_id = 0; + orientation_sensor_effective_id = 0; - sg_orientation_state_update(); + sg_orientation_sensor_update(); EXIT: return FALSE; } -/** Handle orientation_sensor_pipe notifications +/** Handle orientation_sensor_actual_pipe notifications * * @param data The orientation state stored in a pointer */ -static void sg_orientation_state_raw_cb(gconstpointer data) +static void sg_orientation_sensor_actual_cb(gconstpointer data) { - orientation_state_t prev = orientation_state_raw; - orientation_state_raw = GPOINTER_TO_INT(data); + orientation_state_t prev = orientation_sensor_actual; + orientation_sensor_actual = GPOINTER_TO_INT(data); - if( orientation_state_raw == prev ) + if( orientation_sensor_actual == prev ) goto EXIT; mce_log(LL_DEBUG, "orient.raw: %s -> %s", orientation_state_repr(prev), - orientation_state_repr(orientation_state_raw)); + orientation_state_repr(orientation_sensor_actual)); /* Unprime if orientation is unknown */ sg_detect_flipover_gesture(); @@ -361,27 +361,27 @@ static void sg_orientation_state_raw_cb(gconstpointer data) */ /* Remove existing delay timer */ - if( orientation_state_eff_id ) { - g_source_remove(orientation_state_eff_id); - orientation_state_eff_id = 0; + if( orientation_sensor_effective_id ) { + g_source_remove(orientation_sensor_effective_id); + orientation_sensor_effective_id = 0; mce_log(LL_DEBUG, "orient.eff: timer canceled"); } if( prev == MCE_ORIENTATION_UNDEFINED && - orientation_state_raw == MCE_ORIENTATION_FACE_UP ) { + orientation_sensor_actual == MCE_ORIENTATION_FACE_UP ) { /* Invalidate effective sensor value */ - orientation_state_eff = MCE_ORIENTATION_UNDEFINED; + orientation_sensor_effective = MCE_ORIENTATION_UNDEFINED; /* Schedule re-validation after 1000 ms */ - orientation_state_eff_id = - g_timeout_add(1000, sg_orientation_state_eff_cb, 0); + orientation_sensor_effective_id = + g_timeout_add(1000, sg_orientation_sensor_effective_cb, 0); mce_log(LL_DEBUG, "orient.eff: timer started"); } else { /* Update effective sensor value immediately */ - sg_orientation_state_update(); + sg_orientation_sensor_update(); } EXIT: @@ -399,12 +399,12 @@ static datapipe_handler_t sg_datapipe_handlers[] = // output triggers { - .datapipe = &orientation_sensor_pipe, - .output_cb = sg_orientation_state_raw_cb, + .datapipe = &orientation_sensor_actual_pipe, + .output_cb = sg_orientation_sensor_actual_cb, }, { - .datapipe = &display_state_pipe, - .output_cb = sg_display_state_cb, + .datapipe = &display_state_curr_pipe, + .output_cb = sg_display_state_curr_cb, }, { .datapipe = &alarm_ui_state_pipe, diff --git a/modules/usbmode.c b/modules/usbmode.c index cd510407..721deb78 100644 --- a/modules/usbmode.c +++ b/modules/usbmode.c @@ -56,7 +56,7 @@ static void usbmode_dbus_quit (void); * DATAPIPE_HANDLERS * ========================================================================= */ -static void usbmode_datapipe_usbmoded_available_cb (gconstpointer data); +static void usbmode_datapipe_usbmoded_service_state_cb (gconstpointer data); static void usbmode_datapipe_init (void); static void usbmode_datapipe_quit (void); @@ -142,7 +142,7 @@ usbmode_cable_state_lookup(const char *mode) return state; } -/** Update usb_cable_pipe according tomatch USB mode reported by usb_moded +/** Update usb_cable_state_pipe according tomatch USB mode reported by usb_moded * * @param mode Name of USB mode as reported by usb_moded */ @@ -151,7 +151,7 @@ usbmode_cable_state_update(const char *mode) { mce_log(LL_NOTICE, "usb mode: %s", mode); - usb_cable_state_t prev = datapipe_get_gint(usb_cable_pipe); + usb_cable_state_t prev = datapipe_get_gint(usb_cable_state_pipe); usb_cable_state_t curr = usbmode_cable_state_lookup(mode); if( prev == curr ) @@ -161,8 +161,8 @@ usbmode_cable_state_update(const char *mode) usb_cable_state_repr(prev), usb_cable_state_repr(curr)); - execute_datapipe(&usb_cable_pipe, GINT_TO_POINTER(curr), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&usb_cable_state_pipe, GINT_TO_POINTER(curr), + USE_INDATA, CACHE_INDATA); EXIT: return; } @@ -307,27 +307,27 @@ static void usbmode_dbus_quit(void) * DATAPIPE_HANDLERS * ========================================================================= */ -static service_state_t usbmoded_available = SERVICE_STATE_UNDEF; +static service_state_t usbmoded_service_state = SERVICE_STATE_UNDEF; -/** Handle display_state_req_pipe notifications +/** Handle display_state_request_pipe notifications * * This is where display state transition starts * * @param data Requested display_state_t (as void pointer) */ -static void usbmode_datapipe_usbmoded_available_cb(gconstpointer data) +static void usbmode_datapipe_usbmoded_service_state_cb(gconstpointer data) { - service_state_t prev = usbmoded_available; - usbmoded_available = GPOINTER_TO_INT(data); + service_state_t prev = usbmoded_service_state; + usbmoded_service_state = GPOINTER_TO_INT(data); - if( usbmoded_available == prev ) + if( usbmoded_service_state == prev ) goto EXIT; - mce_log(LL_NOTICE, "usbmoded_available = %s -> %s", + mce_log(LL_NOTICE, "usbmoded_service_state = %s -> %s", service_state_repr(prev), - service_state_repr(usbmoded_available)); + service_state_repr(usbmoded_service_state)); - if( usbmoded_available == SERVICE_STATE_RUNNING ) + if( usbmoded_service_state == SERVICE_STATE_RUNNING ) usbmode_dbus_query_start(); else usbmode_dbus_query_cancel(); @@ -341,8 +341,8 @@ static datapipe_handler_t usbmode_datapipe_handlers[] = { // output triggers { - .datapipe = &usbmoded_available_pipe, - .output_cb = usbmode_datapipe_usbmoded_available_cb, + .datapipe = &usbmoded_service_state_pipe, + .output_cb = usbmode_datapipe_usbmoded_service_state_cb, }, // sentinel diff --git a/powerkey.c b/powerkey.c index c7fb2793..bff368a3 100644 --- a/powerkey.c +++ b/powerkey.c @@ -528,13 +528,13 @@ static void pwrkey_setting_quit (void); * reacting to state changes / input from other mce modules * ------------------------------------------------------------------------- */ -static void pwrkey_datapipes_keypress_cb(gconstpointer const data); -static void pwrkey_datapipe_ngfd_available_cb(gconstpointer data); +static void pwrkey_datapipes_keypress_event_cb(gconstpointer const data); +static void pwrkey_datapipe_ngfd_service_state_cb(gconstpointer data); static void pwrkey_datapipe_system_state_cb(gconstpointer data); -static void pwrkey_datapipe_display_state_cb(gconstpointer data); +static void pwrkey_datapipe_display_state_curr_cb(gconstpointer data); static void pwrkey_datapipe_display_state_next_cb(gconstpointer data); -static void pwrkey_datapipe_lid_cover_policy_cb(gconstpointer data); -static void pwrkey_datapipe_proximity_sensor_cb(gconstpointer data); +static void pwrkey_datapipe_lid_sensor_filtered_cb(gconstpointer data); +static void pwrkey_datapipe_proximity_sensor_actual_cb(gconstpointer data); static void pwrkey_datapipe_call_state_cb(gconstpointer data); static void pwrkey_datapipe_alarm_ui_state_cb(gconstpointer data); @@ -616,22 +616,22 @@ static bool pwrkey_delete_flagfile(const char *path) * ========================================================================= */ /** System state; is undefined at bootup, can't assume anything */ -static system_state_t system_state = MCE_STATE_UNDEF; +static system_state_t system_state = MCE_SYSTEM_STATE_UNDEF; /** Current display state; undefined initially, can't assume anything */ -static display_state_t display_state = MCE_DISPLAY_UNDEF; +static display_state_t display_state_curr = MCE_DISPLAY_UNDEF; /** Next Display state; undefined initially, can't assume anything */ static display_state_t display_state_next = MCE_DISPLAY_UNDEF; /** Lid cover policy state; assume unknown */ -static cover_state_t lid_cover_policy_state = COVER_UNDEF; +static cover_state_t lid_sensor_filtered = COVER_UNDEF; /** Actual proximity state; assume not covered */ -static cover_state_t proximity_state_actual = COVER_OPEN; +static cover_state_t proximity_sensor_actual = COVER_OPEN; /** NGFD availability */ -static service_state_t ngfd_available = SERVICE_STATE_UNDEF; +static service_state_t ngfd_service_state = SERVICE_STATE_UNDEF; /** Cached alarm ui state */ static alarm_ui_state_t alarm_ui_state = MCE_ALARM_UI_OFF_INT32; @@ -640,7 +640,7 @@ static alarm_ui_state_t alarm_ui_state = MCE_ALARM_UI_OFF_INT32; static call_state_t call_state = CALL_STATE_NONE; /** devicelock dbus name is reserved; assume unknown */ -static service_state_t devicelock_available = SERVICE_STATE_UNDEF; +static service_state_t devicelock_service_state = SERVICE_STATE_UNDEF; /** Use powerkey for blanking during incoming calls */ static bool pwrkey_ignore_incoming_call = false; @@ -673,8 +673,8 @@ pwrkey_ps_override_evaluate(void) } /* If neither sensor is not covered, just reset the counter */ - if( proximity_state_actual != COVER_CLOSED && - lid_cover_policy_state != COVER_CLOSED ) { + if( proximity_sensor_actual != COVER_CLOSED && + lid_sensor_filtered != COVER_CLOSED ) { t_last = 0, count = 0; goto EXIT; } @@ -707,24 +707,24 @@ pwrkey_ps_override_evaluate(void) goto EXIT; } - if( proximity_state_actual == COVER_CLOSED ) { + if( proximity_sensor_actual == COVER_CLOSED ) { mce_log(LL_CRIT, "assuming stuck proximity sensor;" " faking uncover event"); /* Force cached proximity state to "open" */ - execute_datapipe(&proximity_sensor_pipe, - GINT_TO_POINTER(COVER_OPEN), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&proximity_sensor_actual_pipe, + GINT_TO_POINTER(COVER_OPEN), + USE_INDATA, CACHE_INDATA); } - if( lid_cover_policy_state == COVER_CLOSED ) { + if( lid_sensor_filtered == COVER_CLOSED ) { mce_log(LL_CRIT, "assuming stuck lid sensor;" " resetting validation data"); /* Reset lid sensor validation data */ - execute_datapipe(&lid_sensor_is_working_pipe, - GINT_TO_POINTER(false), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&lid_sensor_is_working_pipe, + GINT_TO_POINTER(false), + USE_INDATA, CACHE_INDATA); } t_last = 0, count = 0; @@ -751,7 +751,7 @@ pwrkey_action_shutdown(void) submode_t submode = mce_get_submode_int32(); /* Do not shutdown if the tklock is active */ - if( submode & MCE_TKLOCK_SUBMODE ) + if( submode & MCE_SUBMODE_TKLOCK ) goto EXIT; mce_log(LL_DEVEL, "Requesting shutdown"); @@ -764,11 +764,11 @@ pwrkey_action_shutdown(void) static void pwrkey_action_tklock(void) { - lock_state_t request = LOCK_ON; - mce_log(LL_DEBUG, "Requesting tklock=%s", lock_state_repr(request)); - execute_datapipe(&tk_lock_pipe, - GINT_TO_POINTER(request), - USE_INDATA, CACHE_INDATA); + tklock_request_t request = TKLOCK_REQUEST_ON; + mce_log(LL_DEBUG, "Requesting tklock=%s", tklock_request_repr(request)); + datapipe_exec_full(&tklock_request_pipe, + GINT_TO_POINTER(request), + USE_INDATA, CACHE_INDATA); } static void @@ -784,21 +784,21 @@ pwrkey_action_tkunlock(void) goto EXIT; } - lock_state_t request = LOCK_OFF; + tklock_request_t request = TKLOCK_REQUEST_OFF; /* Even if powerkey actions are allowed to work while proximity * sensor is covered, we must not deactivatie the lockscreen */ - if( proximity_state_actual != COVER_OPEN ) { + if( proximity_sensor_actual != COVER_OPEN ) { mce_log(LL_DEBUG, "Proximity sensor %s; rejecting tklock=%s", - proximity_state_repr(proximity_state_actual), - lock_state_repr(request)); + proximity_state_repr(proximity_sensor_actual), + tklock_request_repr(request)); goto EXIT; } - mce_log(LL_DEBUG, "Requesting tklock=%s", lock_state_repr(request)); - execute_datapipe(&tk_lock_pipe, - GINT_TO_POINTER(request), - USE_INDATA, CACHE_INDATA); + mce_log(LL_DEBUG, "Requesting tklock=%s", tklock_request_repr(request)); + datapipe_exec_full(&tklock_request_pipe, + GINT_TO_POINTER(request), + USE_INDATA, CACHE_INDATA); EXIT: return; } @@ -840,7 +840,7 @@ pwrkey_action_unblank(void) goto EXIT; } - if( proximity_state_actual != COVER_OPEN ) { + if( proximity_sensor_actual != COVER_OPEN ) { mce_log(LL_DEVEL, "skip unblank; proximity covered/unknown"); goto EXIT; } @@ -862,17 +862,17 @@ pwrkey_action_devlock(void) static const char object[] = DEVICELOCK_REQUEST_PATH; static const char interface[] = DEVICELOCK_REQUEST_IF; static const char method[] = "setState"; - dbus_int32_t request = DEVICE_LOCK_LOCKED; + dbus_int32_t request = DEVICELOCK_STATE_LOCKED; - if( devicelock_available != SERVICE_STATE_RUNNING ) { + if( devicelock_service_state != SERVICE_STATE_RUNNING ) { mce_log(LL_WARN, "devicelock service state is %s; skip %s request", - service_state_repr(devicelock_available), - device_lock_state_repr(request)); + service_state_repr(devicelock_service_state), + devicelock_state_repr(request)); goto EXIT; } mce_log(LL_DEBUG, "Requesting devicelock=%s", - device_lock_state_repr(request)); + devicelock_state_repr(request)); dbus_send(service, object, interface, method, 0, DBUS_TYPE_INT32, &request, @@ -1126,11 +1126,11 @@ pwrkey_gestures_allowed(void) default: case DBLTAP_ENABLE_NO_PROXIMITY: - if( lid_cover_policy_state == COVER_CLOSED ) { + if( lid_sensor_filtered == COVER_CLOSED ) { mce_log(LL_DEVEL, "[gesture] ignored due to lid=closed"); goto EXIT; } - if( proximity_state_actual == COVER_CLOSED ) { + if( proximity_sensor_actual == COVER_CLOSED ) { mce_log(LL_DEVEL, "[gesture] ignored due to proximity"); goto EXIT; } @@ -1138,8 +1138,8 @@ pwrkey_gestures_allowed(void) } switch( system_state ) { - case MCE_STATE_USER: - case MCE_STATE_ACTDEAD: + case MCE_SYSTEM_STATE_USER: + case MCE_SYSTEM_STATE_ACTDEAD: break; default: mce_log(LL_DEVEL, "[gesture] ignored due to system state"); @@ -1225,21 +1225,21 @@ pwrkey_actions_do_long_press(void) /* The action configuration applies only in the USER mode */ switch( system_state ) { - case MCE_STATE_SHUTDOWN: - case MCE_STATE_REBOOT: + case MCE_SYSTEM_STATE_SHUTDOWN: + case MCE_SYSTEM_STATE_REBOOT: /* Ignore if we're already shutting down/rebooting */ break; - case MCE_STATE_ACTDEAD: + case MCE_SYSTEM_STATE_ACTDEAD: /* Activate power on led pattern and power up to user mode*/ mce_log(LL_DEBUG, "activate MCE_LED_PATTERN_POWER_ON"); - execute_datapipe_output_triggers(&led_pattern_activate_pipe, - MCE_LED_PATTERN_POWER_ON, - USE_INDATA); + datapipe_exec_output_triggers(&led_pattern_activate_pipe, + MCE_LED_PATTERN_POWER_ON, + USE_INDATA); mce_dsme_request_powerup(); break; - case MCE_STATE_USER: + case MCE_SYSTEM_STATE_USER: /* Apply configured actions */ pwrkey_mask_execute(pwrkey_actions_now->mask_long); break; @@ -1753,7 +1753,7 @@ static void pwrkey_stm_store_initial_state(void) { /* Cache display state */ - pwrkey_stm_display_state = display_state; + pwrkey_stm_display_state = display_state_curr; /* MCE_DISPLAY_OFF requests must be queued only * from fully powered up display states. @@ -1848,13 +1848,13 @@ pwrkey_stm_ignore_action(void) /* fall through */ default: case PWRKEY_ENABLE_NO_PROXIMITY: - if( lid_cover_policy_state == COVER_CLOSED ) { + if( lid_sensor_filtered == COVER_CLOSED ) { mce_log(LL_DEVEL, "[powerkey] ignored due to lid"); ignore_powerkey = true; goto EXIT; } - if( proximity_state_actual == COVER_CLOSED ) { + if( proximity_sensor_actual == COVER_CLOSED ) { mce_log(LL_DEVEL, "[powerkey] ignored due to proximity"); ignore_powerkey = true; goto EXIT; @@ -1924,9 +1924,9 @@ homekey_stm_set_state(homekey_stm_t state) case HOMEKEY_STM_WAIT_UNBLANK: /* Check if policy allows display unblanking */ - if( proximity_state_actual != COVER_OPEN ) { + if( proximity_sensor_actual != COVER_OPEN ) { mce_log(LL_DEBUG, "Proximity sensor %s; skip unblank", - proximity_state_repr(proximity_state_actual)); + proximity_state_repr(proximity_sensor_actual)); break; } @@ -1971,7 +1971,7 @@ homekey_stm_exec_step(void) case HOMEKEY_STM_WAIT_UNBLANK: if( display_state_next != MCE_DISPLAY_ON ) homekey_stm_set_state(HOMEKEY_STM_WAIT_RELEASE); - else if( display_state == MCE_DISPLAY_ON ) + else if( display_state_curr == MCE_DISPLAY_ON ) homekey_stm_set_state(HOMEKEY_STM_SEND_SIGNAL); break; @@ -2145,8 +2145,8 @@ static gboolean pwrkey_dbus_ignore_incoming_call_cb(DBusMessage *const req) /* Make also callstate plugin ignore incoming calls. This * should lead to call_state changing from RINGING to ACTIVE * or NONE depending on whether there are other calls or not. */ - execute_datapipe(&ignore_incoming_call_pipe, GINT_TO_POINTER(true), - USE_INDATA, DONT_CACHE_INDATA); + datapipe_exec_full(&ignore_incoming_call_event_pipe, GINT_TO_POINTER(true), + USE_INDATA, DONT_CACHE_INDATA); } if( !dbus_message_get_no_reply(req) ) { @@ -2759,17 +2759,17 @@ static void pwrkey_datapipe_system_state_cb(gconstpointer data) * @param data display state (as void pointer) */ static void -pwrkey_datapipe_display_state_cb(gconstpointer data) +pwrkey_datapipe_display_state_curr_cb(gconstpointer data) { - display_state_t prev = display_state; - display_state = GPOINTER_TO_INT(data); + display_state_t prev = display_state_curr; + display_state_curr = GPOINTER_TO_INT(data); - if( display_state == prev ) + if( display_state_curr == prev ) goto EXIT; - mce_log(LL_DEBUG, "display_state = %s -> %s", + mce_log(LL_DEBUG, "display_state_curr = %s -> %s", display_state_repr(prev), - display_state_repr(display_state)); + display_state_repr(display_state_curr)); homekey_stm_eval_state(); @@ -2777,7 +2777,7 @@ pwrkey_datapipe_display_state_cb(gconstpointer data) return; } -/** Pre-change notifications for display_state +/** Pre-change notifications for display_state_curr */ static void pwrkey_datapipe_display_state_next_cb(gconstpointer data) { @@ -2798,63 +2798,63 @@ static void pwrkey_datapipe_display_state_next_cb(gconstpointer data) } -/** Change notifications from lid_cover_policy_pipe +/** Change notifications from lid_sensor_filtered_pipe */ -static void pwrkey_datapipe_lid_cover_policy_cb(gconstpointer data) +static void pwrkey_datapipe_lid_sensor_filtered_cb(gconstpointer data) { - cover_state_t prev = lid_cover_policy_state; - lid_cover_policy_state = GPOINTER_TO_INT(data); + cover_state_t prev = lid_sensor_filtered; + lid_sensor_filtered = GPOINTER_TO_INT(data); - if( lid_cover_policy_state == prev ) + if( lid_sensor_filtered == prev ) goto EXIT; - mce_log(LL_DEBUG, "lid_cover_policy_state = %s -> %s", + mce_log(LL_DEBUG, "lid_sensor_filtered = %s -> %s", cover_state_repr(prev), - cover_state_repr(lid_cover_policy_state)); + cover_state_repr(lid_sensor_filtered)); EXIT: return; } -/** Change notifications for proximity_state_actual +/** Change notifications for proximity_sensor_actual */ -static void pwrkey_datapipe_proximity_sensor_cb(gconstpointer data) +static void pwrkey_datapipe_proximity_sensor_actual_cb(gconstpointer data) { - cover_state_t prev = proximity_state_actual; - proximity_state_actual = GPOINTER_TO_INT(data); + cover_state_t prev = proximity_sensor_actual; + proximity_sensor_actual = GPOINTER_TO_INT(data); - if( proximity_state_actual == COVER_UNDEF ) - proximity_state_actual = COVER_OPEN; + if( proximity_sensor_actual == COVER_UNDEF ) + proximity_sensor_actual = COVER_OPEN; - if( proximity_state_actual == prev ) + if( proximity_sensor_actual == prev ) goto EXIT; - mce_log(LL_DEBUG, "proximity_state_actual = %s -> %s", + mce_log(LL_DEBUG, "proximity_sensor_actual = %s -> %s", proximity_state_repr(prev), - proximity_state_repr(proximity_state_actual)); + proximity_state_repr(proximity_sensor_actual)); EXIT: return; } -/** Handle ngfd_available notifications +/** Handle ngfd_service_state notifications * * @param data service availability (as void pointer) */ static void -pwrkey_datapipe_ngfd_available_cb(gconstpointer data) +pwrkey_datapipe_ngfd_service_state_cb(gconstpointer data) { - service_state_t prev = ngfd_available; - ngfd_available = GPOINTER_TO_INT(data); + service_state_t prev = ngfd_service_state; + ngfd_service_state = GPOINTER_TO_INT(data); - if( ngfd_available == prev ) + if( ngfd_service_state == prev ) goto EXIT; - mce_log(LL_NOTICE, "ngfd_available = %s -> %s", + mce_log(LL_NOTICE, "ngfd_service_state = %s -> %s", service_state_repr(prev), - service_state_repr(ngfd_available)); + service_state_repr(ngfd_service_state)); - if( ngfd_available != SERVICE_STATE_RUNNING ) + if( ngfd_service_state != SERVICE_STATE_RUNNING ) xngf_delete_client(); EXIT: @@ -2867,7 +2867,7 @@ pwrkey_datapipe_ngfd_available_cb(gconstpointer data) * @param data A pointer to the input_event struct */ static void -pwrkey_datapipes_keypress_cb(gconstpointer const data) +pwrkey_datapipes_keypress_event_cb(gconstpointer const data) { /* Faulty/aged physical power key buttons can generate * bursts of press and release events that are then @@ -3024,19 +3024,19 @@ pwrkey_datapipe_alarm_ui_state_cb(gconstpointer data) return; } -/** Change notifications for devicelock_available +/** Change notifications for devicelock_service_state */ -static void pwrkey_datapipe_devicelock_available_cb(gconstpointer data) +static void pwrkey_datapipe_devicelock_service_state_cb(gconstpointer data) { - service_state_t prev = devicelock_available; - devicelock_available = GPOINTER_TO_INT(data); + service_state_t prev = devicelock_service_state; + devicelock_service_state = GPOINTER_TO_INT(data); - if( devicelock_available == prev ) + if( devicelock_service_state == prev ) goto EXIT; - mce_log(LL_DEBUG, "devicelock_available = %s -> %s", + mce_log(LL_DEBUG, "devicelock_service_state = %s -> %s", service_state_repr(prev), - service_state_repr(devicelock_available)); + service_state_repr(devicelock_service_state)); /* no immediate action, but see pwrkey_action_devlock() */ @@ -3049,33 +3049,33 @@ static datapipe_handler_t pwrkey_datapipe_handlers[] = { // input triggers { - .datapipe = &keypress_pipe, - .input_cb = pwrkey_datapipes_keypress_cb, + .datapipe = &keypress_event_pipe, + .input_cb = pwrkey_datapipes_keypress_event_cb, }, // output triggers { - .datapipe = &ngfd_available_pipe, - .output_cb = pwrkey_datapipe_ngfd_available_cb, + .datapipe = &ngfd_service_state_pipe, + .output_cb = pwrkey_datapipe_ngfd_service_state_cb, }, { .datapipe = &system_state_pipe, .output_cb = pwrkey_datapipe_system_state_cb, }, { - .datapipe = &display_state_pipe, - .output_cb = pwrkey_datapipe_display_state_cb, + .datapipe = &display_state_curr_pipe, + .output_cb = pwrkey_datapipe_display_state_curr_cb, }, { .datapipe = &display_state_next_pipe, .output_cb = pwrkey_datapipe_display_state_next_cb, }, { - .datapipe = &lid_cover_policy_pipe, - .output_cb = pwrkey_datapipe_lid_cover_policy_cb, + .datapipe = &lid_sensor_filtered_pipe, + .output_cb = pwrkey_datapipe_lid_sensor_filtered_cb, }, { - .datapipe = &proximity_sensor_pipe, - .output_cb = pwrkey_datapipe_proximity_sensor_cb, + .datapipe = &proximity_sensor_actual_pipe, + .output_cb = pwrkey_datapipe_proximity_sensor_actual_cb, }, { .datapipe = &alarm_ui_state_pipe, @@ -3086,8 +3086,8 @@ static datapipe_handler_t pwrkey_datapipe_handlers[] = .output_cb = pwrkey_datapipe_call_state_cb, }, { - .datapipe = &devicelock_available_pipe, - .output_cb = pwrkey_datapipe_devicelock_available_cb, + .datapipe = &devicelock_service_state_pipe, + .output_cb = pwrkey_datapipe_devicelock_service_state_cb, }, // sentinel { @@ -3174,7 +3174,7 @@ xngf_create_client(void) goto EXIT; } - if( ngfd_available != SERVICE_STATE_RUNNING ) { + if( ngfd_service_state != SERVICE_STATE_RUNNING ) { mce_log(LL_WARN, "can't use ngfd - service not running"); goto EXIT; } diff --git a/tests/ut/ut_display.c b/tests/ut/ut_display.c index b2b4f668..b834ed5a 100644 --- a/tests/ut/ut_display.c +++ b/tests/ut/ut_display.c @@ -1221,7 +1221,7 @@ gboolean, waitfb_start, (waitfb_t *self)) * During test execution, the module is not loaded and so the filter is * implemented as part of stub code here. * - * TODO: bug in filter-brightness-simple.c? display_state is never changed. + * TODO: bug in filter-brightness-simple.c? display_state_curr is never changed. */ static gpointer stub__display_brightness_filter(gpointer data) { @@ -1262,124 +1262,124 @@ static void stub_setup_checked(void) stub__main_loop = g_main_loop_new(NULL, TRUE); /* Setup all datapipes - copy & paste from mce's main() */ - setup_datapipe(&system_state_pipe, READ_WRITE, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(MCE_STATE_UNDEF)); - setup_datapipe(&master_radio_pipe, READ_WRITE, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(0)); - setup_datapipe(&call_state_pipe, READ_WRITE, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(CALL_STATE_NONE)); - setup_datapipe(&call_type_pipe, READ_WRITE, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(NORMAL_CALL)); - setup_datapipe(&alarm_ui_state_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(MCE_ALARM_UI_INVALID_INT32)); - setup_datapipe(&submode_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(MCE_NORMAL_SUBMODE)); - setup_datapipe(&display_state_pipe, READ_WRITE, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(MCE_DISPLAY_UNDEF)); - setup_datapipe(&display_state_req_pipe, READ_WRITE, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(MCE_DISPLAY_UNDEF)); - setup_datapipe(&display_brightness_pipe, READ_WRITE, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(0)); - setup_datapipe(&led_brightness_pipe, READ_WRITE, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(0)); - setup_datapipe(&led_pattern_activate_pipe, READ_ONLY, FREE_CACHE, - 0, NULL); - setup_datapipe(&led_pattern_deactivate_pipe, READ_ONLY, FREE_CACHE, - 0, NULL); - setup_datapipe(&key_backlight_pipe, READ_WRITE, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(0)); - setup_datapipe(&keypress_pipe, READ_ONLY, FREE_CACHE, - sizeof (struct input_event), NULL); - setup_datapipe(&touchscreen_pipe, READ_ONLY, FREE_CACHE, - sizeof (struct input_event), NULL); - setup_datapipe(&device_inactive_state_pipe, READ_WRITE, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(FALSE)); - setup_datapipe(&lockkey_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(0)); - setup_datapipe(&keyboard_slide_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(0)); - setup_datapipe(&lid_cover_input_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(0)); - setup_datapipe(&lens_cover_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(0)); - setup_datapipe(&proximity_sensor_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(0)); - setup_datapipe(&tk_lock_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(LOCK_UNDEF)); - setup_datapipe(&charger_state_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(0)); - setup_datapipe(&battery_status_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(BATTERY_STATUS_UNDEF)); - setup_datapipe(&battery_level_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(100)); - setup_datapipe(&camera_button_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(CAMERA_BUTTON_UNDEF)); - setup_datapipe(&inactivity_timeout_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(DEFAULT_INACTIVITY_TIMEOUT)); - setup_datapipe(&audio_route_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(AUDIO_ROUTE_UNDEF)); - setup_datapipe(&usb_cable_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(0)); - setup_datapipe(&jack_sense_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(0)); - setup_datapipe(&power_saving_mode_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(0)); - setup_datapipe(&thermal_state_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(THERMAL_STATE_UNDEF)); - setup_datapipe(&heartbeat_pipe, READ_ONLY, DONT_FREE_CACHE, - 0, GINT_TO_POINTER(0)); - - append_filter_to_datapipe(&display_brightness_pipe, - stub__display_brightness_filter); + datapipe_init(&system_state_pipe, READ_WRITE, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(MCE_SYSTEM_STATE_UNDEF)); + datapipe_init(&master_radio_enabled_pipe, READ_WRITE, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(0)); + datapipe_init(&call_state_pipe, READ_WRITE, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(CALL_STATE_NONE)); + datapipe_init(&call_type_pipe, READ_WRITE, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(CALL_TYPE_NORMAL)); + datapipe_init(&alarm_ui_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(MCE_ALARM_UI_INVALID_INT32)); + datapipe_init(&submode_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(MCE_SUBMODE_NORMAL)); + datapipe_init(&display_state_curr_pipe, READ_WRITE, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(MCE_DISPLAY_UNDEF)); + datapipe_init(&display_state_request_pipe, READ_WRITE, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(MCE_DISPLAY_UNDEF)); + datapipe_init(&display_brightness_pipe, READ_WRITE, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(0)); + datapipe_init(&led_brightness_pipe, READ_WRITE, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(0)); + datapipe_init(&led_pattern_activate_pipe, READ_ONLY, FREE_CACHE, + 0, NULL); + datapipe_init(&led_pattern_deactivate_pipe, READ_ONLY, FREE_CACHE, + 0, NULL); + datapipe_init(&key_backlight_brightness_pipe, READ_WRITE, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(0)); + datapipe_init(&keypress_event_pipe, READ_ONLY, FREE_CACHE, + sizeof (struct input_event), NULL); + datapipe_init(&touchscreen_event_pipe, READ_ONLY, FREE_CACHE, + sizeof (struct input_event), NULL); + datapipe_init(&device_inactive_pipe, READ_WRITE, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(FALSE)); + datapipe_init(&lockkey_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(0)); + datapipe_init(&keyboard_slide_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(0)); + datapipe_init(&lid_sensor_actual_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(0)); + datapipe_init(&lens_cover_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(0)); + datapipe_init(&proximity_sensor_actual_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(0)); + datapipe_init(&tklock_request_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(TKLOCK_REQUEST_UNDEF)); + datapipe_init(&charger_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(0)); + datapipe_init(&battery_status_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(BATTERY_STATUS_UNDEF)); + datapipe_init(&battery_level_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(100)); + datapipe_init(&camera_button_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(CAMERA_BUTTON_UNDEF)); + datapipe_init(&inactivity_delay_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(DEFAULT_INACTIVITY_DELAY)); + datapipe_init(&audio_route_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(AUDIO_ROUTE_UNDEF)); + datapipe_init(&usb_cable_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(0)); + datapipe_init(&jack_sense_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(0)); + datapipe_init(&power_saving_mode_active_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(0)); + datapipe_init(&thermal_state_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(THERMAL_STATE_UNDEF)); + datapipe_init(&heartbeat_event_pipe, READ_ONLY, DONT_FREE_CACHE, + 0, GINT_TO_POINTER(0)); + + datapipe_add_filter(&display_brightness_pipe, + stub__display_brightness_filter); g_module_check_init(NULL); - append_output_trigger_to_datapipe(&display_state_pipe, - ut_display_state_pipe_trigger_transition_recheck); + datapipe_add_output_trigger(&display_state_curr_pipe, + ut_display_state_pipe_trigger_transition_recheck); } static void stub_teardown_checked(void) { - remove_output_trigger_from_datapipe(&display_state_pipe, - ut_display_state_pipe_trigger_transition_recheck); + datapipe_remove_output_trigger(&display_state_curr_pipe, + ut_display_state_pipe_trigger_transition_recheck); g_module_unload(NULL); - remove_filter_from_datapipe(&display_brightness_pipe, - stub__display_brightness_filter); + datapipe_remove_filter(&display_brightness_pipe, + stub__display_brightness_filter); /* Free all datapipes - copy & paste from mce's main() */ - free_datapipe(&thermal_state_pipe); - free_datapipe(&power_saving_mode_pipe); - free_datapipe(&jack_sense_pipe); - free_datapipe(&usb_cable_pipe); - free_datapipe(&audio_route_pipe); - free_datapipe(&inactivity_timeout_pipe); - free_datapipe(&battery_level_pipe); - free_datapipe(&battery_status_pipe); - free_datapipe(&charger_state_pipe); - free_datapipe(&tk_lock_pipe); - free_datapipe(&proximity_sensor_pipe); - free_datapipe(&lens_cover_pipe); - free_datapipe(&lid_cover_input_pipe); - free_datapipe(&keyboard_slide_pipe); - free_datapipe(&lockkey_pipe); - free_datapipe(&device_inactive_state_pipe); - free_datapipe(&touchscreen_pipe); - free_datapipe(&keypress_pipe); - free_datapipe(&key_backlight_pipe); - free_datapipe(&led_pattern_deactivate_pipe); - free_datapipe(&led_pattern_activate_pipe); - free_datapipe(&led_brightness_pipe); - free_datapipe(&display_brightness_pipe); - free_datapipe(&display_state_pipe); - free_datapipe(&submode_pipe); - free_datapipe(&alarm_ui_state_pipe); - free_datapipe(&call_type_pipe); - free_datapipe(&call_state_pipe); - free_datapipe(&master_radio_pipe); - free_datapipe(&system_state_pipe); - free_datapipe(&heartbeat_pipe); + datapipe_free(&thermal_state_pipe); + datapipe_free(&power_saving_mode_active_pipe); + datapipe_free(&jack_sense_state_pipe); + datapipe_free(&usb_cable_state_pipe); + datapipe_free(&audio_route_pipe); + datapipe_free(&inactivity_delay_pipe); + datapipe_free(&battery_level_pipe); + datapipe_free(&battery_status_pipe); + datapipe_free(&charger_state_pipe); + datapipe_free(&tklock_request_pipe); + datapipe_free(&proximity_sensor_actual_pipe); + datapipe_free(&lens_cover_state_pipe); + datapipe_free(&lid_sensor_actual_pipe); + datapipe_free(&keyboard_slide_state_pipe); + datapipe_free(&lockkey_state_pipe); + datapipe_free(&device_inactive_pipe); + datapipe_free(&touchscreen_event_pipe); + datapipe_free(&keypress_event_pipe); + datapipe_free(&key_backlight_brightness_pipe); + datapipe_free(&led_pattern_deactivate_pipe); + datapipe_free(&led_pattern_activate_pipe); + datapipe_free(&led_brightness_pipe); + datapipe_free(&display_brightness_pipe); + datapipe_free(&display_state_curr_pipe); + datapipe_free(&submode_pipe); + datapipe_free(&alarm_ui_state_pipe); + datapipe_free(&call_type_pipe); + datapipe_free(&call_state_pipe); + datapipe_free(&master_radio_enabled_pipe); + datapipe_free(&system_state_pipe); + datapipe_free(&heartbeat_event_pipe); } /* @@ -1432,14 +1432,14 @@ static gboolean ut_is_sysfs_brightness_eq(gpointer user_data) static void ut_state_tests_setup_checked(void) { - append_output_trigger_to_datapipe(&display_state_pipe, - ut_store_trigerred_display_state_trigger); + datapipe_add_output_trigger(&display_state_curr_pipe, + ut_store_trigerred_display_state_trigger); } static void ut_state_tests_teardown_checked(void) { - remove_output_trigger_from_datapipe(&display_state_pipe, - ut_store_trigerred_display_state_trigger); + datapipe_remove_output_trigger(&display_state_curr_pipe, + ut_store_trigerred_display_state_trigger); } /* @@ -1458,8 +1458,8 @@ static gint ut_nth_possible_dim_timeout(int n) static void ut_run_to_user_state(void) { - execute_datapipe(&system_state_pipe, GINT_TO_POINTER(MCE_STATE_USER), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&system_state_pipe, GINT_TO_POINTER(MCE_SYSTEM_STATE_USER), + USE_INDATA, CACHE_INDATA); ut_assert_transition(ut_is_desktop_ready, NULL); ut_assert_transition(ut_is_display_state_eq, @@ -1508,9 +1508,9 @@ START_TEST (ut_check_basic_state_change_no_lpm) display_state_name(state_changes[i].required), display_state_name(state_changes[i].expected)); - execute_datapipe(&display_state_req_pipe, - GINT_TO_POINTER(state_changes[i].required), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&display_state_request_pipe, + GINT_TO_POINTER(state_changes[i].required), + USE_INDATA, CACHE_INDATA); ut_assert_transition(ut_is_display_state_eq, GINT_TO_POINTER(state_changes[i].expected)); } @@ -1557,9 +1557,9 @@ START_TEST (ut_check_basic_state_change) display_state_name(state_changes[i].required), display_state_name(state_changes[i].expected)); - execute_datapipe(&display_state_req_pipe, - GINT_TO_POINTER(state_changes[i].required), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&display_state_request_pipe, + GINT_TO_POINTER(state_changes[i].required), + USE_INDATA, CACHE_INDATA); ut_assert_transition(ut_is_display_state_eq, GINT_TO_POINTER(state_changes[i].expected)); } @@ -1574,9 +1574,9 @@ START_TEST (ut_check_auto_blank_no_lpm) ut_run_to_user_state(); - execute_datapipe(&display_state_req_pipe, - GINT_TO_POINTER(MCE_DISPLAY_DIM), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&display_state_request_pipe, + GINT_TO_POINTER(MCE_DISPLAY_DIM), + USE_INDATA, CACHE_INDATA); ut_assert_transition(ut_is_display_state_eq, GINT_TO_POINTER(MCE_DISPLAY_DIM)); @@ -1600,9 +1600,9 @@ START_TEST (ut_check_auto_blank) ut_run_to_user_state(); - execute_datapipe(&display_state_req_pipe, - GINT_TO_POINTER(MCE_DISPLAY_LPM_ON), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&display_state_request_pipe, + GINT_TO_POINTER(MCE_DISPLAY_LPM_ON), + USE_INDATA, CACHE_INDATA); ut_assert_transition(ut_is_display_state_eq, GINT_TO_POINTER(MCE_DISPLAY_LPM_ON)); @@ -1662,8 +1662,8 @@ START_TEST (ut_check_auto_dim) expected_dim_time); /* Generate activity so adaptive_dimming_index gets inc. */ - execute_datapipe(&device_inactive_event_pipe, GINT_TO_POINTER(FALSE), - USE_INDATA, CACHE_OUTDATA); + datapipe_exec_full(&inactivity_event_pipe, GINT_TO_POINTER(FALSE), + USE_INDATA, CACHE_OUTDATA); ut_assert_transition(ut_is_display_state_eq, GINT_TO_POINTER(MCE_DISPLAY_ON)); } @@ -1702,8 +1702,8 @@ START_TEST (ut_check_adaptive_dim_timeout) expected_dim_time); /* Generating activity the adaptive_dimming_index gets incremented */ - execute_datapipe(&device_inactive_event_pipe, GINT_TO_POINTER(FALSE), - USE_INDATA, CACHE_OUTDATA); + datapipe_exec_full(&inactivity_event_pipe, GINT_TO_POINTER(FALSE), + USE_INDATA, CACHE_OUTDATA); /* Verify adaptive_dimming_index=1 by meassuring rime to re-enter DIM */ expected_dim_time = ut_nth_possible_dim_timeout(forced_dti + 1); ut_assert_transition(ut_is_display_state_eq, @@ -1718,9 +1718,9 @@ START_TEST (ut_check_adaptive_dim_timeout) - UT_COMPARE_TIME_TRESHOLD); /* Verify adaptive_dimming_index=1 by meassuring time to re-enter DIM */ expected_dim_time = ut_nth_possible_dim_timeout(forced_dti + 1); - execute_datapipe(&display_state_req_pipe, - GINT_TO_POINTER(MCE_DISPLAY_ON), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&display_state_request_pipe, + GINT_TO_POINTER(MCE_DISPLAY_ON), + USE_INDATA, CACHE_INDATA); ut_assert_transition(ut_is_display_state_eq, GINT_TO_POINTER(MCE_DISPLAY_ON)); ut_assert_transition_time_eq(ut_is_display_state_eq, @@ -1733,9 +1733,9 @@ START_TEST (ut_check_adaptive_dim_timeout) + UT_COMPARE_TIME_TRESHOLD); /* Verify adaptive_dimming_index=0 by meassuring time to re-enter DIM */ expected_dim_time = ut_nth_possible_dim_timeout(forced_dti + 0); - execute_datapipe(&display_state_req_pipe, - GINT_TO_POINTER(MCE_DISPLAY_ON), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&display_state_request_pipe, + GINT_TO_POINTER(MCE_DISPLAY_ON), + USE_INDATA, CACHE_INDATA); ut_assert_transition(ut_is_display_state_eq, GINT_TO_POINTER(MCE_DISPLAY_ON)); ut_assert_transition_time_eq(ut_is_display_state_eq, @@ -1754,7 +1754,7 @@ START_TEST (ut_check_auto_dim_malf) ut_run_to_user_state(); - mce_add_submode_int32(MCE_MALF_SUBMODE); + mce_add_submode_int32(MCE_SUBMODE_MALF); ut_assert_transition_time_eq(ut_is_display_state_eq, GINT_TO_POINTER(MCE_DISPLAY_OFF), @@ -1773,9 +1773,9 @@ START_TEST (ut_check_auto_lpm) ut_run_to_user_state(); - execute_datapipe(&display_state_req_pipe, - GINT_TO_POINTER(MCE_DISPLAY_DIM), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&display_state_request_pipe, + GINT_TO_POINTER(MCE_DISPLAY_DIM), + USE_INDATA, CACHE_INDATA); ut_assert_transition(ut_is_display_state_eq, GINT_TO_POINTER(MCE_DISPLAY_DIM)); @@ -1814,9 +1814,9 @@ START_TEST (ut_check_brightness) } END_TEST -#define DATA(display_state) { \ - "{ "#display_state" }", \ - display_state } +#define DATA(display_state_curr) { \ + "{ "#display_state_curr" }", \ + display_state_curr } static struct ut_check_blanking_pause_data { const gchar *tag; @@ -1859,9 +1859,9 @@ START_TEST (ut_check_blanking_pause) stub__mce_setting_set_int(MCE_SETTING_DISPLAY_DIM_TIMEOUT_PATH, set_disp_dim_timeout); - execute_datapipe(&display_state_req_pipe, - GINT_TO_POINTER(data[_i].initial_display_state), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&display_state_request_pipe, + GINT_TO_POINTER(data[_i].initial_display_state), + USE_INDATA, CACHE_INDATA); ut_assert_transition(ut_is_display_state_eq, GINT_TO_POINTER(data[_i].initial_display_state)); @@ -1913,9 +1913,9 @@ START_TEST (ut_check_sw_fading) /* Set initial brightness to 60% so there is some space above/bellow */ const gint start_brightness = 3; - execute_datapipe(&display_brightness_pipe, - GINT_TO_POINTER(start_brightness), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&display_brightness_pipe, + GINT_TO_POINTER(start_brightness), + USE_INDATA, CACHE_INDATA); ut_assert_transition(ut_is_sysfs_brightness_eq, GINT_TO_POINTER(start_brightness * 20)); @@ -1950,9 +1950,9 @@ START_TEST (ut_check_sw_fading) const gint start_brightness_write_count = stub__mce_io_write_count(STUB__BRIGHTNESS_OUTPUT_PATH); - execute_datapipe(&display_brightness_pipe, - GINT_TO_POINTER(start_brightness + data[_i].change), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&display_brightness_pipe, + GINT_TO_POINTER(start_brightness + data[_i].change), + USE_INDATA, CACHE_INDATA); ut_assert_transition_time_eq(ut_is_sysfs_brightness_eq, GINT_TO_POINTER(20 * (start_brightness + data[_i].change)), @@ -1970,9 +1970,9 @@ START_TEST (ut_check_set_use_lpm_while_off) { ut_run_to_user_state(); - execute_datapipe(&display_state_req_pipe, - GINT_TO_POINTER(MCE_DISPLAY_OFF), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&display_state_request_pipe, + GINT_TO_POINTER(MCE_DISPLAY_OFF), + USE_INDATA, CACHE_INDATA); ut_assert_transition(ut_is_display_state_eq, GINT_TO_POINTER(MCE_DISPLAY_OFF)); @@ -2014,9 +2014,9 @@ START_TEST (ut_check_unset_use_lpm_while_lpm) display_type_t required_lpm_state = data[_i].lpm_on ? MCE_DISPLAY_LPM_ON : MCE_DISPLAY_LPM_OFF; - execute_datapipe(&display_state_req_pipe, - GINT_TO_POINTER(required_lpm_state), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&display_state_request_pipe, + GINT_TO_POINTER(required_lpm_state), + USE_INDATA, CACHE_INDATA); ut_assert_transition(ut_is_display_state_eq, GINT_TO_POINTER(required_lpm_state)); diff --git a/tests/ut/ut_display_blanking_inhibit.c b/tests/ut/ut_display_blanking_inhibit.c index eb7a033a..daec68af 100644 --- a/tests/ut/ut_display_blanking_inhibit.c +++ b/tests/ut/ut_display_blanking_inhibit.c @@ -14,10 +14,10 @@ EXTERN_DUMMY_STUB ( submode_t, mce_get_submode_int32, (void)); EXTERN_DUMMY_STUB ( -gconstpointer, execute_datapipe, (datapipe_struct *const datapipe, - gpointer indata, - const data_source_t use_cache, - const caching_policy_t cache_indata)); +gconstpointer, datapipe_exec_full, (datapipe_struct *const datapipe, + gpointer indata, + const data_source_t use_cache, + const caching_policy_t cache_indata)); LOCAL_STUB ( void, cancel_blank_prevent, (void)) @@ -65,7 +65,7 @@ static struct ut_check_blanking_inhibit_data /* Global state */ system_state_t system_state; /* ACTDEAD, BOOT, REBOOT, SHUTDOWN, USER, UNDEF */ - display_state_t display_state; /* {LPM_,}{OFF,ON}, DIM, */ + display_state_t display_state_curr; /* {LPM_,}{OFF,ON}, DIM, */ alarm_ui_state_t alarm_ui_state; /* OFF, RINGING, VISIBLE */ gboolean call_ringing; gboolean charger_connected; @@ -139,8 +139,8 @@ START_TEST (ut_check_blanking_inhibit) /* Setup global state */ system_state_pipe.cached_data = GINT_TO_POINTER(data[_i].system_state); - display_state_pipe.cached_data = - GINT_TO_POINTER(data[_i].display_state); + display_state_curr_pipe.cached_data = + GINT_TO_POINTER(data[_i].display_state_curr); alarm_ui_state_pipe.cached_data = GINT_TO_POINTER(data[_i].alarm_ui_state); call_state_pipe.cached_data = data[_i].call_ringing diff --git a/tests/ut/ut_display_filter.c b/tests/ut/ut_display_filter.c index 60613550..723d735f 100644 --- a/tests/ut/ut_display_filter.c +++ b/tests/ut/ut_display_filter.c @@ -10,7 +10,7 @@ * STUBS * ------------------------------------------------------------------------- */ -static submode_t stub__submode = MCE_NORMAL_SUBMODE; +static submode_t stub__submode = MCE_SUBMODE_NORMAL; EXTERN_STUB ( submode_t, mce_get_submode_int32, (void)) @@ -82,11 +82,11 @@ START_TEST (ut_check_is_dismiss_lpm_enabled) use_low_power_mode = data[_i].use_low_power_mode; call_state_pipe.cached_data = GINT_TO_POINTER(data[_i].call_state); if( data[_i].proximity_tklock_submode ) - stub__submode |= MCE_PROXIMITY_TKLOCK_SUBMODE; + stub__submode |= MCE_SUBMODE_PROXIMITY_TKLOCK; if( data[_i].tklock_submode ) - stub__submode |= MCE_TKLOCK_SUBMODE; + stub__submode |= MCE_SUBMODE_TKLOCK; if( data[_i].malf_submode ) - stub__submode |= MCE_MALF_SUBMODE; + stub__submode |= MCE_SUBMODE_MALF; ck_assert_int_eq(is_dismiss_low_power_mode_enabled(), data[_i].expected_result); @@ -179,7 +179,7 @@ START_TEST (ut_check_display_state_filter) ? GINT_TO_POINTER(CALL_STATE_RINGING) : GINT_TO_POINTER(CALL_STATE_NONE); stub__submode |= data[_i].transition_submode - ? MCE_TRANSITION_SUBMODE + ? MCE_SUBMODE_TRANSITION : 0; low_power_mode_supported = use_low_power_mode = data[_i].lpm_enabled; @@ -190,7 +190,7 @@ START_TEST (ut_check_display_state_filter) ck_assert_int_eq(GPOINTER_TO_INT(input2_filtered), data[_i].expected_output); // The ugly hack has been commented out in display_state_filter() - //ck_assert_int_eq(GPOINTER_TO_INT(display_state_pipe.cached_data), + //ck_assert_int_eq(GPOINTER_TO_INT(display_state_curr_pipe.cached_data), // data[_i].expected_output); } END_TEST diff --git a/tests/ut/ut_display_stm.c b/tests/ut/ut_display_stm.c index aaebb082..5b43a2d5 100644 --- a/tests/ut/ut_display_stm.c +++ b/tests/ut/ut_display_stm.c @@ -18,10 +18,10 @@ EXTERN_DUMMY_STUB ( DBusConnection *, dbus_connection_get, (void)); EXTERN_DUMMY_STUB ( -gconstpointer, execute_datapipe, (datapipe_struct *const datapipe, - gpointer indata, - const data_source_t use_cache, - const caching_policy_t cache_indata)); +gconstpointer, datapipe_exec_full, (datapipe_struct *const datapipe, + gpointer indata, + const data_source_t use_cache, + const caching_policy_t cache_indata)); /* mce-sensorfw.c stubs */ @@ -97,7 +97,7 @@ int, suspend_allow_state, (void)) bool block_early = false; #if 0 /* no late suspend in ACTDEAD etc */ - if( system_state != MCE_STATE_USER ) + if( system_state != MCE_SYSTEM_STATE_USER ) block_late = true; /* no late suspend during bootup */ @@ -134,7 +134,7 @@ int, suspend_allow_state, (void)) return block_early ? 0 : block_late ? 1 : 2; } -/* display_state stub */ +/* display_state_curr stub */ static display_state_t stub__display_state = MCE_DISPLAY_UNDEF; @@ -142,10 +142,10 @@ static bool stub__display_state_pre_trigger_called = false; LOCAL_STUB ( void, display_state_pre_trigger, (display_state_t prev_state, - display_state_t display_state)) + display_state_t display_state_curr)) { (void)prev_state; - (void)display_state; + (void)display_state_curr; stub__display_state_pre_trigger_called = true; } @@ -153,10 +153,10 @@ static bool stub__display_state_post_trigger_called = false; LOCAL_STUB ( void, display_state_post_trigger, (display_state_t prev_state, - display_state_t display_state)) + display_state_t display_state_curr)) { (void)prev_state; - stub__display_state = display_state; + stub__display_state = display_state_curr; stub__display_state_post_trigger_called = true; } diff --git a/tklock.c b/tklock.c index e23159b1..af48cf49 100644 --- a/tklock.c +++ b/tklock.c @@ -174,45 +174,45 @@ typedef enum // datapipe values and triggers static void tklock_datapipe_system_state_cb(gconstpointer data); -static void tklock_datapipe_device_lock_state_cb(gconstpointer data); -static void tklock_datapipe_device_resumed_cb(gconstpointer data); -static void tklock_datapipe_lipstick_available_cb(gconstpointer data); -static void tklock_datapipe_update_mode_cb(gconstpointer data); +static void tklock_datapipe_devicelock_state_cb(gconstpointer data); +static void tklock_datapipe_resume_detected_event_cb(gconstpointer data); +static void tklock_datapipe_lipstick_service_state_cb(gconstpointer data); +static void tklock_datapipe_osupdate_running_cb(gconstpointer data); static void tklock_datapipe_shutting_down_cb(gconstpointer data); -static void tklock_datapipe_display_state_cb(gconstpointer data); +static void tklock_datapipe_display_state_curr_cb(gconstpointer data); static void tklock_datapipe_proximity_update(void); static gboolean tklock_datapipe_proximity_uncover_cb(gpointer data); static void tklock_datapipe_proximity_uncover_cancel(void); static void tklock_datapipe_proximity_uncover_schedule(void); -static void tklock_datapipe_proximity_sensor_cb(gconstpointer data); +static void tklock_datapipe_proximity_sensor_actual_cb(gconstpointer data); static void tklock_datapipe_call_state_cb(gconstpointer data); static void tklock_datapipe_alarm_ui_state_cb(gconstpointer data); static void tklock_datapipe_charger_state_cb(gconstpointer data); static void tklock_datapipe_battery_status_cb(gconstpointer data); -static void tklock_datapipe_usb_cable_cb(gconstpointer data); -static void tklock_datapipe_jack_sense_cb(gconstpointer data); -static void tklock_datapipe_camera_button_cb(gconstpointer const data); -static void tklock_datapipe_keypress_cb(gconstpointer const data); -static void tklock_datapipe_exception_state_cb(gconstpointer data); +static void tklock_datapipe_usb_cable_state_cb(gconstpointer data); +static void tklock_datapipe_jack_sense_state_cb(gconstpointer data); +static void tklock_datapipe_camera_button_state_cb(gconstpointer const data); +static void tklock_datapipe_keypress_event_cb(gconstpointer const data); +static void tklock_datapipe_uiexception_type_cb(gconstpointer data); static void tklock_datapipe_audio_route_cb(gconstpointer data); -static void tklock_datapipe_tk_lock_cb(gconstpointer data); +static void tklock_datapipe_tklock_request_cb(gconstpointer data); static void tklock_datapipe_interaction_expected_cb(gconstpointer data); static void tklock_datapipe_submode_cb(gconstpointer data); -static void tklock_datapipe_lockkey_cb(gconstpointer const data); -static void tklock_datapipe_heartbeat_cb(gconstpointer data); -static void tklock_datapipe_keyboard_slide_input_cb(gconstpointer const data); -static void tklock_datapipe_keyboard_slide_output_cb(gconstpointer const data); -static void tklock_datapipe_keyboard_available_cb(gconstpointer const data); -static void tklock_datapipe_ambient_light_poll_cb(gconstpointer const data); -static void tklock_datapipe_ambient_light_sensor_cb(gconstpointer data); +static void tklock_datapipe_lockkey_state_cb(gconstpointer const data); +static void tklock_datapipe_heartbeat_event_cb(gconstpointer data); +static void tklock_datapipe_keyboard_slide_input_state_cb(gconstpointer const data); +static void tklock_datapipe_keyboard_slide_output_state_cb(gconstpointer const data); +static void tklock_datapipe_keyboard_available_state_cb(gconstpointer const data); +static void tklock_datapipe_light_sensor_poll_request_cb(gconstpointer const data); +static void tklock_datapipe_light_sensor_actual_cb(gconstpointer data); static void tklock_datapipe_lid_sensor_is_working_cb(gconstpointer data); -static void tklock_datapipe_lid_cover_sensor_cb(gconstpointer data); -static void tklock_datapipe_lid_cover_policy_cb(gconstpointer data); -static void tklock_datapipe_lens_cover_cb(gconstpointer data); -static void tklock_datapipe_user_activity_cb(gconstpointer data); +static void tklock_datapipe_lid_sensor_actual_cb(gconstpointer data); +static void tklock_datapipe_lid_sensor_filtered_cb(gconstpointer data); +static void tklock_datapipe_lens_cover_state_cb(gconstpointer data); +static void tklock_datapipe_user_activity_event_cb(gconstpointer data); static bool tklock_datapipe_have_tklock_submode(void); -static void tklock_datapipe_set_device_lock_state(device_lock_state_t state); +static void tklock_datapipe_set_devicelock_state(devicelock_state_t state); static void tklock_datapipe_init(void); static void tklock_datapipe_quit(void); @@ -288,15 +288,16 @@ static void tklock_autolock_on_devlock_trigger(void); // ui exception handling state machine -static uiexctype_t topmost_active(uiexctype_t mask); -static void tklock_uiexcept_sync_to_datapipe(void); -static gboolean tklock_uiexcept_linger_cb(gpointer aptr); -static void tklock_uiexcept_begin(uiexctype_t type, int64_t linger); -static void tklock_uiexcept_end(uiexctype_t type, int64_t linger); -static void tklock_uiexcept_cancel(void); -static void tklock_uiexcept_finish(void); -static bool tklock_uiexcept_deny_state_restore(bool force, const char *cause); -static void tklock_uiexcept_rethink(void); +static uiexception_type_t topmost_active(uiexception_type_t mask); + +static void tklock_uiexception_sync_to_datapipe(void); +static gboolean tklock_uiexception_linger_cb(gpointer aptr); +static void tklock_uiexception_begin(uiexception_type_t type, int64_t linger); +static void tklock_uiexception_end(uiexception_type_t type, int64_t linger); +static void tklock_uiexception_cancel(void); +static void tklock_uiexception_finish(void); +static bool tklock_uiexception_deny_state_restore(bool force, const char *cause); +static void tklock_uiexception_rethink(void); // low power mode ui state machine @@ -355,8 +356,8 @@ static void tklock_ui_open(void); static void tklock_ui_close(void); static void tklock_ui_set(bool enable); -static void tklock_ui_get_device_lock_cb(DBusPendingCall *pc, void *aptr); -static void tklock_ui_get_device_lock(void); +static void tklock_ui_get_devicelock_cb(DBusPendingCall *pc, void *aptr); +static void tklock_ui_get_devicelock(void); static void tklock_ui_send_lpm_signal(void); static void tklock_ui_enable_lpm(void); @@ -381,7 +382,7 @@ static gboolean tklock_dbus_mode_change_req_cb(DBusMessage *const msg); static gboolean tklock_dbus_interaction_expected_cb(DBusMessage *const msg); static gboolean tklock_dbus_systemui_callback_cb(DBusMessage *const msg); -static gboolean tklock_dbus_device_lock_changed_cb(DBusMessage *const msg); +static gboolean tklock_dbus_devicelock_changed_cb(DBusMessage *const msg); static gboolean tklock_dbus_notification_beg_cb(DBusMessage *const msg); static gboolean tklock_dbus_notification_end_cb(DBusMessage *const msg); @@ -602,7 +603,7 @@ static bool tklock_ui_enabled = false; static int tklock_ui_notified = -1; // does not match bool values /** System state; is undefined at bootup, can't assume anything */ -static system_state_t system_state = MCE_STATE_UNDEF; +static system_state_t system_state = MCE_SYSTEM_STATE_UNDEF; /** Change notifications for system_state */ @@ -623,47 +624,47 @@ static void tklock_datapipe_system_state_cb(gconstpointer data) } /** Device lock state; assume undefined */ -static device_lock_state_t device_lock_state = DEVICE_LOCK_UNDEFINED; +static devicelock_state_t devicelock_state = DEVICELOCK_STATE_UNDEFINED; -/** Push device lock state value into device_lock_state_pipe datapipe +/** Push device lock state value into devicelock_state_pipe datapipe */ -static void tklock_datapipe_set_device_lock_state(device_lock_state_t state) +static void tklock_datapipe_set_devicelock_state(devicelock_state_t state) { switch( state ) { - case DEVICE_LOCK_UNLOCKED: - case DEVICE_LOCK_UNDEFINED: - case DEVICE_LOCK_LOCKED: + case DEVICELOCK_STATE_UNLOCKED: + case DEVICELOCK_STATE_UNDEFINED: + case DEVICELOCK_STATE_LOCKED: break; default: mce_log(LL_WARN, "unknown device lock state=%d; assuming locked", state); - state = DEVICE_LOCK_LOCKED; + state = DEVICELOCK_STATE_LOCKED; break; } - if( device_lock_state != state ) { - execute_datapipe(&device_lock_state_pipe, - GINT_TO_POINTER(state), - USE_INDATA, CACHE_INDATA); + if( devicelock_state != state ) { + datapipe_exec_full(&devicelock_state_pipe, + GINT_TO_POINTER(state), + USE_INDATA, CACHE_INDATA); } } -/** Change notifications for device_lock_state +/** Change notifications for devicelock_state */ -static void tklock_datapipe_device_lock_state_cb(gconstpointer data) +static void tklock_datapipe_devicelock_state_cb(gconstpointer data) { - device_lock_state_t prev = device_lock_state; - device_lock_state = GPOINTER_TO_INT(data); + devicelock_state_t prev = devicelock_state; + devicelock_state = GPOINTER_TO_INT(data); - if( device_lock_state == prev ) + if( devicelock_state == prev ) goto EXIT; - mce_log(LL_DEVEL, "device_lock_state = %s -> %s", - device_lock_state_repr(prev), - device_lock_state_repr(device_lock_state)); + mce_log(LL_DEVEL, "devicelock_state = %s -> %s", + devicelock_state_repr(prev), + devicelock_state_repr(devicelock_state)); - tklock_uiexcept_rethink(); + tklock_uiexception_rethink(); tklock_autolock_rethink(); @@ -672,13 +673,13 @@ static void tklock_datapipe_device_lock_state_cb(gconstpointer data) * We must not trigger autolock due to these initial * device lock transitions */ switch( prev ) { - case DEVICE_LOCK_UNDEFINED: + case DEVICELOCK_STATE_UNDEFINED: /* Block autolock for 60 seconds when leaving * undefined state (= lipstick startup) */ tklock_autolock_on_devlock_block(60 * 1000); break; - case DEVICE_LOCK_LOCKED: + case DEVICELOCK_STATE_LOCKED: /* Unblock autolock earlier if we see transition * away from locked state (=unlocked by user) */ tklock_autolock_on_devlock_block(0); @@ -688,7 +689,7 @@ static void tklock_datapipe_device_lock_state_cb(gconstpointer data) break; } - if( device_lock_state == DEVICE_LOCK_LOCKED ) + if( devicelock_state == DEVICELOCK_STATE_LOCKED ) tklock_autolock_on_devlock_trigger(); EXIT: @@ -696,7 +697,7 @@ static void tklock_datapipe_device_lock_state_cb(gconstpointer data) } /** Resumed from suspend notification */ -static void tklock_datapipe_device_resumed_cb(gconstpointer data) +static void tklock_datapipe_resume_detected_event_cb(gconstpointer data) { (void) data; @@ -706,30 +707,30 @@ static void tklock_datapipe_device_resumed_cb(gconstpointer data) } /** devicelock dbus name is reserved; assume unknown */ -static service_state_t devicelock_available = SERVICE_STATE_UNDEF; +static service_state_t devicelock_service_state = SERVICE_STATE_UNDEF; -/** Change notifications for devicelock_available +/** Change notifications for devicelock_service_state */ -static void tklock_datapipe_devicelock_available_cb(gconstpointer data) +static void tklock_datapipe_devicelock_service_state_cb(gconstpointer data) { - service_state_t prev = devicelock_available; - devicelock_available = GPOINTER_TO_INT(data); + service_state_t prev = devicelock_service_state; + devicelock_service_state = GPOINTER_TO_INT(data); - if( devicelock_available == prev ) + if( devicelock_service_state == prev ) goto EXIT; - mce_log(LL_DEBUG, "devicelock_available = %s -> %s", + mce_log(LL_DEBUG, "devicelock_service_state = %s -> %s", service_state_repr(prev), - service_state_repr(devicelock_available)); + service_state_repr(devicelock_service_state)); - if( devicelock_available == SERVICE_STATE_RUNNING ) { + if( devicelock_service_state == SERVICE_STATE_RUNNING ) { /* query initial device lock state on devicelock/mce startup */ - tklock_ui_get_device_lock(); + tklock_ui_get_devicelock(); } else { /* if device lock service is not running, the device lock * state is undefined */ - tklock_datapipe_set_device_lock_state(DEVICE_LOCK_UNDEFINED); + tklock_datapipe_set_devicelock_state(DEVICELOCK_STATE_UNDEFINED); } EXIT: @@ -737,21 +738,21 @@ static void tklock_datapipe_devicelock_available_cb(gconstpointer data) } /** Lipstick dbus name is reserved; assume false */ -static service_state_t lipstick_available = SERVICE_STATE_UNDEF; +static service_state_t lipstick_service_state = SERVICE_STATE_UNDEF; -/** Change notifications for lipstick_available +/** Change notifications for lipstick_service_state */ -static void tklock_datapipe_lipstick_available_cb(gconstpointer data) +static void tklock_datapipe_lipstick_service_state_cb(gconstpointer data) { - service_state_t prev = lipstick_available; - lipstick_available = GPOINTER_TO_INT(data); + service_state_t prev = lipstick_service_state; + lipstick_service_state = GPOINTER_TO_INT(data); - if( lipstick_available == prev ) + if( lipstick_service_state == prev ) goto EXIT; - mce_log(LL_DEBUG, "lipstick_available = %s -> %s", + mce_log(LL_DEBUG, "lipstick_service_state = %s -> %s", service_state_repr(prev), - service_state_repr(lipstick_available)); + service_state_repr(lipstick_service_state)); // force tklock ipc tklock_ui_notified = -1; @@ -762,25 +763,25 @@ static void tklock_datapipe_lipstick_available_cb(gconstpointer data) } /** Update mode is active; assume false */ -static bool update_mode = false; +static bool osupdate_running = false; -/** Change notifications for update_mode +/** Change notifications for osupdate_running */ -static void tklock_datapipe_update_mode_cb(gconstpointer data) +static void tklock_datapipe_osupdate_running_cb(gconstpointer data) { - bool prev = update_mode; - update_mode = GPOINTER_TO_INT(data); + bool prev = osupdate_running; + osupdate_running = GPOINTER_TO_INT(data); - if( update_mode == prev ) + if( osupdate_running == prev ) goto EXIT; - mce_log(LL_DEBUG, "update_mode = %d -> %d", prev, update_mode); + mce_log(LL_DEBUG, "osupdate_running = %d -> %d", prev, osupdate_running); - if( update_mode ) { + if( osupdate_running ) { /* undo tklock when update mode starts */ - execute_datapipe(&tk_lock_pipe, - GINT_TO_POINTER(LOCK_OFF), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&tklock_request_pipe, + GINT_TO_POINTER(TKLOCK_REQUEST_OFF), + USE_INDATA, CACHE_INDATA); } EXIT: @@ -800,7 +801,8 @@ static void tklock_datapipe_shutting_down_cb(gconstpointer data) if( shutting_down == prev ) goto EXIT; - mce_log(LL_DEBUG, "shutting_down = %d -> %d", prev, shutting_down); + mce_log(LL_DEBUG, "shutting_down = %d -> %d", + prev, shutting_down); tklock_evctrl_rethink(); @@ -809,7 +811,7 @@ static void tklock_datapipe_shutting_down_cb(gconstpointer data) } /** Display state; undefined initially, can't assume anything */ -static display_state_t display_state = MCE_DISPLAY_UNDEF; +static display_state_t display_state_curr = MCE_DISPLAY_UNDEF; /** Next Display state; undefined initially, can't assume anything */ static display_state_t display_state_next = MCE_DISPLAY_UNDEF; @@ -817,32 +819,32 @@ static display_state_t display_state_next = MCE_DISPLAY_UNDEF; /** Autorelock trigger: assume disabled */ static autorelock_t autorelock_trigger = AUTORELOCK_NO_TRIGGERS; -/** Change notifications for display_state +/** Change notifications for display_state_curr */ -static void tklock_datapipe_display_state_cb(gconstpointer data) +static void tklock_datapipe_display_state_curr_cb(gconstpointer data) { - display_state_t prev = display_state; - display_state = GPOINTER_TO_INT(data); + display_state_t prev = display_state_curr; + display_state_curr = GPOINTER_TO_INT(data); - if( display_state == prev ) + if( display_state_curr == prev ) goto EXIT; - mce_log(LL_DEBUG, "display_state = %s -> %s", + mce_log(LL_DEBUG, "display_state_curr = %s -> %s", display_state_repr(prev), - display_state_repr(display_state)); + display_state_repr(display_state_curr)); tklock_lidfilter_rethink_allow_close(); /* Disable "wakeup with fake policy" hack * when any stable display state is reached */ - if( display_state != MCE_DISPLAY_POWER_UP && - display_state != MCE_DISPLAY_POWER_DOWN ) - tklock_uiexcept_end(UIEXC_NOANIM, 0); + if( display_state_curr != MCE_DISPLAY_POWER_UP && + display_state_curr != MCE_DISPLAY_POWER_DOWN ) + tklock_uiexception_end(UIEXCEPTION_TYPE_NOANIM, 0); - if( display_state == MCE_DISPLAY_DIM ) + if( display_state_curr == MCE_DISPLAY_DIM ) tklock_ui_eat_event(); - tklock_uiexcept_rethink(); + tklock_uiexception_rethink(); tklock_autolock_rethink(); tklock_proxlock_rethink(); @@ -855,17 +857,17 @@ static void tklock_datapipe_display_state_cb(gconstpointer data) return; } -/** Pre-change notifications for display_state +/** Pre-change notifications for display_state_curr */ static void tklock_datapipe_display_state_next_cb(gconstpointer data) { display_state_next = GPOINTER_TO_INT(data); mce_log(LL_DEBUG, "display_state_next = %s -> %s", - display_state_repr(display_state), + display_state_repr(display_state_curr), display_state_repr(display_state_next)); - if( display_state_next == display_state ) + if( display_state_next == display_state_curr ) goto EXIT; /* Cancel autorelock on display off */ @@ -902,10 +904,10 @@ static void tklock_datapipe_display_state_next_cb(gconstpointer data) static call_state_t call_state = CALL_STATE_NONE; /** Actual proximity state; assume not covered */ -static cover_state_t proximity_state_actual = COVER_OPEN; +static cover_state_t proximity_sensor_actual = COVER_OPEN; /** Effective proximity state; assume not covered */ -static cover_state_t proximity_state_effective = COVER_OPEN; +static cover_state_t proximity_sensor_effective = COVER_OPEN; /** Lid cover sensor state; assume unkown * @@ -917,10 +919,10 @@ static cover_state_t proximity_state_effective = COVER_OPEN; * it is used also for things like the hammerhead magnetic lid * sensor. */ -static cover_state_t lid_cover_sensor_state = COVER_UNDEF; +static cover_state_t lid_sensor_actual = COVER_UNDEF; /** Lid cover policy state; assume unknown */ -static cover_state_t lid_cover_policy_state = COVER_UNDEF; +static cover_state_t lid_sensor_filtered = COVER_UNDEF; /** Timer id for delayed proximity uncovering */ static guint tklock_datapipe_proximity_uncover_id = 0; @@ -929,16 +931,16 @@ static guint tklock_datapipe_proximity_uncover_id = 0; */ static void tklock_datapipe_proximity_update(void) { - if( proximity_state_effective == proximity_state_actual ) + if( proximity_sensor_effective == proximity_sensor_actual ) goto EXIT; - mce_log(LL_DEBUG, "proximity_state_effective = %s -> %s", - proximity_state_repr(proximity_state_effective), - proximity_state_repr(proximity_state_actual)); + mce_log(LL_DEBUG, "proximity_sensor_effective = %s -> %s", + proximity_state_repr(proximity_sensor_effective), + proximity_state_repr(proximity_sensor_actual)); - proximity_state_effective = proximity_state_actual; + proximity_sensor_effective = proximity_sensor_actual; - tklock_uiexcept_rethink(); + tklock_uiexception_rethink(); tklock_proxlock_rethink(); tklock_evctrl_rethink(); @@ -1002,27 +1004,27 @@ static void tklock_datapipe_proximity_uncover_schedule(void) g_timeout_add(delay, tklock_datapipe_proximity_uncover_cb, 0); } -/** Change notifications for proximity_state_actual +/** Change notifications for proximity_sensor_actual */ -static void tklock_datapipe_proximity_sensor_cb(gconstpointer data) +static void tklock_datapipe_proximity_sensor_actual_cb(gconstpointer data) { - cover_state_t prev = proximity_state_actual; - proximity_state_actual = GPOINTER_TO_INT(data); + cover_state_t prev = proximity_sensor_actual; + proximity_sensor_actual = GPOINTER_TO_INT(data); - if( proximity_state_actual == COVER_UNDEF ) - proximity_state_actual = COVER_OPEN; + if( proximity_sensor_actual == COVER_UNDEF ) + proximity_sensor_actual = COVER_OPEN; - if( proximity_state_actual == prev ) + if( proximity_sensor_actual == prev ) goto EXIT; - mce_log(LL_DEBUG, "proximity_state_actual = %s -> %s", + mce_log(LL_DEBUG, "proximity_sensor_actual = %s -> %s", proximity_state_repr(prev), - proximity_state_repr(proximity_state_actual)); + proximity_state_repr(proximity_sensor_actual)); /* update lpm ui proximity history using raw data */ - tklock_lpmui_update_history(proximity_state_actual); + tklock_lpmui_update_history(proximity_sensor_actual); - if( proximity_state_actual == COVER_OPEN ) { + if( proximity_sensor_actual == COVER_OPEN ) { tklock_datapipe_proximity_uncover_schedule(); } else { @@ -1062,13 +1064,13 @@ static void tklock_datapipe_call_state_cb(gconstpointer data) /* Fall through */ case CALL_STATE_ACTIVE: - tklock_uiexcept_begin(UIEXC_CALL, 0); + tklock_uiexception_begin(UIEXCEPTION_TYPE_CALL, 0); break; default: - tklock_uiexcept_end(UIEXC_CALL, incoming ? - exception_length_call_in : - exception_length_call_out); + tklock_uiexception_end(UIEXCEPTION_TYPE_CALL, incoming ? + exception_length_call_in : + exception_length_call_out); /* Restore linger time to default again */ incoming = false; @@ -1076,7 +1078,7 @@ static void tklock_datapipe_call_state_cb(gconstpointer data) } // display on/off policy - tklock_uiexcept_rethink(); + tklock_uiexception_rethink(); // volume keys during call tklock_evctrl_rethink(); @@ -1085,19 +1087,20 @@ static void tklock_datapipe_call_state_cb(gconstpointer data) } /** Music playback state; assume not playing */ -static bool music_playback = false; +static bool music_playback_ongoing = false; -/** Change notifications for music_playback +/** Change notifications for music_playback_ongoing */ -static void tklock_datapipe_music_playback_cb(gconstpointer data) +static void tklock_datapipe_music_playback_ongoing_cb(gconstpointer data) { - bool prev = music_playback; - music_playback = GPOINTER_TO_INT(data); + bool prev = music_playback_ongoing; + music_playback_ongoing = GPOINTER_TO_INT(data); - if( music_playback == prev ) + if( music_playback_ongoing == prev ) goto EXIT; - mce_log(LL_DEBUG, "music_playback = %d -> %d", prev, music_playback); + mce_log(LL_DEBUG, "music_playback_ongoing = %d -> %d", + prev, music_playback_ongoing); // volume keys during playback tklock_evctrl_rethink(); @@ -1128,14 +1131,14 @@ static void tklock_datapipe_alarm_ui_state_cb(gconstpointer data) switch( alarm_ui_state ) { case MCE_ALARM_UI_RINGING_INT32: case MCE_ALARM_UI_VISIBLE_INT32: - tklock_uiexcept_begin(UIEXC_ALARM, 0); + tklock_uiexception_begin(UIEXCEPTION_TYPE_ALARM, 0); break; default: - tklock_uiexcept_end(UIEXC_ALARM, exception_length_alarm); + tklock_uiexception_end(UIEXCEPTION_TYPE_ALARM, exception_length_alarm); break; } - tklock_uiexcept_rethink(); + tklock_uiexception_rethink(); EXIT: return; @@ -1202,7 +1205,7 @@ static usb_cable_state_t usb_cable_state = USB_CABLE_UNDEF; /** Change notifications for usb_cable_state */ -static void tklock_datapipe_usb_cable_cb(gconstpointer data) +static void tklock_datapipe_usb_cable_state_cb(gconstpointer data) { usb_cable_state_t prev = usb_cable_state; usb_cable_state = GPOINTER_TO_INT(data); @@ -1247,7 +1250,7 @@ static cover_state_t jack_sense_state = COVER_UNDEF; /** Change notifications for jack_sense_state */ -static void tklock_datapipe_jack_sense_cb(gconstpointer data) +static void tklock_datapipe_jack_sense_state_cb(gconstpointer data) { cover_state_t prev = jack_sense_state; jack_sense_state = GPOINTER_TO_INT(data); @@ -1283,7 +1286,7 @@ static void tklock_datapipe_jack_sense_cb(gconstpointer data) /** Change notifications for camera_button */ -static void tklock_datapipe_camera_button_cb(gconstpointer const data) +static void tklock_datapipe_camera_button_state_cb(gconstpointer const data) { /* TODO: This might make no sense, need to check on HW that has * dedicated camera button ... */ @@ -1295,7 +1298,7 @@ static void tklock_datapipe_camera_button_cb(gconstpointer const data) /** Change notifications for keypress */ -static void tklock_datapipe_keypress_cb(gconstpointer const data) +static void tklock_datapipe_keypress_event_cb(gconstpointer const data) { const struct input_event *const*evp; const struct input_event *ev; @@ -1341,24 +1344,24 @@ static void tklock_datapipe_keypress_cb(gconstpointer const data) } /** UI exception state; initialized to none */ -static uiexctype_t exception_state = UIEXC_NONE; +static uiexception_type_t uiexception_type = UIEXCEPTION_TYPE_NONE; -/** Change notifications for exception_state +/** Change notifications for uiexception_type */ -static void tklock_datapipe_exception_state_cb(gconstpointer data) +static void tklock_datapipe_uiexception_type_cb(gconstpointer data) { - uiexctype_t prev = exception_state; - exception_state = GPOINTER_TO_INT(data); + uiexception_type_t prev = uiexception_type; + uiexception_type = GPOINTER_TO_INT(data); - if( exception_state == prev ) + if( uiexception_type == prev ) goto EXIT; - mce_log(LL_CRUCIAL, "exception_state = %s -> %s", - uiexctype_repr(prev), - uiexctype_repr(exception_state)); + mce_log(LL_CRUCIAL, "uiexception_type = %s -> %s", + uiexception_type_repr(prev), + uiexception_type_repr(uiexception_type)); /* Cancel autorelock if there is a call or alarm */ - if( (exception_state & (UIEXC_CALL | UIEXC_ALARM)) && + if( (uiexception_type & (UIEXCEPTION_TYPE_CALL | UIEXCEPTION_TYPE_ALARM)) && autorelock_trigger != AUTORELOCK_NO_TRIGGERS ) { mce_log(LL_DEBUG, "autorelock canceled: handling call/alarm"); autorelock_trigger = AUTORELOCK_NO_TRIGGERS; @@ -1395,39 +1398,40 @@ static void tklock_datapipe_audio_route_cb(gconstpointer data) goto EXIT; mce_log(LL_DEBUG, "audio_route = %d -> %d", prev, audio_route); - tklock_uiexcept_rethink(); + tklock_uiexception_rethink(); EXIT: return; } -/** Change notifications for tk_lock_pipe +/** Change notifications for tklock_request_pipe * * Handles tklock requests from outside this module */ -static void tklock_datapipe_tk_lock_cb(gconstpointer data) +static void tklock_datapipe_tklock_request_cb(gconstpointer data) { - lock_state_t tk_lock_state = GPOINTER_TO_INT(data); + tklock_request_t tklock_request = GPOINTER_TO_INT(data); - mce_log(LL_DEBUG, "tk_lock_state = %d", tk_lock_state); + mce_log(LL_DEBUG, "tklock_request = %s", + tklock_request_repr(tklock_request)); bool enable = tklock_ui_enabled; - switch( tk_lock_state ) { - case LOCK_UNDEF: - case LOCK_OFF: - case LOCK_OFF_DELAYED: + switch( tklock_request ) { + case TKLOCK_REQUEST_UNDEF: + case TKLOCK_REQUEST_OFF: + case TKLOCK_REQUEST_OFF_DELAYED: enable = false; break; default: - case LOCK_OFF_PROXIMITY: - case LOCK_ON: - case LOCK_ON_DIMMED: - case LOCK_ON_PROXIMITY: - case LOCK_ON_DELAYED: + case TKLOCK_REQUEST_OFF_PROXIMITY: + case TKLOCK_REQUEST_ON: + case TKLOCK_REQUEST_ON_DIMMED: + case TKLOCK_REQUEST_ON_PROXIMITY: + case TKLOCK_REQUEST_ON_DELAYED: enable = true; break; - case LOCK_TOGGLE: + case TKLOCK_REQUEST_TOGGLE: enable = !enable; } tklock_ui_set(enable); @@ -1452,7 +1456,7 @@ static void tklock_datapipe_interaction_expected_cb(gconstpointer data) /* All changes must be ignored when handling exceptional things * like calls and alarms that are shown on top of lockscreen ui. */ - if( exception_state & (UIEXC_CALL | UIEXC_ALARM) ) + if( uiexception_type & (UIEXCEPTION_TYPE_CALL | UIEXCEPTION_TYPE_ALARM) ) goto EXIT; /* Edge triggered action: When interaction becomes expected @@ -1463,14 +1467,14 @@ static void tklock_datapipe_interaction_expected_cb(gconstpointer data) */ if( display_state_next == MCE_DISPLAY_ON && tklock_ui_enabled && interaction_expected ) { - tklock_uiexcept_deny_state_restore(true, "interaction expected"); + tklock_uiexception_deny_state_restore(true, "interaction expected"); } EXIT: return; } -static submode_t submode = MCE_INVALID_SUBMODE; +static submode_t submode = MCE_SUBMODE_INVALID; /** Change notifications for submode */ @@ -1485,7 +1489,7 @@ static void tklock_datapipe_submode_cb(gconstpointer data) mce_log(LL_DEBUG, "submode = 0x%x", submode); // out of sync tklock state blocks state restore - tklock_uiexcept_rethink(); + tklock_uiexception_rethink(); // block tklock removal while autolock rules apply tklock_autolock_rethink(); @@ -1494,10 +1498,10 @@ static void tklock_datapipe_submode_cb(gconstpointer data) tklock_evctrl_rethink(); // skip the rest if tklock did not change - if( !((prev ^ submode) & MCE_TKLOCK_SUBMODE) ) + if( !((prev ^ submode) & MCE_SUBMODE_TKLOCK) ) goto EXIT; - if( submode & MCE_TKLOCK_SUBMODE ) { + if( submode & MCE_SUBMODE_TKLOCK ) { // tklock added } else { @@ -1537,23 +1541,27 @@ static void tklock_datapipe_submode_cb(gconstpointer data) */ static bool tklock_datapipe_have_tklock_submode(void) { - return (submode & MCE_TKLOCK_SUBMODE) != 0; + return (submode & MCE_SUBMODE_TKLOCK) != 0; } -/** Change notifications for lockkey_pipe +/** Change notifications for lockkey_state_pipe */ -static void tklock_datapipe_lockkey_cb(gconstpointer const data) +static void tklock_datapipe_lockkey_state_cb(gconstpointer const data) { /* TODO: IIRC lock key is N900 hw feature, I have not had a chance * to test if this actually works ... */ + key_state_t key_state = GPOINTER_TO_INT(data); + + mce_log(LL_DEBUG, "lockkey: %s", key_state_repr(key_state)); + /* Ignore release events */ - if( GPOINTER_TO_INT(data) == 0 ) + if( key_state != KEY_STATE_PRESSED ) goto EXIT; /* Try to give it the same treatment as power key would get. * Copy pasted from generic_powerkey_handler() @ powerkey.c */ - switch( display_state_get() ) { + switch( display_state_next ) { case MCE_DISPLAY_ON: case MCE_DISPLAY_DIM: case MCE_DISPLAY_POWER_UP: @@ -1564,9 +1572,9 @@ static void tklock_datapipe_lockkey_cb(gconstpointer const data) * The tklock requests get ignored in act dead * etc, so we can just blindly request it. */ - execute_datapipe(&tk_lock_pipe, - GINT_TO_POINTER(LOCK_ON), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&tklock_request_pipe, + GINT_TO_POINTER(TKLOCK_REQUEST_ON), + USE_INDATA, CACHE_INDATA); mce_datapipe_req_display_state(MCE_DISPLAY_OFF); break; @@ -1586,9 +1594,9 @@ static void tklock_datapipe_lockkey_cb(gconstpointer const data) return; } -/** Change notifications for heartbeat_pipe +/** Change notifications for heartbeat_event_pipe */ -static void tklock_datapipe_heartbeat_cb(gconstpointer data) +static void tklock_datapipe_heartbeat_event_cb(gconstpointer data) { (void)data; @@ -1597,24 +1605,24 @@ static void tklock_datapipe_heartbeat_cb(gconstpointer data) } /** Keypad slide input state; assume closed */ -static cover_state_t kbd_slide_input_state = COVER_CLOSED; +static cover_state_t keyboard_slide_input_state = COVER_CLOSED; -/** Change notifications from keyboard_slide_pipe +/** Change notifications from keyboard_slide_state_pipe */ -static void tklock_datapipe_keyboard_slide_input_cb(gconstpointer const data) +static void tklock_datapipe_keyboard_slide_input_state_cb(gconstpointer const data) { - cover_state_t prev = kbd_slide_input_state; - kbd_slide_input_state = GPOINTER_TO_INT(data); + cover_state_t prev = keyboard_slide_input_state; + keyboard_slide_input_state = GPOINTER_TO_INT(data); - if( kbd_slide_input_state == COVER_UNDEF ) - kbd_slide_input_state = COVER_CLOSED; + if( keyboard_slide_input_state == COVER_UNDEF ) + keyboard_slide_input_state = COVER_CLOSED; - if( kbd_slide_input_state == prev ) + if( keyboard_slide_input_state == prev ) goto EXIT; - mce_log(LL_DEVEL, "kbd_slide_input_state = %s -> %s", + mce_log(LL_DEVEL, "keyboard_slide_input_state = %s -> %s", cover_state_repr(prev), - cover_state_repr(kbd_slide_input_state)); + cover_state_repr(keyboard_slide_input_state)); tklock_keyboard_slide_rethink(); @@ -1623,20 +1631,20 @@ static void tklock_datapipe_keyboard_slide_input_cb(gconstpointer const data) } /** Keypad slide output state; assume unknown */ -static cover_state_t kbd_slide_output_state = COVER_UNDEF; +static cover_state_t keyboard_slide_output_state = COVER_UNDEF; static void -tklock_datapipe_keyboard_slide_output_cb(gconstpointer const data) +tklock_datapipe_keyboard_slide_output_state_cb(gconstpointer const data) { - cover_state_t prev = kbd_slide_output_state; - kbd_slide_output_state = GPOINTER_TO_INT(data); + cover_state_t prev = keyboard_slide_output_state; + keyboard_slide_output_state = GPOINTER_TO_INT(data); - if( kbd_slide_output_state == prev ) + if( keyboard_slide_output_state == prev ) goto EXIT; - mce_log(LL_DEVEL, "kbd_slide_output_state = %s -> %s", + mce_log(LL_DEVEL, "keyboard_slide_output_state = %s -> %s", cover_state_repr(prev), - cover_state_repr(kbd_slide_output_state)); + cover_state_repr(keyboard_slide_output_state)); tklock_dbus_send_keyboard_slide_state(0); @@ -1645,20 +1653,20 @@ tklock_datapipe_keyboard_slide_output_cb(gconstpointer const data) } /** Keypad available output state; assume unknown */ -static cover_state_t kbd_available_state = COVER_UNDEF; +static cover_state_t keyboard_available_state = COVER_UNDEF; static void -tklock_datapipe_keyboard_available_cb(gconstpointer const data) +tklock_datapipe_keyboard_available_state_cb(gconstpointer const data) { - cover_state_t prev = kbd_available_state; - kbd_available_state = GPOINTER_TO_INT(data); + cover_state_t prev = keyboard_available_state; + keyboard_available_state = GPOINTER_TO_INT(data); - if( kbd_available_state == prev ) + if( keyboard_available_state == prev ) goto EXIT; - mce_log(LL_DEBUG, "kbd_available_state = %s -> %s", + mce_log(LL_DEBUG, "keyboard_available_state = %s -> %s", cover_state_repr(prev), - cover_state_repr(kbd_available_state)); + cover_state_repr(keyboard_available_state)); tklock_dbus_send_keyboard_available_state(0); @@ -1666,22 +1674,22 @@ tklock_datapipe_keyboard_available_cb(gconstpointer const data) return; } -/** Cached als poll state; tracked via tklock_datapipe_ambient_light_poll_cb() */ -static gboolean ambient_light_poll = FALSE; +/** Cached als poll state; tracked via tklock_datapipe_light_sensor_poll_request_cb() */ +static gboolean light_sensor_polling = FALSE; /** Ambient Light Sensor filter for temporary sensor enable * * @param data Polling enabled/disabled bool (as void pointer) */ static void -tklock_datapipe_ambient_light_poll_cb(gconstpointer const data) +tklock_datapipe_light_sensor_poll_request_cb(gconstpointer const data) { - gboolean prev = ambient_light_poll; - ambient_light_poll = GPOINTER_TO_INT(data) ? TRUE : FALSE; + gboolean prev = light_sensor_polling; + light_sensor_polling = GPOINTER_TO_INT(data) ? TRUE : FALSE; - mce_log(LL_DEBUG, "ambient_light_poll: %s -> %s", + mce_log(LL_DEBUG, "light_sensor_polling: %s -> %s", prev ? "true" : "false", - ambient_light_poll ? "true" : "false"); + light_sensor_polling ? "true" : "false"); /* Check without comparing to previous state. The poll * request can be denied by datapipe filter at the als @@ -1691,20 +1699,20 @@ tklock_datapipe_ambient_light_poll_cb(gconstpointer const data) } /** Raw ambient light sensor state; assume unknown */ -static int ambient_light_sensor_state = -1; +static int light_sensor_actual = -1; -/** Change notifications from ambient_light_sensor_pipe +/** Change notifications from light_sensor_actual_pipe */ -static void tklock_datapipe_ambient_light_sensor_cb(gconstpointer data) +static void tklock_datapipe_light_sensor_actual_cb(gconstpointer data) { - cover_state_t prev = ambient_light_sensor_state; - ambient_light_sensor_state = GPOINTER_TO_INT(data); + cover_state_t prev = light_sensor_actual; + light_sensor_actual = GPOINTER_TO_INT(data); - if( ambient_light_sensor_state == prev ) + if( light_sensor_actual == prev ) goto EXIT; - mce_log(LL_DEBUG, "ambient_light_sensor_state = %d -> %d", - prev, ambient_light_sensor_state); + mce_log(LL_DEBUG, "light_sensor_actual = %d -> %d", + prev, light_sensor_actual); tklock_lidfilter_rethink_als_state(); @@ -1760,36 +1768,36 @@ static void tklock_datapipe_lid_sensor_is_working_cb(gconstpointer data) LID_SENSOR_IS_WORKING_FLAG_FILE); /* Invalidate sensor data */ - execute_datapipe(&lid_cover_sensor_pipe, - GINT_TO_POINTER(COVER_UNDEF), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&lid_sensor_actual_pipe, + GINT_TO_POINTER(COVER_UNDEF), + USE_INDATA, CACHE_INDATA); } EXIT: return; } -/** Change notifications from lid_cover_sensor_pipe +/** Change notifications from lid_sensor_actual_pipe */ -static void tklock_datapipe_lid_cover_sensor_cb(gconstpointer data) +static void tklock_datapipe_lid_sensor_actual_cb(gconstpointer data) { - cover_state_t prev = lid_cover_sensor_state; - lid_cover_sensor_state = GPOINTER_TO_INT(data); + cover_state_t prev = lid_sensor_actual; + lid_sensor_actual = GPOINTER_TO_INT(data); - if( lid_cover_sensor_state == prev ) + if( lid_sensor_actual == prev ) goto EXIT; - if( prev == COVER_CLOSED && lid_cover_sensor_state == COVER_OPEN ) { + if( prev == COVER_CLOSED && lid_sensor_actual == COVER_OPEN ) { /* We have seen the sensor flip from closed to open position, * so we can stop assuming it stays closed forever */ - execute_datapipe(&lid_sensor_is_working_pipe, - GINT_TO_POINTER(true), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&lid_sensor_is_working_pipe, + GINT_TO_POINTER(true), + USE_INDATA, CACHE_INDATA); } - mce_log(LL_DEVEL, "lid_cover_sensor_state = %s -> %s", + mce_log(LL_DEVEL, "lid_sensor_actual = %s -> %s", cover_state_repr(prev), - cover_state_repr(lid_cover_sensor_state)); + cover_state_repr(lid_sensor_actual)); tklock_lidfilter_rethink_lid_state(); @@ -1797,19 +1805,19 @@ static void tklock_datapipe_lid_cover_sensor_cb(gconstpointer data) return; } -/** Change notifications from lid_cover_policy_pipe +/** Change notifications from lid_sensor_filtered_pipe */ -static void tklock_datapipe_lid_cover_policy_cb(gconstpointer data) +static void tklock_datapipe_lid_sensor_filtered_cb(gconstpointer data) { - cover_state_t prev = lid_cover_policy_state; - lid_cover_policy_state = GPOINTER_TO_INT(data); + cover_state_t prev = lid_sensor_filtered; + lid_sensor_filtered = GPOINTER_TO_INT(data); - if( lid_cover_policy_state == prev ) + if( lid_sensor_filtered == prev ) goto EXIT; - mce_log(LL_DEVEL, "lid_cover_policy_state = %s -> %s", + mce_log(LL_DEVEL, "lid_sensor_filtered = %s -> %s", cover_state_repr(prev), - cover_state_repr(lid_cover_policy_state)); + cover_state_repr(lid_sensor_filtered)); /* TODO: On devices that have means to detect physically covered * display, it might be desirable to also power off: @@ -1829,9 +1837,9 @@ static void tklock_datapipe_lid_cover_policy_cb(gconstpointer data) /** Camera lens cover state; assume closed */ static cover_state_t lens_cover_state = COVER_CLOSED; -/** Change notifications from lens_cover_pipe +/** Change notifications from lens_cover_state_pipe */ -static void tklock_datapipe_lens_cover_cb(gconstpointer data) +static void tklock_datapipe_lens_cover_state_cb(gconstpointer data) { cover_state_t prev = lens_cover_state; lens_cover_state = GPOINTER_TO_INT(data); @@ -1906,11 +1914,11 @@ static bool tklock_touch_activity_event_p(const struct input_event *ev) return activity; } -/** Handle user_activity_pipe notifications +/** Handle user_activity_event_pipe notifications * * @param data input_event as void pointer */ -static void tklock_datapipe_user_activity_cb(gconstpointer data) +static void tklock_datapipe_user_activity_event_cb(gconstpointer data) { static int64_t last_time = 0; @@ -1930,7 +1938,7 @@ static void tklock_datapipe_user_activity_cb(gconstpointer data) } /* Touch events relevant unly when handling notification & linger */ - if( !(exception_state & (UIEXC_NOTIF | UIEXC_LINGER)) ) + if( !(uiexception_type & (UIEXCEPTION_TYPE_NOTIF | UIEXCEPTION_TYPE_LINGER)) ) goto EXIT; int64_t now = mce_lib_get_boot_tick(); @@ -1945,18 +1953,19 @@ static void tklock_datapipe_user_activity_cb(gconstpointer data) evdev_get_event_code_name(ev->type, ev->code), ev->value); - /* N.B. the exception_state is bitmask, but only bit at time is - * visible in the exception_state datapipe */ - switch( exception_state ) { - case UIEXC_LINGER: + /* N.B. the uiexception_type is bitmask, but only bit at time is + * visible in the uiexception_type datapipe */ + switch( uiexception_type ) { + case UIEXCEPTION_TYPE_LINGER: /* touch events during linger -> do not restore display state */ - tklock_uiexcept_deny_state_restore(true, "touch event during linger"); + tklock_uiexception_deny_state_restore(true, + "touch event during linger"); break; - case UIEXC_NOTIF: + case UIEXCEPTION_TYPE_NOTIF: /* touch events while device is not locked -> do not restore display state */ - if( tklock_uiexcept_deny_state_restore(false, - "touch event during notification") ) { + if( tklock_uiexception_deny_state_restore(false, + "touch event during notification") ) { break; } /* touchscreen activity makes notification exceptions to last longer */ @@ -1977,63 +1986,63 @@ static datapipe_handler_t tklock_datapipe_handlers[] = { // output triggers { - .datapipe = &device_resumed_pipe, - .output_cb = tklock_datapipe_device_resumed_cb, + .datapipe = &resume_detected_event_pipe, + .output_cb = tklock_datapipe_resume_detected_event_cb, }, { - .datapipe = &lipstick_available_pipe, - .output_cb = tklock_datapipe_lipstick_available_cb, + .datapipe = &lipstick_service_state_pipe, + .output_cb = tklock_datapipe_lipstick_service_state_cb, }, { - .datapipe = &devicelock_available_pipe, - .output_cb = tklock_datapipe_devicelock_available_cb, + .datapipe = &devicelock_service_state_pipe, + .output_cb = tklock_datapipe_devicelock_service_state_cb, }, { - .datapipe = &update_mode_pipe, - .output_cb = tklock_datapipe_update_mode_cb, + .datapipe = &osupdate_running_pipe, + .output_cb = tklock_datapipe_osupdate_running_cb, }, { - .datapipe = &shutting_down_pipe, + .datapipe = &shutting_down_pipe, .output_cb = tklock_datapipe_shutting_down_cb, }, { - .datapipe = &device_lock_state_pipe, - .output_cb = tklock_datapipe_device_lock_state_cb, + .datapipe = &devicelock_state_pipe, + .output_cb = tklock_datapipe_devicelock_state_cb, }, { - .datapipe = &display_state_pipe, - .output_cb = tklock_datapipe_display_state_cb, + .datapipe = &display_state_curr_pipe, + .output_cb = tklock_datapipe_display_state_curr_cb, }, { - .datapipe = &display_state_next_pipe, + .datapipe = &display_state_next_pipe, .output_cb = tklock_datapipe_display_state_next_cb, }, { - .datapipe = &tk_lock_pipe, - .output_cb = tklock_datapipe_tk_lock_cb, + .datapipe = &tklock_request_pipe, + .output_cb = tklock_datapipe_tklock_request_cb, }, { .datapipe = &interaction_expected_pipe, .output_cb = tklock_datapipe_interaction_expected_cb, }, { - .datapipe = &proximity_sensor_pipe, - .output_cb = tklock_datapipe_proximity_sensor_cb, + .datapipe = &proximity_sensor_actual_pipe, + .output_cb = tklock_datapipe_proximity_sensor_actual_cb, }, { - .datapipe = &call_state_pipe, + .datapipe = &call_state_pipe, .output_cb = tklock_datapipe_call_state_cb, }, { - .datapipe = &music_playback_pipe, - .output_cb = tklock_datapipe_music_playback_cb, + .datapipe = &music_playback_ongoing_pipe, + .output_cb = tklock_datapipe_music_playback_ongoing_cb, }, { - .datapipe = &alarm_ui_state_pipe, + .datapipe = &alarm_ui_state_pipe, .output_cb = tklock_datapipe_alarm_ui_state_cb, }, { - .datapipe = &charger_state_pipe, + .datapipe = &charger_state_pipe, .output_cb = tklock_datapipe_charger_state_cb, }, { @@ -2041,56 +2050,56 @@ static datapipe_handler_t tklock_datapipe_handlers[] = .output_cb = tklock_datapipe_battery_status_cb, }, { - .datapipe = &exception_state_pipe, - .output_cb = tklock_datapipe_exception_state_cb, + .datapipe = &uiexception_type_pipe, + .output_cb = tklock_datapipe_uiexception_type_cb, }, { - .datapipe = &audio_route_pipe, + .datapipe = &audio_route_pipe, .output_cb = tklock_datapipe_audio_route_cb, }, { - .datapipe = &system_state_pipe, + .datapipe = &system_state_pipe, .output_cb = tklock_datapipe_system_state_cb, }, { - .datapipe = &usb_cable_pipe, - .output_cb = tklock_datapipe_usb_cable_cb, + .datapipe = &usb_cable_state_pipe, + .output_cb = tklock_datapipe_usb_cable_state_cb, }, { - .datapipe = &jack_sense_pipe, - .output_cb = tklock_datapipe_jack_sense_cb, + .datapipe = &jack_sense_state_pipe, + .output_cb = tklock_datapipe_jack_sense_state_cb, }, { - .datapipe = &heartbeat_pipe, - .output_cb = tklock_datapipe_heartbeat_cb, + .datapipe = &heartbeat_event_pipe, + .output_cb = tklock_datapipe_heartbeat_event_cb, }, { - .datapipe = &submode_pipe, + .datapipe = &submode_pipe, .output_cb = tklock_datapipe_submode_cb, }, { - .datapipe = &ambient_light_sensor_pipe, - .output_cb = tklock_datapipe_ambient_light_sensor_cb, + .datapipe = &light_sensor_actual_pipe, + .output_cb = tklock_datapipe_light_sensor_actual_cb, }, { .datapipe = &lid_sensor_is_working_pipe, .output_cb = tklock_datapipe_lid_sensor_is_working_cb, }, { - .datapipe = &lid_cover_sensor_pipe, - .output_cb = tklock_datapipe_lid_cover_sensor_cb, + .datapipe = &lid_sensor_actual_pipe, + .output_cb = tklock_datapipe_lid_sensor_actual_cb, }, { - .datapipe = &lid_cover_policy_pipe, - .output_cb = tklock_datapipe_lid_cover_policy_cb, + .datapipe = &lid_sensor_filtered_pipe, + .output_cb = tklock_datapipe_lid_sensor_filtered_cb, }, { - .datapipe = &lens_cover_pipe, - .output_cb = tklock_datapipe_lens_cover_cb, + .datapipe = &lens_cover_state_pipe, + .output_cb = tklock_datapipe_lens_cover_state_cb, }, { - .datapipe = &user_activity_pipe, - .output_cb = tklock_datapipe_user_activity_cb, + .datapipe = &user_activity_event_pipe, + .output_cb = tklock_datapipe_user_activity_event_cb, }, { @@ -2098,30 +2107,30 @@ static datapipe_handler_t tklock_datapipe_handlers[] = * the actual state -> uses output triggering * unlike the display state logic that is bound * to datapipe input. */ - .datapipe = &keyboard_slide_pipe, - .output_cb = tklock_datapipe_keyboard_slide_output_cb, + .datapipe = &keyboard_slide_state_pipe, + .output_cb = tklock_datapipe_keyboard_slide_output_state_cb, }, { - .datapipe = &keyboard_available_pipe, - .output_cb = tklock_datapipe_keyboard_available_cb, + .datapipe = &keyboard_available_state_pipe, + .output_cb = tklock_datapipe_keyboard_available_state_cb, }, { - .datapipe = &ambient_light_poll_pipe, - .output_cb = tklock_datapipe_ambient_light_poll_cb, + .datapipe = &light_sensor_poll_request_pipe, + .output_cb = tklock_datapipe_light_sensor_poll_request_cb, }, // input triggers { - .datapipe = &keypress_pipe, - .input_cb = tklock_datapipe_keypress_cb, + .datapipe = &keypress_event_pipe, + .input_cb = tklock_datapipe_keypress_event_cb, }, { - .datapipe = &lockkey_pipe, - .input_cb = tklock_datapipe_lockkey_cb, + .datapipe = &lockkey_state_pipe, + .input_cb = tklock_datapipe_lockkey_state_cb, }, { - .datapipe = &camera_button_pipe, - .input_cb = tklock_datapipe_camera_button_cb, + .datapipe = &camera_button_state_pipe, + .input_cb = tklock_datapipe_camera_button_state_cb, }, { /* Note: Logically we should use output trigger for keyboard slide, @@ -2129,8 +2138,8 @@ static datapipe_handler_t tklock_datapipe_handlers[] = * on if mce happens to restart while keyboard is open. * As long as the slide input is not filtered, there is * no harm in this. */ - .datapipe = &keyboard_slide_pipe, - .input_cb = tklock_datapipe_keyboard_slide_input_cb, + .datapipe = &keyboard_slide_state_pipe, + .input_cb = tklock_datapipe_keyboard_slide_input_state_cb, }, // sentinel @@ -2189,7 +2198,7 @@ static void tklock_autolock_on_devlock_prime(void) const int autolock_limit = 60 * 1000; /* Do nothing during startup */ - if( display_state == MCE_DISPLAY_UNDEF ) + if( display_state_curr == MCE_DISPLAY_UNDEF ) goto EXIT; /* Unprime if we are going to powered off state */ @@ -2206,7 +2215,7 @@ static void tklock_autolock_on_devlock_prime(void) } /* Prime if we are coming from powered off state */ - switch( display_state ) { + switch( display_state_curr ) { case MCE_DISPLAY_DIM: case MCE_DISPLAY_ON: break; @@ -2226,13 +2235,13 @@ static void tklock_autolock_on_devlock_prime(void) static void tklock_autolock_on_devlock_trigger(void) { /* Device lock must be active */ - if( device_lock_state != DEVICE_LOCK_LOCKED ) + if( devicelock_state != DEVICELOCK_STATE_LOCKED ) goto EXIT; /* Not while handling calls or alarms */ - switch( exception_state ) { - case UIEXC_CALL: - case UIEXC_ALARM: + switch( uiexception_type ) { + case UIEXCEPTION_TYPE_CALL: + case UIEXCEPTION_TYPE_ALARM: goto EXIT; default: @@ -2267,9 +2276,9 @@ static void tklock_autolock_on_devlock_trigger(void) */ mce_log(LL_DEBUG, "autolock after devicelock: triggered"); - execute_datapipe(&tk_lock_pipe, - GINT_TO_POINTER(LOCK_ON), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&tklock_request_pipe, + GINT_TO_POINTER(TKLOCK_REQUEST_ON), + USE_INDATA, CACHE_INDATA); EXIT: return; } @@ -2305,9 +2314,9 @@ static void tklock_lidsensor_init(void) tklock_lid_sensor_is_working ? "true" : "false"); /* Broadcast initial state */ - execute_datapipe(&lid_sensor_is_working_pipe, - GINT_TO_POINTER(tklock_lid_sensor_is_working), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&lid_sensor_is_working_pipe, + GINT_TO_POINTER(tklock_lid_sensor_is_working), + USE_INDATA, CACHE_INDATA); } /* ========================================================================= * @@ -2362,7 +2371,7 @@ static tklock_lidlight_t tklock_lidlight_from_lux(int lux) */ static tklock_lidlight_t tklock_lidfilter_map_als_state(void) { - return tklock_lidlight_from_lux(ambient_light_sensor_state); + return tklock_lidlight_from_lux(light_sensor_actual); } /** Predicate for: ALS data is used for filtering Lid sensor state @@ -2435,9 +2444,9 @@ static gboolean tklock_lidfilter_wait_for_close_cb(gpointer aptr) tklock_lidfilter_set_allow_close(false); /* Invalidate sensor data */ - execute_datapipe(&lid_cover_sensor_pipe, - GINT_TO_POINTER(COVER_UNDEF), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&lid_sensor_actual_pipe, + GINT_TO_POINTER(COVER_UNDEF), + USE_INDATA, CACHE_INDATA); EXIT: return FALSE; @@ -2462,7 +2471,7 @@ static bool tklock_lidfilter_get_wait_for_close(void) */ static void tklock_lidfilter_set_wait_for_close(bool state) { - if( lid_cover_sensor_state != COVER_OPEN ) + if( lid_sensor_actual != COVER_OPEN ) state = false; if( display_state_next != MCE_DISPLAY_ON && @@ -2507,9 +2516,9 @@ static gboolean tklock_lidfilter_wait_for_dark_cb(gpointer aptr) tklock_lidfilter_set_als_state(TKLOCK_LIDLIGHT_NA); /* Invalidate sensor data */ - execute_datapipe(&lid_cover_sensor_pipe, - GINT_TO_POINTER(COVER_UNDEF), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&lid_sensor_actual_pipe, + GINT_TO_POINTER(COVER_UNDEF), + USE_INDATA, CACHE_INDATA); EXIT: return FALSE; @@ -2624,7 +2633,7 @@ static void tklock_lidfilter_set_wait_for_light(bool state) static void tklock_lidfilter_rethink_als_poll(void) { // when als polling stops, we must stop waiting for light level - if( !ambient_light_poll ) { + if( !light_sensor_polling ) { tklock_lidfilter_set_wait_for_light(false); tklock_lidfilter_rethink_als_state(); } @@ -2634,7 +2643,7 @@ static void tklock_lidfilter_rethink_als_poll(void) */ static void tklock_lidfilter_rethink_allow_close(void) { - switch( display_state ) { + switch( display_state_curr ) { case MCE_DISPLAY_POWER_UP: /* After display power cycling we need to see a high lux value * before lid close can be used for display blanking again. */ @@ -2643,11 +2652,11 @@ static void tklock_lidfilter_rethink_allow_close(void) /* Display power up while sensor is in closed state. Assume this * is due to user pressing power key and ignore the lid sensor * state until further changes are received. */ - if( lid_cover_sensor_state == COVER_CLOSED ) { + if( lid_sensor_actual == COVER_CLOSED ) { mce_log(LL_DEVEL, "unblank while lid closed; ignore lid"); - execute_datapipe(&lid_cover_sensor_pipe, - GINT_TO_POINTER(COVER_UNDEF), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&lid_sensor_actual_pipe, + GINT_TO_POINTER(COVER_UNDEF), + USE_INDATA, CACHE_INDATA); } break; @@ -2675,13 +2684,13 @@ static void tklock_lidfilter_rethink_lid_state(void) } /* Keep ALS powered up for a while after lid state change */ - if( lid_cover_sensor_state != COVER_UNDEF ) { - execute_datapipe(&ambient_light_poll_pipe, - GINT_TO_POINTER(TRUE), - USE_INDATA, CACHE_OUTDATA); + if( lid_sensor_actual != COVER_UNDEF ) { + datapipe_exec_full(&light_sensor_poll_request_pipe, + GINT_TO_POINTER(TRUE), + USE_INDATA, CACHE_OUTDATA); } - switch( lid_cover_sensor_state ) { + switch( lid_sensor_actual ) { case COVER_OPEN: tklock_lidfilter_set_wait_for_dark(false); tklock_lidfilter_set_wait_for_light(true); @@ -2752,7 +2761,7 @@ static void tklock_lidfilter_rethink_als_state(void) * seen high light value, but rise in level means * the sensor is up and sees light -> we can stop * waiting */ - if( prev < ambient_light_sensor_state ) + if( prev < light_sensor_actual ) tklock_lidfilter_set_als_state(TKLOCK_LIDLIGHT_HI); else tklock_lidfilter_set_als_state(TKLOCK_LIDLIGHT_NA); @@ -2768,8 +2777,8 @@ static void tklock_lidfilter_rethink_als_state(void) } /* Update previous value unless ALS is powered down */ - if( ambient_light_sensor_state >= 0 ) - prev = ambient_light_sensor_state; + if( light_sensor_actual >= 0 ) + prev = light_sensor_actual; tklock_lidpolicy_rethink(); } @@ -2808,30 +2817,30 @@ static void tklock_lidpolicy_rethink(void) else if( !tklock_lidfilter_is_enabled() ) { /* No filtering -> use sensor state as is */ - action = lid_cover_sensor_state; + action = lid_sensor_actual; } - else if( lid_cover_sensor_state == COVER_CLOSED && + else if( lid_sensor_actual == COVER_CLOSED && tklock_lidfilter_als_state == TKLOCK_LIDLIGHT_LO ) { if( tklock_lidfilter_allow_close ) action = COVER_CLOSED; } - else if( lid_cover_sensor_state == COVER_OPEN && + else if( lid_sensor_actual == COVER_OPEN && tklock_lidfilter_als_state == TKLOCK_LIDLIGHT_HI ) { action = COVER_OPEN; } /* Skip the rest if there is no change */ - if( lid_cover_policy_state == action ) + if( lid_sensor_filtered == action ) goto EXIT; mce_log(LL_DEBUG, "lid policy: %s -> %s", - cover_state_repr(lid_cover_policy_state), + cover_state_repr(lid_sensor_filtered), cover_state_repr(action)); /* First make the policy decision known */ - execute_datapipe(&lid_cover_policy_pipe, - GINT_TO_POINTER(action), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&lid_sensor_filtered_pipe, + GINT_TO_POINTER(action), + USE_INDATA, CACHE_INDATA); /* Then execute the required actions */ switch( action ) { @@ -2844,9 +2853,9 @@ static void tklock_lidpolicy_rethink(void) if( tklock_lid_close_actions == LID_CLOSE_ACTION_TKLOCK ) { mce_log(LL_DEBUG, "lid closed - tklock"); - execute_datapipe(&tk_lock_pipe, - GINT_TO_POINTER(LOCK_ON), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&tklock_request_pipe, + GINT_TO_POINTER(TKLOCK_REQUEST_ON), + USE_INDATA, CACHE_INDATA); } break; @@ -2859,9 +2868,9 @@ static void tklock_lidpolicy_rethink(void) if( tklock_lid_open_actions == LID_OPEN_ACTION_TKUNLOCK ) { mce_log(LL_DEBUG, "lid open - untklock"); - execute_datapipe(&tk_lock_pipe, - GINT_TO_POINTER(LOCK_OFF), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&tklock_request_pipe, + GINT_TO_POINTER(TKLOCK_REQUEST_OFF), + USE_INDATA, CACHE_INDATA); } break; @@ -2908,8 +2917,8 @@ static void tklock_keyboard_slide_opened(void) break; case KBD_OPEN_TRIGGER_NO_PROXIMITY: - if( proximity_state_actual == COVER_CLOSED || - lid_cover_policy_state == COVER_CLOSED ) + if( proximity_sensor_actual == COVER_CLOSED || + lid_sensor_filtered == COVER_CLOSED ) goto EXIT; break; } @@ -2922,9 +2931,9 @@ static void tklock_keyboard_slide_opened(void) if( tklock_kbd_open_actions == LID_OPEN_ACTION_TKUNLOCK ) { mce_log(LL_DEBUG, "kbd slide open - untklock"); - execute_datapipe(&tk_lock_pipe, - GINT_TO_POINTER(LOCK_OFF), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&tklock_request_pipe, + GINT_TO_POINTER(TKLOCK_REQUEST_OFF), + USE_INDATA, CACHE_INDATA); } /* Mark down we unblanked due to keyboard open */ @@ -2938,7 +2947,7 @@ static void tklock_keyboard_slide_opened(void) static void tklock_keyboard_slide_closed(void) { /* Must not blank during active alarms / calls */ - if( exception_state & (UIEXC_CALL | UIEXC_ALARM) ) + if( uiexception_type & (UIEXCEPTION_TYPE_CALL | UIEXCEPTION_TYPE_ALARM) ) goto EXIT; /* Check if actions are wanted */ @@ -2967,9 +2976,9 @@ static void tklock_keyboard_slide_closed(void) if( tklock_kbd_close_actions == LID_CLOSE_ACTION_TKLOCK ) { mce_log(LL_DEBUG, "kbd slide closed - tklock"); - execute_datapipe(&tk_lock_pipe, - GINT_TO_POINTER(LOCK_ON), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&tklock_request_pipe, + GINT_TO_POINTER(TKLOCK_REQUEST_ON), + USE_INDATA, CACHE_INDATA); } EXIT: @@ -2984,7 +2993,7 @@ static void tklock_keyboard_slide_closed(void) static void tklock_keyboard_slide_rethink(void) { - switch( kbd_slide_input_state ) { + switch( keyboard_slide_input_state ) { case COVER_OPEN: tklock_keyboard_slide_opened(); break; @@ -3014,11 +3023,11 @@ static mce_hbtimer_t *tklock_autolock_timer = 0; static void tklock_autolock_evaluate(void) { // display must be currently off - if( display_state != MCE_DISPLAY_OFF ) + if( display_state_curr != MCE_DISPLAY_OFF ) goto EXIT; // tklock unset - if( submode & MCE_TKLOCK_SUBMODE ) + if( submode & MCE_SUBMODE_TKLOCK ) goto EXIT; // autolocking enabled @@ -3026,11 +3035,11 @@ static void tklock_autolock_evaluate(void) goto EXIT; // not handling calls, alarms, etc - if( exception_state != UIEXC_NONE ) + if( uiexception_type != UIEXCEPTION_TYPE_NONE ) goto EXIT; // if device lock is on, apply tklock immediately - if( device_lock_state == DEVICE_LOCK_LOCKED ) + if( devicelock_state == DEVICELOCK_STATE_LOCKED ) goto LOCK; // autolock delay to passed @@ -3095,7 +3104,7 @@ static void tklock_autolock_rethink(void) // not in OFF or moving away from OFF tklock_autolock_disable(); } - else if( display_state_next != display_state ) { + else if( display_state_next != display_state_curr ) { // making transition to OFF tklock_autolock_enable(); } @@ -3138,19 +3147,19 @@ static guint tklock_proxlock_id = 0; static void tklock_proxlock_evaluate(void) { // display must be currently off - if( display_state != MCE_DISPLAY_OFF ) + if( display_state_curr != MCE_DISPLAY_OFF ) goto EXIT; // tklock unset - if( submode & MCE_TKLOCK_SUBMODE ) + if( submode & MCE_SUBMODE_TKLOCK ) goto EXIT; // proximity covered - if( proximity_state_effective != COVER_CLOSED ) + if( proximity_sensor_effective != COVER_CLOSED ) goto EXIT; // not handling call, alarm, etc - if( exception_state != UIEXC_NONE ) + if( uiexception_type != UIEXCEPTION_TYPE_NONE ) goto EXIT; // proximity lock delay passed @@ -3234,7 +3243,7 @@ static void tklock_proxlock_rethink(void) // not in OFF or moving away from OFF tklock_proxlock_disable(); } - else if( display_state_next != display_state ) { + else if( display_state_next != display_state_curr ) { // making transition to OFF tklock_proxlock_enable(); } @@ -3250,11 +3259,11 @@ static void tklock_proxlock_rethink(void) typedef struct { - uiexctype_t mask; - uiexctype_t last; + uiexception_type_t mask; + uiexception_type_t last; display_state_t display; bool tklock; - device_lock_state_t devicelock; + devicelock_state_t devicelock; bool insync; bool restore; bool was_called; @@ -3266,11 +3275,11 @@ typedef struct static exception_t exdata = { - .mask = UIEXC_NONE, - .last = UIEXC_NONE, + .mask = UIEXCEPTION_TYPE_NONE, + .last = UIEXCEPTION_TYPE_NONE, .display = MCE_DISPLAY_UNDEF, .tklock = false, - .devicelock = DEVICE_LOCK_UNDEFINED, + .devicelock = DEVICELOCK_STATE_UNDEFINED, .insync = true, .restore = true, .was_called = false, @@ -3280,7 +3289,7 @@ static exception_t exdata = .notif_id = 0, }; -static uiexctype_t topmost_active(uiexctype_t mask) +static uiexception_type_t topmost_active(uiexception_type_t mask) { /* Assume UI side priority is: * 1. notification dialogs @@ -3289,12 +3298,12 @@ static uiexctype_t topmost_active(uiexctype_t mask) * 4. rest */ - static const uiexctype_t pri[] = { - UIEXC_NOTIF, - UIEXC_ALARM, - UIEXC_CALL, - UIEXC_LINGER, - UIEXC_NOANIM, + static const uiexception_type_t pri[] = { + UIEXCEPTION_TYPE_NOTIF, + UIEXCEPTION_TYPE_ALARM, + UIEXCEPTION_TYPE_CALL, + UIEXCEPTION_TYPE_LINGER, + UIEXCEPTION_TYPE_NOANIM, 0 }; @@ -3303,18 +3312,18 @@ static uiexctype_t topmost_active(uiexctype_t mask) return pri[i]; } - return UIEXC_NONE; + return UIEXCEPTION_TYPE_NONE; } -static void tklock_uiexcept_sync_to_datapipe(void) +static void tklock_uiexception_sync_to_datapipe(void) { - uiexctype_t in_pipe = datapipe_get_gint(exception_state_pipe); - uiexctype_t active = topmost_active(exdata.mask); + uiexception_type_t in_pipe = datapipe_get_gint(uiexception_type_pipe); + uiexception_type_t active = topmost_active(exdata.mask); if( in_pipe != active ) { - execute_datapipe(&exception_state_pipe, - GINT_TO_POINTER(active), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&uiexception_type_pipe, + GINT_TO_POINTER(active), + USE_INDATA, CACHE_INDATA); } } @@ -3324,7 +3333,7 @@ static void tklock_uiexcept_sync_to_datapipe(void) * false for canceling only if neither tklock nor devicelock * is active */ -static bool tklock_uiexcept_deny_state_restore(bool force, const char *cause) +static bool tklock_uiexception_deny_state_restore(bool force, const char *cause) { bool changed = false; @@ -3345,22 +3354,21 @@ static bool tklock_uiexcept_deny_state_restore(bool force, const char *cause) return changed; } -static void tklock_uiexcept_rethink(void) +static void tklock_uiexception_rethink(void) { static display_state_t display_prev = MCE_DISPLAY_UNDEF; static call_state_t call_state_prev = CALL_STATE_INVALID; - static uiexctype_t active_prev = UIEXC_NONE; + static uiexception_type_t active_prev = UIEXCEPTION_TYPE_NONE; - bool activate = false; - bool blank = false; - uiexctype_t active = topmost_active(exdata.mask); - - bool proximity_blank = false; + bool activate = false; + bool blank = false; + uiexception_type_t active = topmost_active(exdata.mask); + bool proximity_blank = false; /* Make sure "proximityblanking" state gets cleared if display * changes to non-off state. */ - if( display_prev != display_state ) { - switch( display_state ) { + if( display_prev != display_state_curr ) { + switch( display_state_curr ) { case MCE_DISPLAY_OFF: case MCE_DISPLAY_POWER_DOWN: break; @@ -3372,22 +3380,22 @@ static void tklock_uiexcept_rethink(void) case MCE_DISPLAY_LPM_OFF: case MCE_DISPLAY_LPM_ON: case MCE_DISPLAY_POWER_UP: - execute_datapipe(&proximity_blank_pipe, - GINT_TO_POINTER(false), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&proximity_blanked_pipe, + GINT_TO_POINTER(false), + USE_INDATA, CACHE_INDATA); break; } } if( !active ) { - mce_log(LL_DEBUG, "UIEXC_NONE"); + mce_log(LL_DEBUG, "UIEXCEPTION_TYPE_NONE"); goto EXIT; } /* Track states that have gotten topmost before linger */ - if( active != UIEXC_LINGER ) - exdata.last = UIEXC_NONE; - else if( active_prev != UIEXC_LINGER ) + if( active != UIEXCEPTION_TYPE_LINGER ) + exdata.last = UIEXCEPTION_TYPE_NONE; + else if( active_prev != UIEXCEPTION_TYPE_LINGER ) exdata.last = active_prev; /* Special case: tklock changes during incoming calls */ @@ -3431,11 +3439,11 @@ static void tklock_uiexcept_rethink(void) } /* Canceling state restore due to device lock changes */ - if( device_lock_state == DEVICE_LOCK_LOCKED ) { + if( devicelock_state == DEVICELOCK_STATE_LOCKED ) { // getting locked does not cancel state restore - exdata.devicelock = device_lock_state; + exdata.devicelock = devicelock_state; } - else if( exdata.devicelock != device_lock_state && exdata.restore ) { + else if( exdata.devicelock != devicelock_state && exdata.restore ) { // but getting unlocked does mce_log(LL_NOTICE, "DISABLING STATE RESTORE; devicelock out of sync"); exdata.restore = false; @@ -3451,11 +3459,11 @@ static void tklock_uiexcept_rethink(void) } // re-sync on display on transition - if( display_prev != display_state ) { + if( display_prev != display_state_curr ) { mce_log(LL_DEBUG, "display state: %s -> %s", display_state_repr(display_prev), - display_state_repr(display_state)); - if( display_state == MCE_DISPLAY_ON ) { + display_state_repr(display_state_curr)); + if( display_state_curr == MCE_DISPLAY_ON ) { if( !exdata.insync ) mce_log(LL_NOTICE, "display unblanked; assuming in sync again"); exdata.insync = true; @@ -3471,7 +3479,7 @@ static void tklock_uiexcept_rethink(void) } switch( active ) { - case UIEXC_NOANIM: + case UIEXCEPTION_TYPE_NOANIM: /* The noanim exception is used only during display power up. * It also has the lowest priority, which means that if it * ever gets on top of the exception stack, we need to disable @@ -3482,18 +3490,18 @@ static void tklock_uiexcept_rethink(void) } break; - case UIEXC_NOTIF: - mce_log(LL_DEBUG, "UIEXC_NOTIF"); + case UIEXCEPTION_TYPE_NOTIF: + mce_log(LL_DEBUG, "UIEXCEPTION_TYPE_NOTIF"); activate = true; break; - case UIEXC_ALARM: - mce_log(LL_DEBUG, "UIEXC_ALARM"); + case UIEXCEPTION_TYPE_ALARM: + mce_log(LL_DEBUG, "UIEXCEPTION_TYPE_ALARM"); activate = true; break; - case UIEXC_CALL: - mce_log(LL_DEBUG, "UIEXC_CALL"); + case UIEXCEPTION_TYPE_CALL: + mce_log(LL_DEBUG, "UIEXCEPTION_TYPE_CALL"); if( call_state == CALL_STATE_RINGING ) { mce_log(LL_DEBUG, "call=RINGING; activate"); activate = true; @@ -3502,7 +3510,7 @@ static void tklock_uiexcept_rethink(void) mce_log(LL_DEBUG, "audio!=HANDSET; activate"); activate = true; } - else if( proximity_state_effective == COVER_CLOSED ) { + else if( proximity_sensor_effective == COVER_CLOSED ) { mce_log(LL_DEBUG, "proximity=COVERED; blank"); /* blanking due to proximity sensor */ blank = proximity_blank = true; @@ -3513,12 +3521,12 @@ static void tklock_uiexcept_rethink(void) } break; - case UIEXC_LINGER: - mce_log(LL_DEBUG, "UIEXC_LINGER"); + case UIEXCEPTION_TYPE_LINGER: + mce_log(LL_DEBUG, "UIEXCEPTION_TYPE_LINGER"); activate = true; break; - case UIEXC_NONE: + case UIEXCEPTION_TYPE_NONE: // we should not get here break; @@ -3532,13 +3540,13 @@ static void tklock_uiexcept_rethink(void) mce_log(LL_DEBUG, "blank=%d, activate=%d", blank, activate); if( blank ) { - if( display_state != MCE_DISPLAY_OFF ) { + if( display_state_curr != MCE_DISPLAY_OFF ) { /* expose blanking due to proximity via datapipe */ if( proximity_blank ) { mce_log(LL_DEVEL, "display proximity blank"); - execute_datapipe(&proximity_blank_pipe, - GINT_TO_POINTER(true), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&proximity_blanked_pipe, + GINT_TO_POINTER(true), + USE_INDATA, CACHE_INDATA); } else { mce_log(LL_DEBUG, "display blank"); @@ -3551,7 +3559,7 @@ static void tklock_uiexcept_rethink(void) } else if( activate ) { if( display_prev == MCE_DISPLAY_ON && - display_state != MCE_DISPLAY_ON ) { + display_state_curr != MCE_DISPLAY_ON ) { /* Assume: dim/blank timer took over the blanking. * Disable this state machine until display gets * turned back on */ @@ -3560,7 +3568,7 @@ static void tklock_uiexcept_rethink(void) /* Disable state restore, unless we went out of * sync during call ui handling */ - if( exdata.restore && active != UIEXC_CALL ) { + if( exdata.restore && active != UIEXCEPTION_TYPE_CALL ) { exdata.restore = false; mce_log(LL_NOTICE, "DISABLING STATE RESTORE; display out of sync"); } @@ -3568,13 +3576,13 @@ static void tklock_uiexcept_rethink(void) else if( !exdata.insync ) { mce_log(LL_NOTICE, "NOT UNBLANKING; still out of sync"); } - else if( lid_cover_policy_state == COVER_CLOSED ) { + else if( lid_sensor_filtered == COVER_CLOSED ) { mce_log(LL_NOTICE, "NOT UNBLANKING; lid covered"); } - else if( proximity_state_effective == COVER_CLOSED ) { + else if( proximity_sensor_effective == COVER_CLOSED ) { mce_log(LL_NOTICE, "NOT UNBLANKING; proximity covered"); } - else if( display_state != MCE_DISPLAY_ON ) { + else if( display_state_curr != MCE_DISPLAY_ON ) { mce_log(LL_DEBUG, "display unblank"); mce_datapipe_req_display_state(MCE_DISPLAY_ON); } @@ -3583,18 +3591,18 @@ static void tklock_uiexcept_rethink(void) /* Make sure "proximityblanking" state gets cleared if display * state is no longer controlled by this state machine. */ if( !exdata.insync ) { - execute_datapipe(&proximity_blank_pipe, - GINT_TO_POINTER(false), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&proximity_blanked_pipe, + GINT_TO_POINTER(false), + USE_INDATA, CACHE_INDATA); } EXIT: - display_prev = display_state; + display_prev = display_state_curr; return; } -static void tklock_uiexcept_cancel(void) +static void tklock_uiexception_cancel(void) { if( exdata.notif_id ) { g_source_remove(exdata.notif_id), @@ -3606,11 +3614,11 @@ static void tklock_uiexcept_cancel(void) exdata.linger_id = 0; } - exdata.mask = UIEXC_NONE; - exdata.last = UIEXC_NONE; + exdata.mask = UIEXCEPTION_TYPE_NONE; + exdata.last = UIEXCEPTION_TYPE_NONE; exdata.display = MCE_DISPLAY_UNDEF; exdata.tklock = false; - exdata.devicelock = DEVICE_LOCK_UNDEFINED; + exdata.devicelock = DEVICELOCK_STATE_UNDEFINED; exdata.insync = true; exdata.restore = true; exdata.was_called = false; @@ -3620,15 +3628,15 @@ static void tklock_uiexcept_cancel(void) exdata.notif_id = 0; } -static void tklock_uiexcept_finish(void) +static void tklock_uiexception_finish(void) { /* operate on copy of data, in case the data * pipe operations cause feedback */ exception_t exx = exdata; - tklock_uiexcept_cancel(); + tklock_uiexception_cancel(); /* update exception data pipe first */ - tklock_uiexcept_sync_to_datapipe(); + tklock_uiexception_sync_to_datapipe(); /* check if restoring has been blocked */ if( !exx.restore ) @@ -3637,9 +3645,9 @@ static void tklock_uiexcept_finish(void) /* then flip the tklock back on? Note that we * we do not unlock no matter what. */ if( exx.tklock ) { - execute_datapipe(&tk_lock_pipe, - GINT_TO_POINTER(LOCK_ON), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&tklock_request_pipe, + GINT_TO_POINTER(TKLOCK_REQUEST_ON), + USE_INDATA, CACHE_INDATA); } /* and finally the display data pipe */ @@ -3657,10 +3665,10 @@ static void tklock_uiexcept_finish(void) * * Note: Because linger times are relatively short, * we use raw sensor data here instead of the filtered - * proximity_state_effective that is normally used + * proximity_sensor_effective that is normally used * with unblanking policies. */ - if( proximity_state_actual != COVER_OPEN || - lid_cover_policy_state == COVER_CLOSED ) + if( proximity_sensor_actual != COVER_OPEN || + lid_sensor_filtered == COVER_CLOSED ) break; mce_datapipe_req_display_state(exx.display); @@ -3670,7 +3678,7 @@ static void tklock_uiexcept_finish(void) return; } -static gboolean tklock_uiexcept_linger_cb(gpointer aptr) +static gboolean tklock_uiexception_linger_cb(gpointer aptr) { (void) aptr; @@ -3681,7 +3689,7 @@ static gboolean tklock_uiexcept_linger_cb(gpointer aptr) exdata.linger_id = 0; /* Ignore unless linger bit and only linger bit is set */ - if( exdata.mask != UIEXC_LINGER ) { + if( exdata.mask != UIEXCEPTION_TYPE_LINGER ) { mce_log(LL_WARN, "spurious linger timeout"); goto EXIT; } @@ -3692,7 +3700,7 @@ static gboolean tklock_uiexcept_linger_cb(gpointer aptr) * expected after linger. */ if( display_state_next == MCE_DISPLAY_ON && tklock_ui_enabled && interaction_expected ) { - if( exdata.last == UIEXC_CALL ) { + if( exdata.last == UIEXCEPTION_TYPE_CALL ) { /* End of call is exception within exception because * the call ui can be left on top of the lockscreen and * there is no way to know whether that happened or not. @@ -3704,18 +3712,18 @@ static gboolean tklock_uiexcept_linger_cb(gpointer aptr) */ } else { - tklock_uiexcept_deny_state_restore(true, - "interaction during linger"); + tklock_uiexception_deny_state_restore(true, + "interaction during linger"); } } - tklock_uiexcept_finish(); + tklock_uiexception_finish(); EXIT: return FALSE; } -static void tklock_uiexcept_end(uiexctype_t type, int64_t linger) +static void tklock_uiexception_end(uiexception_type_t type, int64_t linger) { if( !(exdata.mask & type) ) goto EXIT; @@ -3736,38 +3744,38 @@ static void tklock_uiexcept_end(uiexctype_t type, int64_t linger) int delay = (int)(exdata.linger_tick - now); if( delay > 0 ) { mce_log(LL_DEBUG, "finish after %d ms linger", delay); - exdata.mask |= UIEXC_LINGER; - exdata.linger_id = g_timeout_add(delay, tklock_uiexcept_linger_cb, 0); + exdata.mask |= UIEXCEPTION_TYPE_LINGER; + exdata.linger_id = g_timeout_add(delay, tklock_uiexception_linger_cb, 0); } else { mce_log(LL_DEBUG, "finish without linger"); - tklock_uiexcept_finish(); + tklock_uiexception_finish(); } } - tklock_uiexcept_sync_to_datapipe(); + tklock_uiexception_sync_to_datapipe(); EXIT: return; } -static void tklock_uiexcept_begin(uiexctype_t type, int64_t linger) +static void tklock_uiexception_begin(uiexception_type_t type, int64_t linger) { if( !exdata.mask ) { /* reset existing stats */ - tklock_uiexcept_cancel(); + tklock_uiexception_cancel(); /* save display, tklock and device lock states */ - exdata.display = display_state; + exdata.display = display_state_curr; exdata.tklock = tklock_datapipe_have_tklock_submode(); - exdata.devicelock = device_lock_state; + exdata.devicelock = devicelock_state; /* initially insync, restore state at end */ exdata.insync = true; - exdata.restore = (type != UIEXC_NOANIM); + exdata.restore = (type != UIEXCEPTION_TYPE_NOANIM); } - exdata.mask &= ~UIEXC_LINGER; + exdata.mask &= ~UIEXCEPTION_TYPE_LINGER; exdata.mask |= type; int64_t now = mce_lib_get_boot_tick(); @@ -3780,7 +3788,7 @@ static void tklock_uiexcept_begin(uiexctype_t type, int64_t linger) if( exdata.linger_id ) g_source_remove(exdata.linger_id), exdata.linger_id = 0; - tklock_uiexcept_sync_to_datapipe(); + tklock_uiexception_sync_to_datapipe(); } /* ========================================================================= * @@ -3830,9 +3838,9 @@ static void tklock_lpmui_set_state(bool enable) * display modes, the dbus signaling happens after some * delay. */ - execute_datapipe(&tk_lock_pipe, - GINT_TO_POINTER(LOCK_ON), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&tklock_request_pipe, + GINT_TO_POINTER(TKLOCK_REQUEST_ON), + USE_INDATA, CACHE_INDATA); } else { /* Do delayed signaling in sync with possible tklock @@ -3855,7 +3863,7 @@ static void tklock_lpmui_reset_history(void) for( size_t i = 0; i < numof(tklock_lpmui_hist); ++i ) { tklock_lpmui_hist[i].tick = now; - tklock_lpmui_hist[i].state = proximity_state_actual; + tklock_lpmui_hist[i].state = proximity_sensor_actual; } } @@ -3992,25 +4000,25 @@ static bool tklock_lpmui_probe(void) static void tklock_lpmui_rethink(void) { /* prerequisites: in user state, lipstick running and display off */ - if( system_state != MCE_STATE_USER ) + if( system_state != MCE_SYSTEM_STATE_USER ) goto EXIT; - if( lipstick_available != SERVICE_STATE_RUNNING ) + if( lipstick_service_state != SERVICE_STATE_RUNNING ) goto EXIT; - if( display_state != MCE_DISPLAY_OFF ) + if( display_state_curr != MCE_DISPLAY_OFF ) goto EXIT; /* but not during calls, alarms, etc */ - if( exception_state != UIEXC_NONE ) + if( uiexception_type != UIEXCEPTION_TYPE_NONE ) goto EXIT; /* when lid is closed */ - if( lid_cover_policy_state == COVER_CLOSED ) + if( lid_sensor_filtered == COVER_CLOSED ) goto EXIT; /* or when proximity is covered */ - if( proximity_state_effective != COVER_OPEN ) + if( proximity_sensor_effective != COVER_OPEN ) goto EXIT; /* Switch to lpm mode if the proximity sensor history matches activity @@ -4033,7 +4041,7 @@ static void tklock_lpmui_rethink(void) */ static void tklock_lpmui_pre_transition_actions(void) { - mce_log(LL_DEBUG, "prev=%d, next=%d", display_state, display_state_next); + mce_log(LL_DEBUG, "prev=%d, next=%d", display_state_curr, display_state_next); switch( display_state_next ) { case MCE_DISPLAY_LPM_ON: @@ -4043,7 +4051,7 @@ static void tklock_lpmui_pre_transition_actions(void) break; case MCE_DISPLAY_OFF: - switch( display_state ) { + switch( display_state_curr ) { case MCE_DISPLAY_ON: case MCE_DISPLAY_DIM: /* We are about to power off from ON/DIM */ @@ -4203,8 +4211,8 @@ static void tklock_evctrl_set_dt_state(bool enable) static void tklock_evctrl_rethink(void) { /* state variable hooks: - * proximity_state_effective <-- tklock_datapipe_proximity_sensor_cb() - * display_state <-- tklock_datapipe_display_state_cb() + * proximity_sensor_effective <-- tklock_datapipe_proximity_sensor_actual_cb() + * display_state_curr <-- tklock_datapipe_display_state_curr_cb() * submode <-- tklock_datapipe_submode_cb() * call_state <-- tklock_datapipe_call_state_cb() */ @@ -4218,7 +4226,7 @@ static void tklock_evctrl_rethink(void) * - - - - - - - - - - - - - - - - - - - */ /* display must be on/dim */ - switch( display_state ) { + switch( display_state_curr ) { case MCE_DISPLAY_ON: case MCE_DISPLAY_DIM: break; @@ -4242,7 +4250,7 @@ static void tklock_evctrl_rethink(void) * * In absense of such info, better to do nothing. */ - if( lid_cover_policy_state == COVER_CLOSED ) { + if( lid_sensor_filtered == COVER_CLOSED ) { enable_kp = false; } #endif @@ -4260,7 +4268,7 @@ static void tklock_evctrl_rethink(void) } /* enable volume keys if music playing */ - if( music_playback ) + if( music_playback_ongoing ) enable_kp = true; /* - - - - - - - - - - - - - - - - - - - * @@ -4268,7 +4276,7 @@ static void tklock_evctrl_rethink(void) * - - - - - - - - - - - - - - - - - - - */ /* display must be on/dim */ - switch( display_state ) { + switch( display_state_curr ) { case MCE_DISPLAY_ON: case MCE_DISPLAY_DIM: break; @@ -4291,7 +4299,7 @@ static void tklock_evctrl_rethink(void) * - - - - - - - - - - - - - - - - - - - */ /* display must be off */ - switch( display_state ) { + switch( display_state_curr ) { case MCE_DISPLAY_OFF: case MCE_DISPLAY_LPM_OFF: case MCE_DISPLAY_LPM_ON: @@ -4316,7 +4324,7 @@ static void tklock_evctrl_rethink(void) break; default: case DBLTAP_ENABLE_NO_PROXIMITY: - if( proximity_state_effective != COVER_OPEN ) + if( proximity_sensor_effective != COVER_OPEN ) enable_dt = false; break; } @@ -4332,7 +4340,7 @@ static void tklock_evctrl_rethink(void) * - - - - - - - - - - - - - - - - - - - */ #if 0 // FIXME: malf is not really supported yet - if( submode & MCE_MALF_SUBMODE ) { + if( submode & MCE_SUBMODE_MALF ) { enable_kp = false; enable_ts = false; enable_dt = false; @@ -4365,7 +4373,7 @@ static void tklock_evctrl_rethink(void) bool grab_ts = datapipe_get_gint(touch_grab_wanted_pipe); - switch( display_state ) { + switch( display_state_curr ) { default: case MCE_DISPLAY_OFF: case MCE_DISPLAY_POWER_DOWN: @@ -4394,12 +4402,12 @@ static void tklock_evctrl_rethink(void) * only when proximity sensor is not covered / proximity * blocks input feature is disabled */ if( grab_ts || - ( (proximity_state_effective == COVER_OPEN || + ( (proximity_sensor_effective == COVER_OPEN || !proximity_blocks_touch) && - (lid_cover_policy_state != COVER_CLOSED) ) ) { - execute_datapipe(&touch_grab_wanted_pipe, - GINT_TO_POINTER(grab_ts), - USE_INDATA, CACHE_INDATA); + (lid_sensor_filtered != COVER_CLOSED) ) ) { + datapipe_exec_full(&touch_grab_wanted_pipe, + GINT_TO_POINTER(grab_ts), + USE_INDATA, CACHE_INDATA); } /* - - - - - - - - - - - - - - - - - - - * @@ -4413,7 +4421,7 @@ static void tklock_evctrl_rethink(void) switch( volkey_policy ) { case VOLKEY_POLICY_MEDIA_ONLY: - if( !music_playback ) + if( !music_playback_ongoing ) grab_kp = true; break; @@ -4424,9 +4432,9 @@ static void tklock_evctrl_rethink(void) if( !tk_input_policy_enabled ) grab_kp = false; - execute_datapipe(&keypad_grab_wanted_pipe, - GINT_TO_POINTER(grab_kp), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&keypad_grab_wanted_pipe, + GINT_TO_POINTER(grab_kp), + USE_INDATA, CACHE_INDATA); return; } @@ -5309,7 +5317,7 @@ static void tklock_ui_send_tklock_signal(void) tklock_ui_notified = current; /* do lipstick specific ipc */ - if( lipstick_available == SERVICE_STATE_RUNNING ) { + if( lipstick_service_state == SERVICE_STATE_RUNNING ) { if( current ) tklock_ui_open(); else @@ -5353,11 +5361,11 @@ static bool tklock_ui_notify_must_be_delayed(void) * off sequence as those might trigger lockscreen related * animations at UI side */ - if( display_state == MCE_DISPLAY_POWER_DOWN ) { + if( display_state_curr == MCE_DISPLAY_POWER_DOWN ) { /* Powering down the display for any reason */ delay = true; } - else if( display_state != display_state_next ) { + else if( display_state_curr != display_state_next ) { switch( display_state_next ) { case MCE_DISPLAY_OFF: case MCE_DISPLAY_LPM_OFF: @@ -5475,7 +5483,7 @@ static void tklock_ui_set(bool enable) * to tklock state ringing if/when lipstick happens * to require tklock to be set. */ - if( lipstick_available != SERVICE_STATE_RUNNING ) { + if( lipstick_service_state != SERVICE_STATE_RUNNING ) { /* When there is no UI to lock, allowing tklock to * be set can only cause problems */ mce_log(LL_INFO, "deny tklock; lipstick not running"); @@ -5491,23 +5499,23 @@ static void tklock_ui_set(bool enable) * allow *removing* of tklock (=move away from lockscreen) * while device lock is still active. */ if( tklock_devicelock_in_lockscreen && - device_lock_state == DEVICE_LOCK_LOCKED && !enable ) { + devicelock_state == DEVICELOCK_STATE_LOCKED && !enable ) { mce_log(LL_DEVEL, "deny tkunlock; show device lock query"); tklock_devicelock_want_to_unlock = true; goto EXIT; } /* Do not allow unlocking while lid sensor is enabled and covered */ - if( lid_cover_policy_state == COVER_CLOSED && !enable ) { + if( lid_sensor_filtered == COVER_CLOSED && !enable ) { mce_log(LL_WARN, "deny tkunlock; lid sensor is covered"); goto EXIT; } /* Activate the new tklock state */ if( (tklock_ui_enabled = enable) ) - mce_add_submode_int32(MCE_TKLOCK_SUBMODE); + mce_add_submode_int32(MCE_SUBMODE_TKLOCK); else - mce_rem_submode_int32(MCE_TKLOCK_SUBMODE); + mce_rem_submode_int32(MCE_SUBMODE_TKLOCK); EXIT: /* Schedule notification attempt even if there is no change, @@ -5518,7 +5526,7 @@ static void tklock_ui_set(bool enable) /** Handle reply to device lock state query */ -static void tklock_ui_get_device_lock_cb(DBusPendingCall *pc, void *aptr) +static void tklock_ui_get_devicelock_cb(DBusPendingCall *pc, void *aptr) { (void)aptr; @@ -5541,7 +5549,7 @@ static void tklock_ui_get_device_lock_cb(DBusPendingCall *pc, void *aptr) } mce_log(LL_INFO, "device lock status reply: state=%d", val); - tklock_datapipe_set_device_lock_state(val); + tklock_datapipe_set_devicelock_state(val); EXIT: if( rsp ) dbus_message_unref(rsp); @@ -5550,14 +5558,14 @@ static void tklock_ui_get_device_lock_cb(DBusPendingCall *pc, void *aptr) /** Initiate asynchronous device lock state query */ -static void tklock_ui_get_device_lock(void) +static void tklock_ui_get_devicelock(void) { mce_log(LL_DEBUG, "query device lock status"); dbus_send(DEVICELOCK_SERVICE, DEVICELOCK_REQUEST_PATH, DEVICELOCK_REQUEST_IF, "state", - tklock_ui_get_device_lock_cb, + tklock_ui_get_devicelock_cb, DBUS_TYPE_INVALID); } @@ -5573,7 +5581,7 @@ static void tklock_ui_send_lpm_signal(void) bool enabled = (tklock_lpmui_state_wanted > 0); /* Do lipstick specific ipc 1st */ - if( lipstick_available == SERVICE_STATE_RUNNING ) { + if( lipstick_service_state == SERVICE_STATE_RUNNING ) { if( enabled ) tklock_ui_enable_lpm(); else @@ -5670,7 +5678,7 @@ tklock_dbus_send_display_blanking_policy(DBusMessage *const req) if( !rsp ) goto EXIT; - const char *arg = uiexctype_to_dbus(exception_state); + const char *arg = uiexception_type_to_dbus(uiexception_type); mce_log(LL_DEBUG, "send display blanking policy %s: %s", req ? "reply" : "signal", arg); @@ -5723,7 +5731,7 @@ tklock_dbus_send_keyboard_slide_state(DBusMessage *const req) const char *arg = MCE_SLIDING_KEYBOARD_UNDEF; - switch( kbd_slide_output_state ) { + switch( keyboard_slide_output_state ) { case COVER_OPEN: arg = MCE_SLIDING_KEYBOARD_OPEN; break; case COVER_CLOSED: arg = MCE_SLIDING_KEYBOARD_CLOSED; break; default: break; @@ -5780,7 +5788,7 @@ tklock_dbus_send_keyboard_available_state(DBusMessage *const req) const char *arg = MCE_HARDWARE_KEYBOARD_UNDEF; - switch( kbd_available_state ) { + switch( keyboard_available_state ) { case COVER_OPEN: arg = MCE_HARDWARE_KEYBOARD_AVAILABLE; break; case COVER_CLOSED: arg = MCE_HARDWARE_KEYBOARD_NOT_AVAILABLE; break; default: break; @@ -5894,23 +5902,23 @@ static gboolean tklock_dbus_mode_get_req_cb(DBusMessage *const msg) * * @returns allowed state */ -static lock_state_t -tklock_dbus_sanitize_requested_mode(lock_state_t state) +static tklock_request_t +tklock_dbus_sanitize_requested_mode(tklock_request_t state) { /* Translate toggle requests to something we can evaluate */ - if( state == LOCK_TOGGLE ) - state = tklock_ui_enabled ? LOCK_OFF : LOCK_ON; + if( state == TKLOCK_REQUEST_TOGGLE ) + state = tklock_ui_enabled ? TKLOCK_REQUEST_OFF : TKLOCK_REQUEST_ON; switch( state ) { default: - case LOCK_UNDEF: - case LOCK_TOGGLE: + case TKLOCK_REQUEST_UNDEF: + case TKLOCK_REQUEST_TOGGLE: break; - case LOCK_OFF: - case LOCK_OFF_DELAYED: - case LOCK_OFF_PROXIMITY: - state = LOCK_OFF; + case TKLOCK_REQUEST_OFF: + case TKLOCK_REQUEST_OFF_DELAYED: + case TKLOCK_REQUEST_OFF_PROXIMITY: + state = TKLOCK_REQUEST_OFF; switch( display_state_next ) { case MCE_DISPLAY_ON: case MCE_DISPLAY_DIM: @@ -5919,17 +5927,17 @@ tklock_dbus_sanitize_requested_mode(lock_state_t state) if( tklock_ui_enabled ) { mce_log(LL_WARN, "tkunlock denied due to display=%s", display_state_repr(display_state_next)); - state = LOCK_ON; + state = TKLOCK_REQUEST_ON; } break; } goto EXIT; - case LOCK_ON: - case LOCK_ON_DIMMED: - case LOCK_ON_PROXIMITY: - case LOCK_ON_DELAYED: - state = LOCK_ON; + case TKLOCK_REQUEST_ON: + case TKLOCK_REQUEST_ON_DIMMED: + case TKLOCK_REQUEST_ON_PROXIMITY: + case TKLOCK_REQUEST_ON_DELAYED: + state = TKLOCK_REQUEST_ON; break; } EXIT: @@ -5961,25 +5969,25 @@ static gboolean tklock_dbus_mode_change_req_cb(DBusMessage *const msg) mce_log(LL_DEVEL, "Received tklock mode change request '%s' from %s", mode, mce_dbus_get_message_sender_ident(msg)); - int state = LOCK_UNDEF; + int state = TKLOCK_REQUEST_UNDEF; if (!strcmp(MCE_TK_LOCKED, mode)) - state = LOCK_ON; + state = TKLOCK_REQUEST_ON; else if (!strcmp(MCE_TK_LOCKED_DIM, mode)) - state = LOCK_ON_DIMMED; + state = TKLOCK_REQUEST_ON_DIMMED; else if (!strcmp(MCE_TK_LOCKED_DELAY, mode)) - state = LOCK_ON_DELAYED; + state = TKLOCK_REQUEST_ON_DELAYED; else if (!strcmp(MCE_TK_UNLOCKED, mode)) - state = LOCK_OFF; + state = TKLOCK_REQUEST_OFF; else mce_log(LL_WARN, "Received an invalid tklock mode; ignoring"); mce_log(LL_DEBUG, "mode: %s/%d", mode, state); - if( state != LOCK_UNDEF ) { + if( state != TKLOCK_REQUEST_UNDEF ) { tklock_ui_notified = -1; state = tklock_dbus_sanitize_requested_mode(state); - tklock_datapipe_tk_lock_cb(GINT_TO_POINTER(state)); + tklock_datapipe_tklock_request_cb(GINT_TO_POINTER(state)); } if( no_reply ) @@ -6017,9 +6025,9 @@ static gboolean tklock_dbus_interaction_expected_cb(DBusMessage *const msg) } mce_log(LL_DEBUG, "received interaction expected signal: state=%d", arg); - execute_datapipe(&interaction_expected_pipe, - GINT_TO_POINTER(arg), - USE_INDATA, CACHE_INDATA); + datapipe_exec_full(&interaction_expected_pipe, + GINT_TO_POINTER(arg), + USE_INDATA, CACHE_INDATA); EXIT: dbus_error_free(&err); @@ -6052,12 +6060,12 @@ static gboolean tklock_dbus_systemui_callback_cb(DBusMessage *const msg) mce_log(LL_DEVEL, "tklock callback value: %d, from %s", result, mce_dbus_get_message_sender_ident(msg)); - lock_state_t state = LOCK_OFF; + tklock_request_t state = TKLOCK_REQUEST_OFF; switch( result ) { case TKLOCK_UNLOCK: tklock_ui_notified = -1; state = tklock_dbus_sanitize_requested_mode(state); - tklock_datapipe_tk_lock_cb(GINT_TO_POINTER(state)); + tklock_datapipe_tklock_request_cb(GINT_TO_POINTER(state)); break; default: @@ -6158,7 +6166,7 @@ static gboolean tklock_dbus_notification_end_cb(DBusMessage *const msg) * * @return TRUE */ -static gboolean tklock_dbus_device_lock_changed_cb(DBusMessage *const msg) +static gboolean tklock_dbus_devicelock_changed_cb(DBusMessage *const msg) { DBusError err = DBUS_ERROR_INIT; dbus_int32_t val = 0; @@ -6175,7 +6183,7 @@ static gboolean tklock_dbus_device_lock_changed_cb(DBusMessage *const msg) } mce_log(LL_DEBUG, "received device lock signal: state=%d", val); - tklock_datapipe_set_device_lock_state(val); + tklock_datapipe_set_devicelock_state(val); EXIT: dbus_error_free(&err); @@ -6192,7 +6200,7 @@ static mce_dbus_handler_t tklock_dbus_handlers[] = .name = "stateChanged", .rules = "path='/devicelock'", .type = DBUS_MESSAGE_TYPE_SIGNAL, - .callback = tklock_dbus_device_lock_changed_cb, + .callback = tklock_dbus_devicelock_changed_cb, }, { .interface = "org.nemomobile.lipstick.screenlock", @@ -6520,14 +6528,14 @@ tklock_notif_update_state(void) if( tmo < MAX_TICK ) { tklock_notif_schedule_autostop((gint)(tmo - now)); - tklock_uiexcept_begin(UIEXC_NOTIF, 0); - tklock_uiexcept_rethink(); + tklock_uiexception_begin(UIEXCEPTION_TYPE_NOTIF, 0); + tklock_uiexception_rethink(); } else { if( (tmo = tklock_notif_state.tn_linger - now) < 0 ) tmo = 0; - tklock_uiexcept_end(UIEXC_NOTIF, tmo); - tklock_uiexcept_rethink(); + tklock_uiexception_end(UIEXCEPTION_TYPE_NOTIF, tmo); + tklock_uiexception_rethink(); } } @@ -6829,7 +6837,7 @@ void mce_tklock_exit(void) /* cancel all timers */ tklock_autolock_disable(); tklock_proxlock_disable(); - tklock_uiexcept_cancel(); + tklock_uiexception_cancel(); tklock_dtcalib_stop(); tklock_datapipe_proximity_uncover_cancel(); tklock_notif_quit(); @@ -6855,7 +6863,7 @@ void mce_tklock_unblank(display_state_t to_state) /* Disable lockscreen animations by invoking a faked * abnormal display blanking policy for the duration * of the display power up. */ - tklock_uiexcept_begin(UIEXC_NOANIM, 0); + tklock_uiexception_begin(UIEXCEPTION_TYPE_NOANIM, 0); } mce_datapipe_req_display_state(to_state);