On Thu, Jun 26, 2014 at 10:20 PM, Steve Ballantyne <[email protected]> wrote: >> However, we don't have all of the 09AE/0001 protocols decoded in the >> tripplite_usb driver. > > I can try to help out on this front? :-)
Definitely. >> > 9.783126 Unknown input voltage range: 0x02 >> > 9.783308 Unknown number of switchable load banks: 0x01 >> >> Is this a 230V unit? Again, it's looking for the ASCII version of 0x02 >> (which would be 0x32) > > Nope, this is a standard 120V, for a standard grounded outlet. > Although I suppose perhaps they could have shared some of the guts of > this from larger units that are 220/230v? Well, that number scales some of the voltages. Not much we can do until we find out more about the other values. > I can most definitely connect this to a Windows PC. Just let me know > what I can provide you. The ideal situation is a trace of all the USB commands that the Windows software sends. However, I think this is just a binary version of the 3003 protocol, so experimenting might be easier. Most important are the "OB" and "LB" status bits. Unfortunately, there is no good way to generate the LB signal besides running the battery down. You might need more than a Raspberry Pi to do this in short order. I like to use incandescent lights instead of computers for test loads, because if the UPS pulls power at an inopportune time, you won't have nearly as much filesystem damage on a light bulb. I think the 'M' command shows the min and max voltages - see if there is something similar in the Windows display. Also, any load values would be helpful. For a 500W UPS, I assume it's one 12V (or 2x 6V) battery pack? Attached is a patch to try to map some of the 3005 differences into the driver. It should apply to the NUT 2.7.2 tarball, but it was generated from the Git master branch. If you do check out from Github, you'll need to install autoconf, automake and libtool. AsciiDoc is pretty slow, so you can pass "--without-doc" to the ./configure script. You may also want to add "--with-drivers=tripplite_usb" so that it doesn't try to compile everything. -- - Charles Lepple
commit 60b33c1d516f965b12fb67e873a73f27cd4cad14 Author: Charles Lepple <[email protected]> Date: Sat Jun 28 00:01:15 2014 -0400 tripplite_usb: basic support for 3005 binary protocol Based on logs from SMART500RT1U diff --git a/drivers/tripplite_usb.c b/drivers/tripplite_usb.c index e8b3df7..9518467 100644 --- a/drivers/tripplite_usb.c +++ b/drivers/tripplite_usb.c @@ -133,7 +133,7 @@ #include "usb-common.h" #define DRIVER_NAME "Tripp Lite OMNIVS / SMARTPRO driver" -#define DRIVER_VERSION "0.23" +#define DRIVER_VERSION "0.24" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -188,9 +188,23 @@ static enum tl_model_t { TRIPP_LITE_OMNIVS, TRIPP_LITE_OMNIVS_2001, TRIPP_LITE_SMARTPRO, - TRIPP_LITE_SMART_0004 + TRIPP_LITE_SMART_0004, + TRIPP_LITE_SMART_3005 } tl_model = TRIPP_LITE_UNKNOWN; +/*! Are the values encoded in ASCII or binary? + * TODO: Add 3004? + */ +static int is_binary_protocol() +{ + switch(tl_model) { + case TRIPP_LITE_SMART_3005: + return 1; + default: + return 0; + } +} + /*!@brief If a character is not printable, return a dot. */ #define toprint(x) (isalnum((unsigned)x) ? (x) : '.') @@ -360,6 +374,9 @@ enum tl_model_t decode_protocol(unsigned int proto) case 0x3003: upslogx(3, "Using SMARTPRO protocol (%x)", proto); return TRIPP_LITE_SMARTPRO; + case 0x3005: + upslogx(3, "Using binary SMART protocol (%x)", proto); + return TRIPP_LITE_SMART_3005; default: printf("Unknown protocol (%x)", proto); break; @@ -371,7 +388,15 @@ enum tl_model_t decode_protocol(unsigned int proto) void decode_v(const unsigned char *value) { unsigned char ivn, lb; - int bv = hex2d(value+2, 2); + int bv; + + if(is_binary_protocol()) { + /* 0x00 0x0c -> 12V ? */ + battery_voltage_nominal = (value[2] << 8) | value[3]; + } else { + bv = hex2d(value+2, 2); + battery_voltage_nominal = bv * 6; + } ivn = value[1]; lb = value[4]; @@ -381,6 +406,7 @@ void decode_v(const unsigned char *value) input_voltage_scaled = 100; break; + case 2: /* protocol 3005 */ case '1': input_voltage_nominal = input_voltage_scaled = 120; break; @@ -398,16 +424,18 @@ void decode_v(const unsigned char *value) break; } - battery_voltage_nominal = bv * 6; - if( (lb >= '0') && (lb <= '9') ) { switchable_load_banks = lb - '0'; } else { + if(is_binary_protocol()) { + switchable_load_banks = value[4]; + } if( lb != 'X' ) { upslogx(2, "Unknown number of switchable load banks: 0x%02x", (unsigned int)lb); } } + upsdebugx(2, "Switchable load banks: %d", switchable_load_banks); } void upsdrv_initinfo(void); @@ -1005,6 +1033,8 @@ void upsdrv_updateinfo(void) double bv_12V = 0.0; /*!< battery voltage, relative to a 12V battery */ double battery_voltage; /*!< the total battery voltage */ + unsigned int s_value_1; + int ret; status_init(); @@ -1055,8 +1085,17 @@ void upsdrv_updateinfo(void) /* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ - if(tl_model == TRIPP_LITE_SMARTPRO || tl_model == TRIPP_LITE_OMNIVS_2001 || tl_model == TRIPP_LITE_SMART_0004) { - switch(s_value[2]) { + if(tl_model == TRIPP_LITE_SMARTPRO || + tl_model == TRIPP_LITE_OMNIVS_2001 || + tl_model == TRIPP_LITE_SMART_0004 || + tl_model == TRIPP_LITE_SMART_3005) { + + unsigned int s_value_2 = s_value[2]; + + if(is_binary_protocol()) { + s_value_2 += '0'; + } + switch(s_value_2) { case '0': dstate_setinfo("battery.test.status", "Battery OK"); break; @@ -1111,7 +1150,12 @@ void upsdrv_updateinfo(void) /* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ - switch(s_value[1]) { + s_value_1 = s_value[1]; + if(is_binary_protocol()) { + s_value_1 += '0'; + } + + switch(s_value_1) { case '0': status_set("LB"); break;
_______________________________________________ Nut-upsuser mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser

