diff options
-rw-r--r-- | openwrt/rhctl/Makefile | 2 | ||||
-rw-r--r-- | openwrt/rhctl/files/rhctl.config | 7 | ||||
-rw-r--r-- | options.c | 3 | ||||
-rw-r--r-- | serialclient.c | 3 | ||||
-rw-r--r-- | utils.c | 17 |
5 files changed, 25 insertions, 7 deletions
diff --git a/openwrt/rhctl/Makefile b/openwrt/rhctl/Makefile index 84fc2e3..cc2acac 100644 --- a/openwrt/rhctl/Makefile +++ b/openwrt/rhctl/Makefile @@ -18,7 +18,7 @@ PKG_RELEASE:=1 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://localhost/ -PKG_MD5SUM:=646e9d1439cc9c23d3cb64773b34c513 +PKG_MD5SUM:=d406052350d01799bcf69ea2c575a436 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install diff --git a/openwrt/rhctl/files/rhctl.config b/openwrt/rhctl/files/rhctl.config index 3b4874e..7d14e51 100644 --- a/openwrt/rhctl/files/rhctl.config +++ b/openwrt/rhctl/files/rhctl.config @@ -1,4 +1,5 @@ config 'switchctl' + option log 'syslog:5,switchctl,daemon' option command_sock '/var/run/rhctl/switchctl.sock' option baudrate '19200' option device '/dev/audioswitch' @@ -9,7 +10,7 @@ config 'switchctl' config 'serialclient' # option disabled 1 option name 'master' - option log 'syslog:3,serialclient-master,daemon' + option log 'syslog:5,serialclient-master,daemon' option command_sock '/var/run/rhctl/switchctl.sock' option baudrate '38400' option device '/dev/ttyMaster' @@ -18,13 +19,15 @@ config 'serialclient' config 'serialclient' # option disabled 1 option name 'standby' - option log 'syslog:3,serialclient-standby,daemon' + option log 'syslog:5,serialclient-standby,daemon' option command_sock '/var/run/rhctl/switchctl.sock' option baudrate '38400' option device '/dev/ttyStandby' option type 'standby' config 'heartbeatclient' + option log 'syslog:5,heartbeatclient,daemon' option command_sock '/var/run/rhctl/switchctl.sock' option baudrate '38400' option device '/dev/ttyHeartbeat' + @@ -1,3 +1,4 @@ + /* * rhctl * @@ -458,6 +459,6 @@ void options_print(options_t* opt) #ifdef OPT_HEARTBEATCLIENT printf("serial_dev: '%s'\n", opt->serial_dev_); - printf("timeout: %d\m", opt->timeout_); + printf("timeout: %d\n", opt->timeout_); #endif } diff --git a/serialclient.c b/serialclient.c index 87e9428..f81c7cb 100644 --- a/serialclient.c +++ b/serialclient.c @@ -63,9 +63,10 @@ int process_data(int src_fd, int dest_fd) } offset += ret; - if(offset+1 >= len) + if(offset >= len) break; } + log_printf(DEBUG, "wrote %d bytes to fd (%d)", offset, dest_fd); return 0; } @@ -150,6 +150,21 @@ int setup_tty(int fd, speed_t speed) return ret; } +// tmio.c_iflag |= ; + tmio.c_iflag &= ~(INLCR | ICRNL | IGNCR | IXON | IXOFF); + +// tmio.c_oflag |= ; + tmio.c_oflag &= ~(ONLCR | OCRNL | ONOCR | ONLRET); + + tmio.c_cflag |= CS8 | CLOCAL | CREAD; + tmio.c_cflag &= ~(CSTOPB | PARENB); + +// tmio.c_lflag |= ; + tmio.c_lflag &= ~(ICANON | ECHO); + + tmio.c_cc[VTIME] = 0; + tmio.c_cc[VMIN] = 1; + ret = cfsetospeed(&tmio, speed); if(ret) { log_printf(ERROR, "Error on cfsetospeed(): %s", strerror(errno)); @@ -162,8 +177,6 @@ int setup_tty(int fd, speed_t speed) return ret; } - tmio.c_lflag &= ~ECHO; - ret = tcsetattr(fd, TCSANOW, &tmio); if(ret) { log_printf(ERROR, "Error on tcsetattr(): %s", strerror(errno)); |