[Nut-upsuser] Adding TrippLite SMART550 / Protocol 2001 Support
Anthony J. Ciani
aciani1 at uic.edu
Wed Oct 11 20:20:59 UTC 2006
I have added preliminary support for the TrippLite protocol number 2001
into tripplite_usb.c. The attached file is supplied as a patch against
today's SVN.
This patch adds support for TrippLite SMART550USB and some Omni models.
Tested are On Line, On Battery, Battery Good, and Battery Bad indication.
Everything else seems to work, but this UPS is attached to a critical
system, and I can only do limited testing.
As an aside, tripplite_usb.c seems to need nut ownership of
/proc/bus/XXX/YYY in order to work, as opposed to /dev/hid/hiddevX. It
would be nice to get this "fixed".
------------------------------------------------------------
Anthony Ciani (aciani1 at uic.edu)
Computational Condensed Matter Physics
Department of Physics, University of Illinois, Chicago
http://ciani.phy.uic.edu/~tony
------------------------------------------------------------
-------------- next part --------------
--- nut.20061011/drivers/tripplite_usb.c 2006-10-11 14:51:04.000000000 -0500
+++ nut.20061004/drivers/tripplite_usb.c 2006-10-04 20:41:57.000000000 -0500
@@ -243,7 +243,8 @@
#include <math.h>
#include <ctype.h>
-static enum tl_model_t { TRIPP_LITE_UNKNOWN = 0, TRIPP_LITE_OMNIVS, TRIPP_LITE_SMARTPRO }
+static enum tl_model_t { TRIPP_LITE_UNKNOWN = 0, TRIPP_LITE_OMNIVS, TRIPP_LITE_OMNIVS2,
+TRIPP_LITE_SMARTPRO}
tl_model = TRIPP_LITE_UNKNOWN;
/*!@brief If a character is not printable, return a dot. */
@@ -387,6 +388,9 @@
case 0x1001:
upslogx(3, "Using OMNIVS protocol (%x)", proto);
return TRIPP_LITE_OMNIVS;
+ case 0x2001:
+ upslogx(3, "Using OMNIVS2 protocol (%x)", proto);
+ return TRIPP_LITE_OMNIVS2;
case 0x3003:
upslogx(3, "Using SMARTPRO protocol (%x)", proto);
return TRIPP_LITE_SMARTPRO;
@@ -861,7 +865,7 @@
return;
}
- if(tl_model != TRIPP_LITE_OMNIVS) {
+ if(tl_model != TRIPP_LITE_OMNIVS && tl_model != TRIPP_LITE_OMNIVS2) {
dstate_setinfo("ups.debug.S","%s", hexascdump(s_value+1, 7));
}
@@ -893,6 +897,44 @@
}
}
+
+ if(tl_model == TRIPP_LITE_OMNIVS2) {
+ switch(s_value[2]) {
+ case '0':
+ dstate_setinfo("battery.test.status", "Battery OK");
+ break;
+ case '1':
+ dstate_setinfo("battery.test.status", "Battery bad - replace");
+ break;
+ case '2':
+ status_set("CAL");
+ break;
+ case '3':
+ status_set("OVER");
+ dstate_setinfo("battery.test.status", "Overcurrent?");
+ break;
+ case '4':
+ /* The following message is confusing, and may not be accurate: */
+ /* dstate_setinfo("battery.test.status", "Battery state unknown"); */
+ break;
+ case '5':
+ status_set("OVER");
+ dstate_setinfo("battery.test.status", "Battery fail - overcurrent?");
+ break;
+ default:
+ upslogx(LOG_ERR, "Unknown value for s[2]: 0x%02x", s_value[2]);
+ dstate_datastale();
+ break;
+ }
+
+ /* Online/on battery: */
+ if(s_value[4] & 1) {
+ status_set("OB");
+ } else {
+ status_set("OL");
+ }
+ }
+
if(tl_model == TRIPP_LITE_SMARTPRO) {
switch(s_value[2]) {
case '0':
@@ -949,7 +991,7 @@
status_commit();
- if( tl_model == TRIPP_LITE_OMNIVS ) {
+ if( tl_model == TRIPP_LITE_OMNIVS || tl_model == TRIPP_LITE_OMNIVS2 ) {
ret = send_cmd(b_msg, sizeof(b_msg), b_value, sizeof(b_value));
if(ret <= 0) {
dstate_datastale();
@@ -1037,6 +1079,7 @@
switch(tl_model) {
case TRIPP_LITE_OMNIVS:
+ case TRIPP_LITE_OMNIVS2:
dstate_setinfo("output.voltage", "%.1f", hex2d(l_value+1, 4)/2.0);
break;
case TRIPP_LITE_SMARTPRO:
@@ -1047,7 +1090,7 @@
break;
}
- if(tl_model != TRIPP_LITE_OMNIVS) {
+ if(tl_model != TRIPP_LITE_OMNIVS && tl_model != TRIPP_LITE_OMNIVS2) {
debug_message("D", 2);
debug_message("V", 2);
More information about the Nut-upsuser
mailing list