Displaying 2 results from an estimated 2 matches for "upsflushin".
2010 Apr 19
1
Patch for the bestfortress driver 0.02
...ver description structure */
upsdrv_info_t upsdrv_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, siz...
2009 Aug 14
2
Bestfortress driver, network serial patch for nut-2.0
...{
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 */
void upsdrv_updateinfo(void) {
char temp[256];
char *p;
int loadva;
int len;
int retry;
int checksum_ok, is_online=1, is_off, low_batt, trimming, boosting;
f...