- 05 Sep, 2018 2 commits
-
-
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:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
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:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
- 24 Aug, 2018 3 commits
-
-
spiiroin authored
Implement enter/leave mass-storage mode functionality also for the configfs backend. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
The mtp functionality is started roughly as follows: 1. usb-moded completes whole gadget configuration, and then 2. signals mtp mode activation on D-Bus 3. msyncd sees the mode change and loads mtp plugin 4. mtp plugin writes endpoint configuration, and then 5. scans storage ares to enumerate files exposed via mtp, but 6. does not really respond to ptp/mtp requests until storages are ready The problems are: While the above sequence has worked with with android usb, it does cause timing issues for usb enumeration and longer than expected response times from pc side mtp initiator point of view. Additionally when configfs is used, the gadget configuration can't even be completed before mtp daemon gets a chance to write configuration data to the control endpoint. To remedy the situation the following changes are made: 1. buteo-mtp-qt5-sync-plugin package is removed from the system -> mtp functionality is no longer handled by msyncd process 2. mtp daemon is made to enumerate storage content before writing config data to control endpoint -> when usb enumeration is possible, mtp daemon is already ready to handle commands from initiator 3. usb-moded explicitly starts/stops mtp daemon when it is about to activate/deactivate mtp_mode -> usb stays configured in charging mode until it is ready to handle mtp This patch handles step (3). Step (2) is in buteo-mtp-qt5 >= 0.5.0, and (1) needs to be fixed in device specific package configuration. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
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:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-