summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--switchctl.c2
-rw-r--r--utils.c6
-rw-r--r--utils.h3
3 files changed, 6 insertions, 5 deletions
diff --git a/switchctl.c b/switchctl.c
index 3a259fc..9650674 100644
--- a/switchctl.c
+++ b/switchctl.c
@@ -532,7 +532,7 @@ int main(int argc, char* argv[])
if(switch_fd < 0)
ret = 2;
else {
- ret = setup_tty(switch_fd);
+ ret = setup_tty(switch_fd, B9600);
if(ret)
ret = 2;
else
diff --git a/utils.c b/utils.c
index 14d4670..6e786cf 100644
--- a/utils.c
+++ b/utils.c
@@ -117,7 +117,7 @@ int nonblock_recvline(read_buffer_t* buffer, int fd, cmd_t** cmd_q, client_t* cl
return ret;
}
-int setup_tty(int fd)
+int setup_tty(int fd, speed_t speed)
{
struct termios tmio;
@@ -127,13 +127,13 @@ int setup_tty(int fd)
return ret;
}
- ret = cfsetospeed(&tmio, B9600);
+ ret = cfsetospeed(&tmio, speed);
if(ret) {
log_printf(ERROR, "Error on cfsetospeed(): %s", strerror(errno));
return ret;
}
- ret = cfsetispeed(&tmio, B9600);
+ ret = cfsetispeed(&tmio, speed);
if(ret) {
log_printf(ERROR, "Error on cfsetispeed(): %s", strerror(errno));
return ret;
diff --git a/utils.h b/utils.h
index e34fc88..806a4d4 100644
--- a/utils.h
+++ b/utils.h
@@ -23,10 +23,11 @@
#define _UTILS_H_
#include "options.h"
+#include <termios.h>
int init_command_socket(const char* path);
int send_string(int fd, const char* string);
int nonblock_recvline(read_buffer_t* buffer, int fd, cmd_t** cmd_q, client_t* client_lst, options_t* opt);
-int setup_tty(int fd);
+int setup_tty(int fd, speed_t speed);
#endif