Skip to content
This repository was archived by the owner on Nov 26, 2025. It is now read-only.

Commit 3c6738e

Browse files
Vrongdcyoung
authored andcommitted
Fixed badly set bitrate causing sweep object creation to hang on Linux (#117)
* Fixed badly set bitrate causing sweep object creation to hang on Linux * Removed redundant condition in get_baud
1 parent 0a326fa commit 3c6738e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

libsweep/src/unix/serial.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ static speed_t get_baud(int32_t bitrate) {
2626
throw error{"Only baud rate 115200 is supported at this time."};
2727
return -1;
2828
}
29+
30+
// translate human readable bitrate to termios bitrate
31+
#ifdef B115200
32+
return B115200;
33+
#endif
2934
return bitrate;
3035
}
3136

@@ -148,7 +153,7 @@ void device_read(device_s serial, void* to, int32_t len) {
148153
} else {
149154
throw error{"reading from serial device failed"};
150155
}
151-
} else if(ret == 0){
156+
} else if (ret == 0) {
152157
throw error{"encountered EOF on serial device"};
153158
} else {
154159
bytes_read += ret;

0 commit comments

Comments
 (0)