- 24 Aug, 2018 1 commit
-
-
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>
-
- 06 Jun, 2018 2 commits
-
-
spiiroin authored
-
- 05 Jun, 2018 3 commits
-
-
spiiroin authored
On some devices enumeration fails on the 1st connect after bootup unless android usb has already been set up for some function at least once. Add --android-bootup-function option that can be used on such devices to force usb-moded to program some function and then clear the function list when usb-moded is executed during device bootup. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
Improves readability on narrow console sessions and allows writing multi-line explanations when/if needed. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
There are situations where usb-moded needs to behave in slightly different manner depending on whether it is executed as a part of device starup sequence or (restarted) after the device is already fully booted up. Make the related init-done functions available to all modules within usb-moded source tree. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
- 04 Apr, 2018 2 commits
-
-
spiiroin authored
-
- 29 Mar, 2018 3 commits
-
-
spiiroin authored
There were non-unique dsme message type identifiers: 0x00000320 = SET_THERMAL_STATUS = BATTERY_EMPTY_IND 0x00000506 = PROCESSWD_PING = PROCESSWD_PONG Replace custom get-message-type-name functions with common functionality made available from libdsme. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
-
- 28 Mar, 2018 7 commits
-
-
spiiroin authored
The charging_fallback() function has multiple return paths and does not always clear timer id variable "charging_timeout". This can later on lead to attempts to remove stale timer id - which causes glib to emit warnings. Clear the bookkeeping variable on entry to callback rather than just one of the possible return points. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
Compilation options such as: -Wno-unused-parameter and -Wno-unused-result easily hide genuine issues. Remove such relaxations and deal with issues that surface. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
If variables are used only from one source file, make them static. If variables are truly global, put extern declaration to relevant header. Drop completely unused variables. Explicitly initialize variables to sane defaults. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
Fix warnings about undocumented function arguments during documentation build. Fix incorrectly tagged structure/enum members. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
The usb_mode structure is by design used only within usb-moded.c source file. Clarify the intent by not exposing the structure in a header file. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
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>
-
spiiroin authored
When debugging it can be useful to get visibility to requests and signals usb-moded receives over D-Bus. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
- 14 Mar, 2018 2 commits
-
-
spiiroin authored
-
- 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>
-
- 04 Dec, 2017 2 commits
-
-
spiiroin authored
-
- 01 Dec, 2017 2 commits
-
-
spiiroin authored
If usb-moded exits when it can't deduce cable connect state, it will be restarted by systemd. As the usb-moded restarts are not going to change how the udev status looks like, this repeats until systemd moves the usb-moded service to failed state. Do not exit and assume no usb-cable is connected. In addition to not triggering restart spree, this has the additional benefit that the usb-moded dbus interface stays available and signaling not-connected state. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
Usb-moded expects to see POWER_SUPPLY_PRESENT and POWER_SUPPLY_TYPE properties defined for usb power-supply devices. When this is not the case, it emits warnings and applies various fallbacks. Since the properties get re-evaluated periodically, this also leads to the same warnings being repeated. Refactor the code so that in default verbosity the property warnings are emitted only during what looks like cable connect / disconnect. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
- 15 Nov, 2017 2 commits
-
-
spiiroin authored
-
- 14 Nov, 2017 1 commit
-
-
spiiroin authored
While usb-moded correctly goes to charging-only mode when/if it sees power supply type go through USB_DCP -> USB_HVDCP, it still complains about unhandled USB_HVDCP type. Explicitly treat receiving of high voltage dedicated charger profile events as a charger connection. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
- 23 Aug, 2017 3 commits
-
-
Andrew den Exter authored
-
Andrew den Exter authored
[usb] Add a whitelist property specifying allowed USB modes. Contributes to JB#33745 See merge request !28
-
Andrew den Exter authored
-
- 18 Aug, 2017 2 commits
-
-
spiiroin authored
-
- 17 Aug, 2017 3 commits
-
-
spiiroin authored
It seems that kernels in many if not all devices ignore writing of empty string to ffs function control file - the function list is left as it were and this can cause subtle issues on the next cable connect. On the other hand writing a non-existing "function" will clear the function list, but causes write error to be reported. Treat attempts to clear function list as a special case so that non-empty string gets written and the resulting write error is ignored under normal logging verbosity. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
When debugging order and timing of issues related to several processes it is handy to have signals emitted by usb-moded in the journal along with the other related logging. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
When debugging usb-moded it is time consuming to find where the various debug messages originate from. When logging to stderr, prefix the messages with source code position info similar as gcc uses for reporting compilation issues. This allows browsing usb-moded code with jump to the next error functionality available in many text editors. Since the amount of information passed to logging functions is significantly increased, check whether the message would be emitted or not before evaluating formatting parameters etc. Also make variables relating to logging level, type, etc available only via accessor functions. 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.
-
- 05 May, 2017 2 commits
-
-
spiiroin authored
-