Commit 405eeb63370a6f76c7709cc08c9ce84b8164519e

Con Kolivas 2012-06-25T23:06:57

Merge pull request #236 from kanoi/master fpgautils.c - set BAUD rate according to termio spec

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/fpgautils.c b/fpgautils.c
index 59eb7bc..6211bbc 100644
--- a/fpgautils.c
+++ b/fpgautils.c
@@ -186,8 +186,14 @@ serial_open(const char*devpath, unsigned long baud, signed short timeout, bool p
 	tcgetattr(fdDev, &my_termios);
 
 	switch (baud) {
-	case 0: break;
-	case 115200: my_termios.c_cflag = B115200; break;
+	case 0:
+		break;
+	case 115200:
+		my_termios.c_cflag &= ~CBAUD;
+		my_termios.c_cflag |= B115200;
+		break;
+	// TODO: try some higher speeds with the Icarus and BFL to see
+	// if they support them and if setting them makes any difference
 	default:
 		applog(LOG_WARNING, "Unrecognized baud rate: %lu", baud);
 	}