[Nut-upsuser] BestPower Ferrups driver glitch with f commands

Ritter, Nicholas Nicholas.Ritter at americantv.com
Mon Feb 10 18:27:30 UTC 2014


The problem will only affect newer firmwares on the BestPower FerrUPS 2.1kva units. Additional white-space was the issue. I added a if clause to the bestfcom driver to account for this without breaking what was there. Here is the patch:

diff -rupN release-orig/nut-2.7.1/drivers/bestfcom.c release-patched/nut-2.7.1/drivers/bestfcom.c
--- release-orig/nut-2.7.1/drivers/bestfcom.c   2013-07-31 13:41:31.000000000 -0700
+++ release-patched/nut-2.7.1/drivers/bestfcom.c        2014-02-10 10:22:35.405305828 -0800
@@ -582,6 +582,13 @@ void upsdrv_init_nofc(void)
                fc.type = FERRUPS;
                snprintf(fc.name, sizeof(fc.name), "%s", "Ferrups");
        } else
+       /* For FE2.1KVA running 9.28 firmware */ 
+       if (strstr(rstring, "Model:      FE2.1KVA")
+           || strstr(rstring, "Model:      FE")){
+                fc.model = FExxxx;
+                fc.type = FERRUPS;
+                snprintf(fc.name, sizeof(fc.name), "%s", "Ferrups");
+        } else
        if (strlen(rstring) < 300 ) {
                /* How does the old Fortress respond to this? */
                upsdebugx(2, "Old Best Fortress???");


How long does it take for this sort of patch to get into a release? I ask because I need the OpenGear engineers to add this patch and/or release version into the ACM5xxx product line to be able to use it on site here.

Nicholas



________________________________________
From: Nut-upsuser [nut-upsuser-bounces+nicholas.ritter=americantv.com at lists.alioth.debian.org] on behalf of Ritter, Nicholas [Nicholas.Ritter at americantv.com]
Sent: Monday, February 10, 2014 11:40 AM
To: Charles Lepple
Cc: nut-upsuser at lists.alioth.debian.org
Subject: Re: [Nut-upsuser] BestPower Ferrups driver glitch with f commands

I did the testing you suggested, and it was indeed the whitespace. I added another if clause test to the function and everything seems to work. I have working driver that I will email a patch for this list. My coworker says the model ID is configurable though, so we will try that first, which would negate the need to patch the driver.

________________________________________
From: Charles Lepple [clepple at gmail.com]
Sent: Friday, February 07, 2014 8:21 PM
To: Ritter, Nicholas
Cc: nut-upsuser at lists.alioth.debian.org
Subject: Re: [Nut-upsuser] BestPower Ferrups driver glitch with f commands

On Feb 7, 2014, at 3:44 PM, Ritter, Nicholas wrote:

> Greetings to you all,
>
> We are attempting to use NUT to interface with a BestPower FerrUPS FE2.1KVA. We are using the bestfcom driver because the driver listed our UPS as supported. The driver fails, however, because "fc" commands do not exist on the unit.

There is a upsdrv_init_nofc() function, but it seems to be brittle in its string matching.

> We are running NUT v2.7.1 on CentOS 6.5 with the bestfcom driver. We setup a serial tap and see the UPS error out on the fc command issued for the model, which than causes the driver to not identify the model correctly.
>
> Does anyone have any suggestions?

See below.

> Nicholas
>
>
> Here are some details:
>
> From "upsdrvctl -DDDDD start":
>
> ------------------------------------------------------------------
> Network UPS Tools - UPS driver controller 2.7.1
>   0.000000
> If you're not a NUT core developer, chances are that you're told to enable debugging
> to see why a driver isn't working for you. We're sorry for the confusion, but this is
> the 'upsdrvctl' wrapper, not the driver you're interested in.
>
> Below you'll find one or more lines starting with 'exec:' followed by an absolute
> path to the driver binary and some command line option. This is what the driver
> starts and you need to copy and paste that line and append the debug flags to that
> line (less the 'exec:' prefix).
>
>   0.000181    Starting UPS: ATVUPS
>   0.000194    exec:  /usr/local/ups/bin/bestfcom -a ATVUPS -u root

As the message suggests, for debugging the driver, you should bypass the upsdrvctl command (which really only helps when starting multiple drivers at once) and pass the -D flags directly to the driver:

/usr/local/ups/bin/bestfcom -a ATVUPS -u root -DDD

But I suspect that this line is not matching the spaces after the "Model:" string properly:

https://github.com/networkupstools/nut/blob/master/drivers/bestfcom.c#L579

Does it work if you match the exact string your model returns? If so, we can patch it to skip however much white space is present before the "FE".

--
Charles Lepple
clepple at gmail





 AMTV Spam Admin: Clickhttps://www.mailcontrol.com/sr/nApD3Do4eoPGX2PQPOmvUqW!RI4xIDLrB+QJRwHJqbUvO65YYfmXJsNFE+0nuLp3kIs893ZinNHp5oVq8TaMKA==  to report this email as spam.

_______________________________________________
Nut-upsuser mailing list
Nut-upsuser at lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser



More information about the Nut-upsuser mailing list