Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions drivers/apcupsd-ups.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#define DRIVER_NAME "apcupsd network client UPS driver"
#define DRIVER_VERSION "0.5"

#define POLL_INTERVAL_MIN 10

/* driver description structure */
upsdrv_info_t upsdrv_info = {
DRIVER_NAME,
Expand Down Expand Up @@ -237,14 +239,16 @@ void upsdrv_initinfo(void)
if(!port)fatalx(EXIT_FAILURE,"invalid host or port specified!");
if(getdata())fatalx(EXIT_FAILURE,"can't communicate with apcupsd!");
else dstate_dataok();
poll_interval=60;

poll_interval = (poll_interval > POLL_INTERVAL_MIN) ? POLL_INTERVAL_MIN : poll_interval;
}

void upsdrv_updateinfo(void)
{
if(getdata())upslogx(LOG_ERR,"can't communicate with apcupsd!");
else dstate_dataok();
poll_interval=60;

poll_interval = (poll_interval > POLL_INTERVAL_MIN) ? POLL_INTERVAL_MIN : poll_interval;
}

void upsdrv_shutdown(void)
Expand Down