A little problem of my serial port

Stan zylog at club-internet.fr
Mon Sep 6 09:14:26 UTC 2004


----- Original Message ----- 
From: "Yanjun Luo" <yjluo at panjet.net>
To: <rtems-users at rtems.com>
Sent: Monday, September 06, 2004 11:41 AM
Subject: A little problem of my serial port


> Hi,
> My serial port driver can read, write now,but I face another problem.
> when I connect one of my serial port(not dbgu) to my PC and running
> hyper terminer, I find that only when I press the Enter key then my
> board can get what I input before. But if I connect my board to another
> serial device, I'll not get Enter key(or "\n"), so how can I get every
char
> from serial port and don't need Enter key?
>
>
> Regards,
> Yanjun Luo.
>



You must modify termios params.
Here's a short example :


#include <termios.h>

struct termios Params;

   tcgetattr(STDIN_FILENO, &Params);
   Params.c_lflag &= ~(ICANON | ECHO);
   Params.c_cc[VMIN]=0;
   Params.c_cc[VTIME]=30;
   tcsetattr(STDIN_FILENO, TCSANOW, &Params);

In this cas, the function read return after 30*(1/10 second)  of time out.

If Params.c_cc[VMIN]=1 and Params.c_cc[VTIME]=0, the function read wait for
next character;


You can get other details with 'man termios' on Linux host.


        Stan .






More information about the users mailing list