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

Kevin bakdong at gmail.com
Mon Jan 17 15:42:55 UTC 2011


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

> It's sad that you never submitted these changes back to NUT, so that  
> other people might benefit from them.
> 

Yes indeed, although I don't by any means consider myself an expert, and the 
changes that I made were just cludges to get the thing working for me.

> 
> 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.

(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);
}

and tested it against the CS 500. This works. When the CS 500 goes into sleep 
mode, the red (Overload) and the green (online) lights flash alternately for 
about 10 seconds, the load is switched off, and then all the lights go out until 
the power comes back.

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...

but have yet to work out the changes that I made to bring this about. The debug 
output is not as easy to work with as the old hidups driver and the code has 
become much more complex.

If and when I find out more, I will post the results.






More information about the Nut-upsuser mailing list