summaryrefslogtreecommitdiff
path: root/misc/temper/temper-1.0.diff
diff options
context:
space:
mode:
Diffstat (limited to 'misc/temper/temper-1.0.diff')
-rw-r--r--misc/temper/temper-1.0.diff70
1 files changed, 70 insertions, 0 deletions
diff --git a/misc/temper/temper-1.0.diff b/misc/temper/temper-1.0.diff
new file mode 100644
index 0000000000..4f9943aad0
--- /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