[Nut-upsdev] POSIX serial handling semantics (was: Re: [windows port] blazer_ser issues, select_read() from serial semantics)
Paul Fertser
fercerpav at gmail.com
Wed Sep 28 08:39:18 UTC 2011
Hello,
(adding mailing list back to Cc as i consider this to be of general
interest, hope you do not mind)
On Wed, Sep 28, 2011 at 09:18:38AM +0200, Frédéric Bohé wrote:
> I would like to integrate your patch in the next release of Windows
> binary. But I want to check if it does not introduce regression on
> serial devices I have.
I hope i made it clear enough that it has different (though more
correct imho) semantics from the current *nix version and that this
issue should probably be discussed in a more detailed manner.
Here follows my humble opinion with regard to that:
It should be put straight: current idea of asking for "some" data and
being happy with whatever first "chunk" received feels like a misuse
of the POSIX serial handling semantics. Given that we do not know in
advance how many bytes we want to receive and also provided you do not
want to introduce protocol-specific "end-of-data/line" handling, a
sane solution seems to be reading as much data as available until we
stop receiving (as there's nothing left) and hit timeout. That's what
i (hopefully) implemented in this patch. This can't work properly with
any device that constantly sends something (as e.g. GPS) and this
introduces an additional latency (waiting for a timeout after the last
byte received) unless the supplied buffer was exactly the response
size.
So it'd would be nice to hear the opinion of the *nix serial hackers
here: are you sure the current approach is correct? Do you think it
should be changed in similar way to my windows patch? Or do you think
a protocol-specific handling for end-of-data condition should be
introduced? Depending on this decision, windows code should be
correspondingly altered.
> All this to say to you that I do not forget your patch but I will treat
> it in several weeks.
Thanks for letting me know, i was about to think my mail slipped
through the cracks ;)
> Thanks for your interest in this project.
Thanks for your work on this rather cool software :)
--
Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software!
mailto:fercerpav at gmail.com
More information about the Nut-upsdev
mailing list