diff options
author | Pierre Cazenave <pwcazenave at gmail {dot} com> | 2011-03-06 01:45:25 +0000 |
---|---|---|
committer | Robby Workman <rworkman@slackbuilds.org> | 2011-03-08 12:14:31 -0600 |
commit | 1cc202a987642d414f84a6dab763225060714c1f (patch) | |
tree | 7270dce8d56860f0b73159de7f1ca8d5ecbc8f62 /misc | |
parent | e7d570026f80a9ccdb1149bfbc5c5089010e2ad1 (diff) |
misc/temper: Added. A USB Temperature Sensor Linux Driver.
Signed-off-by: Michiel van Wessem <michiel@slackbuilds.org>
Diffstat (limited to 'misc')
-rw-r--r-- | misc/temper/README | 10 | ||||
-rw-r--r-- | misc/temper/slack-desc | 19 | ||||
-rw-r--r-- | misc/temper/temper-1.0.diff | 70 | ||||
-rw-r--r-- | misc/temper/temper.SlackBuild | 95 | ||||
-rw-r--r-- | misc/temper/temper.info | 10 |
5 files changed, 204 insertions, 0 deletions
diff --git a/misc/temper/README b/misc/temper/README new file mode 100644 index 0000000000000..fe02e73bd3c72 --- /dev/null +++ b/misc/temper/README @@ -0,0 +1,10 @@ +TEMPer Temperature Sensor Linux Driver + +TEMPer USB Thermometer interface driver and utility. + +The temper binary outputs temperatures as measured by the USB thermometer. + +The code has been patched to work with the newest versions of the USB stick +with code corrections from the comments section of the homepage. Also +implemented changes for greater ease of parsing with standard tools (awk +etc.). diff --git a/misc/temper/slack-desc b/misc/temper/slack-desc new file mode 100644 index 0000000000000..cdafa35337cb7 --- /dev/null +++ b/misc/temper/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' on +# the right side marks the last column you can put a character in. You must make +# exactly 11 lines for the formatting to be correct. It's also customary to +# leave one space after the ':'. + + |-----handy-ruler--------------------------------------------------| +temper: TEMPer Temperature Sensor Linux Driver +temper: +temper: Driver and utility to output temperature readings from the TEMPer +temper: USB thermometer. This is for the HID version of TEMPer (not the +temper: serial version). +temper: +temper: +temper: +temper: +temper: +temper: diff --git a/misc/temper/temper-1.0.diff b/misc/temper/temper-1.0.diff new file mode 100644 index 0000000000000..4f9943aad09a6 --- /dev/null +++ b/misc/temper/temper-1.0.diff @@ -0,0 +1,70 @@ +--- temper-1.0/temper.c 2009-10-17 08:26:46.000000000 +0100 ++++ temper-1.0.new/temper.c 2011-02-06 16:49:24.511084503 +0000 +@@ -49,7 +49,7 @@ + + t = calloc(1, sizeof(*t)); + t->device = dev; +- t->debug = debug; ++ t->debug = 0; + t->timeout = timeout; + t->handle = usb_open(t->device); + if(!t->handle) { +@@ -190,7 +190,7 @@ + int + TemperGetTemperatureInC(Temper *t, float *tempC) + { +- char buf[256]; ++ unsigned char buf[256]; + int ret, temperature, i; + + TemperSendCommand(t, 10, 11, 12, 13, 0, 0, 2, 0); +@@ -204,9 +204,7 @@ + return -1; + } + +- temperature = (buf[1] & 0xFF) + (buf[0] << 8); +- temperature += 1152; // calibration value +- *tempC = temperature * (125.0 / 32000.0); ++ *tempC=buf[0]+((float)buf[1])/256; + return 0; + } + +@@ -253,29 +251,15 @@ + TemperSendCommand(t, 0, 0, 0, 0, 0, 0, 0, 0); + */ + +- bzero(buf, 256); +- ret = TemperGetOtherStuff(t, buf, 256); +- printf("Other Stuff (%d bytes):\n", ret); +- for(i = 0; i < ret; i++) { +- printf(" %02x", buf[i] & 0xFF); +- if(i % 16 == 15) { +- printf("\n"); +- } +- } +- printf("\n"); +- +- for(;;) { +- float tempc; +- +- if(TemperGetTemperatureInC(t, &tempc) < 0) { +- perror("TemperGetTemperatureInC"); +- exit(1); +- } +- printf("temperature %.2fF %.2fC\n", (9.0 / 5.0 * tempc + 32.0), +- tempc); +- sleep(10); +- } +- return 0; ++ float tempc; ++ ++ if(TemperGetTemperatureInC(t, &tempc) < 0) { ++ perror("TemperGetTemperatureInC"); ++ exit(1); ++ } ++ printf("temperature %.2fF %.2fC\n", (9.0 / 5.0 * tempc + 32.0), ++ tempc); ++ fflush(stdout); /* flush the stdout buffer */ + } + + #endif diff --git a/misc/temper/temper.SlackBuild b/misc/temper/temper.SlackBuild new file mode 100644 index 0000000000000..05f20c05548a7 --- /dev/null +++ b/misc/temper/temper.SlackBuild @@ -0,0 +1,95 @@ +#!/bin/sh + +# Slackware build script for temper. +# +# Copyright 2011 Pierre Cazenave <pwcazenave {at} gmail [dot] com> +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=temper +VERSION=${VERSION:-1.0} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i486 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tgz +cd $PRGNAM-$VERSION +chown -R root:root . +chmod -R u+w,go+r-w,a-s . + +# Patch code for newer versions of the USB thermometer with suggestions from +# homepage's comments. Patch also turns off debugging mode. +patch -p1 < $CWD/$PRGNAM-$VERSION.diff + +export CFLAGS="$SLKCFLAGS" +make clean +make + +mkdir -p $PKG/usr/bin +install -m 0755 temper $PKG/usr/bin + +find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +# Install the udev rule file. +mkdir -p $PKG/lib/udev/rules.d +install -m 644 99-tempsensor.rules $PKG/lib/udev/rules.d + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild +cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README$TAG + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/misc/temper/temper.info b/misc/temper/temper.info new file mode 100644 index 0000000000000..bbd31a29337e7 --- /dev/null +++ b/misc/temper/temper.info @@ -0,0 +1,10 @@ +PRGNAM="temper" +VERSION="1.0" +HOMEPAGE="http://relavak.wordpress.com/2009/10/17/temper-temperature-sensor-linux-driver/" +DOWNLOAD="http://www.relavak.com/downloads/temper-1.0.tgz" +MD5SUM="aab4888f351e110e252335ab5dc143f4" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +MAINTAINER="Pierre Cazenave" +EMAIL="pwcazenave <at> gmail {dot} com" +APPROVED="Michiel van Wessem" |