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. 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>
  6. 07 Mar, 2019 1 commit
  7. 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>
  8. 02 Nov, 2018 1 commit
    • spiiroin's avatar
      [led] Add proximity sensor debugging patterns. JB#43690 · 5667900c
      spiiroin authored
      Debugging proximity sensor issues is difficult as inspecting logs is
      usually not possible in the situation where the problem is detected,
      or the sensor has failed in distant enough past so that logs have been
      already lost due to log rotation.
      Add led patterns that are activated/deactivated as follows:
      - PatternProximityCovered when sensor is reporting closed state.
      - PatternProximityUncovering when sensor is reporting uncovered state, but
        effective state is still covered (uncover hysteresis).
      - PatternProximityUncovered when effective proximity state is uncovered.
      The patterns are disabled by default, but can be enabled via:
        mcetool --enable-led-pattern=PatternProximityCovered\
      And disabled again with:
        mcetool --disable-led-pattern=PatternProximityCovered\
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
  9. 19 Sep, 2018 1 commit
    • spiiroin's avatar
      [datapipe] Mass rename datatypes. JB#22475 · d6b8b122
      spiiroin authored
      Switch to indent by 4 spaces.
      Rename datapipe_struct to datapipe_t, and use dp_ prefix for member data.
      Rename read_only_policy_t to datapipe_filtering_t, and values
      Rename cache_free_policy_t to datapipe_data_t, and values
      Rename data_source_t to datapipe_use_t, and values
      Rename caching_policy_t to datapipe_cache_t, and values
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
  10. 15 Aug, 2018 1 commit
    • spiiroin's avatar
      [fingerprint] Add support for debug led patterns · 7f395b61
      spiiroin authored
      There are no visible clues for fingerprint authentication being
      possible / activated. This makes it difficult to differentiate between
      situations where fingerprint scanner has not been activated and lower
      lever functionality having problems with fingerprint acquisition.
      To ease debugging, add led patterns for lighting up the led in yellow
      color when fingerprint scanner is active and briefly turning the led
      blue on fingerprint acquisition events.
      These led patterns are not used by default, user must opt-in via:
        mcetool --enable-led-pattern=PatternScanningFingerprint
        mcetool --enable-led-pattern=PatternFingerprintAcquired
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
  11. 28 May, 2018 1 commit
    • spiiroin's avatar
      [mce-sensorfw] Implement sensor-test mode for mce. JB#41369 · 7bd4cfbc
      spiiroin authored
      When porting new devices, there already are numerous tools for testing
      sensors via kernel and/or android sensors hal interfaces. What is missing
      is an easy way to test sensors via interfaces exposed by mer sensorfwd.
      MCE implements robust sensofrwd IPC mechanisms and has user controllable
      debug logging facilities - take advantage of these to provide sensor
      test mode that can be used to test all sensors known to sensorfwd 0.10.0.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
  12. 16 Mar, 2018 1 commit
    • 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>
  13. 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>
  14. 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>
  15. 06 Oct, 2017 1 commit
  16. 12 May, 2017 1 commit
  17. 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>
  18. 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
  19. 11 Aug, 2016 1 commit
    • spiiroin's avatar
      [led] Always breathe CSD white blinking pattern. Fixes JB#35854 · 8c40c8e4
      spiiroin authored
      The way white led blinking test in CSD tool behaves differently depending
      on whether charger has been connected (breathes) or not (blinks).
      Unconditionally allow breathing when PatternCsdWhiteBlink led pattern
      is active so that it behaves similarly regardless of breathing settings
      and/or charging status.
  20. 31 Mar, 2016 1 commit
  21. 03 Nov, 2015 1 commit
  22. 07 Oct, 2015 1 commit
  23. 30 Sep, 2015 1 commit
    • spiiroin's avatar
      [tklock] Add setting for disabling unblank to lockscreen animation. Contributes to JB#30849 · eae505cb
      spiiroin authored
      A lot of users think the animated unblank to lockscreen is too slow.
      While there is at present no way to directly control the animation that
      happens on the ui side, it does get implicitly disabled when display is
      unblanked due to alarms/calls/notifications. Utilize this and optionally
      fake notification unblank when a double tap or power key press is used
      to wake up the device.
      Add setting for enabling/disabling lockscreen unblank animations.
      By default the animations are enabled, but this can be changed via
      mcetool option:
      The value of the setting persists over mce / device restarts.
  24. 18 Jun, 2015 1 commit
    • spiiroin's avatar
      Expose active blanking policy on D-Bus · 4abe2a81
      spiiroin authored
      UI side needs to differentiate between display turning off due to
      explicit user activity like pressing power key and other reasons like
      incoming calls, alarms etc. Currently this is not possible.
      Allow applications to query and track display blanking policy on D-Bus.
      When default blanking policy is effective, display turns on only because
      of explicit user activity. If display is unblanked for other reasons, the
      non-default blanking policy is signaled before display power up actually
      [mce] Expose active blanking policy on D-Bus. Fixes JB#29675
  25. 11 Jun, 2015 1 commit
    • spiiroin's avatar
      Fixes to diagnostic logging from powerkey handler · ed04415e
      spiiroin authored
      Some actions have diagnostic logging while others do not. The unblank
      action emits incorrect message on too high priority.
      Make sure all actions have diagnostic logging at DEBUG level. When
      possible use state to human readable string converters instead of
      hard coding the whole diagnostic message.
      Also fix the device lock request so that more appropriate constant
      is used.
      [mce] Fixes to diagnostic logging from powerkey handler. Fixes JB#29793
  26. 14 Mar, 2015 2 commits
    • spiiroin's avatar
      Remove stale l10n code and data · 4dc8e161
      spiiroin authored
      MCE has some limited swedish localization data and code. These have not
      been enabled or actively maintained for ages and are out of sync with
      the current implementation. There are no plans/requirements for having
      mce fully localized.
      Remove unused, out of sync localization data.
      [mce] Remove stale l10n code and data. Fixes NEMO#721
    • spiiroin's avatar
      Remove SoftOff mode · b6d161ea
      spiiroin authored
      SoftOff mode is basically manual suspend to RAM for pre N900 era maemo
      devices. The logic in MCE side does not work and also support needed by
      it has beed dropped from DSME side ages ago.
      Remove all remnants of SoftOff mode that still linger in mce code tree.
      [mce] Remove SoftOff mode. Fixes JB#27285
  27. 04 Mar, 2015 1 commit
    • spiiroin's avatar
      Stop mce fbdev child process from dumping cores on shutdown · 928282db
      spiiroin authored
      The mce fbdev child process by design is meant to exit very late in
      the shutdown sequence. If it gets terminated before it exits, the
      non-functional signal handlers inherited from the parent process
      cause (partially successful) core dumps via SIGABRT.
      Remove signal handlers installed by the parent process and trap signals
      that would cause core dumping to happen and make an _exit() instead.
      [mce] Stop mce fbdev child process from dumping cores on shutdown. Fixes JB#26832
  28. 09 Feb, 2015 1 commit
    • spiiroin's avatar
      Log system state changes in human readable form · 5a1b3886
      spiiroin authored
      System state changes are logged in numeric form which means that mental
      exercise is required while interpreting the logs.
      Add system state enum to state name helper function and use it to
      provide human readable diagnostic logging.
  29. 03 Feb, 2015 1 commit
    • spiiroin's avatar
      Make state enum to state name helper functions globally available · 67d966cb
      spiiroin authored
      In many cases the helpers were created at the module that is primarily
      responsive for maintaining the datapipe content and datapipe listeners
      do debug logging using the numeric states - which requires effort to
      Move state enum to string helper functions to datapipe.c and list
      prototypes in mce.h next to enum type declaration.
  30. 29 Jan, 2015 1 commit
  31. 27 Jan, 2015 1 commit
  32. 25 Jan, 2015 1 commit
  33. 23 Jan, 2015 1 commit
    • spiiroin's avatar
      Fix USB cable connection related issues in display blanking policy · 4da9aaa6
      spiiroin authored
      There is logic in mce to process charging state separately from usb
      cable connect state, but since the legacy logic for detecting does
      not work charging status has been used for things that should depend
      on cable connect. This delays things like turning on display to show
      usb mode selection dialog and makes it hard to decide how long the
      display should be kept on. And turning on display when mce starts
      up while usb cable is already attached can cause problems during 1st
      boot if the display state restoration occurs close to starting up of
      the startup wizard.
      Use usb mode provided by usb_moded to determine usb cable state. The
      usb_moded tracking logic is derived from the implentation used in dsme.
      Both mce and dsme use LGPL v2.1 license.
      Use separate display on rules for charging and cable connect changes.
      Do not turn on the display when cable is removed / charging stops.
      Do not turn on the display if usb cable is already connected when
      mce is started.
      Fix glitches in display state handling and automatic brightness
      tuning during mce startup.
      [mce] Fix USB cable connection related issues in display blanking policy. Fixes JB#25788
  34. 12 Jun, 2014 2 commits
  35. 27 May, 2014 1 commit
  36. 26 May, 2014 2 commits
    • spiiroin's avatar
      Move datapipes variables from mce.h to datapipe.c · 9ed67631
      spiiroin authored
      Duplicates were generated in to every object file that was compiled
      from source code that included mce.h. I guess this a) compiled
      because the structures are not initialized b) worked because the
      runtime linker resolved refs from the plugins to use variables
      compiled into mce main binary.
      Leave extern declarations to the header, but define the actual
      variables only once in the datapipe module.
      [mce] Move datapipes variables from mce.h to datapipe.c. Fixes JB#18917
    • spiiroin's avatar
      Add empty lines to improve readability · 2f584eb2
      spiiroin authored
      Tightly interleaved doxygen data and code made it unnecessarily
      hard to browse the code.