Commit 9b04af27 authored by spiiroin's avatar spiiroin

[usb-moded] Do not force appsync stop during bootup. MER#1694

Starting/stopping appsync related systemd units is relatively expensive
task to perform and can cause timing problems during bootup.

As we know the appsync processes have not been started when device is
booting up, we can skip the explicit stopping when usb-moded is started
as part of bootup sequence.

Also, when usb-moded is exiting, it should be enough to stop only those
units that have been started by usb-moded.
Signed-off-by: spiiroin's avatarSimo Piiroinen <>
parent 99f2413d
......@@ -124,6 +124,7 @@ static gboolean set_disconnected_silent(gpointer data);
static void usb_moded_init(void);
static gboolean charging_fallback(gpointer data);
static void usage(void);
static bool init_done_p(void);
/* ============= Implementation starts here =========================================== */
/** set the usb connection status
......@@ -623,8 +624,19 @@ static void usb_moded_init(void)
#ifdef APP_SYNC
/* make sure all services are down when starting */
/* If usb-moded happens to crash, it could leave appsync processes
* running. To make sure things are in the order expected by usb-moded
* force stopping of appsync processes during usb-moded startup.
* The exception is: When usb-moded starts as a part of bootup. Then
* we can be relatively sure that usb-moded has not been running yet
* and therefore no appsync processes have been started and we can
* skip the blocking ipc required to stop the appsync systemd units. */
if( init_done_p() )
log_warning("usb-moded started after init-done; forcing appsync stop");
#endif /* APP_SYNC */
/* always read dyn modes even if appsync is not used */
......@@ -673,7 +685,10 @@ static gboolean charging_fallback(gpointer data)
static void handle_exit(void)
/* exiting and clean-up when mainloop ended */
/* Stop appsync processes that have been started by usb-moded */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment