[LCP]reg serial communication in linux.

James Attard james_attard at ieee.org
Tue Oct 14 18:49:01 UTC 2003


With reference to this topic, do you know whether using CANONICAL data
processing, and the serial device is a printer, the results will be
displayed correctly? I mean, using canonical mode, transferring serial
data to another computer works fine and all data are formatted as "clean"
lines. Will transferring the same data (using canonical mode) to a
printer, produce garbage data? I'm speaking of a general printer, since i
don't know the details. What is the best thing, based from your
experience? Thanks.

James.

>
>
> On Tuesday, October 14, 2003 12:19 PM, sowmya.k [SMTP:sowmi99 at yahoo.com]
> wrote:
>> I had connected 2 systems using null modem
>> cable(RS232).
>> My problem comes in the reading part.
>> My coding goes this way.
>>    First I had opened my tty (i.e my terminal screen
>> and keyboard)
>>    Then I set some parameters to it.
>>    Third I opened my port and finished all my
>> settings.
>>    Fourth I started to write and read datas from the
>> port.
>>    Atlast I closed everything.
>>  Let me give the code I used to read and write
>>
>>
>> To write datas to the port
>>
>>      while (STOP==FALSE)   //STOP is defined to be
>> TRUE
>>       {
>>          status = fread(&Key,1,1,input);
>>          if (status==1)  //if a key was hit
>>          {
>>              fputc((int) Key,output);
>>              write(fd,&Key,1);          //write 1 byte
>> to the port
>>            }
>>        }
>>
>>
>>
>> To read from the port
>>
>>          if (wait_flag==FALSE)  //if input is
>> available
>>          {
>>             res = read(fd,buf,255);
>>             if (res)
>>             {
>>                for (i=0; i<res; i++)  //for all chars
>> in string
>>                {
>>                   In1 = buf[i];
>>                   printf(message,"%c ",In1);
>>                         fputs(message,output);
>>                       }
>>                    }
>>             wait_flag = TRUE;      /* wait for new
>> input */
>>          }  //end if wait flag == FALSE
>>
>>       }  //while stop==FALSE
>>
>>
>> Thanking you
>>
>> sowmya
>>
> So... what is the problem that you are getting?
>
>
>
>
>> __________________________________
>> Do you Yahoo!?
>> The New Yahoo! Shopping - with improved product search
>> http://shopping.yahoo.com
>> _______________________________________________
>> This is the Linux C Programming List
>> :  http://lists.linux.org.au/listinfo/linuxcprogramming List
> _______________________________________________
> This is the Linux C Programming List
> :  http://lists.linux.org.au/listinfo/linuxcprogramming List
>



More information about the linuxCprogramming mailing list