1. 10 May, 2019 1 commit
  2. 09 Apr, 2019 5 commits
  3. 20 Feb, 2019 1 commit
  4. 05 Sep, 2018 6 commits
    • 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>
      3161f170
    • 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>
      94a484c2
    • 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>
      566b7a6e
    • spiiroin's avatar
      [usb-moded] Normalize typedefs · e48f26b4
      spiiroin authored
      Use named structs / enums in typedefs.
      
      Drop "struct" from code in places where it has been made redundant due to
      having a typedef for the structure.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
      e48f26b4
    • spiiroin's avatar
      [usb-moded] Remove redundant include statements · 176b53cf
      spiiroin authored
      Make all local header files self-sufficient.
      
      Normalize order of including header files, so that header corresponding with
      compilation module is included first, followed by local headers, system
      headers, standard headers, and finally headers from auxiliary libraries.
      
      Remove all include statements that are, or are made redundant by the above
      changes.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
      176b53cf
    • spiiroin's avatar
      [usb-moded] Move synchronous mode switch to worker thread. Fixes JB#42757 · 57d404a3
      spiiroin authored
      Mode switching in usb-moded is done via synchronous ipc / otherwise
      blocking operations - which makes usb-moded mainloop unable to process
      for example udev events / dbus requests from clients during the swich
      and causes potentially stale events to be seen after the mode switch.
      
      Separate mode selection from mode activation so that the latter is
      executed from worker thread.
      
      Distribute existing code in manner that makes the selection vs activation,
      or mainloop / worker thread separation more apparent:
      - control.c: Mode selection logic
      - worker.c:  Mode activation logic
      
      And move miscellaneous functions that have accumulated into the main
      usb-moded module to:
      
      - common.c:  Generic helper functions
      - sigpipe.c: Asynchronous signal trapping
      
      Rename all moved functions so that they still have prefix indicating the
      containing module.
      
      Refuse synchronous sleeps in order to terminate ongoing mode switch
      if udev events / other inputs invalidate the target of transition.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
      57d404a3
  5. 24 Aug, 2018 2 commits
    • spiiroin's avatar
      [usb_moded] Do not track pc / charger connect separately. JB#41748 · 8e469091
      spiiroin authored
      Handling "connected to pc" and "connected to charger" as separate boolean
      states just complicates things.
      
      Move cable_state_t enumeration values from udev module to usb_moded.h
      to make them generally available.
      
      Utilize cable_state_t also within usb_moded.c module.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
      8e469091
    • 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>
      692c2cb3
  6. 28 Mar, 2018 2 commits
  7. 24 Mar, 2017 2 commits
  8. 13 Mar, 2017 1 commit
  9. 07 Jul, 2016 2 commits
    • spiiroin's avatar
      [network] Improve network interface availability checking · 21400d50
      spiiroin authored
      The buffer used for constructing sysfs path from interface name is rather
      short, which can lead to false negatives due to truncation. Additionally
      the actual names of the interfaces checked are not logged in case of
      errors and the helper function can crash if fed null strings.
      
      Make the check_interface() helper function tolerate null arguments
      and enlarge the path expansion buffer to make truncation less likely.
      
      In case get_interface() fails to find valid a interface name, make it
      emit diagnostic message that identifies the actual names attempted.
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
      21400d50
    • spiiroin's avatar
      [compilation] Remove -pedantic compiler option · 58c11bca
      spiiroin authored
      Unless the code base is actively used with other than gcc compilers, use
      of -pedantic just denies use of handy gcc extensions like use of "%m"
      format parameter instead of non-thread-safe strerror().
      
      Drop the '-pedantic' option and replace all strerror() calls with "%m".
      Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
      58c11bca
  10. 01 Apr, 2016 1 commit
  11. 15 Nov, 2015 1 commit
  12. 03 Aug, 2015 2 commits
  13. 31 Jul, 2015 1 commit
  14. 07 Jul, 2015 1 commit
  15. 06 Jul, 2015 1 commit
  16. 02 Jul, 2015 1 commit
  17. 15 Apr, 2015 1 commit
  18. 01 Apr, 2015 1 commit
  19. 31 Mar, 2015 1 commit
  20. 30 Mar, 2015 1 commit
  21. 13 Mar, 2015 1 commit
  22. 12 Mar, 2015 1 commit
  23. 09 Mar, 2015 2 commits
  24. 07 Nov, 2014 1 commit
  25. 04 Nov, 2014 1 commit