diff options
-rw-r--r-- | package/alix-temperature/Makefile | 28 | ||||
-rw-r--r-- | package/alix-temperature/files/alix-temperature | 43 |
2 files changed, 71 insertions, 0 deletions
diff --git a/package/alix-temperature/Makefile b/package/alix-temperature/Makefile new file mode 100644 index 000000000..7fb906635 --- /dev/null +++ b/package/alix-temperature/Makefile @@ -0,0 +1,28 @@ +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +include $(TOPDIR)/rules.mk + +PKG_NAME:= alix-temperature +PKG_VERSION:= 1.0 +PKG_RELEASE:= 1 +PKG_DESCR:= read alix boards i2c thermal sensor +PKG_SECTION:= utils +PKG_DEPENDS:= i2c-tools + +PKG_CFLINE_ALIX_TEMPERATURE:=depends on (ADK_TARGET_SYSTEM_PCENGINES_ALIX2D2 || ADK_TARGET_SYSTEM_PCENGINES_ALIX2D13) +NO_DISTFILES:= 1 + +include $(TOPDIR)/mk/package.mk + +$(eval $(call PKG_template,ALIX_TEMPERATURE,alix-temperature,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) + +CONFIG_STYLE:= manual +BUILD_STYLE:= manual +INSTALL_STYLE:= manual + +alix-temperature-install: + $(INSTALL_DIR) $(IDIR_ALIX_TEMPERATURE)/usr/sbin + $(INSTALL_BIN) ./files/alix-temperature $(IDIR_ALIX_TEMPERATURE)/usr/sbin + +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/alix-temperature/files/alix-temperature b/package/alix-temperature/files/alix-temperature new file mode 100644 index 000000000..cdcf5c1fe --- /dev/null +++ b/package/alix-temperature/files/alix-temperature @@ -0,0 +1,43 @@ +#!/bin/sh +# temperature.sh +# this tool reads the lm86 from pcengines alix mainboards. +# http://pcengines.ch/alix.htm +# tested only on alix2d13 but should work on the other +# alix2dxx and alix3dxx boards too. +# +# Copyright (C) 2011 Tobias Breckle <tobias.breckle@stz-bt.de> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +CMD="i2cget -y 0 0x4c" + +TEMP_LOCAL=`$CMD 0x00` +TEMP_REMOTE_HIGH=`$CMD 0x01` +TEMP_REMOTE_LOW=`$CMD 0x10` + +let "TEMP_REMOTE_LOW >>= 5" +let "TEMP_REMOTE_LOW = TEMP_REMOTE_LOW * 125" + +if [ "$1" = "local" ] +then + printf "Local:\t%d\n" $TEMP_LOCAL +elif [ "$1" = "remote" ] +then + printf "Remote:\t%d,%d\n" $TEMP_REMOTE_HIGH $TEMP_REMOTE_LOW +elif [ -z "$1" ] +then + printf "Local:\t%d\n" $TEMP_LOCAL + printf "Remote:\t%d,%d\n" $TEMP_REMOTE_HIGH $TEMP_REMOTE_LOW +fi + |