1. 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>
      a80fd7ea
  2. 17 May, 2019 1 commit
    • spiiroin's avatar
      [mce] Unify license blurbs. JB#33684 · 091d6e7e
      spiiroin authored
      MCE uses LGPL v2.1 (without "or later") license, but due to missing / use
      of different license blurbs this is not always clear enough.
      
      Replace blurbs referring to "LGPLv2" short form which could be either
      LGPL v2.0 or v2.1 without "or later" with the same blurb that is used
      in mce.c file.
      
      Similarly add blurb to source files that are missing one altogether.
      
      Add all authors that can be derived from git logs.
      
      Update Jolla Ltd. copyright statements to match git activity.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
      091d6e7e
  3. 08 Mar, 2019 1 commit
    • spiiroin's avatar
      [dbus] Fix peerinfo tracking on mce startup · f5deaf81
      spiiroin authored
      Tracked services that are not running when mce starts up are left hanging in
      undefined state instead of getting declared as stopped. This happens because
      service is considered stopped when peerinfo makes transition away from
      running state - which is not possible before the service has been up at
      least once.
      
      Drop stale and deleted peerinfo states as they are not really needed and
      just add complexity.
      
      Handle state transitions resulting from name owner changes explicitly
      instead of doing them implicitly from within the setter function.
      
      Declare service as stopped when peerinfo enters stopped state rather than
      leaving running state.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
      f5deaf81
  4. 14 Dec, 2018 1 commit
    • spiiroin's avatar
      [battery-udev] Add battery debugging D-Bus methods. Fixes JB#44072 · 3142c92a
      spiiroin authored
      Waiting for battery to get completely full / empty takes time and makes it
      difficult to verify that actions that ought to happen under certain
      conditions actually get triggered.
      
      Implement D-Bus methods that temporarily allow overriding charging/battery
      information mce has derived from udev.
      
      Add options to mcetool for using the override method calls:
          --set-charger-state=<unknown|on|off>
          --set-battery-level=<percent>
      
      As faked charger connection can block/delay battery empty shutdown and lead
      to battery getting too depleted, the battery simulation functionality is
      made available only in devel flavor mce build and even then only to
      privileged clients.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
      3142c92a
  5. 28 May, 2018 1 commit
    • spiiroin's avatar
      [mce-sensorfw] Refactor mce - sensorfwd IPC. JB#41369 · 17104348
      spiiroin authored
      So far MCE has utilized only three sensors - all of which report a single
      unsigned integer value. This has allowed code to organically grow in to a
      form that requires numerous glue functions for each sensor type and is
      ill-prepared for handling sensors that report vector form data.
      
      Reduce the amount of glue functions that needs to be implemented for each
      supported sensor type and stop assuming sensor data will be a single integer
      value.
      
      Handle situations where the standby-override attribute is not supported for
      an otherwise functioning sensor.
      
      Do not attempt to start mce-starting-up exceptional situation before the
      objects required by such operation have been created.
      
      Also fix spelling of some constants from SWF_xxx to SFW_xxx.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
      17104348
  6. 16 Mar, 2018 3 commits
    • spiiroin's avatar
      [dbus] Cleanup mce-dbus header file. JB#41340 · 2889d7ce
      spiiroin authored
      After years of organic growth there is little structure left in
      the mce-dbus.h header file.
      
      Group constants, types and functions by association.
      
      Use only spaces for indentation.
      
      Fix include guard so that it does not use a reserved name.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
      2889d7ce
    • spiiroin's avatar
      [dbus] Add dbus peer tracking api. JB#41340 · d456a8b9
      spiiroin authored
      While mce already has functionality for tracking dbus client
      details, the code was originally used for diagnostic logging
      purposes and is not really usable as generic purpose peer
      tracking api.
      
      Add functions for adding/removing peer detail trackers and
      make some already existing peerinfo functions available for
      use outside mce-dbus module too.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
      d456a8b9
    • 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>
      acb29188
  7. 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>
      2735b290
    • spiiroin's avatar
      [build] Remove unneeded include statements · 4e3a2510
      spiiroin authored
      The include files required by modules/headers changes over time.
      While missing headers cause compilation errors and are thus fixed
      promptly, the same does not apply for excess/redundant includes.
      
      Mass remove all includes that are no longer needed.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
      4e3a2510
  8. 02 Jun, 2017 2 commits
    • spiiroin's avatar
      [dbus] Drop unused async pid query functionality · 93dce250
      spiiroin authored
      No longer used, and if use arises, it would be better to implement via
      peerinfo mechanism that queries the pid anyway.
      
      Remove unused coode.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
      93dce250
    • spiiroin's avatar
      [dbus] Enablers for limiting dbus methods to privileged clients. JB#38607 · ad906022
      spiiroin authored
      D-Bus configuration mechanisms do not support allowing/denying method calls
      based on effective uid/gid. While mce already has multiple partially
      overlapping ways to track clients, none of these are suitable for effective
      uid/gid checking.
      
      Track all D-Bus peers doing ipc with mce and maintain a cache of properties
      relevant for privilege checks for each peer.
      
      Delay execution of privileged method calls until the peer details are known
      so that access can be granted / denied.
      
      Rewrite existing client exit, service availability and debug identity
      tracking to utilize the same logic that is used for privilege checks.
      
      Also remove / hide some mce-dbus functions that are not used by other
      parts of mce code base.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
      ad906022
  9. 11 May, 2017 1 commit
  10. 24 Nov, 2016 1 commit
    • spiiroin's avatar
      [dbus] Allow use of sender in signal matching. JB#18661 · 09383a94
      spiiroin authored
      The mce signal listener does not support matching sender names. This is not a
      problem as long as the interfaces and member names are unique enough. But when
      tracking signals from standard dbus interfaces such as InterfacesAdded and
      InterfacesRemoved from org.freedesktop.DBus.ObjectManager / PropertiesChanged
      from org.freedesktop.DBus.Properties interface, the sender must be included
      in the rule to avoid unnecessary i/o and scheduling.
      
      Make it possible to define sender name when installing mce D-Bus signal
      listeners.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
      09383a94
  11. 03 Nov, 2015 1 commit
    • spiiroin's avatar
      [dbus] Move dbus_any_t union declaration to mce-dbus.h · 0b7a9f9b
      spiiroin authored
      Essentially the same declaration is made in several source files and
      is used to simplify D-Bus message construction and parsing.
      
      Move the declaration to mce-dbus.h header file and remove redundant
      declarations from source files.
      
      Rename the union declared in the radiostates plugin as it is used in
      slightly different manner and needs to have non-const pointers.
      0b7a9f9b
  12. 09 Oct, 2015 1 commit
  13. 12 Feb, 2015 1 commit
    • spiiroin's avatar
      Do not attempt to reconnect if dsme socket connection is closed · b0074507
      spiiroin authored
      When dsme exits, mce sees the dsme specific socket getting closed
      before dsme dbus service drops from the system bus. Because the
      dbus service is still supposedly available, reconnect attempt
      is made but it only leads into spamming journal with warnings.
      
      Use dbus service tracking from mce-dbus module for dsme too.
      
      When eof or read error occurs on dsme socket, assume dsme has made
      and exit and wait for dbus service availability changes before
      attempting to reconnect.
      
      Also skip some dsme related warnings when the device is shutting
      down and not having dsme available is more or less expected.
      
      [mce] Do not attempt to reconnect if dsme socket connection is closed. Fixes JB#26373
      b0074507
  14. 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
      4da9aaa6
  15. 22 Jan, 2015 1 commit
    • spiiroin's avatar
      Move dbus service tracking helpers from display plugin to mce-dbus · 27dc9059
      spiiroin authored
      There are multitudes of local dbus service tracking variants scattered
      around mce code base.
      
      The lipstick state is needed by tklock core module and provided by
      in theory optional display plugin.
      
      Move the name owner tracking implemented in display plugin to mce-dbus
      so that it can be used as common implementation for tracking all dbus
      services that are essential for mce operation. Initially use it for
      tracking availability of lipstick and compositor service.
      27dc9059
  16. 25 Aug, 2014 3 commits
  17. 18 Aug, 2014 1 commit
    • spiiroin's avatar
      Make MCE introspectable over D-Bus · 4139106d
      spiiroin authored
      Previously mce did not support org.freedesktop.DBus.Introspectable
      D-Bus interface which required use of workarounds for making method
      calls or listening to signals from qt and qml applications.
      
      Augment mce dbus handler structures to hold XML introspection data too.
      
      Allow registering of dummy signal handlers for the purposes of holding
      introspection data for outbound signals.
      
      Unify all dbus handler registration to happen via array-of-handers
      functionality and provide introspection data for all method calls
      supported by mce and (non-configurable) signals sent by mce.
      
      Do diagnostic logging if mce still sends non-introspectable signals.
      
      Implement org.freedesktop.DBus.Introspectable D-Bus interface for mce.
      
      Allow use of org.freedesktop.DBus.Peer D-Bus interface with mce.
      
      [mce] Make MCE introspectable over D-Bus. Fixes JB#21034
      4139106d
  18. 27 May, 2014 1 commit
  19. 20 May, 2014 1 commit
  20. 13 May, 2014 1 commit
    • spiiroin's avatar
      Fix white space issues in mce code base · 9cc0f544
      spiiroin authored
      No functional changes.
      
      Files where majority of lines are indented with tabulators are changed
      so that every beginning of line uses tabulators for 8 character skips.
      The rest of the files use only space characters for indentation.
      
      Remove excess empty lines from all source files.
      
      Make indentation levels uniform within each source file.
      
      [mce] Fix white space issues in mce code base. Fixes JB#18915
      9cc0f544
  21. 08 Apr, 2014 1 commit
  22. 11 Mar, 2014 1 commit
  23. 18 Feb, 2014 2 commits
    • spiiroin's avatar
      Cache dbus name owner identification data for debugging purposes · 626171ca
      spiiroin authored
      Textual identification of dbus name owner can be requested via
      two new functions: mce_dbus_get_name_owner_ident() and
      mce_dbus_get_message_sender_ident().
      
      If requested name is not already known, the functions will - after
      initiating asynchronous pid query - return only the dbus name for
      use at the call site.
      
      Once the async pid query finishes, the command name is resolved
      from /proc file system and full information is logged so that
      previously written log entries can be associated with a command.
      
      Subsequent calls will immediately provide full information for use
      at the call site.
      
      If the identified name drops from system bus, the cached entry is
      released.
      626171ca
    • spiiroin's avatar
      Allow passing of context data to async dbus method call reply handlers · 5694a754
      spiiroin authored
      Add new function dbus_send_ex() that is similar to already existing
      dbus_send() function, except it takes extra user_data and user_free
      parameters.
      5694a754
  24. 31 Jan, 2014 1 commit
  25. 23 Oct, 2013 1 commit
    • spiiroin's avatar
      Add new dbus helper functions · e5298485
      spiiroin authored
      Parsers to ease handling of messages with containers.
      
      And message handler registration that is easy to unregister too.
      e5298485
  26. 04 Sep, 2013 1 commit
  27. 01 Mar, 2013 1 commit
    • spiiroin's avatar
      Implement cpu-keepalive plugin for mce · 1a4f929e
      spiiroin authored
      The cpu-keepalive plugin implementes dbus interface defined in
      mce-headers >= 1.12.3.
      
      Applications can query keepalive renew period via:
        MCE_CPU_KEEPALIVE_PERIOD_REQ
      
      And then block suspend via:
        MCE_CPU_KEEPALIVE_START_REQ x N
        MCE_CPU_KEEPALIVE_STOP_REQ
      
      The iphb plugin in dsme can signal wakeups via:
        MCE_CPU_KEEPALIVE_WAKEUP_REQ
      
      While there are clients with active keepalive periods, mce will block
      the device from entering late suspend.
      
      If client with active keepalive perdiod drops from system bus, it will
      be handled as if MCE_CPU_KEEPALIVE_STOP_REQ were made.
      
      If mce is compiled without wakelock support, longer renew period is
      reported by MCE_CPU_KEEPALIVE_PERIOD_REQ.
      
      After receiving MCE_CPU_KEEPALIVE_WAKEUP_REQ from dsme, mce blocks
      late suspend for a short while to allow clients using libiphb timers
      to register keepalive periods.
      1a4f929e
  28. 16 Dec, 2010 1 commit