From f7fbb9dfa9275fe3880d159793cb3f32c00058dd Mon Sep 17 00:00:00 2001 From: Philippe De Swert Date: Thu, 24 Sep 2015 15:48:17 +0300 Subject: [PATCH] [usb-moded] Do not print output for post services that are not started To avoid confusion while debugging, we avoid printing messages for services that are started in post when they are not actually started. Signed-off-by: Philippe De Swert --- src/usb_moded-appsync.c | 13 +++++++------ src/usb_moded-appsync.h | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/usb_moded-appsync.c b/src/usb_moded-appsync.c index 3a41491..8e66387 100644 --- a/src/usb_moded-appsync.c +++ b/src/usb_moded-appsync.c @@ -245,14 +245,14 @@ int activate_sync(const char *mode) /* do not launch items marked as post, will be launched after usb is up */ if(data->post) { - mark_active(data->name); + mark_active(data->name, data->post); continue; } log_debug("launching app %s\n", data->name); if(data->systemd) { if(!systemd_control_service(data->name, SYSTEMD_START)) - mark_active(data->name); + mark_active(data->name, 0); else goto error; } @@ -261,11 +261,11 @@ int activate_sync(const char *mode) /* skipping if dbus session bus is not available, or not compiled in */ if(no_dbus) - mark_active(data->name); + mark_active(data->name, 0); #ifdef APP_SYNC_DBUS else if(!usb_moded_dbus_app_launch(data->launch)) - mark_active(data->name); + mark_active(data->name, 0); else goto error; #endif /* APP_SYNC_DBUS */ @@ -338,14 +338,15 @@ int activate_sync_post(const char *mode) return(1); } -int mark_active(const gchar *name) +int mark_active(const gchar *name, int post) { int ret = -1; // assume name not found int missing = 0; GList *iter; - log_debug("App %s notified it is ready\n", name); + if(post) + log_debug("App %s notified it is ready\n", name); for( iter = sync_list; iter; iter = g_list_next(iter) ) { diff --git a/src/usb_moded-appsync.h b/src/usb_moded-appsync.h index ec8ca60..14ae85c 100644 --- a/src/usb_moded-appsync.h +++ b/src/usb_moded-appsync.h @@ -47,7 +47,7 @@ typedef struct list_elem void readlist(int diag); int activate_sync(const char *mode); int activate_sync_post(const char *mode); -int mark_active(const gchar *name); +int mark_active(const gchar *name, int post); int appsync_stop(void); void free_appsync_list(void); void usb_moded_appsync_cleanup(void);