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

Kevin bakdong at gmail.com
Fri Jan 21 04:28:33 UTC 2011


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

> 
> Citeren Kevin <bakdong <at> gmail.com>:

> >    return immediately switches to battery for a moment, sets both shutdown
> >      and startup to 90 seconds, sleeps after 90 seconds
> 
> That is very odd. You could try what happens if you change the  
> 'ondelay' and 'offdelay' values in 'ups.conf'. Set offdelay to 1  
> second and ondelay to 100/200/400 seconds and run the shutdown.return  
> command again (while monitoring the 'ups.timer.shutdown' and  
> 'ups.timer.start' through upslog or upsc.

Like this?

[apc1500]
        driver=usbhid-ups
        port=auto
        ondelay=200
        offdelay=1

After restarting the driver, and running shutdown.return, the timers are set to 
90 and 200. (the values of ups.delay.shutdown and ups.delay.start)

REBOOT:-1 SHUT:-1 START:-1
REBOOT:-1 SHUT:-1 START:-1
REBOOT:-1 SHUT:89 START:199
REBOOT:-1 SHUT:89 START:199
REBOOT:-1 SHUT:89 START:199
REBOOT:-1 SHUT:85 START:195
REBOOT:-1 SHUT:85 START:195
REBOOT:-1 SHUT:83 START:193
REBOOT:-1 SHUT:83 START:193

Using values of 250 and 1 gives:

delay.start:250 delay.shutdown:1 REBOOT:-1 SHUT:-1 START:-1
delay.start:250 delay.shutdown:1 REBOOT:-1 SHUT:-1 START:-1
delay.start:250 delay.shutdown:1 REBOOT:-1 SHUT:89 START:249
delay.start:250 delay.shutdown:1 REBOOT:-1 SHUT:89 START:249
delay.start:250 delay.shutdown:1 REBOOT:-1 SHUT:89 START:249
delay.start:250 delay.shutdown:1 REBOOT:-1 SHUT:86 START:246
delay.start:250 delay.shutdown:1 REBOOT:-1 SHUT:86 START:246
delay.start:250 delay.shutdown:1 REBOOT:-1 SHUT:84 START:244
delay.start:250 delay.shutdown:1 REBOOT:-1 SHUT:84 START:244

 
> According to the USB HID PDC specifications, the 'reboot n' command  
> will kill the power immediately and return after 'n' seconds if power  
> is present or will wait until the power returns if it wasn't. We  
> prefer to have a little grace period, so that's why we do the two step  
> approach of setting both the shutdown and (re)start timers.
> 
> By setting a restart timer longer than the shutdown timer, this  
> effectively allows for a grace period until the UPS switches off. From  
> then it behaves like a reboot command. You need this grace period if  
> you want your system to hibernate instead of shutdown, since the Linux  
> kernel doesn't allow calling hooks just before it powers off the system.
> 

Ok, this makes sense now. The Smart-UPS 1000 apparently has some variations on 
the 'standard'. The CS 500, by the way, is more compliant at least with the 
reboot command using hidups, in that it actions the command straight away. I'd 
be very happy if we could get the reboot command to work on this one too.

> Apparently, due to the dreadful granularity of your UPS hardware  
> timers the commands we send
> 
>      load.on.delay 30
>      load.off.delay 20
> 
> are interpreted as setting both to 90 seconds. Worse, since the  
> ups.timer.start elapses before the ups.timer.shutdown, this  
> effectively puts the UPS to sleep.

The default appears to be that they are both set equal (at the minimum value of 
90), and so elapse at the same time. 

Isn't putting the UPS to sleep the desired behaviour here, so that it wakes up 
again when power returns?

> 
> > On the CS 500 the load.off switches it off immediately, the load.off delay,
> > shutdown.return and shutdown.stayoff all switch to battery, and set  
> > the shutdown
> > timer to 20 seconds and then shuts down after that time. (Never restarts) 
The
> > beeper commands work, as does the shutdown.stop (sets the shutdown  
> > timer to -1)
> 
> This probably requires some remapping of variables. I'll see if I can  
> find a solution for that.

On the CS 500, the shutdown timer is the only one that changes at all. The 
reboot and start timers stay at zero (not -1) all the time.

Regards,
Kevin.






More information about the Nut-upsuser mailing list