1. 17 Oct, 2018 1 commit
    • spiiroin's avatar
      [mce-io] Augment resume detection with timerfd source. Fixes JB#43297 · f5e7d2f9
      spiiroin authored
      MCE needs to perform some tasks like rethinking timer expiration when device
      resumes from suspend. The resume detection is built on assumption that some
      input devices will send EV_SYN events on resume. In devices where such events
      are not emitted, on resume tasks can get indefinitely delayed.
      
      Take advantage on the fact that system time gets updated on resume, and
      use timerfd to trigger resume detection logic whenever system time changes.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
      f5e7d2f9
  2. 15 Aug, 2018 1 commit
  3. 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>
      7bd4cfbc
  4. 12 May, 2017 1 commit
  5. 10 May, 2017 1 commit
    • spiiroin's avatar
      [mce] Use sigaction() for registering signal handlers. Fixes JB#38515 · 18b29372
      spiiroin authored
      Under hard to reproduce conditions mce can crash due to SIGPIPE when
      attempting to writev() to libdsme related unix domain socket.
      
      Assumption is that it might have something to do with mce setting up
      SIGPIPE handler via signal() and attempting to pass the signals to
      mainloop just to be ignored there.
      
      Simply ignore SIGPIPE altogether instead of attempting to move it from
      signal handler context to mainloop.
      
      Also use sigaction() for setting up signal handlers, separate handling of
      terminal failure signals from expected control signals, and make sure that
      signal() function is used only for SIG_IGN and SIG_DFL purposes.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
      18b29372
  6. 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
      afe100cb
  7. 31 Mar, 2016 2 commits
  8. 10 Nov, 2015 1 commit
  9. 09 Oct, 2015 2 commits
    • spiiroin's avatar
      [wltimer] Add moduled for suspend blocking timers. Contributes to JB#32462 · a180ca1f
      spiiroin authored
      MCE code has accumulated copy paste code dealing with blocking suspend
      for limited time.
      
      Implement wakelock timer object logic that encapsulates holding a wakelock
      while waiting for a glib timeout to trigger.
      
      The interface is derived from already existing heartbeat timer code.
      a180ca1f
    • spiiroin's avatar
      [wakelock] Add module for virtual wakelocks. Contributes to JB#32462 · 1b5a256e
      spiiroin authored
      MCE has multitude of reasons for blocking late suspend. Using real
      wakelocks for each reason pollutes the kernel bookkeeping data and
      using dynamically named wakelocks would make things even worse.
      
      Add mce-wakelock module that multiplexes virtual wakelocks internal
      to mce into just one real sysfs based wakelock.
      1b5a256e
  10. 02 Sep, 2015 1 commit
    • spiiroin's avatar
      [inactivity] Block suspend during inactivity broadcast. Fixes JB#31927 · 28afd352
      spiiroin authored
      While mce wakes up from suspend to change activity state to inactive,
      it might be possible that the device falls back to suspend before
      other processes have had a chance to receive and process the D-Bus
      signal.
      
      Block suspend briefly when inactivity signal is broadcast.
      28afd352
  11. 19 May, 2015 1 commit
    • spiiroin's avatar
      Implement iphb based timers for use from within mce · 6112f541
      spiiroin authored
      There are some mce state transitions that should be taken some time after
      display is powered off and device has potentially entered late suspend.
      These timers are re-evaluated when the device resume from suspend, but
      that might be too late and applications can end up making decisions based
      on mce state data that was frozen in time.
      
      There are nemo-keepalive interfaces that use libiphb for waking up from
      suspend, but those can't be used from mce because they depend on mce for
      keeping the device away from suspend via mce cpu-keepalive dbus-service.
      
      Add mce code module mce-hbtimer, which makes available: Timers that use
      regular glib timeouts, but are backed up by iphb wakeups in case the
      device gets suspended.
      
      About the backdated copyright blurb: The code dealing with iphb wakeups
      is derived from keepalive-heartbeat.c from nemo-keepalive package that
      was written by me for Jolla and uses the same license as mce - LGPL v2.1.
      
      [mce] Implement iphb based timers for use from within mce. Contributes to JB#28706
      6112f541
  12. 15 Mar, 2015 1 commit
    • spiiroin's avatar
      Using sensorfw for ambient light / proximity sensor control is not optional · 05eac7df
      spiiroin authored
      The legacy sensor control methods are removed, only sensorfw can be used
      for starting/stopping sensors. If sensord is not running on the device
      or does not support some of the expected to be available sensors, mce
      will still function and uses sensible fallback values for sensors.
      
      Remove the build time configuration for disabling sensorfw usage.
      
      [mce] Using sensorfw for ambient light / proximity sensor control is not optional. Fixes JB#27286
      05eac7df
  13. 14 Mar, 2015 1 commit
    • 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
      4dc8e161
  14. 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
      928282db
  15. 10 Feb, 2015 1 commit
    • spiiroin's avatar
      Move fbdev control from display plugin to separate mce-fbdev module · 824acab1
      spiiroin authored
      Having mce hold open framebuffer device file descriptor during bootup
      blocks display from making implicit power cycling while switching ui
      components that draw on screen. But since the frame buffer is opened
      from display plugin, it happens only after mce core functionality is
      already initialized.
      
      Making frame buffer handling be part of core functionality to allow the
      device node to be opened earlier.
      
      Also keept the framebuffer device opened also during normal operation
      so that mce already has the file descriptor that is needed to keep the
      shutdown logo on screen after ui and mce services are terminated.
      
      To give visibility to possible lipstick crashes and switches between
      various act dead ui processes, close the file descriptor if compositor
      dbus service is terminated eventhought he device is not shutting down.
      
      [mce] Move fbdev control from display plugin to separate mce-fbdev module. Fixes JB#26215
      824acab1
  16. 22 Jan, 2015 1 commit
  17. 16 Jan, 2015 1 commit
    • spiiroin's avatar
      Tune diagnostic logging · 5fb84646
      spiiroin authored
      Do not complain about missing evdev event mapping configuration as it
      is optional.
      
      Use LOG_NOTICE rather than LOG_CRIT when emitting extra diagnostic
      messages from mce devel builds to stop journalctl from highlighting
      them.
      
      Promote logging of infrequent but important system state changes to
      NOTICE level.
      
      Promote logging of system upgrade related state changes to WARN level
      so that in the future diagnostics are available from both existing
      and upgraded versions in case update problems need to be analyzed.
      
      Demote display state request filtering to DEBUG as it is needed only
      when debugging specific problems.
      5fb84646
  18. 28 Oct, 2014 1 commit
    • spiiroin's avatar
      Do not broadcast intermediate tklock changes over D-Bus · f7411f93
      spiiroin authored
      If mce side state machines oscillate between tklock on and off, it
      can cause problems due to ui side trying to react to intermediate
      states.
      
      Use idle callback to delay sending of tklock state information so that
      only the final tklock state is communicated outside mce process. Hold
      a wakelock until the dbus ipc is actually made plus couple of seconds
      to make it more likely for ui side to have time to process the state
      change before device is allowed to suspend.
      
      Also clear last send state when tklock change requests are made over
      D-Bus. This way the state mce arrived at is always broadcast even if
      the request ends up getting ignored.
      
      [mce] Do not broadcast intermediate tklock changes over D-Bus
      f7411f93
  19. 31 Aug, 2014 1 commit
    • spiiroin's avatar
      Release logging related resources when mce makes an orderly exit · 7e7ac38c
      spiiroin authored
      While closing logging is not necessary, doing it reduces noise during
      memory leak debugging. In the code the logging cleanup was made on
      abnormal exit paths, but omitted when making an orderly exit.
      
      Remove unnecessary mce_log_close() calls from abnormal exit paths.
      
      Perform logging cleanup actions on normal exit.
      7e7ac38c
  20. 27 Aug, 2014 1 commit
  21. 18 Aug, 2014 1 commit
  22. 17 Jun, 2014 2 commits
    • spiiroin's avatar
      Identify mce version & flavor on start up · 972516e4
      spiiroin authored
      So that both DSME and MCE versions can be found from journal.
      972516e4
    • spiiroin's avatar
      Do not required dsme to be running when mce starts up · ecd3ebaf
      spiiroin authored
      Previously mce could not be started unless dsme was running and was
      forced to exit if dsme stopped/crashed.
      
      Now mce tracks availability of dsme by watching D-Bus name ownership
      changes of com.nokia.dsme on system bus and makes connection when
      dsme is up and running.
      
      While dsme is not available process watchdog ping-pong based heartbeat
      activities do not get triggered and shutdown requests can't be made.
      
      I/O errors during socket IPC with dsme trigger re-connect attempt.
      
      Also the mce --debug-mode command line option is removed since it is not
      needed anymore.
      
      [mce] Do not required dsme to be running when mce starts up. Fixes JB#11581
      ecd3ebaf
  23. 27 May, 2014 1 commit
  24. 26 May, 2014 1 commit
  25. 14 May, 2014 1 commit
    • spiiroin's avatar
      Use ambient light sensor to tune display brightness in lpm_on state · f40f2dc0
      spiiroin authored
      Add ALS profile configuration for use with lpm_on state. Should stay
      relatively dim indoors, saturates to 100% brightness at the same level
      as lowest display brightness profile.
      
      Setup a datapipe for communicating lpm brightness changes between display
      and brightness filtering plugins.
      
      Set standby override flag for ambient light sensor so that it can be
      powered on in lpm_on state too.
      
      [mce] Use ambient light sensor to tune display brightness in lpm_on state. Fixes JB#18791
      f40f2dc0
  26. 12 May, 2014 1 commit
  27. 08 May, 2014 1 commit
    • spiiroin's avatar
      Add enablers for proximity based LPM display states · 360706a9
      spiiroin authored
      Re-use legacy N9 low power display states for proximity based one
      that lights up the display briefly when proximity sensor input matches
      a) device is taken out of pocket / flipped front side up on table
      b) hand hovers over device that is lying on table
      
      Both legacy D-Bus method calls and freshly added signals are used to
      tell ui side whether lpm states are active or not.
      
      New datapipe display_state_next_pipe allows tracking of the next stable
      display state - this is used to make sure tklock and lpm state data is
      sent to lipstick before display powerup starts so that final ui state
      is known when the first rendering after display power up happens.
      
      The ambient light sensor is powered up in parallel with display - and
      kept powered up in the lpm display states.
      
      Leds that are active in display off, are active also during lpm states.
      
      [mce] Add enablers for proximity based LPM display states. Fixes JB#17735
      360706a9
  28. 29 Apr, 2014 1 commit
    • spiiroin's avatar
      Add option to use breathing led patterns · 134be265
      spiiroin authored
      Adds two new runtime configuration values
      * sw breathing enable flag
      * sw breathing battery level limit
      
      These can be modified with mcetool options
        --set-sw-breathing=<enabled|disabled>
        --set-sw-breathing-limit=<0 ... 100>
      
      The led patterns that are configured to use the fully on / fully off
      blinking mode supported by the pwm led controller will oscillate
      smoothly along the first half of sine wave.
      
      For the smooth transitions to work frequent timer wakeups are needed
      and the device can't be suspended. As this will increase the battery
      consumption the sw breathing happens only if breathing is enabled and
      battery level exceeds the limit or the device is connected to charger.
      
      [mce] Add option to use breathing led patterns. Contributes to JB#17229
      134be265
  29. 24 Apr, 2014 1 commit
    • spiiroin's avatar
      Block late suspend while bluetooth activity is seen on D-Bus · fc628ee9
      spiiroin authored
      Add plugin for monitoring bluetooth activity on D-Bus.
      
      Any D-Bus signals from bluez are taken as bluetooth activity and late
      suspend is blocked until no more signals are seen for 5 seconds. This
      should allow time for bluetooth related processing to happen without
      the device falling to late suspend too early.
      
      [mce] Block late suspend while bluetooth activity is seen on D-Bus. Fixes JB#18124
      fc628ee9
  30. 14 Mar, 2014 2 commits
    • spiiroin's avatar
      Remove calls to deprecated g_type_init() function · 4c5e5bb2
      spiiroin authored
      Since GLib 2.36 the type system is initialised automatically
      and g_type_init() function does nothing.
      4c5e5bb2
    • spiiroin's avatar
      Handle io watch error conditions gracefully · 7a56637c
      spiiroin authored
      All calls to g_io_add_watch() request error condition reporting, and
      all related callback functions at minimum will not create a virtual
      busyloop by leaving the io watch active and ignoring the error state.
      
      The mce io monitoring subsystem is modified so that instead of using
      separate io watches for data and error handling + optional error
      recovery callback it now has one io watch that first deals with
      possible errors and then handles possible input via monitor type
      specific logic and enforces delete notification callbacks for making
      clean up at upper level logic. This should allow mce to gracefully
      handle situations like adding/removing bluetooth keyboards.
      
      [mce] Handle io watch error conditions gracefully
      7a56637c
  31. 11 Mar, 2014 4 commits
    • spiiroin's avatar
      Leave touch panel active during in-call proximity blanking · 9b42491a
      spiiroin authored
      If touch panel is powered off, the touch detection does not work
      reliably if there is finger/ear/chin on screen when the panel is
      powered on again. Since that can break the touch blocking during
      display power up in a situation where capacitive touch from chin
      or ear is likely, the touch panel is not powered off during proximity
      blanking even if the double tap detection is disabled.
      
      [mce] Leave touch panel active during in-call proximity blanking
      9b42491a
    • spiiroin's avatar
      Delay automatic unblanking after proximity sensor is uncovered · d2379c17
      spiiroin authored
      If proximity blanking policy is active, covering the proximity sensor
      will blank immediately. But the display is unblanked only after the
      sensor stays uncovered for 500 milliseconds.
      
      [mce] Delay automatic unblanking after proximity sensor is uncovered
      d2379c17
    • spiiroin's avatar
      Ungrab volume keys when music playback is active · 30899182
      spiiroin authored
      As there is no direct music playback is active information available,
      heuristics based on volume limit audio policy decisions are used.
      
      Based on that the volume keys are ungrabbed even if display is off or
      ui is locked.
      
      Also parsing of audio routing was changed, now all sink devices that
      have name like "xxxforcall" are considered the same as "xxx". This
      should make headset detection work the same whether "forcall" type
      sinks are needed in the device or not.
      
      [mce] Ungrab volume keys when music playback is active
      30899182
    • spiiroin's avatar
      Grab volume key input while display is off · fb4317b1
      spiiroin authored
      Volume key input device is grabbed when existing keypad input policy
      would have disabled emitting of key input events, i.e. when display
      is off or ui is locked and there is no active call.
      
      [mce] Grab volume key input while display is off
      fb4317b1
  32. 10 Mar, 2014 1 commit
    • spiiroin's avatar
      Grab touch input while display is off · a7e41b03
      spiiroin authored
      Input is grabbed when display is powered off.
      
      The grab is released when display is powered on and there are no
      finger or palm touch detected.
      
      This should stop the UI side from seeing touch events during
      display power up and provides additional protection against
      stray input if the device is held without covering the proximity
      sensor.
      
      [mce] Grab touch input while display is off
      a7e41b03
  33. 06 Feb, 2014 1 commit
    • spiiroin's avatar
      Enable tklock if device lock gets activated · 38bffceb
      spiiroin authored
      Otherwise having device lock timeout that is shorter than tklock
      grace period can lead into situation where the device is locked but
      the last active application can still be made visible and used.
      
      [mce] Enable tklock if device lock gets activated
      38bffceb