wich condition(events) can produce EOF in serial port in blocked raw mode????
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > wich condition(events) can produce EOF in serial port in blocked raw mode????




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    wich condition(events) can produce EOF in serial port in blocked raw mode????  
cvv


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-09-05 12:49 PM

OS:linux 2.4.26

sometimes, possible after noise in line, I receive situation when
select() on port return then there are data available for read but
following read() return 0 bytes.

according to man tcsetattr and analogue with socket I understand this
situation as EOF.

All following pair select()/read() return same situation regardless
from data in port.

serial port open/tune via code:

<code>
port->fd =3D open(devfile, O_RDWR | O_NOCTTY);

if (port->fd =3D=3D -1) {syslog(LOG_ERR,"watcher_open_port():error
opening '%s': %m", devfile); free(port);return NULL; }


if (tcgetattr(port->fd, &ti) < 0)

{ syslog(LOG_ERR, "%s(%s):error getting terminal line modes:
%m",__func__, devfile); close(port->fd);free(port); return
NULL; }



cfmakeraw(&ti);

cfsetispeed(&ti, WATCHER_PORT_SPEED);

cfsetospeed(&ti, WATCHER_PORT_SPEED);



//c_iflag &=3D
 ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNC
R|ICRNL|IXON);

ti.c_iflag |=3D IGNBRK;//??? =D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=
BD=
=D0=BE =D0=B8=D0=BC=D0=B5=D0=B5=D1=82 =D1=81=D0=BC=D1=8B=D1=81=D0=BB
 =D0=BE=D1=81=D1=82=D0=B0=D0=B2=D0=B8=D1=
82=D1=8C =D1=8D=D1=82=D0=BE=D1=82 =
=D1=84=D0=BB=D0=B0=D0=B3 =D1=81=D0=BD=D1=8F=D1=82=D1=8B=D0=BC =D0=B0 =D0=B2=
=D0=BC=D0=B5=D1=81=D1=82=D0=BE
=D0=BD=D0=B5=D0=B3=D0=BE  =D0=BF=D0=BE=D0=B4=D0=BD=D1=8F=D1=82=D1=
8C BRKINT?=
??
ti.c_iflag |=3D IGNPAR;//Ignore framing errors and parity errors.

ti.c_iflag &=3D ~(INPCK | PARMRK);

ti.c_iflag &=3D ~(IXOFF | IXON | IXANY);    /* disable start/stop i/o
flow control*/


//c_oflag &=3D ~OPOST;



ti.c_cflag &=3D ~(PARENB | PARODD);  /* no parity */

ti.c_cflag &=3D ~CSTOPB;             /* 1 stop bit */

ti.c_cflag &=3D ~CRTSCTS;            /* no i/o rts/cts flow control
*/
ti.c_cflag |=3D CLOCAL;

ti.c_cflag |=3D HUPCL;

ti.c_cflag |=3D CREAD;



//c_lflag &=3D ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);

//Disable  flushing  the  input and output queues when
generating the SIGINT, SIGQUIT and SIGSUSP signals.
//ti.c_lflag &=3D ~(NOFLSH);//???=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=
=B6=D0=BD=D0=BE
 =D0=BF=D0=BE=D1=82=D1=80=D0=B5=D0=B1=D1=
83=D0=B5=D1=82=D1=81=D1=8F =D1=83=
 =D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=
B8=D1=82=D1=8C/=D1=81=D0=BD=D1=8F=
=D1=82=D1=8C???



ti.c_cc[VMIN] =3D 0;

ti.c_cc[VTIME] =3D 0;



if (tcsetattr(port->fd, TCSANOW, &ti) < 0)

{ syslog(LOG_ERR,"%s(%s):error setting terminal line modes: %m",
__func__,  devfile); close(port->fd);free(port); return
NULL; }
</code>

any idea???






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 03:35 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register