aboutsummaryrefslogtreecommitdiff
path: root/rpc_serial.c
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2016-07-06 14:29:54 -0400
committerPaul Selkirk <paul@psgd.org>2016-07-06 14:29:54 -0400
commitff928e437962a80a7f5033673cfc9f9ec019fdf8 (patch)
treee353680079a5bff36f972db1fba1e2bbfe34e673 /rpc_serial.c
parentddb9f749f109f7e9488b3d16733e0bdd53cac47e (diff)
Fix speed setting?
Diffstat (limited to 'rpc_serial.c')
-rw-r--r--rpc_serial.c6
1 files 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