From dd4731b33460524722a2b630f4b3cf2307fce22e Mon Sep 17 00:00:00 2001 From: Philippe De Swert Date: Mon, 10 Mar 2014 16:42:19 +0200 Subject: [PATCH] [usb-moded] Split of appsync for diag mode also. It's cleaner that way. Signed-off-by: Philippe De Swert --- config/{run => run-diag}/qa-diagnostic.ini | 0 rpm/usb-moded.spec | 4 +++- src/usb_moded-appsync.c | 14 +++++++++++--- src/usb_moded-appsync.h | 5 +++-- src/usb_moded.c | 2 +- 5 files changed, 18 insertions(+), 7 deletions(-) rename config/{run => run-diag}/qa-diagnostic.ini (100%) diff --git a/config/run/qa-diagnostic.ini b/config/run-diag/qa-diagnostic.ini similarity index 100% rename from config/run/qa-diagnostic.ini rename to config/run-diag/qa-diagnostic.ini diff --git a/rpm/usb-moded.spec b/rpm/usb-moded.spec index d781c80..084aee0 100644 --- a/rpm/usb-moded.spec +++ b/rpm/usb-moded.spec @@ -272,11 +272,13 @@ install -m 644 -D %{SOURCE2} %{buildroot}/%{_sysconfdir}/modprobe.d/usb_moded.co install -m 644 -D %{SOURCE1} %{buildroot}/lib/systemd/system/%{name}.service install -d %{buildroot}/%{_sysconfdir}/usb-moded install -d %{buildroot}/%{_sysconfdir}/usb-moded/run +install -d %{buildroot}/%{_sysconfdir}/usb-moded/run-diag install -d %{buildroot}/%{_sysconfdir}/usb-moded/dyn-modes install -d %{buildroot}/%{_sysconfdir}/usb-moded/diag install -m 644 -D config/dyn-modes/* %{buildroot}/%{_sysconfdir}/usb-moded/dyn-modes/ install -m 644 -D config/diag/* %{buildroot}/%{_sysconfdir}/usb-moded/diag/ install -m 644 -D config/run/* %{buildroot}/%{_sysconfdir}/usb-moded/run/ +install -m 644 -D config/run-diag/* %{buildroot}/%{_sysconfdir}/usb-moded/run-diag/ install -m 644 -D config/mass-storage-jolla.ini %{buildroot}/%{_sysconfdir}/usb-moded/ install -d $RPM_BUILD_ROOT/lib/systemd/system/basic.target.wants/ ln -s ../%{name}.service $RPM_BUILD_ROOT/lib/systemd/system/basic.target.wants/%{name}.service @@ -367,7 +369,7 @@ systemctl daemon-reload || : %files diagnostics-config %defattr(-,root,root,-) %{_sysconfdir}/usb-moded/diag/qa_diagnostic_mode.ini -%{_sysconfdir}/usb-moded/run/qa-diagnostic.ini +%{_sysconfdir}/usb-moded/run-diag/qa-diagnostic.ini %files connection-sharing-android-config %defattr(-,root,root,-) diff --git a/src/usb_moded-appsync.c b/src/usb_moded-appsync.c index 068402a..2f8a4f2 100644 --- a/src/usb_moded-appsync.c +++ b/src/usb_moded-appsync.c @@ -77,7 +77,7 @@ void free_appsync_list(void) } } -void readlist(void) +void readlist(int diag) { GDir *confdir = 0; @@ -86,8 +86,16 @@ void readlist(void) free_appsync_list(); - if( !(confdir = g_dir_open(CONF_DIR_PATH, 0, NULL)) ) - goto cleanup; + if(diag) + { + if( !(confdir = g_dir_open(CONF_DIR_DIAG_PATH, 0, NULL)) ) + goto cleanup; + } + else + { + if( !(confdir = g_dir_open(CONF_DIR_PATH, 0, NULL)) ) + goto cleanup; + } while( (dirname = g_dir_read_name(confdir)) ) { diff --git a/src/usb_moded-appsync.h b/src/usb_moded-appsync.h index b139ad4..e191774 100644 --- a/src/usb_moded-appsync.h +++ b/src/usb_moded-appsync.h @@ -19,7 +19,8 @@ 02110-1301 USA */ -#define CONF_DIR_PATH "/etc/usb-moded/run" +#define CONF_DIR_PATH "/etc/usb-moded/run" +#define CONF_DIR_DIAG_PATH "/etc/usb-moded/run-diag" #define APP_INFO_ENTRY "info" #define APP_INFO_MODE_KEY "mode" @@ -45,7 +46,7 @@ typedef struct list_elem /*@}*/ }list_elem; -void readlist(void); +void readlist(int diag); int activate_sync(const char *mode); int activate_sync_post(const char *mode); int mark_active(const gchar *name); diff --git a/src/usb_moded.c b/src/usb_moded.c index f209a59..8e4b1ba 100644 --- a/src/usb_moded.c +++ b/src/usb_moded.c @@ -516,7 +516,7 @@ static void usb_moded_init(void) } #ifdef APP_SYNC - readlist(); + readlist(diag_mode); /* make sure all services are down when starting */ appsync_stop(); modelist = read_mode_list(diag_mode);