User avatar
peepo
Posts: 305
Joined: Sun Oct 21, 2012 9:36 am

disable XON XOFF termios howto?

Sat May 02, 2015 9:08 am

by default software flow control is enabled, how to disable?

minicom -b 9600 -o -D /dev/ttyAMA0 rtscts
wfm

but using termios this does not:

struct termios options;
tcgetattr(fd, &options);
options.c_iflag &= ~(IXON|IXOFF|IXANY);
cfsetispeed(&options, B9600);
cfsetospeed(&options, B9600);
tcsetattr(fd, TCSAFLUSH, &options);

I tried various combinations without success

thanks

Jonathan

User avatar
PeterO
Posts: 5005
Joined: Sun Jul 22, 2012 4:14 pm

Re: disable XON XOFF termios howto?

Sat May 02, 2015 9:25 am

Have you tried setting "raw mode" ?

This is the code I normally use to configure a dumb serial port...

Code: Select all

  serial_fd = open("/dev/ttyAMA0",O_RDWR);


  tcgetattr(serial_fd,&newtio);
  cfsetospeed(&newtio,B57600);
  newtio.c_cc[VMIN] = 0;
  newtio.c_cc[VTIME] = 0;
  cfmakeraw(&newtio);
  newtio.c_cflag &= ~CRTSCTS;
  tcsetattr(serial_fd,TCSANOW,&newtio);

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
peepo
Posts: 305
Joined: Sun Oct 21, 2012 9:36 am

Re: disable XON XOFF termios howto?

Sat May 02, 2015 11:33 am

how do I undo cfmakeraw?

seems far too strong** and did not achieve what was wanted:
ie equivalent to: minicom -b 9600 -o -D /dev/ttyAMA0 rtscts

cheers

~:"

**ie after reboot minicom is no longer typing characters...

User avatar
PeterO
Posts: 5005
Joined: Sun Jul 22, 2012 4:14 pm

Re: disable XON XOFF termios howto?

Sat May 02, 2015 12:58 pm

peepo wrote:how do I undo cfmakeraw?
There is nothing to "undo", termios settings only apply to the device while it is open.

seems far too strong** and did not achieve what was wanted:
ie equivalent to: minicom -b 9600 -o -D /dev/ttyAMA0 rtscts
As far as I can see "rtscts" is not a valid option to minicom so I don't know what you are trying to achieve. Plus PI doesn't have any hardware handshake lines anyway (AFAIK).
**ie after reboot minicom is no longer typing characters...
Where are you putting your code that changes the terminal settings ?
PerterO



man



cheers

~:"
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Return to “C/C++”