search for: upssend

Displaying 3 results from an estimated 3 matches for "upssend".

2010 Apr 19
1
Patch for the bestfortress driver 0.02
..._info = { @@ -203,20 +203,26 @@ int loadva; int len; int retry; + char ch; int checksum_ok, is_online=1, is_off, low_batt, trimming, boosting; for (retry = 0; retry < 5; ++retry) { upsflushin (0, 0, "\r "); upssend ("f\r"); + while (ser_get_char(upsfd, &ch, 0, UPSDELAY) > 0 && ch != '\n'); // response starts with \r\n + temp[2] = 0; do { - if (upsrecv (temp+2, sizeof temp - 2, ENDCHAR, IGNCHARS) <= 0) { +...
2009 Aug 14
2
Bestfortress driver, network serial patch for nut-2.0
...to float value */ static inline void setinfo_float (const char *key, char * fmt, const char * s, size_t len, double factor) { char buf[10]; if (len > sizeof(buf)) len = sizeof(buf)-1; strncpy (buf, s, len); buf[len] = 0; dstate_setinfo (key, fmt, factor * (double)atoi (buf)); } static int upssend(const char *fmt,...) { int ret; char buf[1024], *p; va_list ap; unsigned int sent = 0; va_start(ap, fmt); ret = vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); if ((ret < 1) || (ret >= (int) sizeof(buf))) upslogx(LOG_WARNING, "ser_send_pace: vsnprintf needed more &qu...
2011 Oct 03
2
patch: Replace many usleep and some sleep calls with nanosleep
...-#define UPSDELAY 50000 /* 50 ms delay required for reliable operation */ +#define UPSDELAY 50e6 /* 50e6 ns delay required for reliable operation */ #define SER_WAIT_SEC 2 /* allow 2.0 sec for ser_get calls */ #define SER_WAIT_USEC 0 #define ENDCHAR '\r' @@ -162,7 +162,7 @@ static int upssend(const char *fmt,...) char buf[1024], *p; va_list ap; unsigned int sent = 0; - int d_usec = UPSDELAY; + struct timespec d_nsec = {0, UPSDELAY}; va_start(ap, fmt); ret = vsnprintf(buf, sizeof(buf), fmt, ap); @@ -175,8 +175,7 @@ static int upssend(const char *fmt,...) if (write(upsfd, p...