[Nut-upsdev] [PATCH 35/36] Initial exploratory hacks and fixes to prepare for temperature monitoring.

Greg A. Woods woods at planix.com
Thu Mar 8 23:21:46 UTC 2012


From: "Greg A. Woods" <woods at planix.com>

---
 drivers/metasys.c |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/metasys.c b/drivers/metasys.c
index ddac1c0..664b05e 100644
--- a/drivers/metasys.c
+++ b/drivers/metasys.c
@@ -309,7 +309,7 @@ void upsdrv_initinfo(void)
 	 dstate_setinfo("ups.delay.start", "%d", -1);
 	dstate_setflags("ups.delay.start", ST_FLAG_RW);
 	 dstate_setinfo("ups.temperature", "%d", -1);
-	dstate_setflags("ups.temperature", ST_FLAG_RW);
+	dstate_setflags("ups.temperature", ST_FLAG_RW); /* XXX writeable??? */
 	 dstate_setinfo("ups.test.result", "not yet done...");
 	dstate_setflags("ups.test.result", ST_FLAG_STRING | ST_FLAG_RW);
 	  dstate_setaux("ups.test.result", 20);
@@ -763,7 +763,12 @@ void upsdrv_updateinfo(void)
 		if (my_answer[3] > 0) {
 			dstate_setinfo("ups.temperature", "%d", my_answer[3]);
 		} else {
+			/* XXX this seems wrong -- it should be unset, not set to an invalid value */
+#if 0
 			dstate_setinfo("ups.temperature", "%s", "not available");
+#else
+			dstate_delinfo("ups.temperature");
+#endif
 		}	
 		/* Status */
 		status_init();
@@ -785,6 +790,10 @@ void upsdrv_updateinfo(void)
 				printf("status unknown \n");
 				break;
 		} 
+		/*
+		 * XXX if this driver supported alarms then some of these
+		 * should set alarms...
+		 */
 		switch (my_answer[2]) {		/* byte 2 = FAULTS */
 			case 0x00:				/* all right */
 				break;
@@ -804,6 +813,9 @@ void upsdrv_updateinfo(void)
 				printf("status unknown \n");
 				break;
 		}
+#ifdef notyet
+		check_temperature();
+#endif
 		status_commit();	
 		dstate_dataok();
 	}
-- 
1.7.9.2




More information about the Nut-upsdev mailing list