Skip to content

Commit 657c25f

Browse files
authored
Merge pull request #230 from Joe7M/master
Fix #228: Non-posix baud rates
2 parents 76175cb + 7c8d4cc commit 657c25f

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/common/fs_serial.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ long select_unix_serial_speed(long n) {
4242
return B19200;
4343
case 38400:
4444
return B38400;
45-
// extra baud rates (but not posix)
45+
#ifdef B4000000
46+
// extra baud rates are not POSIX standard
47+
// but supported by Linux and FreeBSD
4648
case 57600:
4749
return B57600;
4850
case 115200:
@@ -53,14 +55,10 @@ long select_unix_serial_speed(long n) {
5355
return B460800;
5456
case 500000:
5557
return B500000;
56-
case 576000:
57-
return B576000;
5858
case 921600:
5959
return B921600;
6060
case 1000000:
6161
return B1000000;
62-
case 1152000:
63-
return B1152000;
6462
case 1500000:
6563
return B1500000;
6664
case 2000000:
@@ -73,6 +71,15 @@ long select_unix_serial_speed(long n) {
7371
return B3500000;
7472
case 4000000:
7573
return B4000000;
74+
#endif
75+
#ifdef B576000
76+
// Following baud rates are supported in Linux but
77+
// not defined in FreeBSD
78+
case 576000:
79+
return B576000;
80+
case 1152000:
81+
return B1152000;
82+
#endif
7683
}
7784
return B9600;
7885
}

0 commit comments

Comments
 (0)