[Nut-upsdev] Re: About blazer, powermust and mustek

Carlos Rodrigues carlos.efr at mail.telepac.pt
Mon Oct 10 00:02:08 UTC 2005


Arnaud Quette wrote:

> Anyhow, I would more see this as a merge of all these drivers, with 
> some autodetection or flag/param to switch the mfr/model and maybe 
> capabilities... Whatever the driver name is, a good thing would be the 
> name of the protocol or something generic enough, though powermust is 
> fine.

Ok, I made some minor changes to powermust, to make it less "mustek" and 
more "megatec protocol", which can be seen in the attached patch.

If this is ok, I can rebuild the patch with the other changes necessary 
for this (rename powermust and change the docs and manpage).

Carlos Rodrigues


-------------- next part --------------
diff -ruN nut.orig/drivers/powermust.c nut/drivers/powermust.c
--- nut.orig/drivers/powermust.c	2005-09-12 13:38:35.000000000 +0100
+++ nut/drivers/powermust.c	2005-10-10 00:58:50.000000000 +0100
@@ -1,8 +1,8 @@
 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: t; -*-
  * 
- * powermust.c: support for Mustek (and others) models
+ * powermust.c: support for Megatec protocol based UPSes
  *
- * Copyright (C) 2003, 2004 Carlos Rodrigues <carlos.efr at mail.telepac.pt>
+ * Copyright (C) 2003-2005 Carlos Rodrigues <carlos.efr at mail.telepac.pt>
  *
  * powermust.c created on 4/10/2003
  *
@@ -99,7 +99,7 @@
 } QueryValues;
 
 
-/* Defined in upsdrv_initups */
+/* Defined in upsdrv_initinfo */
 static float battvolt_min;
 static float battvolt_max;
 
@@ -206,13 +206,13 @@
 	}
 
 	if (success < IDENT_MINSUCCESS) {
-		fatalx("Mustek PowerMust UPS, or compatible, not detected.");
+		fatalx("Megatec protocol UPS not detected.");
 	}
-	upslogx(LOG_INFO, "Mustek PowerMust UPS, or compatible, detected.");
+	upslogx(LOG_INFO, "Megatec protocol UPS detected.");
 
 	dstate_setinfo("driver.version.internal", "%s", DRV_VERSION);
-	dstate_setinfo("ups.mfr", "Mustek");
-	dstate_setinfo("ups.model", "PowerMust");
+	dstate_setinfo("ups.mfr", "unknown");
+	dstate_setinfo("ups.model", "unknown (Megatec protocol based)");
         dstate_setinfo("ups.serial", "unknown");  
 
 	if (get_firmware_values(&values) < 0) {
@@ -427,7 +427,7 @@
 	if (strcasecmp(varname, "ups.delay.start") == 0) {    
 		delay = CLAMP(delay, 0, MAX_START_DELAY);
 		start_delay = delay;
-		dstate_setinfo( "ups.delay.start", "%d", delay);
+		dstate_setinfo("ups.delay.start", "%d", delay);
 
      		dstate_dataok();
 
@@ -437,7 +437,7 @@
 	if (strcasecmp(varname, "ups.delay.shutdown") == 0) {
 		delay = CLAMP(delay, 0, MAX_SHUTDOWN_DELAY);
 		shutdown_delay = delay;
-		dstate_setinfo( "ups.delay.shutdown", "%d", delay);
+		dstate_setinfo("ups.delay.shutdown", "%d", delay);
 
     		dstate_dataok();
 
@@ -460,8 +460,8 @@
 
 void upsdrv_banner(void)
 {
-	printf("Network UPS Tools - Mustek PowerMust UPS driver %s (%s)\n", DRV_VERSION, UPS_VERSION);
-	printf("Carlos Rodrigues (c) 2003, 2004\n\n");
+	printf("Network UPS Tools - Megatec protocol driver %s (%s)\n", DRV_VERSION, UPS_VERSION);
+	printf("Carlos Rodrigues (c) 2003-2005\n\n");
 }
 
 
diff -ruN nut.orig/drivers/powermust.h nut/drivers/powermust.h
--- nut.orig/drivers/powermust.h	2005-09-12 13:38:35.000000000 +0100
+++ nut/drivers/powermust.h	2005-10-10 00:57:59.000000000 +0100
@@ -1,8 +1,8 @@
 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: t; -*-
  * 
- * powermust.h: support for Mustek (and others) models
+ * powermust.h: support for Megatec protocol based UPSes
  *
- * Copyright (C) 2003, 2004 Carlos Rodrigues <carlos.efr at mail.telepac.pt>
+ * Copyright (C) 2003-2005 Carlos Rodrigues <carlos.efr at mail.telepac.pt>
  *
  * powermust.c created on 4/10/2003
  *
@@ -21,4 +21,4 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
-#define DRV_VERSION "1.1"
+#define DRV_VERSION "1.2"


More information about the Nut-upsdev mailing list