Fixed LIST BUS output

Wed, 23 Jul 2014 17:07:29 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 23 Jul 2014 17:07:29 +0200
changeset 125
94aea38d4da5
parent 124
350401bac16e
child 126
480bbe88ce0e

Fixed LIST BUS output

thermferm/server.c file | annotate | diff | comparison | revisions
--- a/thermferm/server.c	Wed Jul 23 16:49:37 2014 +0200
+++ b/thermferm/server.c	Wed Jul 23 17:07:29 2014 +0200
@@ -235,25 +235,25 @@
 		    if (strncmp(de->d_name, (char *)"w1", 2) == 0) {
 			srv_send((char *)"%s,0,NA,System device", de->d_name);
 		    } else if (strncmp(de->d_name, (char *)"10", 2) == 0) {
-			if (Config.air_address && (strncmp((char *)"10", Config.air_address, 2) == 0))
+			if (Config.air_address && (strcmp(de->d_name, Config.air_address) == 0))
 			    ref++;
 			for (unit = Config.units; unit; unit = unit->next) {
-			    if (unit->air_address && (strncmp((char *)"10", unit->air_address, 2) == 0))
+			    if (unit->air_address && (strcmp(de->d_name, unit->air_address) == 0))
 				ref++;
-			    if (unit->beer_address && (strncmp((char *)"10", unit->beer_address, 2) == 0))
+			    if (unit->beer_address && (strcmp(de->d_name, unit->beer_address) == 0))
 				ref++;
 			}
-			srv_send((char *)"%s,%d,18S20,Digital thermometer", ref, de->d_name);
+			srv_send((char *)"%s,%d,18S20,Digital thermometer", de->d_name, ref);
 		    } else if (strncmp(de->d_name, (char *)"28", 2) == 0) {
-			if (Config.air_address && (strncmp((char *)"28", Config.air_address, 2) == 0))
+			if (Config.air_address && (strcmp(de->d_name, Config.air_address) == 0))
 			    ref++;
 			for (unit = Config.units; unit; unit = unit->next) {
-			    if (unit->air_address && (strncmp((char *)"28", unit->air_address, 2) == 0))
+			    if (unit->air_address && (strcmp(de->d_name, unit->air_address) == 0))
 				ref++;
-			    if (unit->beer_address && (strncmp((char *)"28", unit->beer_address, 2) == 0))
+			    if (unit->beer_address && (strcmp(de->d_name, unit->beer_address) == 0))
 				ref++;
 			}
-			srv_send((char *)"%s,%d,18B20,Digital thermometer", ref, de->d_name);
+			srv_send((char *)"%s,%d,18B20,Digital thermometer", de->d_name, ref);
 		    } else if (strncmp(de->d_name, (char *)"29", 2) == 0) {
 			for (unit = Config.units; unit; unit = unit->next) {
 			    if (unit->io1_address && (strncmp((char *)"29", unit->io1_address, 2) == 0))
@@ -261,7 +261,7 @@
 			    if (unit->io2_address && (strncmp((char *)"29", unit->io2_address, 2) == 0))
 				ref++;
 			}
-			srv_send((char *)"%s,%d,2408,8 Channel addressable switch/LCD", ref, de->d_name);
+			srv_send((char *)"%s,%d,2408,8 Channel addressable switch/LCD", de->d_name, ref);
 		    } else if (strncmp(de->d_name, (char *)"3a", 2) == 0) {
 			for (unit = Config.units; unit; unit = unit->next) {
 			    if (unit->io1_address && (strncmp((char *)"3a", unit->io1_address, 2) == 0))
@@ -269,7 +269,7 @@
 			    if (unit->io2_address && (strncmp((char *)"3a", unit->io2_address, 2) == 0))
 				ref++;
 			}
-			srv_send((char *)"%s,%d,2413,Dual channel addressable switchs", ref, de->d_name);
+			srv_send((char *)"%s,%d,2413,Dual channel addressable switchs", de->d_name, ref);
 		    } else {
 			srv_send((char *)"%s,0,NA,Unknown device", de->d_name);
 		    }

mercurial