From 65e602bd3c3bd937b77a2872cb2a1962858eb74d Mon Sep 17 00:00:00 2001 From: skarg Date: Sun, 17 Mar 2019 13:16:59 +0000 Subject: [PATCH] 1. readme.txt - Build instructions modified. - Added valid example of cmd line 2. main.c - Return false if no args passed. Fixes segmentation fault --- bacnet-stack/demo/router/main.c | 3 +++ bacnet-stack/demo/router/readme.txt | 12 ++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/bacnet-stack/demo/router/main.c b/bacnet-stack/demo/router/main.c index a26a52f4..89f4e91c 100644 --- a/bacnet-stack/demo/router/main.c +++ b/bacnet-stack/demo/router/main.c @@ -464,7 +464,10 @@ bool parse_cmd( ROUTER_PORT *current = head; if (argc < 2) + { print_help(); + return false; + } /* begin checking cmd parameters */ opt = getopt_long(argc, argv, optString, Options, &index); diff --git a/bacnet-stack/demo/router/readme.txt b/bacnet-stack/demo/router/readme.txt index c0510f2c..dba29017 100644 --- a/bacnet-stack/demo/router/readme.txt +++ b/bacnet-stack/demo/router/readme.txt @@ -37,8 +37,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 1. Download, build and install libconfig C/C++ Configuration File Library from http://www.hyperrealm.com/libconfig or use APT to install sudo apt-get install libconfig-dev -2. Set variable "BACNET_PORT" in library root directory Makefile to linux -3. Run "make clean all" from library root directory +2. Run "make clean all" from library root directory +3. Run "make router" from library root directory ----------------------- 4. Router configuration @@ -134,12 +134,16 @@ mstp arguments: } ); - ----------------------- 5. Start ----------------------- +5.1. With configuration file 1. Copy configuration file in the router executable directory -2. Start the router with "router -c init.cfg" command in terminal +2. Start the router with "sudo ./router -c init.cfg" command in terminal + +5.2. Passing params in command line +1. sudo ./router -D "mstp" "/dev/ttyS0" --mac 1 127 1 --baud 38400 --network 4 -D "bip" "eth0" --network 1 +