aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorTed Hess <thess@kitschensync.net>2015-08-02 20:08:34 -0400
committerTed Hess <thess@kitschensync.net>2015-08-17 11:10:35 -0400
commit44aa70d796f42f0c2bdf24ca18c95db55bc28de7 (patch)
treefde578c97fe0f83e953749af7ec57cba195cb967 /utils
parent1df699db402b77f78f9ea9ec67d689efabe41a38 (diff)
crelay: import usb relay control daemon
Signed-off-by: Ted Hess <thess@kitschensync.net>
Diffstat (limited to 'utils')
-rw-r--r--utils/crelay/Makefile70
-rw-r--r--utils/crelay/files/crelay.init24
-rw-r--r--utils/crelay/patches/010-link_with_ftdi1.patch11
3 files changed, 105 insertions, 0 deletions
diff --git a/utils/crelay/Makefile b/utils/crelay/Makefile
new file mode 100644
index 000000000..59c763f9a
--- /dev/null
+++ b/utils/crelay/Makefile
@@ -0,0 +1,70 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=crelay
+PKG_VERSION:=0.8-081415
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/ondrej1024/crelay
+PKG_SOURCE_VERSION:=037360cf143d705ea97b32ae22460f346ad2586f
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+
+PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>
+PKG_LICENSE:=GPL-2.0
+PKG_LICENSE_FILES:=LICENSE
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/crelay
+ SECTION:=utils
+ CATEGORY:=Utilities
+ TITLE:=USB relay remote control daemon
+ URL:=http://github.com/ondrej1024/crelay
+ DEPENDS:=+libftdi1 +hidapi +libusb-1.0
+endef
+
+define Package/crelay/description
+ crelay is used to control different relay cards in a unified manner. It provides
+ several interfaces for controlling the relays locally or remotely by a web browser
+ or a smartphone. The card which is detected first will be used. A WebUI control is
+ availble on port 8000 (default)
+ .
+ Currently supported relay cards:
+ - Conrad USB 4-channel relay card
+ - Sainsmart USB 4-channel relay card
+ - Generic GPIO relays
+ - HID API compatible relay card
+endef
+
+define Build/Configure
+endef
+
+TARGET_CFLAGS+= \
+ -D_GNU_SOURCE \
+ -I$(STAGING_DIR)/usr/include/libftdi1 \
+ -I$(STAGING_DIR)/usr/include/hidapi
+
+
+define Build/Compile
+ $(MAKE) -C $(PKG_BUILD_DIR)/src \
+ CC="$(TARGET_CC)" \
+ CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
+ LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)"
+endef
+
+define Package/crelay/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/crelay $(1)/usr/bin/
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_BIN) ./files/crelay.init $(1)/etc/init.d/crelay
+endef
+
+$(eval $(call BuildPackage,crelay))
diff --git a/utils/crelay/files/crelay.init b/utils/crelay/files/crelay.init
new file mode 100644
index 000000000..2f4647500
--- /dev/null
+++ b/utils/crelay/files/crelay.init
@@ -0,0 +1,24 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2015 OpenWrt.org
+
+NAME=crelay
+START=93
+
+PROG=/usr/bin/${NAME}
+
+USE_PROCD=1
+
+# Custom relay labels (for Web GUI)
+LABEL1=""
+LABEL2=""
+LABEL3=""
+LABEL4=""
+
+start_service() {
+ procd_open_instance
+
+ procd_set_param command "$PROG"
+ procd_append_param command -d "$LABEL1 $LABEL2 $LABEL3 $LABEL4"
+
+ procd_close_instance
+}
diff --git a/utils/crelay/patches/010-link_with_ftdi1.patch b/utils/crelay/patches/010-link_with_ftdi1.patch
new file mode 100644
index 000000000..756d45a9c
--- /dev/null
+++ b/utils/crelay/patches/010-link_with_ftdi1.patch
@@ -0,0 +1,11 @@
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -44,7 +44,7 @@ endif
+ #ifdef DRV_SAINSMART
+ ifeq ($(DRV_SAINSMART), y)
+ SRC += relay_drv_sainsmart.c
+-LIBS += -lftdi
++LIBS += -lftdi1
+ OPTS += -DDRV_SAINSMART
+ endif
+ #ifdef DRV_HIDAPI