Hi, you shouldn't need special functions read / write on /dev/ttySx should work. use ##linux on irc.freenode.net? Trev On Tue, Aug 31, 2010 at 02:35:16PM -0500, Martin McCormick wrote: > I am writing some C code to manage the operation of a > new scanner radio and it is mostly coming along well but I have > run in to some odd behavior from a RS-232 port routine I stole > from a Linux HowTo on serial communications. > > One calls the routine and it stores characters in to a > buffer or transmits data from a buffer. Receiving 50 or 60 > characters is a piece of cake. Everything works as expected but > receiving a longer string such as 60 to 70 or more characters, > the first read brings back some of the chars from the previous > read even though the buffer was zero'd out. A second read gets > all the character that should have been there in the first read. > > Needless to say, this is not good but I discovered I can > put a 1-second sleep before the next read and then it always > gives the correct data. > > When I get through, the radio will be totally accessible > thanks to its serial control capabilities and to Linux, in this > case, Vinux. > > Are there any Linux discussion groups that would be > really good for this question? > > The receiver control program really creeps along with > those forced 1-second pauses before every serial read. > Interestingly enough, I wouldn't call it flaky because it does > exactly the same wrong thing every time and it is always on a > longer receive string. The buffer is set for 1024 characters and > none of the reads have even come close to overflowing it so > that's not the problem. Also, if the sleep is even slightly less > than 1 full second, such as .75 seconds, I still get the bogus > read. > > Again, any ideas as to where to take this question are > appreciated. > > Martin > > _______________________________________________ > Blinux-list mailing list > Blinux-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/blinux-list
Attachment:
signature.asc
Description: Digital signature
_______________________________________________ Blinux-list mailing list Blinux-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/blinux-list