diff options
Diffstat (limited to 'lib/tty.c')
-rw-r--r-- | lib/tty.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -61,6 +61,20 @@ int terminal_probesize(unsigned *xx, unsigned *yy) return 0; } +void xsetspeed(struct termios *tio, int speed) +{ + int i, speeds[] = {50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, + 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, + 500000, 576000, 921600, 1000000, 1152000, 1500000, 2000000, + 2500000, 3000000, 3500000, 4000000}; + + // Find speed in table, adjust to constant + for (i = 0; i < ARRAY_LEN(speeds); i++) if (speeds[i] == speed) break; + if (i == ARRAY_LEN(speeds)) error_exit("unknown speed: %d", speed); + cfsetspeed(tio, i+1+4081*(i>15)); +} + + // Reset terminal to known state, saving copy of old state if old != NULL. int set_terminal(int fd, int raw, int speed, struct termios *old) { |