ts-7000
[Top] [All Lists]

Re: [ts-7000] ttyS0 linux serial buffer size

To:
Subject: Re: [ts-7000] ttyS0 linux serial buffer size
From: Jim Jackson <>
Date: Wed, 20 Dec 2006 19:52:04 +0000 (GMT)
Hi Don,

On Tue, 19 Dec 2006, Don W. Carr wrote:

> On a serial port there is no such thing as end of file. I have always
> assumed that a return value of 0 is because there was a timeout. A value of
> -1 would indicate an error. Of course if you have not set a timeout, you
> should wait for ever, and the only valid return values would be -1 and 1 or
> greater. You should never see a zero. Let me know if I am interpreting this
> wrong.

With a serial line in canonical mode, doesn't ^D usually generate an EOF
condition? If the tty is in raw mode then I think your analysis holds.
Assuming I remember this stuff correct :-) it's been a long time since I
did serious serial stuff.

Jim

>
> On 12/19/06, Jim Jackson <> wrote:
> >
> >
> >
> > On Tue, 19 Dec 2006, kendwyer wrote:
> >
> > > Hi,
> > >
> > > I am using the TS-7260 system for my application. I have found that
> > > the tty (at least ttyS0) will only read 4096 bytes as a defualt
> > > maximum, when my user code executes the following, r =
> > > read(ft,ser_databuf,4096);.
> > >
> > > When I change the code as follows:
> > >
> > > res1 = read(ft,ser_databuf,8192);
> > >
> > > I still only read 4096 bytes...
> > >
> > > How/where do I change the code to read greater than 4096?
> > >
> >
> > Read the man page for the read function
> >
> > man 2 read
> >
> > on most any linux desktop.
> >
> > I quote......
> >
> > On success, the number of bytes read is returned (zero
> > indicates end of file), and the file position is advanced
> > by this number. It is not an error if this number is
> > smaller than the number of bytes requested; this may hap­
> > pen for example because fewer bytes are actually available
> > right now (maybe because we were close to end-of-file, or
> > because we are reading from a pipe, or from a terminal),
> > or because read() was interrupted by a signal.
> >
> > re-code your application to loop on the read call until you've read all
> > the bytes.
> >
> >
>
>
>
> --
> Dr. Don W. Carr
> J. G. Montenegro 2258
> Guadalajara, Mexico
> +52-333-630-0704
> +52-333-836-4500 ext 2930
>



Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
    
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/


<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU