[Nut-upsdev] Problem with bestfcom and old Ferrups

Arjen de Korte nut+devel at de-korte.org
Thu Feb 7 15:13:42 UTC 2008


>> 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.

Best regards, Arjen




More information about the Nut-upsdev mailing list