X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fmultimeter.c;h=6953750525ce34cd2f4e50de26af4cfa6f6949e3;hb=3aeca36659b04725028f123bcea387a37581624a;hp=e3da00a1520a98109d210b4217f84375cce2e25e;hpb=a28ebbb8265605a09f0555d1eb036f50b9a784c8;p=collectd.git diff --git a/src/multimeter.c b/src/multimeter.c index e3da00a1..69537505 100644 --- a/src/multimeter.c +++ b/src/multimeter.c @@ -153,17 +153,18 @@ static int multimeter_init (void) for (i = 0; i < 10; i++) { - device[strlen(device)-1] = i + '0'; + device[strlen(device)-1] = i + '0'; - if ((fd = open(device, O_RDWR | O_NOCTTY)) > 0) + if ((fd = open(device, O_RDWR | O_NOCTTY)) != -1) { struct termios tios; int rts = TIOCM_RTS; double value; + memset (&tios, 0, sizeof (tios)); tios.c_cflag = B1200 | CS7 | CSTOPB | CREAD | CLOCAL; tios.c_iflag = IGNBRK | IGNPAR; - tios.c_oflag = 0; + tios.c_oflag = 0; tios.c_lflag = 0; tios.c_cc[VTIME] = 3; tios.c_cc[VMIN] = LINE_LENGTH; @@ -171,7 +172,7 @@ static int multimeter_init (void) tcflush(fd, TCIFLUSH); tcsetattr(fd, TCSANOW, &tios); ioctl(fd, TIOCMBIC, &rts); - + if (multimeter_read_value (&value) < -1) { close (fd); @@ -200,7 +201,6 @@ static void multimeter_submit (double value) vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "multimeter", sizeof (vl.plugin)); sstrncpy (vl.type, "multimeter", sizeof (vl.type));