ts-7000
[Top] [All Lists]

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

To:
Subject: [ts-7000] Re: ttyS0 linux serial buffer size
From: "kendwyer" <>
Date: Wed, 20 Dec 2006 12:56:28 -0000
Hi 

thanks for the replies, this helps a lot.

Ken

--- In  "Don W. Carr" <> wrote:
>
> With the read system call, there is NO guarantee that it will not return
> with less data when it is available. This depends on the device and
internal
> buffer sizes, etc. You should never write code that assumes you will
get all
> of the bytes you ask for, even if you are sure they have been sent.
It is
> your job to write a loop to handle this.
> 
> Here is some example code, but you also need to check for a return
value of
> -1 and handle that. Hope this helps
> 
> I also have some code for setting the baud rate and timeout if you
need it..
> 
> Don.
> 
> int rt_read_serial(int fd, void *data, int sz)
> {
>   int total_read = 0;
>   char *dp = (char *) data;
>   while (total_read < sz)
>   {
>     int n = read(fd, dp + total_read, sz - total_read);
>     if (n == 0)
>     {
>       // we timed out waiting for our characters.
>       return total_read;
>     }
>     total_read += n;
>   }
>   return total_read;
> }
> 
> 
> 
> On 12/19/06, 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?
> >
> > Thanks,
> > Ken
> >
> >  
> >
> 
> 
> 
> -- 
> 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