serial: using smart link

This commit is contained in:
fengzero
2023-07-07 09:13:01 +00:00
parent 10a4521a99
commit e88894e34d
2 changed files with 9 additions and 4 deletions
+6 -3
View File
@@ -854,15 +854,18 @@ static void conn_connect(neu_conn_t *conn)
break;
}
case NEU_CONN_TTY_CLIENT: {
struct termios tty_opt = { 0 };
#ifdef NEU_SMART_LINK
#include "connection/neu_smart_link.h"
int ret =
neu_conn_smart_link_auto_set(conn->param.params.tty_client.device);
zlog_notice(conn->param.log, "smart link ret: %d", ret);
#endif
struct termios tty_opt = { 0 };
if (ret > 0) {
fd = ret;
}
#else
fd = open(conn->param.params.tty_client.device, O_RDWR | O_NOCTTY, 0);
#endif
if (fd <= 0) {
zlog_error(conn->param.log, "open %s error: %s(%d)",
conn->param.params.tty_client.device, strerror(errno),
+3 -1
View File
@@ -230,7 +230,7 @@ static int set_serial_mode(const char *dev_path, int baudrate, int mode)
break;
}
if ((serial_fd = open(dev_path, O_RDWR | O_NOCTTY | O_NDELAY)) < 0) {
if ((serial_fd = open(dev_path, O_RDWR | O_NOCTTY)) < 0) {
fprintf(stderr, "open %s failed, fd: %d, strerr: %s\n", dev_path,
serial_fd, strerror(errno));
goto out;
@@ -276,7 +276,9 @@ static int set_serial_mode(const char *dev_path, int baudrate, int mode)
close(switch_fd);
out2:
close(serial_fd);
serial_fd = -1;
out:
pthread_mutex_unlock(&mode_switch_mtx);
ret = serial_fd;
return ret;
}