- 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
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 changes. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
Just to make it easier for editor to handle automatic indentation, make all C comment continuation lines start with whitespace followed by '*'. 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>
-
- 28 Mar, 2018 1 commit
-
-
spiiroin authored
USB mode white-list configuration can get applied via D-Bus during bootup. This requires re-evaluation of the currently active usb mode - which misfires when nothing is connected to usb port and usb mode gets changed from undefined to charging fallback (= charging from pc). Add explicit check for undefined usb mode. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
- 08 Mar, 2018 2 commits
-
-
spiiroin authored
usb_moded_send_whitelisted_modes_signal() function is used without including the header where the function is declared - which then leads to compilation time warnings. Fix the issue by adding the required #include statements. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
Usb-moded does android usb initialization only if there is a non-empty configuration block in the ini-files. This does not make sense anymore as the values defined in the config file are used as fallback solution if required data can't be obtained by other means. If android_usb specific sysfs controls are present on the device, try to initialize them regardless of whether ubs-moded configuration files contain relevant information or not. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
- 11 Aug, 2017 1 commit
-
-
Andrew den Exter authored
If the whitelist property exists in the conf file only modes that appear in the list can be used or set as the default. If a current mode is removed from the whitelist the device will be put into charging mode and if the default is removed that will be changed to ask.
-
- 07 Jul, 2016 4 commits
-
-
spiiroin authored
Having a predicate function with name xxx_changed() that returns a non-zero value when nothing has changed is confusing. Switch the return value meaning so that non-zero means there is a difference and zero that there is not. Also treat old value of NULL and new value of NULL as no change. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
The function compares old value with ini file section name, which leads to practically every new value being evaluated different from previous one. Check old value vs new value instead. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
The make_hidden_modes_string() function claims to return const string, but that is true only as an exception to the rule. Since the callers of the function do not release dynamic memory, this leads to leakage. Also if no mode is hidden, request to unhide something least to that mode getting hidden and hiding something already hidden returns NULL which is rather unintuitive. Fix make_hidden_modes_string() and make all callers of it to release dynamically reserved memory / deal with possible null return value. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
The prototypes for these functions claim to return const string, while in reality it is dynamic memory that should released via g_free(). Change the prototypes to match the reality. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
- 11 May, 2016 1 commit
-
-
spiiroin authored
Maintaining usb manufacturer and product name configurations for multiple devices is cumbersome and time consuming. It also duplicates effort that is needed for ssu configuration anyway. When possible, override usb-moded manufacturer and product name configuration by using data provided by ssu D-Bus service. The feature is optional and needs to be enabled at usb-moded build time via "--enable-mer-ssu" configure option. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
- 29 Apr, 2016 1 commit
-
-
spiiroin authored
If usb mode setting is not present in usb-moded.ini and override is not specified in kernel command line, get_mode_setting() will return null. The handler for "get_config" D-Bus method call does not check the return value and using the null value triggers abort from sanity checks at libdbus. Attempting to pass NULL as string via D-Bus causes abort. Use MODE_UNDEFINED as fallback in case the setting value is not defined. Also remove potential memory leaks in the code used for determining the mode setting value and use correct function for releasing the resulting dynamically allocated string. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
- 06 Apr, 2016 1 commit
-
-
jpoutiai authored
Always merge ini files in the order of [0-9][A-Z][a-z] Signed-off-by:
Jarko Poutiainen <jarko.poutiainen@jollamobile.com>
-
- 04 Apr, 2016 1 commit
-
-
martinjones authored
-
- 26 Dec, 2015 1 commit
-
-
phdeswer authored
Allow to add and remove modes to a list with multiple hidden modes through the dbus api. Signed-off-by:
Philippe De Swert <philippedeswert@gmail.com>
-
- 15 Dec, 2015 3 commits
-
-
phdeswer authored
Keep the hidden modes info so the information does not get lost between merges of the conf file. Will also keep from them popping up in the UI when not expected. Signed-off-by:
Philippe De Swert <philippedeswert@gmail.com>
-
phdeswer authored
When the modes list gets updated by hiding/unhiding a mode, we send the new mode list out to make sure UI/anybody listening knows about the change. Signed-off-by:
Philippe De Swert <philippedeswert@gmail.com>
-
phdeswer authored
Allow to hide a mode. Also add a dbus method to do so. (Only one mode atm) Signed-off-by:
Philippe De Swert <philippedeswert@gmail.com>
-
- 03 Aug, 2015 2 commits
-
-
Philippe De Swert authored
Get all the network data from one function, so we do not need to have the same work-arounds, or fallbacks in different places. Signed-off-by:
Philippe De Swert <philippe.deswert@jollamobile.com>
-
Philippe De Swert authored
Handle netmask from command line and config file. At the same time fix some issues with the network code. Signed-off-by:
Philippe De Swert <philippe.deswert@jollamobile.com>
-
- 27 May, 2015 1 commit
-
-
Philippe De Swert authored
Add a function to check if a new value is changed or not. Signed-off-by:
Philippe De Swert <philippe.deswert@jollamobile.com>
-
- 26 May, 2015 1 commit
-
-
Slava Monich authored
The signal notifies the clients that configuration has been modified.
-
- 28 Apr, 2015 1 commit
-
-
Thomas Perl authored
-
- 02 Jan, 2015 1 commit
-
-
Philippe De Swert authored
Skip files not ending with .ini when merging conf files. Also update documentation to reflect this. Signed-off-by:
Philippe De Swert <philippe.deswert@jollamobile.com>
-
- 11 Nov, 2014 1 commit
-
-
Philippe De Swert authored
Hopefully the last bits of unneeded casting and faulty use of const are now gone. Signed-off-by:
Philippe De Swert <philippe.deswert@jollamobile.com>
-
- 07 Nov, 2014 2 commits
-
-
Philippe De Swert authored
Avoid unneeded casting. Signed-off-by:
Philippe De Swert <philippe.deswert@jollamobile.com>
-
Philippe De Swert authored
Not a real issue but the code is more readable and it removes the need for casting by removing some const stuff that is not needed. Signed-off-by:
Philippe De Swert <philippe.deswert@jollamobile.com>
-
- 19 Aug, 2014 1 commit
-
-
Philippe De Swert authored
Since hal has been replaced and removed long ago, there is no reason to keep udev separated. Makes code easier to read and eases Makefile maintenance. Signed-off-by:
Philippe De Swert <philippe.deswert@jollamobile.com>
-
- 20 Apr, 2014 1 commit
-
-
Philippe De Swert authored
It seems possible to feed bad ip's over dbus, which causes errors when setting up the network and udhcpd. Also fixed a potential crash when updating the ip. Signed-off-by:
Philippe De Swert <philippe.deswert@jollamobile.com>
-
- 13 Feb, 2014 1 commit
-
-
Philippe De Swert authored
Signed-off-by:
Philippe De Swert <philippe.deswert@jollamobile.com>
-
- 30 Nov, 2013 2 commits
-
-
Philippe De Swert authored
Nat might not be needed in all usb network related modes, but the nat interface usually stays the same in the device. Signed-off-by:
Philippe De Swert <philippe.deswert@jollamobile.com>
-
Philippe De Swert authored
Signed-off-by:
Philippe De Swert <philippe.deswert@jollamobile.com>
-
- 27 Nov, 2013 2 commits
-
-
Philippe De Swert authored
Signed-off-by:
Philippe De Swert <philippe.deswert@jollamobile.com>
-
Philippe De Swert authored
Signed-off-by:
Philippe De Swert <philippe.deswert@jollamobile.com>
-
- 29 Oct, 2013 2 commits
-
-
Philippe De Swert authored
Signed-off-by:
Philippe De Swert <philippe.deswert@jollamobile.com>
-
Philippe De Swert authored
Signed-off-by:
Philippe De Swert <philippe.deswert@jollamobile.com>
-
- 25 Oct, 2013 1 commit
-
-
Philippe De Swert authored
There was a mistake in setting the network configuration. Set_network_settings takes the config option first, then the value to be set. Signed-off-by:
Philippe De Swert <philippe.deswert@jollamobile.com>
-