termios, ioctl problem
From: Carole MacDonald (elora_c_at_yahoo.com)
Date: 10/21/03
- Previous message: Bernd Strieder: "Re: Many linux processes and threads"
- Next in thread: Julián Albo: "Re: termios, ioctl problem"
- Reply: Julián Albo: "Re: termios, ioctl problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 21 Oct 2003 10:33:30 -0700
I have a C++ program that communicates with a device on a serial port
using /dev/ttyS0. When my program checks for data with ioctl() and
then do a read(), certain byte values are being dropped: 0x11 (start)
and 0x13 (stop). I can send these out from my program just fine, I
just can't read them in. I've looked at the termios structure and I'm
sure I'm setting a flag improperly, but I can't figure it out. Here's
what the stty -a output looks like:
speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase =
^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl
ixon -ixoff
-iuclc -ixany -imaxbel
-opost olcuc ocrnl onlcr onocr onlret ofill ofdel nl1 cr3 tab3 bs1 vt1
ff1
-isig -icanon iexten -echo -echoe echok echonl noflsh xcase tostop
echoprt
-echoctl echoke
and the code I'm using to set the settings on the port:
//set the options for the Port
fcntl(m_fd,F_SETFL,0);
tcgetattr(m_fd,&settings);
settings.c_lflag = ~(ICANON | ECHO | ECHOE | ISIG | ECHOCTL);
settings.c_oflag &= ~OPOST;
tcsetattr(m_fd,TCSANOW,&settings);
fcntl(m_fd,F_SETFL,FNDELAY);
If anyone can help me figure out the proper flags, I'd really
appreciate it.
Thanks,
Carole
- Previous message: Bernd Strieder: "Re: Many linux processes and threads"
- Next in thread: Julián Albo: "Re: termios, ioctl problem"
- Reply: Julián Albo: "Re: termios, ioctl problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|