- 18 Oct, 2016 5 commits
-
-
spiiroin authored
-
spiiroin authored
The once/bootup mechanism used for terminating rescue mode leaves it permanently active if usb moded is restarted after bootup has finished. Do not activate rescue mode if init-done has been reached when usb-moded is starting up. Disable rescue mode if init-done is signaled on D-Bus SystemBus while usb-moded is running. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
When charger is connected, usb-moded can see first "USB" (=cable) connection event from udev followed by "USB_CDP" (=charger) event. Due to cached something-connected flag usb moded still behaves as if pc cable were connected - which leaves ui thinking mode selection can/should be done etc. If dedicated charger is reported after pc cable, clear the low level something-connected flag before acting on charger connected info. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
- 05 Oct, 2016 2 commits
-
-
spiiroin authored
-
- 04 Oct, 2016 1 commit
-
-
spiiroin authored
Existing configuration files do not cover case where android kernel is used to implement just mtp functionality using ffs based userspace code - mtp_mode-android uses "mtp" instead of "ffs" and pc_suite-android activates both mtp and obex support. Add mtp_mode-android-ffs.ini that is identical with pc_suite-android.ini except for the mode name which is "mtp" instead of "pc_suite".
-
- 07 Jul, 2016 25 commits
-
-
spiiroin authored
-
spiiroin authored
Since enumeration timers are not left running anymore when enumeration occurs / appsync is canceled, the increment at activate_sync() and check at enumerate_usb() based tag code filtering is no longer needed. Remove the tag variables and code related to them. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
The boolean state data for tracking active/inactive applications makes it difficult to separate applications that are not relevant to the mode and as a result an attempt to stop also those irrelevant apps that were not started is made when exiting the mode. Switch from boolean to inactive|active|dontcare state tracking. When starting appsync, mark apps relevant to the mode as inactive and the rest as dontcare. When stopping appsync, stop only those applications that have been activated by usb-moded. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
When appsync is starting applications, pre-enum applications are started before post-enum apps. However stopping applications is done in whatever order they happen to be after configuration parsing - which could cause problems if post apps have explicit dependencies on pre apps. Do also application stopping in two phases: first post-enum apps followed by pre-enum apps. Also, apart from usb-moded startup/shutdown, attempt to skip stopping of applications that have not been started. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
The systemd_control_service() function returns zero on success. Due to incorrect boolean check in appsync_stop() diagnostic failure messages are emitted on success and failures are ignored silently. Fix the condition so that failures are logged. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
Enumeration timer is started every time activate_sync() is called and is left running even if enumeration occurs / appsync_stop() is called. Cache enumeration timer id and cancel it when it is no longer needed. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
If android usb is in enable=0 state, cable detection is persistently broken as the existing workarounds in usb-moded are made when cable disconnect is detected and that can't happen unless cable detect works. Enable android usb on usb-moded startup. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
Seems that just writing enable=0 functions=none leaves the android usb in some sort of limbo where cable detection does not work until enable=1 write is also made. Do enable=1 write after clearing functions on cable disconnect. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
When debugging mode setting issues, it is hard to tell when and what gets written to android usb sysfs files. When running usb-moded in debug verbosity, log sysfs paths that get written to and the data that is written - and if possible also the value held by the sysfs file before the write. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
If dbus_connection_send_with_reply_and_block() should set the dbus error, it is never freed. Make sure dbus_error_free() is called before returning from the function. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
If charging_timeout should already contain a valid timer id when the timer is started, the old timer will be leaked. Remove existing timer id before assigning new one. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
The io watch source id is not cleared when it is going to be implicitly removed - which can lead to unsuccessful removal attempt when/if hwal_cleanup() function is called later on. Clear watch_id when return value from the callback function is going to cause it to be implicitly removed. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
Various pointers are uninitialized / left to hold stale values after releasing. Which could lead to hard to debug problems if trigger_stop() is called multiple times / after unsuccessful trigger_init(). Zero initialize all pointers dealing with dynamic resources and clear them when resources are released. Also clear iowatch id when it is going to be implicitly removed due to the return value from the callback so that removal is not attempted anymore when/if trigger_stop() is called later on. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
When network_retry() timer callback gets triggered, the associated timer id delayed_network is not invalidated and usb moded can try to remove it later on - which will lead to complaints from glib being emitted to journal. Clear the timer id when the timer callback gets called. Also make sure already existing timer id is not left active when scheduling a timeout. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
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 get_hidden_modes() returns data allocated via g_key_file_get_string() which should be released with g_free() and fallback uses strdup() which should use free(). Use g_strdup() in the fallback case and release memory with g_free(). Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
There is data obtained via g_key_file_get_string() that is released with free(). Use g_free() instead. Also use a helper callback function with expected argument types when releasing a list of elements. Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
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:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
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:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
When fallback to alternate mount point is made, the pointer to the dynamically allocated primary mount point is leaked. Free string obtained via find_mounts() before assigning the pointer to string returned by find_alt_mount(). Signed-off-by:
Simo Piiroinen <simo.piiroinen@jollamobile.com>
-
spiiroin authored
Probably in attempt to hide compilation warnings due to storing dynamically allocated data in const pointers, there are multiple places where releasing of dynamic memory uses casts. Some of these casts are incorrect and there are still compilation issues. Remove const attribute from pointers that are used to store dynamically allocated data and remove the unnecessary casts at free() / g_free(). 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 3 commits
-
-
Matti Kosola authored
Signed-off-by:
Matti Kosola <matti.kosola@jolla.com>
-
Matti Kosola authored
Get device manufacturer and product name from ssu See merge request !11
-
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>
-
- 04 May, 2016 2 commits
-
-
Matti Kosola authored
Signed-off-by:
Matti Kosola <matti.kosola@jolla.com>
-
Matti Kosola authored
Handle missing mode setting gracefully See merge request !10
-
- 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>
-
- 27 Apr, 2016 1 commit
-
-
jpoutiai authored
Signed-off-by:
Jarko Poutiainen <jarko.poutiainen@jollamobile.com>
-