ts-7000
[Top] [All Lists]

Re: [ts-7000] Re: TS7200 COM2 - ttyAM1 Issues

To:
Subject: Re: [ts-7000] Re: TS7200 COM2 - ttyAM1 Issues
From: Jim Jackson <>
Date: Thu, 5 Feb 2009 17:28:32 +0000 (GMT)


On Thu, 5 Feb 2009, bonjelo2000 wrote:

> I was just informed that the standard Linux Kernel limits the buffer
> to 16 bytes.   Does anyone know of a way to change this without
> recompiling the Kernel?  If not I will have to change the way I
> perform my reads.

You mean like everyone else does? Surely you keep reading until you have 
all the message you expect? Often this is to read all chars upto the 
terminating CR LF or whatever the device terminates a line of characters 
with. Repeated reading for input in the norm in network reads too.

>
> --- In  "bonjelo2000" <> wrote:
>>
>> I'm back again
>>
>> Thought I had it.  When I read there appears to be a 16 byte maximum
>> character return.  Is there a way to set a buffer size for the serial
>> port?
>>
>>
>>
>> --- In  Donal <donaloconnor@> wrote:
>>>
>>> Ah great stuff
>>>
>>> On Thu, Feb 5, 2009 at 2:21 PM, bonjelo2000 <rameandc@> wrote:
>>>
>>>>   Got it
>>>>
>>>> I had to set an additional flag
>>>>
>>>> termConf.c_lflag &= (~ICANON);
>>>>
>>>>
>>>> --- In  <ts-7000%40yahoogroups.com>,
>> "bonjelo2000"
>>>> <rameandc@> wrote:
>>>>>
>>>>> Unfortunately the device I am comunicating with does not offer
> this
>>>>> functionality.
>>>>>
>>>>> --- In  <ts-7000%40yahoogroups.com>, Donal
>>>> <donaloconnor@> wrote:
>>>>>>
>>>>>> Could try adding \x0D to end of string being sent back.
>>>>>>
>>>>>> On Thu, Feb 5, 2009 at 1:38 PM, bonjelo2000 <rameandc@> wrote:
>>>>>>
>>>>>>> OK,
>>>>>>>
>>>>>>> I found some dumb mistakes in coding. I tested with
>> Hyperterminal
>>>>> on
>>>>>>> another computer and could see write command work. Read
> appeared
>>>>> to
>>>>>>> work but required I hit the enter key when in Hyperterminal.
>>>>>>>
>>>>>>> When connecting back to device the write command works but I
>> hang
>>>>>>> when attempting to read. I must have one of the c_cflag
>> parameters
>>>>>>> sent wrong.
>>>>>>>
>>>>>>> Any help is appreciated
>>>>>>>
>>>>>>>
>>>>>>> --- In  <ts-7000%40yahoogroups.com>
>> <ts-7000%
>>>>> 40yahoogroups.com>, "bonjelo2000"
>>>>>>> <rameandc@> wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I am attempting to communicate with a device.
>>>>>>>>
>>>>>>>> I use the folowing write and read commands. The write
>> appears to
>>>>>>> work
>>>>>>>> in that the device responds correctly to the appropriate
>> command
>>>>>>> sent.
>>>>>>>> The read command always returns a -1.
>>>>>>>>
>>>>>>>> i=write(fd_com,cSendBuf,iSendLen);
>>>>>>>>
>>>>>>>> sleep(1);
>>>>>>>>
>>>>>>>> iReturnLen=read(fd_com,cRecBuf,6);
>>>>>>>>
>>>>>>>>
>>>>>>>> int comm_init ()
>>>>>>>> {
>>>>>>>> struct termios termConf;
>>>>>>>> bzero (&termConf, sizeof (struct termios));
>>>>>>>>
>>>>>>>> tcgetattr(fd_com, &termConf);
>>>>>>>>
>>>>>>>> termConf.c_cflag = B38400 | CREAD | CLOCAL;
>>>>>>>> termConf.c_cflag |= PARENB;
>>>>>>>> termConf.c_cflag &= ~PARODD;
>>>>>>>> termConf.c_cflag &= ~CSIZE;
>>>>>>>> termConf.c_cflag |= CS8;
>>>>>>>> termConf.c_cflag |= CRTSCTS;
>>>>>>>>
>>>>>>>> fd_com = open(PORT, O_RDWR | O_NOCTTY | O_NDELAY);
>>>>>>>> if (fd_com < 0)
>>>>>>>> {
>>>>>>>> return FAILURE;
>>>>>>>> }
>>>>>>>>
>>>>>>>> tcsetattr(fd_com, TCSADRAIN, &termConf); // Set the new
>>>>>>> options for
>>>>>>>> the port...
>>>>>>>>
>>>>>>>> return SUCCESS;
>>>>>>>> }
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> -----------------------------------------------------
>>>>>>>> So what are you trying to do?
>>>>>>>>
>>>>>>>> I don't understand what you mean by "read commands"?
>>>>>>>>
>>>>>>>> did you write a program to use COM2, or are you trying
> to use
>>>>>>>> it as a login port?
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>
>
>
>


------------------------------------

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