search for: upsrecv

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

2010 Apr 19
1
Patch for the bestfortress driver 0.02
...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) { + if ((len = upsrecv (temp+2, sizeof temp - 2, ENDCHAR, IGNCHARS)) <= 0) { upsflushin (0, 0, "\r "); upssend ("f\r"); +...
2009 Aug 14
2
Bestfortress driver, network serial patch for nut-2.0
...upslogx(LOG_WARNING, "ser_send_pace: vsnprintf needed more " "than %d bytes", sizeof(buf)); int d_usec = UPSDELAY; for (p = buf; *p; p++) { if (write(upsfd, p, 1) != 1) return -1; if (d_usec) usleep(d_usec); sent++; } return sent; } static int upsrecv(char *buf,size_t bufsize,char ec,const char *ic) { return ser_get_line(upsfd, buf, bufsize - 1, ec, ic, SER_WAIT_SEC, SER_WAIT_USEC); } static int upsflushin(int f,int verbose,const char *ignset) { return ser_flush_in(upsfd, ignset, verbose); } /* read out UPS and store info */ voi...
2011 Oct 03
2
patch: Replace many usleep and some sleep calls with nanosleep
..., buffer, sizeof(buffer), '>', "\012", 3, 0) <= 0) { printf("."); ser_send(upsfd, "\r"); - sleep(UPSDELAY); + nanosleep(&delay, NULL); } } @@ -537,7 +538,7 @@ void upsdrv_init_nofc(void) ser_send(upsfd, "id\r"); /* prevent upsrecv from timing out */ - sleep(UPSDELAY); + struct timespec delay = {UPSDELAY, 0}; nanosleep(&delay, NULL); ser_get_line(upsfd, rstring, sizeof(rstring), '>', "", 3, 0); Index: b/drivers/bestfortress.c =================================================================== --...