Ritter, Nicholas
2014-Feb-10 17:40 UTC
[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 rootAs 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.
Ritter, Nicholas
2014-Feb-10 18:27 UTC
[Nut-upsuser] BestPower Ferrups driver glitch with f commands
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 rootAs 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
Charles Lepple
2014-Feb-11 04:51 UTC
[Nut-upsuser] BestPower Ferrups driver glitch with f commands
On Feb 10, 2014, at 1:27 PM, Ritter, Nicholas wrote:> 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:Can you try the following, which should skip over arbitrary amounts of whitespace? https://github.com/networkupstools/nut/commit/6f5cd409f808ba05e6aae125c57d23c360bd1764 (also attached to this message.)> 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.From the NUT perspective, we try to keep the Git master branch in a releasable state, or at least a state without known compilation problems. But we don't tend to swamp users with tarball releases every time something changes in SVN/Git - generally it tends to be about six months between NUT releases, and the last one was in November. At the moment, we have a few open issues that I would like to fix before the next release. From that point, I'm not sure how long it would be until a group like OpenGear picks that up. From the OpenGear perspective, I assume it would not be too hard for them to apply your patch onto their latest source tree, and generate a maintenance release. I haven't really looked into the OpenGear release process (they might have worked with Arnaud, or someone else at Eaton), but Linux distributions like Debian will often add driver patches on top of the latest NUT tarball in response to bug reports, since theoretically, a localized patch like this doesn't require full system testing.> 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-- Charles Lepple clepple at gmail -------------- next part -------------- A non-text attachment was scrubbed... Name: bestfcom_FE.patch Type: application/octet-stream Size: 1716 bytes Desc: not available URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20140210/ce06edf2/attachment-0001.obj>