From 526b0e68ebcc8acd6afa8a6437e318c25ccf98ea Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Sun, 22 Mar 2015 11:14:14 -0700 Subject: [PATCH] Linux: modified shell to not show _main suffix The builtin commands all have _main suffix by convention so no need to show _main. Also nsh calls the commmands without the _main suffix. Signed-off-by: Mark Charlebois --- Tools/linux_apps.py | 20 ++++++++++++++------ src/modules/mavlink/mavlink_main_linux.cpp | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Tools/linux_apps.py b/Tools/linux_apps.py index 9a380efd01..548dcc5e46 100755 --- a/Tools/linux_apps.py +++ b/Tools/linux_apps.py @@ -38,7 +38,7 @@ builtins = glob.glob("builtin_commands/COMMAND*") apps = [] for f in builtins: - apps.append(f.split(".")[-1]) + apps.append(f.split(".")[-1].split("_main")[0]) print print """ @@ -49,10 +49,11 @@ using namespace std; extern "C" { """ for app in apps: - print "extern int "+app+"(int argc, char *argv[]);" + print "extern int "+app+"_main(int argc, char *argv[]);" print """ -static int list_builtins(int argc, char *argv[]); +static int list_builtins_main(int argc, char *argv[]); +static int shutdown_main(int argc, char *argv[]); } @@ -63,16 +64,17 @@ static map app_map(void) map apps; """ for app in apps: - print '\tapps["'+app+'"] = '+app+';' + print '\tapps["'+app+'"] = '+app+'_main;' -print '\tapps["list_builtins"] = list_builtins;' +print '\tapps["list_builtins"] = list_builtins_main;' +print '\tapps["shutdown"] = shutdown_main;' print """ return apps; } map apps = app_map(); -static int list_builtins(int argc, char *argv[]) +static int list_builtins_main(int argc, char *argv[]) { cout << "Builtin Commands:" << endl; for (map::iterator it=apps.begin(); it!=apps.end(); ++it) @@ -80,5 +82,11 @@ static int list_builtins(int argc, char *argv[]) return 0; } + +static int shutdown_main(int argc, char *argv[]) +{ + cout << "Shutting down" << endl; + exit(0); +} """ diff --git a/src/modules/mavlink/mavlink_main_linux.cpp b/src/modules/mavlink/mavlink_main_linux.cpp index 99e689e74e..633ba8554f 100644 --- a/src/modules/mavlink/mavlink_main_linux.cpp +++ b/src/modules/mavlink/mavlink_main_linux.cpp @@ -88,7 +88,7 @@ #endif static const int ERROR = -1; -#define DEFAULT_DEVICE_NAME "/dev/ttyS1" +#define DEFAULT_DEVICE_NAME "/tmp/ttyS1" #define MAX_DATA_RATE 20000 ///< max data rate in bytes/s #define MAIN_LOOP_DELAY 10000 ///< 100 Hz @ 1000 bytes/s data rate #define FLOW_CONTROL_DISABLE_THRESHOLD 40 ///< picked so that some messages still would fit it.