Basically I\'m using the following code to set the baud rate of a serial port:
struct termios options;
tcgetattr(fd, &options);
cfsetispeed(&options,
On many OSes, the enumerated values are numerically equal to the baud rate. So just skip the macro/enumeration and pass the baud rate you want, e.g.
cfsetispeed(&options, 307200);
Of course you should check the return code to make sure this trick actually worked, furthermore not all baud rates are supported by all UARTs.
You can also try setting the options in struct serial_struct using the TIOCGSERIAL and TIOCSSERIAL ioctl codes.