1. 09 Apr, 2019 1 commit
  2. 08 Mar, 2019 7 commits
  3. 22 Feb, 2019 2 commits
  4. 21 Feb, 2019 3 commits
    • spiiroin's avatar
      [usb-moded] Normalize backend startup/cleanup functionality · 97107d13
      spiiroin authored
      Use backend_init() and backend_quit() functions for settings up and
      cleaning up all backends.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
    • spiiroin's avatar
      [configfs] Make control details configurable. JB#44679 · 9ae49bb2
      spiiroin authored
      Configfs support was orginally developed in Sony XA2 context. Now it turns
      out some details need tweaking to make it work with other devices.
      Make location of configfs control file hierarchy, configuration and
      functions to use tweakable via usb-moded configuration files.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
    • spiiroin's avatar
      [settings] Do not write dynamic data to /etc. Fixes JB#38241 · 0e9f72cb
      spiiroin authored
      While combining all configuration data into /etc/usb-moded/usb-moded.ini
      works as expected when new configuration files are installed to the device,
      it also means that 1) uninstalling / updating configuration files has no
      effect and 2) /etc can't reside on a read-only file-system.
      Maintain "delta to static configuration" and store it outside /etc - in
      /var/lib/usb-moded/usb-moded.ini, so that also changes in / removal of
      existing configuration files are handled in deterministic manner.
      If /etc/usb-moded/usb-moded.ini exists, migrate data from it and then remove
      the now unnecessary file.
      Streamline handling of non-existing configuration and remove functions made
      redundant in the process.
      Note: The "read from filesystem on each setting access" is retained for now
      to avoid regression is situations where such behavior might be expected.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
  5. 20 Feb, 2019 2 commits
  6. 18 Feb, 2019 2 commits
  7. 07 Feb, 2019 1 commit
    • spiiroin's avatar
      [dbus] Add target mode signaling. JB#44479 · 87936ffc
      spiiroin authored
      Some transitions such as activating mtp mode can take so long that giving
      user feedback becomes necessary. However as usb-moded exposes only what
      has happened, there is no reliable source of information for what is
      going on.
      Also, the "sig_usb_state_ind" D-Bus signal is used for transmitting both
      mode change notifications and transient events - which is confusing and
      can cause problems if new signals are ever added as there is no backwards
      compatible ways to tell apart mode names from event names.
      Add dbus query / change notifications for target mode. The target mode
      is changed before starting mode transition, so that processes listening
      to signals from usb-moded know what kind of transition is happening when
      the current mode changes to "busy".
      Add separate dbus signals for mode changes and events. The legacy
      "sig_usb_state_ind" is retained as-is for the sake of backwards
      Also synchronize the content of D-Bus Introspect xml data provided as
      a file in development package and made available at runtime via D-Bus
      method call.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
  8. 21 Jan, 2019 1 commit
  9. 16 Jan, 2019 1 commit
  10. 14 Nov, 2018 2 commits
  11. 13 Nov, 2018 3 commits
  12. 12 Sep, 2018 3 commits
  13. 06 Sep, 2018 2 commits
  14. 05 Sep, 2018 10 commits
    • spiiroin's avatar
      [dbus] Deny mode change requests while busy. JB#42757 · 054e8e00
      spiiroin authored
      Previously switches would block mainloop and multiple mode change requests
      would effectively get queued and executed one after another. Now that
      separate worker thread is utilized, the D-Bus requests are handled without
      delay and can cause termination of already ongoing transition - which is
      could cause problems especially if done in rapid succession.
      Deny mode change requests over D-Bus when already busy with mode switch,
      so that bailing out from ongoing transition is reserved only for dealing
      with unavoidable physical cable disconnect situations.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
    • spiiroin's avatar
      [usb-moded] Normalize use of return statement · 3161f170
      spiiroin authored
      As 'return' is not a function, do not make it look like one.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
    • spiiroin's avatar
      [usb-moded] Normalize use of sizeof operator · 94a484c2
      spiiroin authored
      As 'sizeof' is not a function, do not make it look like one.
      Also 'sizeof(char)' is redundant as it is 1 by definition.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
    • spiiroin's avatar
      [dbus] Deal with NULL strings on D-Bus signal broadcast attempts · fdc32b06
      spiiroin authored
      Corrupted settings, empty lists and other hiccups can lead to usb-moded
      attempting to send D-Bus signal with NULL strings - which either leads
      to omitting signal sending when checked / crashing when not checked.
      To avoid crashing, make umdbus_send_signal_ex() send empty string when
      signal with null content is given, and add sufficient checks / diagnostic
      logging to umdbus_send_config_signal().
      Remove null checks from common_send_hidden_modes_signal() and
      common_send_whitelisted_modes_signal() so that NULL set gets equated
      with empty set and signal broadcasting is never skipped.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
    • spiiroin's avatar
      [config] Never return NULL mode setting · 67df6982
      spiiroin authored
      If usb-moded configuration is corrupted, it can lead to segfaults as the
      return value from config_get_mode_setting() is not always checked.
      Make config_get_mode_setting() always return a valid c-string.
      Use MODE_CHARGING as fallback value, and remove any alternative fallback
      strategies used elsewhere in the code base.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
    • spiiroin's avatar
      [common] Do not implicitly map fallback charging mode to ask on D-Bus · 92bcb718
      spiiroin authored
      Underneath the hood fallback charging mode and ask mode are equivalent.
      However ask mode must not be exposed on D-Bus until device has been
      unlocked i.e. blindly mapping fallback charging to produce ask mode
      activation is not correct.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
    • spiiroin's avatar
      [worker] Undo partially executed mode switch on failure · 3b873f00
      spiiroin authored
      If mode switch fails / is abandoned due to request from main thread,
      undo any changes already made towards the current target.
      Also do not shortcut synchronous sleeps during the cleanup
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
    • spiiroin's avatar
      [worker] Adjust mtp daemon start/stop timeouts · 566b7a6e
      spiiroin authored
      In devices that have lots of files (say tens of thousands), mtp daemon
      might have trouble getting everything enumerated within 30 second timeout
      allowed by usb-moded.
      Use 2 minute timeout for starting, and 15 second timeout for stopping
      mtp daemon.
      Implement a generic wait for condition/timeout function that can also
      be interrupted from main thread. Use the wait function for both regular
      blocking sleeps and waiting for mtp daemon starting/stopping.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
    • spiiroin's avatar
      [modesetting] Replace questionable async timer with sleep loop. JB#42757 · 1d9e91e4
      spiiroin authored
      In case of network setup failure usb-moded utilizes glib timer to retry
      the operation once once after 3 second delay. How well that has worked is
      a bit questionable as the dynamic mode setup continues with things that
      probably require functional network. Also, while it used to be guaranteed
      that the timer would not trigger before the synchronous mode switch
      operations have finished, this is no longer guaranteed due to the use of
      worker thread for the mode switch.
      Use retry three times with one second delay between retries instead of
      relying on a three second asynchronous timer with hazardous triggering
      time and context.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
    • spiiroin's avatar
      [appsync] Exclude problematic timer from compilation. JB#42757 · bf2e96af
      spiiroin authored
      After moving the mode switch activity to worker thread, there is now a
      situation in appsync code where timer started from worker thread can get
      prematurely (before the blocking mode switch is finished) triggered.
      Luckily the timer is needed only for the purposes of APP_SYNC_DBUS
      feature - which is not enabled by default and probably does not even
      work as it would require usb-moded having session bus connection.
      Put all dbus appsync related code within #ifdef APP_SYNC_DBUS. This
      effectively stops the problematic timer code from being included in
      the binary.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>