projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
treewide: use designated initializers for ai_hints
[collectd.git]
/
src
/
ted.c
diff --git
a/src/ted.c
b/src/ted.c
index
37ab85d
..
282212b
100644
(file)
--- a/
src/ted.c
+++ b/
src/ted.c
@@
-70,11
+70,15
@@
static int ted_read_value(double *ret_power, double *ret_voltage)
{
unsigned char receive_buffer[300];
unsigned char package_buffer[300];
{
unsigned char receive_buffer[300];
unsigned char package_buffer[300];
- char pkt_request[1] = {0xAA};
+
unsigned
char pkt_request[1] = {0xAA};
int package_buffer_pos;
fd_set input;
int package_buffer_pos;
fd_set input;
- struct timeval timeout;
+
+ /* Initialize timeout structure, set to 2 seconds */
+ struct timeval timeout = {
+ .tv_sec = 2
+ };
int end_flag;
int escape_flag;
int end_flag;
int escape_flag;
@@
-87,11
+91,6
@@
static int ted_read_value(double *ret_power, double *ret_voltage)
FD_ZERO (&input);
FD_SET (fd, &input);
FD_ZERO (&input);
FD_SET (fd, &input);
- /* Initialize timeout structure, set to 2 seconds */
- memset (&timeout, 0, sizeof (timeout));
- timeout.tv_sec = 2;
- timeout.tv_usec = 0;
-
/* clear out anything in the buffer */
tcflush (fd, TCIFLUSH);
/* clear out anything in the buffer */
tcflush (fd, TCIFLUSH);