forked from Archive/PX4-Autopilot
Added ability to set OS specific path for dataman file
dataman can now be started using: dataman start -f filepath Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
parent
9e5978b2b1
commit
05720b5aef
|
@ -131,8 +131,8 @@ static sem_t g_sys_state_mutex;
|
|||
|
||||
/* The data manager store file handle and file name */
|
||||
static int g_fd = -1, g_task_fd = -1;
|
||||
// FIXME - need a configurable path that is not OS specific
|
||||
static const char *k_data_manager_device_path = "/fs/microsd/dataman";
|
||||
static const char *default_device_path = "/fs/microsd/dataman";
|
||||
static char *k_data_manager_device_path = NULL;
|
||||
|
||||
/* The data manager work queues */
|
||||
|
||||
|
@ -831,7 +831,7 @@ stop(void)
|
|||
static void
|
||||
usage(void)
|
||||
{
|
||||
warnx("usage: dataman {start|stop|status|poweronrestart|inflightrestart}");
|
||||
warnx("usage: dataman {start [-f datafile]|stop|status|poweronrestart|inflightrestart}");
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -848,11 +848,20 @@ dataman_main(int argc, char *argv[])
|
|||
warnx("dataman already running");
|
||||
return -1;
|
||||
}
|
||||
if (argc == 4 && strcmp(argv[2],"-f") == 0) {
|
||||
k_data_manager_device_path = strdup(argv[3]);
|
||||
warnx("dataman file set to: %s\n", k_data_manager_device_path);
|
||||
}
|
||||
else {
|
||||
k_data_manager_device_path = strdup(default_device_path);
|
||||
}
|
||||
|
||||
start();
|
||||
|
||||
if (g_fd < 0) {
|
||||
warnx("dataman start failed");
|
||||
free(k_data_manager_device_path);
|
||||
k_data_manager_device_path = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -866,8 +875,11 @@ dataman_main(int argc, char *argv[])
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (!strcmp(argv[1], "stop"))
|
||||
if (!strcmp(argv[1], "stop")) {
|
||||
stop();
|
||||
free(k_data_manager_device_path);
|
||||
k_data_manager_device_path = NULL;
|
||||
}
|
||||
else if (!strcmp(argv[1], "status"))
|
||||
status();
|
||||
else if (!strcmp(argv[1], "poweronrestart"))
|
||||
|
|
Loading…
Reference in New Issue