[Nut-upsdev] Fwd: upscode2.c

Arjen de Korte nut+devel at de-korte.org
Thu Jan 29 20:01:21 UTC 2009


----- Doorgestuurd bericht van dkbrig at gmail.com -----
     Datum: Thu, 29 Jan 2009 11:16:06 -0600
       Van: Danny <dkbrig at gmail.com>
  Onderwerp: upscode2.c
       Aan: adkorte-guest at alioth.debian.org

Hi,

I apologize if you are not the correct person, but I was wanting to  
submit a bug report for the upscode2.c driver but could not find a way  
to do that from the NUT website.

Here is the problem code and what I have noticed in upscode2.c:

void upsdrv_shutdown(void)
{
         if (can_upsd && can_uppc) {
                 upslogx(LOG_EMERG, "Emergency shutdown");
                 upscsend("UPSD");       /* Set shutdown delay */
                 upscsend("1");          /* 1 second (lowest possible.  
0 returns current.*/

                 upslogx(LOG_EMERG, "Shutting down...");
                 upscsend("UPPC");       /* Powercycle UPS */
                 upscsend("IJHLDMGCIU"); /* security code */
         }
         else {
                 upslogx(LOG_EMERG, "Shutdown called, but UPS does not  
support it");
         }
}


The problem is that the if(can_upsd && can_uppc) check was added  
between SVN 408 and SVN 743.  Those variables can_upsd and can_uppc  
get set to 0 (zero) when upscode2 starts and then based on the output  
of the UPCL command to the UPS, they get set to a one if the UPS  
supports those commands.

However, if you call the driver with the -k option to force a  
shutdown, which my shutdown scripts do, it fails because those  
variables are never set, because the routine upsc_commandlist is never  
called.  That is the routine where the output of the UPCL command to  
the UPS is checked to see if the UPS supports those commands.

I noticed that in version 408 those checks didn't exist, but in SVN  
743 they were added.  I checked NUT 2.0.5 and the upscode2.c driver  
didn't contain those checks and therefore the shutdown for my UPS  
worked properly.  But with version 2.2.2, those checks exist and the  
shutdown doesn't work.

Thanks,
Danny
dkbrig at gmail.com



----- Einde doorgestuurd bericht -----



More information about the Nut-upsdev mailing list