1. 24 Aug, 2018 3 commits
    • spiiroin's avatar
      [usb_moded] Refactor entering/leaving usb mode. JB#41748 · 64350689
      spiiroin authored
      Split mode switching to three layers: Tracking cable connection state,
      choosing target mode, and performing required actions to activate
      the chosen mode.
      Try to minimize places where layer borders are crossed - which should
      work also as an enabler for moving blocking actions to separate thread
      later on.
      Arrange logic in such manner that usb gadget is always configured as
      being able to serve some function - fallback being the dummy mass_storage
      function used for charging.
      Deprecate command line options that serve no useful purpose after the
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
    • spiiroin's avatar
      [usb_moded] Drop --android-bootup-function option. JB#41748 · 4f53cf48
      spiiroin authored
      The target is to always have android usb enabled with valid function, so
      this workaround is not relevant anymore.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
    • spiiroin's avatar
      [usb_moded] Add configfs support. Fixes JB#42083 · 692c2cb3
      spiiroin authored
      Add custom Makefile for faster smoke-test rebuilds without spending time
      in configure, autotools, document generation and/or rolling rpm packages.
      Add multiple include protection to all header files.
      Move function prototypes away from header files that included in the
      development package.
      Mass rename functions to have a prefix giving context for the function.
      For the most part the prefix is derived from the name of the compilation
      module containing the function.
      Mass normalize indentation to four spaces in all source files.
      Augment author lists on each source file based on git committers.
      Remove "inline" attributes from not-really-inlineable functions.
      Remove .gitignore.
      Remove unused modules-android.c source file.
      Define _GNU_SOURCE for whole build rather than in individual files.
      Fix resource leaks here and there.
      Try to avoid hard-coding android usb paths.
      Add configfs backend for usb cadget configuration.
      Probe supported backends (configfs, android usb, or kmod) on usb-moded
      startup and make them mutually exclusive with each other.
      Allow configfs and android usb control structures some time to show up
      if usb-moded is started during device bootup.
      Refactor udev event listener to utilize a state machine. Simplifies
      book keeping and makes pc/charger detection heuristics easier to control.
      Refactor mode selection to utilize three interconnected mini state machines.
      Allows separating logically wanted mode from mode programmed to usb and
      mode exposed over D-Bus.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
  2. 05 Jun, 2018 2 commits
  3. 28 Mar, 2018 3 commits
  4. 11 Aug, 2017 1 commit
  5. 24 Mar, 2017 3 commits
  6. 14 Feb, 2017 1 commit
    • spiiroin's avatar
      [usb-moded] Use single function to exit charging fallback. Fixes JB#37759 · 8286dbf8
      spiiroin authored
      Whether and when we can switch for example from charging fallback to
      developer mode depends on multiple triggers - the order of which might vary
      from one device/bootup to another. Using custom state evaluation code at
      each possible trigger location easily causes unexpected results like device
      staying in fallback charging mode until the cable is re-attached.
      Add a state evaluation function and call it from those triggers that
      potentially allow exit from the charging fallback mode.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
  7. 07 Nov, 2016 1 commit
    • spiiroin's avatar
      [usb-moded] Fix issues on exit path. MER#1694 · b3e2f370
      spiiroin authored
      Exiting from mainloop does not work as intended, looks like handle_exit()
      is meant to be called from main() function after mainloop is stopped. What
      happens in practice is that handle_exit() gets called from signal handler
      and it makes exit() without ever returning to main() function - which
      means some cleanup tasks are skipped.
      In general: Make cleanup tasks happen on the same logical level where
      initialization is made, re-order init/cleanup tasks according to what
      functional inter dependencies exist and add comments describing why
      things are done when they are done.
      Remove handle_exit() function and distribute work it used to do among:
      - usb_moded_stop() - exiting from mainloop
      - usb_moded_cleanup() - releasing usb-mode related state/config data
      - main() - cleaning up init steps made from main()
      To make possible ordering issues more visible, refuse to send usb-moded
      dbus signals in situations where the service name is not owned by the
      ubs-moded process.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
  8. 26 Apr, 2016 2 commits
    • spiiroin's avatar
      [udev] Suspend proof event reading and processing. Fixes JB#34440 · c982d3b4
      spiiroin authored
      Depending on kernel side usb drivers and charging logic, it is possible
      that device suspends immediately after reporting usb connect / disconnect
      while display is off and autosuspend enabled. That can delay the actions
      that should be made on usb connection state changes.
      Acquire a wakelock for the duration of udev event input processing.
      Hold a wakelock for a while when usb connection state changes occur.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
    • spiiroin's avatar
      [udev] Try to ignore false positive cable connects. Contributes to JB#34547 · 2fa5781b
      spiiroin authored
      When connecting charger to usb port, it is sometimes initially detected as
      a pc cable instead of charger. This leads to usb mode selection dialog
      popping up in a situation where mode selection is not possible.
      Optionally, when cable connect is seen based on udev events, wait a while
      to see if it gets identified as dedicated charger before invoking actions
      relevant to pc cable connection only.
      It is assumed that data reported by udev on usb-moded startup is stable
      and pc cable connection is accepted without delay.
      By default usb-moded reacts immediately to pc cable connect events.
      If needed, the default delay can be adjusted via usb-moded command
      line argument -m/--max-cable-delay=<ms>.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
  9. 11 Jun, 2014 1 commit
  10. 02 Jun, 2014 1 commit
  11. 30 Oct, 2013 1 commit
  12. 29 Oct, 2013 1 commit
  13. 22 Oct, 2013 1 commit
  14. 27 May, 2013 2 commits
  15. 10 May, 2013 1 commit
  16. 13 Apr, 2013 1 commit
  17. 17 May, 2011 1 commit
  18. 10 May, 2011 1 commit
  19. 22 Mar, 2011 1 commit