[Nut-upsdev] Problem with bestfcom and old Ferrups

Charles Lepple clepple at gmail.com
Sat Feb 9 01:13:30 UTC 2008


On Feb 7, 2008 10:13 AM, Arjen de Korte <nut+devel at de-korte.org> wrote:
> >> 193-                 ser_get_line_alert(upsfd, buf, sizeof(buf), '\012', "",
> >> 194-                         POLL_ALERT, alert_handler, 0, 20000);
> >> 193+
> >> 194+                 ser_flush_io(upsfd);
> >> 195
> >> 196          ser_send(upsfd, cmd);
> >
> > I tried this, but it didn't catch the extra data.  I still needed the
> > ser_get_line() calls.
>
> That's probably because in you ser_get_line() function, you specify quite
> a long delay (3 seconds), while the ser_flush_io() commmand will not wait
> for data. So the reply you're trying to get rid of may not have arrived
> completely at the time of flushing the buffers. So we may need both.
> Reading the reply through ser_get_line() and ser_flush_io() to get rid of
> unexpected messages.

What was the final decision regarding the placement and order of the
ser_get_line/ser_flush_io calls?

-- 
- Charles Lepple



More information about the Nut-upsdev mailing list