How to set baud rate to 307200 on Linux?

Posted by cairol on Stack Overflow See other posts from Stack Overflow or by cairol
Published on 2011-02-11T11:36:56Z Indexed on 2011/02/11 15:25 UTC
Read the original article Hit count: 159

Filed under:
|
|
|
|

Basically I'm using the following code to set the baud rate of a serial port:

struct termios options;
tcgetattr(fd, &options);
cfsetispeed(&options, B115200);
cfsetospeed(&options, B115200);
tcsetattr(fd, TCSANOW, &options);

This works very well. But know I have to communicate with a device that uses a baud rate of 307200. How can I set that? cfsetispeed(&options, B307200); doesn't work, there is no B307200 defined.

© Stack Overflow or respective owner

Related posts about c++

Related posts about c