[PATCH 1/2] osmocon.c: Fix serial_set_baudrate function

Daniel Willmann daniel at totalueberwachung.de
Mon May 17 01:37:02 CEST 2010


We have to call tcgetattr prior to changing the baudrate and writing the
struct again.
---
 src/host/osmocon/osmocon.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/host/osmocon/osmocon.c b/src/host/osmocon/osmocon.c
index b823b5b..df242b1 100644
--- a/src/host/osmocon/osmocon.c
+++ b/src/host/osmocon/osmocon.c
@@ -230,6 +230,11 @@ static int serial_set_baudrate(speed_t baudrate)
 	int rc;
 	struct termios tio;
 
+	rc = tcgetattr(dnload.serial_fd.fd, &tio);
+	if (rc < 0) {
+		perror("tcgetattr()");
+		return rc;
+	}
 	cfsetispeed(&tio, baudrate);
 	cfsetospeed(&tio, baudrate);
 
-- 
1.7.0.4




More information about the baseband-devel mailing list