[Cryptech-Commits] [sw/libhal] 03/05: Fix speed setting?

git at cryptech.is git at cryptech.is
Wed Jul 6 23:02:01 UTC 2016


This is an automated email from the git hooks/post-receive script.

paul at psgd.org pushed a commit to branch master
in repository sw/libhal.

commit ff928e437962a80a7f5033673cfc9f9ec019fdf8
Author: Paul Selkirk <paul at psgd.org>
AuthorDate: Wed Jul 6 14:29:54 2016 -0400

    Fix speed setting?
---
 rpc_serial.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/rpc_serial.c b/rpc_serial.c
index 5dc659e..17addee 100644
--- a/rpc_serial.c
+++ b/rpc_serial.c
@@ -64,7 +64,6 @@ static int fd = -1;
 hal_error_t hal_serial_init(const char * const device, const uint32_t speed)
 {
     struct termios tty;
-    speed_t termios_speed;
 
     fd = open(device, O_RDWR | O_NOCTTY | O_SYNC);
     if (fd == -1) {
@@ -76,6 +75,7 @@ hal_error_t hal_serial_init(const char * const device, const uint32_t speed)
 	return perror("tcgetattr"), HAL_ERROR_RPC_TRANSPORT;
 
 #if !HAL_RPC_SERIAL_USE_MACOSX_IOCTL
+    speed_t termios_speed;
 
     switch (speed) {
     case 115200:
@@ -89,8 +89,8 @@ hal_error_t hal_serial_init(const char * const device, const uint32_t speed)
 	return HAL_ERROR_RPC_TRANSPORT;
     }
 
-    cfsetospeed (&tty, speed);
-    cfsetispeed (&tty, speed);
+    cfsetospeed (&tty, termios_speed);
+    cfsetispeed (&tty, termios_speed);
 
 #endif
 



More information about the Commits mailing list