[Nut-upsuser] Support of & amp; quot; shutdown.return& amp; quot; on a APC Back-UPS CS 500

Kevin bakdong at gmail.com
Tue Jan 18 12:55:07 UTC 2011


Arjen de Korte <nut+users <at> de-korte.org> writes:

> 
> Citeren Kevin <bakdong <at> gmail.com>:
> 
> >> Have you tried the latest version (nut-2.6.0) that was released only a
> >> couple of days ago? Chances are that it might just work, since we have
> >> seen reports about people running the CS 500 in recent years.
> > Yes, I have now had a chance to try this version and can confirm that it 
does
> > not work on either the Smart-1000 or the CS 500. It shuts them both  
> > down, never
> > to start up again without operator intervention.
> 
> Please post the first 30 seconds worth of
> 
>      /path/to/usbhid-ups -DD -u root -a upsname > APC_CS500.txt 2>&1
> 
> here. Make sure to stop any running driver before doing so and be so  
> kind to zip the resulting logfile.
> 
> > (I should make it clear that I only use these in a server  
> > environment, so I am
> > only interested in the shutdown function for the PC and the sleep/hibernate
> > commands for the UPS.)
> >
> > I have also done some experimenting with the working executables that I 
have,
> > running them in debug mode. The output of the hidups indicated
> > setvalue(0xff860077c,1) so I modified the code from nut-2.0.0 as follows:
> >
> > void upsdrv_shutdown(void)
> > {
> >         /* XXX: replace with a proper shutdown function
> >         fatalx("shutdown not supported"); */
> >
> >         /* 1) set DelayBeforeStartup */
> >         if (getval ("ondelay"))
> >                 ondelay = atoi (getval ("ondelay"));
> >
> >         /* setvalue(UPS_WAKEDELAY, ondelay); */ /* commented out  
> > this line for
> > APC CS 500 */
> >
> >         /* 2) set DelayBeforeShutdown */
> >         if (getval ("offdelay"))
> >                 offdelay = atoi (getval ("offdelay"));
> >
> >         /* setvalue(UPS_GRACEDELAY, offdelay); */
> >         setvalue(0xff86007c, 1);
> > }
> 
> This version is way too old to be of any use. We already know that  
> 0xff86007c is APCDelayBeforeReboot and we already try that after the  
> shutdown.return command fails. Only if that one fails too, we use  
> load.off.delay.
> 
> > I haven't finished testing the Smart-1000 yet. I have code that works, and
> > outputs the following:
> >
> > Initiating UPS shutdown
> > upsdrv_shutdown...
> > instcmd(shutdown.return, [NULL])
> > find_nut_info: unknown info type: shutdown.return
> >
> > instcmd(load.on.delay, [NULL])
> > find_nut_info: unknown info type: load.on.delay
> >
> > instcmd: info element unavailable load.on.delay
> >
> > instcmd(shutdown.reboot, [NULL])
> > Report[set]: (4 bytes) => 13 0a 00 00
> > upsdrv_cleanup...
> 
> This is what the nut-2.6.0 usbhid-ups driver will do by default, so  
> I'm not surprised. Double check which version of the driver you're  
> running in your tests (preferably by checking with 'upsc'). I will not  
> answer further messages unless you make clear which version of the  
> driver you're running and whether or not you modified it.
> 
> Best regards, Arjen


Hi Arjen,

I have some more results for you:

After a further day testing, I have found that the two devices behave 
differently.

To avoid any confusion, I ran the following:

wget http://www.networkupstools.org/source/2.6/nut-2.6.0.tar.gz
tar xvf nut-2.6.0.tar.gz     (note: despite the name, this is not a gzipped 
file)
cd nut-2.6.0
./configure  --prefix= --sysconfdir=/etc/ups --with-statepath=/var/run/nut --
with-user=nut --with-group=uucp --without-serial
make
cd drivers/
./usbhid-ups -DDDDD -k -a apc1500


Last few lines of output:

   0.686042     Path: UPS.PowerSummary.AudibleAlarmControl, Type: Feature, 
ReportID: 0x14, Offset: 0, Size: 8, Value: 2
   0.686059     send_to_all: ADDCMD beeper.disable
   0.686075     hid_lookup_usage: UPS -> 00840004
   0.686092     hid_lookup_usage: PowerSummary -> 00840024
   0.686107     hid_lookup_usage: AudibleAlarmControl -> 0084005a
   0.686121     string_to_path: depth = 3
   0.686139     Report[buf]: (2 bytes) => 14 02
   0.686154     PhyMax = 0, PhyMin = 0, LogMax = 3, LogMin = 1
   0.686168     Unit = 00000000, UnitExp = 0
   0.686182     Exponent = 0
   0.686198     Path: UPS.PowerSummary.AudibleAlarmControl, Type: Feature, 
ReportID: 0x14, Offset: 0, Size: 8, Value: 2
   0.686228     send_to_all: ADDCMD beeper.mute
   0.686250     send_to_all: ADDCMD load.off
   0.686274     send_to_all: ADDCMD load.on
   0.686293     send_to_all: ADDCMD shutdown.return
   0.686310     send_to_all: ADDCMD shutdown.stayoff
   0.686325     Initiating UPS shutdown
   0.686340     upsdrv_shutdown...
   0.686365     instcmd(shutdown.return, [NULL])
   0.686382     find_nut_info: unknown info type: shutdown.return
   0.686398     instcmd(load.on.delay, 30)
   0.686433     Unit = 00001001, UnitExp = 0
   0.686450     Exponent = 0
   0.686464     PhyMax = 0, PhyMin = 0, LogMax = 32767, LogMin = -1
   0.690437     Report[set]: (3 bytes) => 28 1e 00
   0.690437     Set report succeeded
   0.690437     instcmd: SUCCEED

   0.690437     instcmd(load.off.delay, 20)
   0.690437     Unit = 00001001, UnitExp = 0
   0.690437     Exponent = 0
   0.690437     PhyMax = 0, PhyMin = 0, LogMax = 32767, LogMin = -1
   0.695437     Report[set]: (3 bytes) => 12 14 00
   0.695437     Set report succeeded
   0.695437     instcmd: SUCCEED

   0.695437     upsdrv_cleanup...


APC CS 500
This shuts down the APC CS 500 after 20 seconds.  (and it stays shutdown)

APC Smart-UPS 1000
If the power is left on, switches to battery and back online after 2 seconds.
If the power is off, goes to sleep after 90 seconds. (and comes back on when the 
power is connected)


Then I connected the Smart-UPS 1000 and ran:

(pwd; ps ax | grep usbhid; ./usbhid-ups -DD -u root -a apc1500) > 
APC_Smart_UPS_1000.txt 2>&1


Then again with the CS 500 connected:

(pwd; ps ax | grep usbhid; ./usbhid-ups -DD -u root -a apc1500) > APC_CS_500.txt 
2>&1

I will email the zip files to you.

Regards,
Kevin.
PS. I have also tried the 2.4.x code, which works properly with the Smart-UPS 
1000, but not with the CS 500.






More information about the Nut-upsuser mailing list