Skip to content

Commit

Permalink
[usb-moded] Split of appsync for diag mode also. It's cleaner that way.
Browse files Browse the repository at this point in the history
Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
  • Loading branch information
philippedeswert committed Mar 10, 2014
1 parent ee07aad commit dd4731b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
File renamed without changes.
4 changes: 3 additions & 1 deletion rpm/usb-moded.spec
Expand Up @@ -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
Expand Down Expand Up @@ -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,-)
Expand Down
14 changes: 11 additions & 3 deletions src/usb_moded-appsync.c
Expand Up @@ -77,7 +77,7 @@ void free_appsync_list(void)
}
}

void readlist(void)
void readlist(int diag)
{
GDir *confdir = 0;

Expand All @@ -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)) )
{
Expand Down
5 changes: 3 additions & 2 deletions src/usb_moded-appsync.h
Expand Up @@ -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"
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/usb_moded.c
Expand Up @@ -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);
Expand Down

0 comments on commit dd4731b

Please sign in to comment.