New daemon option nodevicecheck added.
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
ebus Daemon (ebusd) - ChangeLog
|
||||
===============================
|
||||
|
||||
2013-11-29:
|
||||
* New daemon option nodevicecheck added.
|
||||
|
||||
2013-11-19:
|
||||
* Data type of struct commands.s_type changed from integer to char[2]. Possible
|
||||
data types are: BR, MM, MS. (BroadCast, MasterMaster, MasterSlave)
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
# log file (/var/log/ebusd.log)
|
||||
#logfile=/var/log/ebusd.log
|
||||
|
||||
# don't check serial device (NO | YES/NO)
|
||||
#nodevicecheck=YES
|
||||
|
||||
# pid file (/var/run/ebusd.pid)
|
||||
#pidfile=/var/run/ebusd.pid
|
||||
|
||||
|
||||
+10
-1
@@ -52,6 +52,7 @@ static struct send_data send_data;
|
||||
|
||||
static struct recv_data recv_data;
|
||||
|
||||
static int nodevicecheck = NO;
|
||||
static int rawdump = NO;
|
||||
static int showraw = NO;
|
||||
|
||||
@@ -74,6 +75,14 @@ static FILE *rawfp = NULL;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
eb_set_nodevicecheck(int check)
|
||||
{
|
||||
nodevicecheck = check;
|
||||
}
|
||||
|
||||
void
|
||||
eb_set_rawdump(int dump)
|
||||
{
|
||||
@@ -185,7 +194,7 @@ eb_serial_valid()
|
||||
{
|
||||
int serial;
|
||||
|
||||
if (ioctl(sfd, TIOCMGET, &serial) < 0)
|
||||
if (ioctl(sfd, TIOCMGET, &serial) < 0 && nodevicecheck == NO)
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
@@ -64,6 +64,15 @@ struct recv_data {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief set nodevicecheck
|
||||
* @param [in] YES | NO
|
||||
* @return none
|
||||
*/
|
||||
void eb_set_nodevicecheck(int check);
|
||||
|
||||
/**
|
||||
* @brief set rawdump
|
||||
* @param [in] YES | NO
|
||||
|
||||
+10
@@ -60,6 +60,7 @@ static char extension[10];
|
||||
static int foreground = UNSET;
|
||||
static char loglevel[CFG_LINELEN];
|
||||
static char logfile[CFG_LINELEN];
|
||||
static int nodevicecheck = UNSET;
|
||||
static char pidfile[CFG_LINELEN];
|
||||
static int port = UNSET;
|
||||
static int rawdump = UNSET;
|
||||
@@ -86,6 +87,7 @@ static struct option opts[] = {
|
||||
{"foreground", no_argument, NULL, 'f'},
|
||||
{"loglevel", required_argument, NULL, 'l'},
|
||||
{"logfile", required_argument, NULL, 'L'},
|
||||
{"nodevicecheck", no_argument, NULL, 'n'},
|
||||
{"pidfile", required_argument, NULL, 'P'},
|
||||
{"port", required_argument, NULL, 'p'},
|
||||
{"rawdump", no_argument, NULL, 'r'},
|
||||
@@ -108,6 +110,7 @@ static struct config cfg[] = {
|
||||
{"foreground", BOL, &foreground, "run in foreground"},
|
||||
{"loglevel", STR, &loglevel, "\tlog level (INF | " LOGTXT ")"},
|
||||
{"logfile", STR, &logfile, "\tlog file (" DAEMON_LOGFILE ")"},
|
||||
{"nodevicecheck", BOL, &nodevicecheck, "don't check serial device"},
|
||||
{"pidfile", STR, &pidfile, "\tpid file (" DAEMON_PIDFILE ")"},
|
||||
{"port", NUM, &port, "\tport (" NUMSTR(SOCKET_PORT) ")"},
|
||||
{"rawdump", BOL, &rawdump, "\tdump raw ebus data to file"},
|
||||
@@ -189,6 +192,9 @@ cmdline(int *argc, char ***argv)
|
||||
case 'L':
|
||||
strncpy(logfile, optarg, strlen(optarg));
|
||||
break;
|
||||
case 'n':
|
||||
nodevicecheck = YES;
|
||||
break;
|
||||
case 'P':
|
||||
strncpy(pidfile, optarg, strlen(optarg));
|
||||
break;
|
||||
@@ -250,6 +256,9 @@ set_unset(void)
|
||||
if (*logfile == '\0')
|
||||
strncpy(logfile , DAEMON_LOGFILE, strlen(DAEMON_LOGFILE));
|
||||
|
||||
if (nodevicecheck == UNSET)
|
||||
nodevicecheck = NO;
|
||||
|
||||
if (*pidfile == '\0')
|
||||
strncpy(pidfile , DAEMON_PIDFILE, strlen(DAEMON_PIDFILE));
|
||||
|
||||
@@ -669,6 +678,7 @@ main(int argc, char *argv[])
|
||||
|
||||
|
||||
/* set ebus configuration */
|
||||
eb_set_nodevicecheck(nodevicecheck);
|
||||
eb_set_rawdump(rawdump);
|
||||
eb_set_showraw(showraw);
|
||||
|
||||
|
||||
@@ -28,13 +28,10 @@
|
||||
#define DAEMON_CFGDIR "/etc/ebusd"
|
||||
#define DAEMON_CFGFILE DAEMON_CFGDIR"/ebusd.conf"
|
||||
#define DAEMON_EXTENSION "csv"
|
||||
#define DAEMON_FOREGROUND NO
|
||||
#define DAEMON_LOGLEVEL "INF"
|
||||
#define DAEMON_LOGFILE "/var/log/ebusd.log"
|
||||
#define DAEMON_NOSYN NO
|
||||
#define DAEMON_PIDFILE "/var/run/ebusd.pid"
|
||||
#define DAEMON_RAWFILE "/tmp/ebusd.bin"
|
||||
#define DAEMON_RAWDUMP NO
|
||||
|
||||
|
||||
void usage(void);
|
||||
|
||||
Reference in New Issue
Block a user