[Nut-upsdev] Problem with bestfcom and old Ferrups
Chris Adams
cmadams at hiwaay.net
Tue Feb 12 14:46:54 UTC 2008
Once upon a time, Charles Lepple <clepple at gmail.com> said:
> 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?
I need the ser_get_line() calls in my patch either way.
While the ser_get_line_alert() call above isn't really doing anything
(the alert handler just throws away the input) does have a wait that is
longer than the ser_flush_io() call, so I don't know if that will
function the same.
I have not yet had a chance to try it on my old UPS (since I have to
copy updates to my notebook and carry it to the power room).
--
Chris Adams <cmadams at hiwaay.net>
Systems and Network Administrator - HiWAAY Internet Services
I don't speak for anybody but myself - that's enough trouble.
More information about the Nut-upsdev
mailing list