1 /* 2 * Copyright 2023, Haiku, inc. 3 * 4 * Distributed under the terms of the MIT License. 5 */ 6 7 8 #include <termios.h> 9 10 11 int 12 cfsetspeed(struct termios *termios, speed_t speed) 13 { 14 /* Custom speed values are stored in c_ispeed and c_ospeed. 15 * Standard values are inlined in c_cflag. */ 16 if (speed > B31250) { 17 termios->c_cflag |= CBAUD; 18 termios->c_ispeed = speed; 19 termios->c_ospeed = speed; 20 return 0; 21 } 22 23 termios->c_cflag &= ~CBAUD; 24 termios->c_cflag |= speed; 25 return 0; 26 } 27 28