Linux: Use config file for gateway settings (#1061)

- The following settings can be use on the config file:
  - verbose=[debug,info,notice,warn,err] - Logging verbosity.
  - log_file[0|1] - Enable logging to a file.
  - log_filepath=(FILE) - Log file path.
  - log_pipe=[0|1] - Enable logging to a named pipe(aka fifo).
    Use this option to view your gateway's log messages from the
    log_pipe_file (defined below).
    To do so, run the following command on another terminal:
    - $ cat "log_pipe_file"
  - log_pipe_file=(FILE)
  - syslog=[0|1] - Enable logging to syslog.
  - eeprom_file=[/etc/mysensors.eeprom]
  - eeprom_size=[1024]
- Change some mysgw parameters:
  - Added:
    - -q, --quiet:  for quiet mode, disable log messages written to the
    terminal.
  - Removed:
    - -d, --debug: removed, log messages are now enabled by default.
  - Replaced:
    - -b, --background: replaced by --daemon
- isatty() is no longer used, log messages by default are printed to
  stderr unless the gateway is started with --quiet (#1022)
- MY_LINUX_CONFIG_FILE: no longer holds the path to the eeprom file,
  but to the configuration file
This commit is contained in:
Marcelo Aquino
2018-03-23 11:00:34 +01:00
committed by Mikael Falkvidd
parent 06f8d2b7e5
commit 2175c993ef
14 changed files with 681 additions and 176 deletions
+7 -2
View File
@@ -6,7 +6,7 @@
* network topology allowing messages to be routed to nodes.
*
* Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
* Copyright (C) 2013-2017 Sensnology AB
* Copyright (C) 2013-2018 Sensnology AB
* Full contributor list: https://github.com/mysensors/MySensors/graphs/contributors
*
* Documentation: http://www.mysensors.org
@@ -27,8 +27,9 @@
#include <unistd.h>
#include "SoftEeprom.h"
#include "log.h"
#include "config.h"
static SoftEeprom eeprom = SoftEeprom(MY_LINUX_CONFIG_FILE, 1024); // ATMega328 has 1024 bytes
static SoftEeprom eeprom;
static FILE *randomFp = NULL;
bool hwInit(void)
@@ -43,6 +44,10 @@ bool hwInit(void)
#endif
#endif
if (eeprom.init(conf.eeprom_file, conf.eeprom_size) != 0) {
exit(1);
}
return true;
}