[Nut-upsuser] powercom driver - battery test?

Albert de Jongh nut-upsuser at skaap.za.org
Sun Oct 11 20:51:56 UTC 2009


I was running Fedora Core 7 on my machine until this weekend when I upgraded
to Fedora 11.
This meant upgrading from nut 2.0.5 to nut 2.4.1.  I have a Powercom Black
Knight 600AP UPS,
and this was always driven by the powercom driver, type KIN1500AP.  Now I
had to use type "BNT"
to connect to the UPS.

My rather long-winded question:  the powercom driver now does some kind of
"battery test" when
it connects to the UPS.  Is this correct?

I did some checking in the svn repo, and this change was added in revision:
http://svn.debian.org/wsvn/nut/trunk/drivers/powercom.c?rev=1236&sc=0

In method "upsdrv_initups" there is now an extra section that does the
"ser_send_char(upsfd, BATTERY_TEST)"  for some reason:
---------- code ----------
if (!strncasecmp(types[type].name, "BNT",3) ||
!strncasecmp(types[type].name, "KIN",3) || !strncasecmp(types[type].name,
"IMP",3)){
        if (!ups_getinfo()) return;
        if (raw_data[UPSVERSION]==0xFF){
            types[type].name="IMP";
            model=raw_data[MODELNUMBER]/16;
        }
        if (raw_data[MODELNAME]==0x42){
            types[type].name="BNT";
            model=BNTmodels[raw_data[MODELNUMBER]/16];
        }
        if (raw_data[MODELNAME]==0x4B){
            types[type].name="KIN";
            model=KINmodels[raw_data[MODELNUMBER]/16];
        }
        linevoltage=voltages[raw_data[MODELNUMBER]%16];
        sprintf(buf,"%s-%dAP",types[type].name,model);
        modelname=buf;
        upsdebugx(1,"Detected: %s , %dV",modelname,linevoltage);
        if (ser_send_char (upsfd, BATTERY_TEST) != 1) {
            upslogx(LOG_NOTICE, "writing error");
            dstate_datastale();
            return;
        }
    }
---------- code ----------
The outer "if" (with the string comparisons to BNT, KIN and IMP) does not
make a lot of sense to me?

So my questions are:
 . why the battery test?
 . the if looks a bit strange - is it supposed to look like that?

Thanks!
Albert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20091011/95bf8d32/attachment.htm>


More information about the Nut-upsuser mailing list