[package] add fancontroled
authorFlorian Fainelli <florian@openwrt.org>
Sun, 21 Nov 2010 22:01:24 +0000 (22:01 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Sun, 21 Nov 2010 22:01:24 +0000 (22:01 +0000)
Add fancontroled (fancontrol for embedded devices) package. fancontroled
is linux daemon written in C implementing a temperature dependent fan
speed control. fancontroled provides similar functionalities like
fancontrol script from lm-sensors; but fancontroled does not need bash
or other dependencies (except lm-sensors library). That makes it
suitable for embedded devices.

More info here:
http://fancontroled.lukaperkov.net/

fancontroled.init file contains parameters for D-Link DNS323 device.

Signed-off-by: Luka Perkov <openwrt@lukaperkov.net>
SVN-Revision: 24070

utils/fancontroled/Makefile [new file with mode: 0644]
utils/fancontroled/files/fancontroled.init [new file with mode: 0644]

diff --git a/utils/fancontroled/Makefile b/utils/fancontroled/Makefile
new file mode 100644 (file)
index 0000000..43e3b2e
--- /dev/null
@@ -0,0 +1,54 @@
+#
+# Copyright (C) 2010 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v3.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=fancontroled
+PKG_VERSION:=0.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar
+PKG_SOURCE_URL:=http://code.lukaperkov.net/fancontroled/
+PKG_MD5SUM:=8c3a7efa99e58216ad4633d1e6ed1358
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/fancontroled
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=fancontroled
+  DEPENDS:=+libsensors
+  URL:=http://fancontroled.lukaperkov.net/
+endef
+
+define Package/fancontroled/description
+       fancontroled is linux daemon written in C implementing a temperature dependent fan speed control.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+       $(TARGET_CONFIGURE_OPTS) \
+       CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CPPFLAGS)" \
+       LDFLAGS="$(TARGET_LDFLAGS)" \
+       INC_PATH="-I$(STAGING_DIR)/usr/include/ -I$(STAGING_DIR)/usr/lib/"
+
+       $(STRIP) $(PKG_BUILD_DIR)/$(PKG_NAME)
+
+       mkdir -p $(PKG_INSTALL_DIR)/usr/sbin
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+       DESTDIR="$(PKG_INSTALL_DIR)" \
+       install
+endef
+
+define Package/fancontroled/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/$(PKG_NAME) $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/fancontroled.init $(1)/etc/init.d/fancontroled
+endef
+
+$(eval $(call BuildPackage,fancontroled))
diff --git a/utils/fancontroled/files/fancontroled.init b/utils/fancontroled/files/fancontroled.init
new file mode 100644 (file)
index 0000000..2ec5e87
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh /etc/rc.common
+
+START=75
+STOP=75
+
+TEMP_SENSOR_CHIP=lm75
+TEMP_READ_FIELD=temp1_input
+MIN_TEMP=30
+MAX_TEMP=50
+FAN_SENSOR_CHIP=g760a
+FAN_CONTROL_FIELD=pwm1
+PWM_FAN_MIN=1
+PWM_FAN_MAX=180
+PID_FILENAME=/var/run/fancontroled.pid
+
+start() {
+       /usr/sbin/fancontroled -t $TEMP_SENSOR_CHIP -r $TEMP_READ_FIELD -m $MIN_TEMP -M $MAX_TEMP -f $FAN_SENSOR_CHIP -c $FAN_CONTROL_FIELD -p $PWM_FAN_MIN -P $PWM_FAN_MAX -z $PID_FILENAME
+}
+
+stop() {
+       kill $(cat $PID_FILENAME)
+}