Added support for all 1-wire temperature sensors that are in the Linux kernel source.

Fri, 20 Mar 2015 16:56:07 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 20 Mar 2015 16:56:07 +0100
changeset 338
8e29d142d67d
parent 337
5d3670aafd1b
child 339
16203280eea2

Added support for all 1-wire temperature sensors that are in the Linux kernel source.

thermferm/devices.c file | annotate | diff | comparison | revisions
--- a/thermferm/devices.c	Thu Mar 19 20:32:23 2015 +0100
+++ b/thermferm/devices.c	Fri Mar 20 16:56:07 2015 +0100
@@ -292,6 +292,9 @@
 			if (strcmp(buf, (char *)"10") == 0) {
 			    ndev->direction = DEVDIR_IN_ANALOG;
 			    ndev->description = xstrcpy((char *)"DS18S20 Digital thermometer");
+			} else if (strcmp(buf, (char *)"22") == 0) {
+			    ndev->direction = DEVDIR_IN_ANALOG;
+			    ndev->description = xstrcpy((char *)"DS1820 Digital thermometer");
 			} else if (strcmp(buf, (char *)"28") == 0) {
 			    ndev->direction = DEVDIR_IN_ANALOG;
 			    ndev->description = xstrcpy((char *)"DS18B20 Digital thermometer");
@@ -299,6 +302,12 @@
 			    ndev->description = xstrcpy((char *)"DS2408 8 Channel addressable switch/LCD");
 			} else if (strcmp(buf, (char *)"3a") == 0) {
 			    ndev->description = xstrcpy((char *)"DS2413 Dual channel addressable switch");
+			} else if (strcmp(buf, (char *)"3b") == 0) {
+			    ndev->direction = DEVDIR_IN_ANALOG;
+			    ndev->description = xstrcpy((char *)"DS1825 Digital thermometer");
+			} else if (strcmp(buf, (char *)"42") == 0) {
+			    ndev->direction = DEVDIR_IN_ANALOG;
+			    ndev->description = xstrcpy((char *)"DS28EA00 Digital thermometer");
 			} else if (strcmp(buf, (char *)"w1") == 0) {
 			    ndev->description = xstrcpy((char *)"Master System device");
 			} else {
@@ -520,8 +529,15 @@
 
 	    switch (device->type) {
 		case DEVTYPE_W1:
-			if (strncmp(device->address, (char *)"28", 2) == 0) {
-			    /* Read DS18B20 sensor */
+			/*
+			 * Only tested with DS18B20 but from the kernel source this
+			 * should work with all 1-wire thermometer sensors.
+			 */
+			if ((strncmp(device->address, (char *)"10", 2) == 0) ||
+			    (strncmp(device->address, (char *)"22", 2) == 0) ||
+			    (strncmp(device->address, (char *)"28", 2) == 0) ||
+			    (strncmp(device->address, (char *)"3b", 2) == 0) ||
+			    (strncmp(device->address, (char *)"42", 2) == 0)) {
 			    addr = xstrcpy((char *)"/sys/bus/w1/devices/");
 			    addr = xstrcat(addr, device->address);
 			    addr = xstrcat(addr, (char *)"/w1_slave");

mercurial