From 625a7e7563f23fbb97186fa059bab67de4847cdb Mon Sep 17 00:00:00 2001 From: Ted Hess Date: Sun, 17 Apr 2016 13:21:44 -0400 Subject: [PATCH] crelay: Update to 0.10, refresh patches, remove daemon background call Signed-off-by: Ted Hess --- utils/crelay/Makefile | 7 ++++--- utils/crelay/files/crelay.init | 3 +++ utils/crelay/patches/010-link_with_ftdi1.patch | 6 +++--- utils/crelay/patches/020-link_using_LDFLAGS.patch | 2 +- .../patches/030-remove_daemonize_call.patch | 15 +++++++++++++++ 5 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 utils/crelay/patches/030-remove_daemonize_call.patch diff --git a/utils/crelay/Makefile b/utils/crelay/Makefile index 6445f8d8cc..26c7afee9a 100644 --- a/utils/crelay/Makefile +++ b/utils/crelay/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2015 OpenWrt.org +# Copyright (C) 2015-2016 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=crelay -PKG_VERSION:=0.9 +PKG_VERSION:=0.10 PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git @@ -40,7 +40,8 @@ define Package/crelay/description . Currently supported relay cards: - Conrad USB 4-channel relay card - - Sainsmart USB 4-channel relay card + - Sainsmart USB 4/8-channel relay board + - Sainsmart USB 16-channel relay control module - Generic GPIO relays - HID API compatible relay card endef diff --git a/utils/crelay/files/crelay.init b/utils/crelay/files/crelay.init index e00396118e..53183a8cfe 100644 --- a/utils/crelay/files/crelay.init +++ b/utils/crelay/files/crelay.init @@ -13,6 +13,9 @@ USE_PROCD=1 start_service() { procd_open_instance + # restart if it croaks + procd_set_param respawn + procd_set_param command "$PROG" # daemon mode (not daemonized) - starts HTTP server procd_append_param command -d diff --git a/utils/crelay/patches/010-link_with_ftdi1.patch b/utils/crelay/patches/010-link_with_ftdi1.patch index bc4ff1ed32..26b4c97711 100644 --- a/utils/crelay/patches/010-link_with_ftdi1.patch +++ b/utils/crelay/patches/010-link_with_ftdi1.patch @@ -1,11 +1,11 @@ --- a/src/Makefile +++ b/src/Makefile -@@ -45,7 +45,7 @@ endif - #ifdef DRV_SAINSMART +@@ -44,7 +44,7 @@ OPTS += -DDRV_CONRAD + endif ifeq ($(DRV_SAINSMART), y) SRC += relay_drv_sainsmart.c -LIBS += -lftdi +LIBS += -lftdi1 OPTS += -DDRV_SAINSMART endif - #ifdef DRV_HIDAPI + ifeq ($(DRV_SAINSMART16), y) diff --git a/utils/crelay/patches/020-link_using_LDFLAGS.patch b/utils/crelay/patches/020-link_using_LDFLAGS.patch index 9154b08cb6..5b4a7a2e0c 100644 --- a/utils/crelay/patches/020-link_using_LDFLAGS.patch +++ b/utils/crelay/patches/020-link_using_LDFLAGS.patch @@ -1,6 +1,6 @@ --- a/src/Makefile +++ b/src/Makefile -@@ -61,7 +61,7 @@ all: $(BIN) +@@ -64,7 +64,7 @@ all: $(BIN) $(BIN): $(OBJ) @echo "[Link $(BIN)] with libs $(LIBS)" diff --git a/utils/crelay/patches/030-remove_daemonize_call.patch b/utils/crelay/patches/030-remove_daemonize_call.patch new file mode 100644 index 0000000000..9b2216e3ef --- /dev/null +++ b/utils/crelay/patches/030-remove_daemonize_call.patch @@ -0,0 +1,15 @@ +--- a/src/crelay.c ++++ b/src/crelay.c +@@ -678,10 +678,12 @@ int main(int argc, char *argv[]) + listen(sock, 5); + syslog(LOG_DAEMON | LOG_NOTICE, "HTTP server listening on %s:%d\n", inet_ntoa(iface), port); + ++#if 0 + if (daemon(0, 0) == -1) { + syslog(LOG_DAEMON | LOG_ERR, "Failed to daemonize: %s", strerror(errno)); + exit(EXIT_FAILURE); + } ++#endif + + while (1) + {