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.
I tried it using a MOXA Uport 1150 (that's actually a USB-to-serial converter) and the standard serial port of an Intel motherboard. I don't know the exact kind of the latter, setserial just reports it as 16550A.
See Question&Answers more detail:os