1. 25 Jun, 2020 1 commit
    • spiiroin's avatar
      [battery-udev] Enablers for configurable charger types. JB#49693 · d387d08c
      spiiroin authored
      For example pinephone exposes charger devices in a manner where the
      name is prefixed with chiptype (e.g. "axp813-ac" / "axp20x-usb").
      As mce does not recognize these, both wall charger and pc connection
      gets treated as "other" type charger - which works to some extent but
      triggers incorrect UI actions.
      If direct match for power supply device type / name is not found, try
      to eliminate chipname prefix so that for example names such as
      "axp20x-usb" get treated as plain "usb".
      To future proof things, make it possible to override build-in
      defaults and heuristics via mce configuration files.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
  2. 04 Feb, 2020 1 commit
    • spiiroin's avatar
      [battery] Do not report 100% when battery level is unknown. JB#48562 · 3e41f3d2
      spiiroin authored
      Using 100% as default initial value can lead to clients seeing what
      looks like genuine battery level drop during mce startup.
      Use MCE_BATTERY_LEVEL_UNKNOWN (-1) - which is documented in mce-dev
      headers as placeholder value used while battery level is unknown.
      Adapt battery level tracking withing mce to expect and deal with
      unknown/negative initial state.
      To allow debugging of battery level unknown states, expand value
      range allowed by mcetool --set-battery-level=<percent> to include
      also -1.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
  3. 07 Oct, 2019 1 commit
  4. 28 Aug, 2019 1 commit
    • spiiroin's avatar
      [battery-udev] Make charger type available on D-Bus. JB#38667 · a80fd7ea
      spiiroin authored
      Battery notifier in lipstick needs charger type information.
      Add charger type evaluation to udev power supply device tracker and
      broadcast changes internally within mce via a datapipe.
      Reflect datapipe changes as D-Bus signals, and add D-Bus methods for
      querying the current state.
      For development builds enable charger type simulation and appropriate
      mcetool options for controlling it.
      The required D-Bus constants are available in mce-dev >= 1.27.0.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
  5. 15 Mar, 2019 2 commits
    • spiiroin's avatar
      [proximity] Do not assume unknown sensor state equals not-covered · e4f5b1bf
      spiiroin authored
      When code was built on assumption that proximity sensor is always
      enabled, it made sense to equate unkown sensor state with not-covered
      as a means to avoid corner case hiccups.
      As an enabler for on-demand proximity sensor activation all such
      assumptions must be removed.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
    • spiiroin's avatar
      [proximity] On-demand proximity sensor activation. Fixes JB#34789 MER#1562 · d9c917b7
      spiiroin authored
      MCE code has built-in assumption that proximity sensor is either not used at
      all, or it is constantly powered on. The former basically means that in-call
      proximity blanking is not available. And the latter can cause direct (the
      sensor itself) or indirect (might block suspend) power drain, or make it
      more likely for lower level sensor handling glitches to surface.
      Make it possible to select on-demand proximity sensor activation.
      When selected, proximity sensor is powered up:
      - While the device in a state where it might be needed (calls, alarms, etc).
      - When events that could lead to display wakeup are received (powerkey
        presses, doubletaps, etc).
      As the sensor state is not available immediately after requesting
      sensor powerup, implement on-proximity action queue which can be used
      to schedule actions to be taken when the sensor has reached a stable
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
  6. 08 Mar, 2019 1 commit
    • spiiroin's avatar
      [datapipe] Add enablers for logging datapipe value changes · e2f29495
      spiiroin authored
      A lot of mce functionality is based on pushing events through datapipes,
      which then causes cascade of activity on other datapipes. Tracing this
      can be cumbersome at times.
      Add logging hooks to datapipe structure to allow generic value tracing,
      and modify datapipe initialization so that data type specific hooks are
      bound to all datapipes so that all datapipe activity can be tracked by
      invoking mce with logging options such as:
        mce -T -ldatapipe.c:*_pipe
      Also fix couple of cases where incorrect data type were used for datapipe
      value tracking.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
  7. 07 Mar, 2019 1 commit
  8. 23 Nov, 2018 1 commit
    • spiiroin's avatar
      [dsme] Track thermal state from thermal manager. Fixes JB#43907 · e82c1a3f
      spiiroin authored
      MCE has functionality like PowerSaveMode that depends on device thermal
      state, however the thermal state datapipe that is supposed to carry
      thermal status information within MCE is not connected to any data source.
      Query current thermal status from thermal manager when the service shows
      up on D-Bus SystemBus, listen to thermal status change notifications, and
      feed the state information to thermal state datapipe.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
  9. 20 Nov, 2018 1 commit
  10. 19 Sep, 2018 15 commits
  11. 18 Sep, 2018 1 commit
    • spiiroin's avatar
      [tklock] Keep tklock submode and lockscreen state in sync. Fixes JB#42145 · c4d2ffba
      spiiroin authored
      Looks like hard to reproduce problems like defunct device unlock view
      and semi-active lockscreen might be caused by various glitches in mce
      side tklock submode tracking and lockscreen state synchronization.
      Force tklock submode datapipe changes to comply with lockscreen policy
      by installing a datapipe filter instead of attempting to correct after
      arriving to non-allowed state.
      Sync lockscreen policy changes to tklock submode from idle callback
      instead of using potentially hazardous recursive datapipe execution.
      Use only lockscreen policy state when deciding how tklock state should
      show up on D-Bus.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
  12. 15 Aug, 2018 1 commit
  13. 16 Mar, 2018 3 commits
    • spiiroin's avatar
      [display] Track pid of topmost window. JB#41340 · acb29188
      spiiroin authored
      MCE needs to differentiate between situations where lockscreen
      is shown vs. when some application is on top of the lockscreen.
      This can be accomplished by tracking the pid of the application
      that owns the topmost window on screen - which is -1 when
      lockscreen or homescreen is on top.
      Add topmost_window_pid datapipe, keep it in sync by querying
      initial state from compositor on startup and then listening to
      change signals.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
    • spiiroin's avatar
      [datapipe] Add init_done_pipe. JB#22475 · 24952240
      spiiroin authored
      The "init_done" condition is tracked only internally within the
      display plugin eventhough it would be needed in other modules
      Add init_done -datapipe and feed it from the display plugin.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
    • spiiroin's avatar
      [mce] Make tristate_t type generally available. JB#22475 · 9aa28fd4
      spiiroin authored
      Generic "extended boolean" type supporting als "unknown" in
      addition to "true" and "false" is useful for dealing with
      state data where neither true nor false is suitable for
      use as initial value. There already is tristate_t type
      that fits the requirement, but it is internal to the
      buttonbacklight plugin.
      Move tristate_t from plugin to mce core modules so that
      it can be utilized anywhere within mce.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
  14. 01 Mar, 2018 2 commits
    • spiiroin's avatar
      [fingerprint] Ignore powerkey during fingerprint enroll. Fixes JB#41217 · 2735b290
      spiiroin authored
      When enrolling fingerprints in devices where powerkey doubles as
      fingerprint sensor (e.g. f5121 / Sony Xperia X), it easily happens
      that the user presses the button all the way down - screen is blanked,
      which then causes cancellation of the enroll operation and the user
      must start all over again.
      Track fingerprint service availability and state on D-Bus.
      Ignore powerkey presses when enroll operation is in progress.
      Interpret fingerprint acquisition notifications as user activity
      during enroll, identify and verify operations - so that display
      blanking timers get reset every time user places finger on the
      sensor surface.
      The code in fingerprint plugin is derived from usb mode tracking
      plugin at modules/usbmode.c.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
    • spiiroin's avatar
      [logging] Log human readable state names instead of enumeration values · 196c63ee
      spiiroin authored
      There are still some state changes that are logged in numeric form
      and these make log reading more difficult than it needs to be.
      Use human readable representations where applicable.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
  15. 28 Feb, 2018 1 commit
    • spiiroin's avatar
      [datapipe] Unify naming. Contributes to JB#22475 · 5fadb870
      spiiroin authored
      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
      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
      Switch lockkey_state_pipe value from gboolean to key_state_t type.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
  16. 06 Oct, 2017 1 commit
  17. 02 Jun, 2017 2 commits
    • spiiroin's avatar
      [inactivity] Skip activity renew instead of switching to inactivity · 5c3916fe
      spiiroin authored
      Datapipe filter callback functions can only modify the value that datapipe
      ends up having and can't be used to skip calling of notification functions.
      In case of inactivity processing this means that when filter function does
      not allow extending of "user activity" period, it actually immediately
      terminates the period.
      Instead of having a single inactivity datapipe with filter callback, use two
      separate "event" and "state" datapipes chained so that events can be
      propagated from event to state datapipe or ignored depending on whether the
      activity change is allowed or not.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
    • spiiroin's avatar
      [tklock] Cancel display blanking on lockscreen interaction. Fixes JB#35376 · 1ee11dd7
      spiiroin authored
      Implicit display power ups due to notifications and such use shorter than
      normal blanking timeouts. If mce sees sufficient user activity during the
      exceptional situation, it cancels the display state restore. However since
      the device unlocking was moved to happen within lockscreen context, mce
      has no way to detect that there is significant user interaction with
      the device and blanks the display while user is entering the lock code.
      Listen to lockscreen notifications on D-Bus and cancel display state
      restore when lockscreen signals transition to a state where user
      interaction is expected to happen.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
  18. 20 Apr, 2017 1 commit
  19. 21 Feb, 2017 1 commit
    • spiiroin's avatar
      [callstate] Make it possible to ignore incoming calls. Fixes JB#37565 · 42ccef85
      spiiroin authored
      The existing workaround for allowing powerkey to be used for blanking the
      display after ignoring an incoming calls leaves the callstate to ringing
      state. When ignoring incoming call while already having an active call,
      this effectively leaves in-call proximity blanking disabled.
      Add ignored call state enum value for use within mce callstate plugin.
      Separate call state enum <-> string translations functions dealing with
      D-Bus interface from the ones dealing with internal diagnostic logging.
      Add ignore_incoming_calls datapipe and bind it to ignoring all calls that
      are currently in the ringing state and re-evaluating overall call state.
      Execute the ignore_incoming_calls datapipe when D-Bus message indicating
      that call ui has ignored incoming calls is received.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
  20. 23 Jan, 2017 1 commit
    • spiiroin's avatar
      [mce] Expose battery/charging data on D-Bus. Fixes JB#37422 · afe100cb
      spiiroin authored
      Tracking battery data via statefs requires dealing with fuse and kernel
      related quirks. Since mce already deals with that, it would be preferable
      to reuse already functioning code instead of duplicating it elsewhere.
      Add handlers D-Bus method calls that can be used to query current values
      and send signals when state changes are detected.
      The following information is made available:
      - usb_cable_state: unknown | connected | disconnected
      - charging_state:  unknown | on | off
      - battery_status:  unknown | full | ok | low | empty
      - battery_level:   -1 | 0...100
      Related D-Bus constants are defined in mce-headers >= 1.21.0.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
      REVIEW separate internal & dbus state processing more clearly
  21. 18 Jan, 2017 1 commit