forked from hefloryd/dterm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
speeds.sh
30 lines (28 loc) · 1.23 KB
/
speeds.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
#
# This file attempts to list all likely baud rates, and generates a header
# file containing them, along with conditionals to only include rates that
# are supported on the target system.
#
# Currently, this list is a merging of the speeds found the headr files
# Linux (kernel 4.11) and FreeBSD 11.0-RELEASE. (FreeBSD includes oddballs
# like 7200, 14400, 28800 & 76800, while lacking many of the higher speeds
# 500000, 576000, and everything from 1000000 upwards that are included in
# the Linux headers.)
#
# The dterm command "speeds" will list the available speeds, i.e. the
# intersection of the set of speeds found in this file and those listed
# in the system header files. Note that this list is not the list of
# speeds supported by the actual hardware.
#
echo "/* Terminal speeds, generated by speeds.sh */"
echo "static struct { int s, c; } speeds[] = {"
for speed in 50 75 110 134 150 200 300 600 1200 1800 2400 4800 7200 9600 \
14400 19200 28800 38400 57600 76800 115200 230400 460800 500000 576000 \
921600 1000000 1152000 1500000 2000000 2500000 3000000 3500000 4000000
do echo "#ifdef B$speed"
printf "\t { %8s, B%-8s },\n" $speed $speed
echo "#endif /* B$speed */"
done
echo " { 0, 0 }};"
echo "/* EOF */"