Re: [Nut-upsuser] APC Smart-UPS 1000

2011-02-07 Thread Arjen de Korte

Citeren Kevin bakd...@gmail.com:


On 06/02/2011 21:42, Kevin wrote:
Ok, I've tried that. The result of clientcmd -u apcmon -p pass123  
-a apc1500 shutdown.reboot is nothing. Nothing that I can see  
changes at all.


Of course. Do as I asked you and it *will* make a difference.


I did this with the old working modified hidups driver:

# ./hidups -DDD -k /dev/hiddev0
Network UPS Tools: HID UPS driver 0.13 (2.0.0)


Use nut-2.6.0 instead. The above version is too old and I have no idea  
what variables it supports (and I don't want to take the time finding  
out).



There are three lines in the apc-hid.c code that reference shutdown.reboot:

  1. { shutdown.reboot, 0, 0, UPS.PowerSummary.DelayBeforeReboot,
 NULL, 10, HU_TYPE_CMD, NULL },
  2. { shutdown.reboot, 0, 0, UPS.Output.DelayBeforeReboot, NULL,
 10, HU_TYPE_CMD, NULL },
  3. { shutdown.reboot, 0, 0,
 UPS.APCGeneralCollection.APCDelayBeforeReboot, NULL, 1,
 HU_TYPE_CMD, NULL },


The name change of the command is critical here. NUT will use whatever  
mapping it finds first, so that's the reason I asked you to use  
'shutdown.return' for this specific HID path instead. Otherwise the  
command will never be reached if you call the driver with '-k' and  
when you run 'shutdown.reboot' it will probably find a different HID  
path first.


Best regards, Arjen
--
Please keep list traffic on the list (off-list replies will be rejected)


___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] APC Smart-UPS 1000

2011-02-07 Thread Arnaud Quette
2011/2/7 Kevin bakd...@gmail.com

  On 06/02/2011 21:42, Kevin wrote:

 on 06/02/2011 21:06 Charles Lepple wrote:


 It looks like the only uncommented code which talks to the device is
 the last line. (The results from the getval() calls do not seem to be
 used.)

 APCDelayBeforeReboot maps to 0xff86007c, so Arjen's suggestion to
 change the 10 to 1 should be equivalent to the setvalue() line at the
 end.


 Thanks for the input Charles. I will post back the results tomorrow.


 Ok, I've tried that. The result of clientcmd -u apcmon -p pass123 -a
 apc1500 shutdown.reboot is nothing. Nothing that I can see changes at all.

 I did this with the old working modified hidups driver:

 # ./hidups -DDD -k /dev/hiddev0
 Network UPS Tools: HID UPS driver 0.13 (2.0.0)

 Warning: This is an experimental driver.
 Some features may not function correctly.

 debug level is '3'
 Detected American Power Conversion Back-UPS CS 500 FW:808.q10 .I USB FW:q10
 on port /dev/hiddev0
 Initiating UPS shutdown
 setvalue(ff86007c, 1): obtained 0 (report 40))
 setvalue(using type = feature): report sent successfully


 Something must be different! Is the type = feature relevant at all?

 There are three lines in the apc-hid.c code that reference shutdown.reboot:


1. { shutdown.reboot, 0, 0, UPS.PowerSummary.DelayBeforeReboot,
NULL, 10, HU_TYPE_CMD, NULL },
2. { shutdown.reboot, 0, 0, UPS.Output.DelayBeforeReboot, NULL,
10, HU_TYPE_CMD, NULL },
3. { shutdown.reboot, 0, 0,
UPS.APCGeneralCollection.APCDelayBeforeReboot, NULL, 1, HU_TYPE_CMD,
NULL },


 I did usbhid-ups -a apc1500 -k -DDD  CS500shutdown.txt 21 and attached
 the output in case it holds any clues.


according to your attached output, shutdown.reboot has been mapped on
UPS.PowerSummary.DelayBeforeReboot

You should try putting the above last line
(UPS.APCGeneralCollection.APCDelayBeforeReboot) before all the other
possible paths (ie 3 before 1 and 2 in apc-hid.c), recompile and try again
your procedure.
The rule for the generic USB/HID engine is that the first HID path that
exist is used to map the NUT variable, in case multiple HID paths can
satisfy it.

cheers,
Arnaud
-- 
Linux / Unix Expert RD - Eaton - http://powerquality.eaton.com
Network UPS Tools (NUT) Project Leader - http://www.networkupstools.org/
Debian Developer - http://www.debian.org
Free Software Developer - http://arnaud.quette.free.fr/
___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Status OB (on battery) when polling a Liebert PSA

2011-02-07 Thread Pier Paolo Glave
Hi Arjen,

Thanks for your answer.
If you have time to support me, I will for sure follow you, providing all
the information you need.
I'm a software designer too, so don't hesitate to ask for some particular
build or to make changes at source code level.

Looking at the rejected earlier message, I'd say you have a Belkin OEM
 device that has a very broken report descriptor. You may want to
 checkout the recently released nut-2.6.0 version. But I'm almost
 certain that the fixes in the HID parser are not going to solve this
 problem and that instead the problem is in the UPS itself. We may or
 may not be able to work around this, but in that case we will need
 lots of support from you (and you must be willing/capable to run the
 development version too).


I have built the nut-2.6.0 version.
I did not want to completely uninstall my 2.4.3 version, which had been so
gracefully installed by the debian package system... So, I tried to install
only the 2.6.0 drivers, and forced nut to use them, by creating a new
directory called /lib/nut-2.6, and making a symbolic link:
/lib/nut - /lib/nut-2.6.
Please tell me if this is a right approach, to use the 2.6 HID parser.

From this test, it seems that you were right: the UPS is still reported as
OB, and some information (like the serial number, e.g) are missing from
the upsc report.



  I would like to paste also a complete tracing of /lib/nut/usbhid-ups
 -D
  -a liebert, but the message would become too big.

 Then use gzip to compress it before attaching. We really need the full
 listing as an attachment, not inline in a message.


Ok, I will do in this way.
Please find attached the log of /lib/nut/usbhid-ups -D -a liebert,
produced with the 2.6 driver.

Thank you for your support.

Kind regards,
--
Pier


nut-usbhid-2.6-20110207.log.gz
Description: GNU Zip compressed data
___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] APC Smart-UPS 1000

2011-02-07 Thread Arjen de Korte

Citeren Kevin bakd...@gmail.com:


Ok. Thanks. The order of the code is now:

  { shutdown.reboot, 0, 0,  
UPS.APCGeneralCollection.APCDelayBeforeReboot, NULL, 1,  
HU_TYPE_CMD, NULL },
  { shutdown.reboot, 0, 0, UPS.PowerSummary.DelayBeforeReboot,  
NULL, 10, HU_TYPE_CMD, NULL },
  { shutdown.reboot, 0, 0, UPS.Output.DelayBeforeReboot, NULL,  
10, HU_TYPE_CMD, NULL },


and the output of usbhid-ups -a apc1500 -k -DDD  CS500shutdown.txt  
21 is attached.


(No visible change)


Of course not. When do you start listening to my advice? :-(

Best regards, Arjen
--
Please keep list traffic on the list (off-list replies will be rejected)


___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] APC Smart-UPS 1000

2011-02-07 Thread Kevin

on 07/02/2011 18:46 Arjen de Korte wrote:

Citeren Kevin bakd...@gmail.com:


Of course not. When do you start listening to my advice? :-(



Arjen,

There is no call for language like that. I've spent a huge amount of 
time in the last six weeks trying to sort this problem with your code.


I'll go and find other alternatives if you take that attitude.

Regards,
Kevin.


___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] Status OB (on battery) when polling a Liebert PSA

2011-02-07 Thread Pier Paolo Glave
On Mon, Feb 7, 2011 at 12:37 PM, Arjen de Korte nut+us...@de-korte.org wrote:

 It looks like the firmware developers missed the fact that for some units,
 an exponent is used (V, VA and W) which causes a 7 decades offset. You
 either have to account for that in the units exponent or use a type that
 doesn't have this offset. I'm fairly certain that by commenting out the
 following lines in drivers/libhid.c

 604             for (i = 0; i  NB_HID_UNITS; i++) {
 605
 606                     if (HIDUnits[i].Type == hiddata-Unit) {
 607                             unit_expo -= HIDUnits[i].Expo;
 608                             break;
 609                     }
 610             }

 you'll get better results. Please let us know if it does, so that we can
 include this fix in the belkin-hid subdriver.


Yes!
The results are quite different now :)

This is the result of upsc now, when AC power is plugged in:
battery.charge: 100
battery.type: PbAc
battery.voltage: 28
battery.voltage.nominal: 2
device.mfr: Emerson Network Power
device.model: LiebertPSA
device.serial:
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.version: 2.6.0
driver.version.data: Liebert HID 0.3
driver.version.internal: 0.35
ups.mfr: Emerson Network Power
ups.model: LiebertPSA
ups.productid: 0001
ups.serial:
ups.status: OL CHRG
ups.vendorid: 10af

And, if I unplug the AC power, the following parameter changes:
ups.status: OB DISCHRG

Thank you Arjen: you gave me a good support, in a very short time.

I'm ready now to go on with NUT configuration: I think I'm able now to
have a controlled PC shutdown.
I'll let you know how it goes.

Kind regards,
Pier

___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] APC Smart-UPS 1000

2011-02-07 Thread Kevin

on 07/02/2011 15:36 Arjen de Korte wrote:

Citeren Kevin bakd...@gmail.com:

Of course. Do as I asked you and it *will* make a difference.



You could have perhaps made a point of the sudden change to a different 
command. Others also missed this subtlety.




I did this with the old working modified hidups driver:

# ./hidups -DDD -k /dev/hiddev0
Network UPS Tools: HID UPS driver 0.13 (2.0.0)


Use nut-2.6.0 instead. The above version is too old and I have no idea 
what variables it supports (and I don't want to take the time finding out).


You miss the point entirely. I am giving you code that works, whereas 
yours does not. Surely a programmers dream.


The name change of the command is critical here. NUT will use whatever 
mapping it finds first, so that's the reason I asked you to use 
'shutdown.return' for this specific HID path instead. Otherwise the 
command will never be reached if you call the driver with '-k' and when 
you run 'shutdown.reboot' it will probably find a different HID path first.


Ok, I'll give this a try too.


___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] APC Smart-UPS 1000

2011-02-07 Thread Arjen de Korte

Citeren Kevin bakd...@gmail.com:

There is no call for language like that. I've spent a huge amount of  
time in the last six weeks trying to sort this problem with your code.


This is not *my* code. I'm just trying to help here. I would be more  
than happy to ditch the APC support from NUT entirely, but due to  
popular demand this is just not an option.



I'll go and find other alternatives if you take that attitude.


Whatever. I have better things to do too with my free time.

Best regards, Arjen
--
Please keep list traffic on the list (off-list replies will be rejected)


___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] Status OB (on battery) when polling a Liebert PSA

2011-02-07 Thread Arjen de Korte

Citeren Pier Paolo Glave pierpaolo.gl...@gmail.com:


Yes!
The results are quite different now :)


That's good to know.


This is the result of upsc now, when AC power is plugged in:
battery.charge: 100
battery.type: PbAc
battery.voltage: 28
battery.voltage.nominal: 2
device.mfr: Emerson Network Power
device.model: LiebertPSA
device.serial:
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.version: 2.6.0
driver.version.data: Liebert HID 0.3
driver.version.internal: 0.35
ups.mfr: Emerson Network Power
ups.model: LiebertPSA
ups.productid: 0001
ups.serial:
ups.status: OL CHRG
ups.vendorid: 10af


Looking at the debug output you sent earlier, it looks like your UPS  
might support some other variables too. Could you please post some  
similar output as you did recently, now with these patches included?



And, if I unplug the AC power, the following parameter changes:
ups.status: OB DISCHRG


That looks promising.


Thank you Arjen: you gave me a good support, in a very short time.

I'm ready now to go on with NUT configuration: I think I'm able now to
have a controlled PC shutdown.
I'll let you know how it goes.


That's also something I would be interested in.

Best regards, Arjen
--
Please keep list traffic on the list (off-list replies will be rejected)


___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] APC Smart-UPS 1000

2011-02-07 Thread Arjen de Korte

Citeren Kevin bakd...@gmail.com:

You could have perhaps made a point of the sudden change to a  
different command. Others also missed this subtlety.


I posted the 'old' and 'new' lines. You might have missed this on the  
first look, buy after I told you the difference, you could have looked  
again at the original post.


You miss the point entirely. I am giving you code that works,  
whereas yours does not. Surely a programmers dream.


Not at all. As I already indicated a couple of times, APC uses a  
myriad of methods to shutdown their UPSes. Have a look at the USB  
apcupsd code and you'll appreciate how broken the APC software is. So  
bluntly accepting your changes might have fixed you problems, but  
would at the same time break it again for others. This is the problem  
we're in (which you don't seem to understand).


Best regards, Arjen
--
Please keep list traffic on the list (off-list replies will be rejected)


___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] APC Smart-UPS 1000

2011-02-07 Thread Kevin

on 07/02/2011 20:46 Arjen de Korte wrote:

Citeren Kevin bakd...@gmail.com:

This is not *my* code. I'm just trying to help here. 


As am I.

I would be more
than happy to ditch the APC support from NUT entirely, but due to 
popular demand this is just not an option.


Exactly. I am beginning to see a 'broken firmware' pattern here.




I'll go and find other alternatives if you take that attitude.


Whatever. I have better things to do too with my free time.


That's fine. Maybe there is someone else on the project willing to put 
in the time perhaps?





___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] APC Smart-UPS 1000

2011-02-07 Thread Kevin

on 07/02/2011 20:58 Arjen de Korte wrote:

I posted the 'old' and 'new' lines. You might have missed this on the 
first look, buy after I told you the difference, you could have looked 
again at the original post.


Of course I saw it, after you made it so plain in such a blunt manner. 
As I said, others also missed it.


You miss the point entirely. I am giving you code that works, whereas 
yours does not. Surely a programmers dream.


Not at all. As I already indicated a couple of times, APC uses a myriad 
of methods to shutdown their UPSes. Have a look at the USB apcupsd code 
and you'll appreciate how broken the APC software is. 


Again, the broken software story.

So bluntly 
accepting your changes might have fixed you problems, but would at the 
same time break it again for others. This is the problem we're in (which 
you don't seem to understand).


No, because you seem unable even to replicate the behaviour of your 
earlier versions (which I have shown to work after a small modification) 
in your current versions.


It is beginning to seem as though the current code has become so complex 
that no one actually understands exactly what it does any more.


As I said before, I am willing to put as much effort into this as is 
required, but I am not a programmer, so please don't jump down my throat 
for misreading a sentence.


I'll let you know the results tomorrow. However, it would help if you 
gave me a patch to the original code so there could be no more 
misunderstandings.


___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] APC Smart-UPS 1000

2011-02-07 Thread Arjen de Korte

Citeren Kevin bakd...@gmail.com:


Exactly. I am beginning to see a 'broken firmware' pattern here.


The above is the only reason why we need multiple HID subdrivers in  
usbhid-ups. If every UPS vendor would care to implement (and properly  
test!) their firmware, we would need exactly one subdriver that would  
fit all USB HID Power Device Class UPS'es. But since many contain bugs  
(and sometime conflicting implementations) we need one for almost  
every vendor.


Best regards, Arjen
--
Please keep list traffic on the list (off-list replies will be rejected)


___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] APC Smart-UPS 1000

2011-02-07 Thread Kevin

on 07/02/2011 22:04 Arjen de Korte wrote:

The above is the only reason why we need multiple HID subdrivers in 
usbhid-ups. If every UPS vendor would care to implement (and properly 
test!) their firmware, we would need exactly one subdriver that would 
fit all USB HID Power Device Class UPS'es. But since many contain bugs 
(and sometime conflicting implementations) we need one for almost every 
vendor.


Quite, but, as you so rightly say, every vendor is providing different 
'standards', they are all offering 'broken' implementations, even 
between models. This doesn't change things for us mere mortals trying to 
do a job.


I've given you something that works in an older version, all you have to 
do is translate that into the current version and then at least we will 
have something to build on. At the moment, we have nothing working in 
2.0.6 for the CS 500.


___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


[Nut-upsuser] hardware compatibility list

2011-02-07 Thread Ernest Sales
I would like to report a working device to add to the hardware compatibility 
list, but cannot find a way on the website. Would this list be OK for that 
purpose?

Best regards,
Ernest



___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] hardware compatibility list

2011-02-07 Thread Arjen de Korte

Citeren Ernest Sales ersa...@gmail.com:

I would like to report a working device to add to the hardware  
compatibility list, but cannot find a way on the website. Would this  
list be OK for that purpose?


Sure. Please list the output of 'upsc' as well as whether or not you  
tested the shutdown function of the UPS.


Best regards, Arjen
--
Please keep list traffic on the list (off-list replies will be rejected)


___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] APC Smart-UPS 1000

2011-02-07 Thread Arjen de Korte

Citeren Kevin bakd...@gmail.com:


You are quite right! I now have this line in apc-hid.c:

 { shutdown.return, 0, 0,  
UPS.APCGeneralCollection.APCDelayBeforeReboot, NULL, 1,  
HU_TYPE_CMD, NULL },


and get this result:

# clients/upscmd -u apcmon -p pass123 apc1500 shutdown.return
Unexpected response from upsd: ERR CMD-NOT-SUPPORTED

I have attached the output of usbhid-ups -a apc1500 -k -DDD   
CS500shutdown.txt 21 in case it is of value.


It is of value. The HID path I sent was wrong (it isn't in the above  
listing, so usbhid-ups will not find it). There is no  
APCGeneralCollection in your UPS. Instead of


{ shutdown.return, 0, 0,  
UPS.APCGeneralCollection.APCDelayBeforeReboot, NULL, 1,  
HU_TYPE_CMD, NULL },


the correct HID path should be

{ shutdown.return, 0, 0, UPS.Output.APCDelayBeforeReboot,  
NULL, 1, HU_TYPE_CMD, NULL },


Sorry about that.

Best regards, Arjen
--
Please keep list traffic on the list (off-list replies will be rejected)


___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser