[Nut-upsdev] newhidups with APC Smart-UPS - workaround!

Кузьменко Алексей Васильевич kuzmenko at pikinvest.ru
Thu Oct 19 05:45:58 UTC 2006


> -----Original Message-----
> From: Peter Selinger [mailto:selinger at mathstat.dal.ca] 
> Sent: Wednesday, October 18, 2006 8:57 PM
> To: Кузьменко Алексей Васильевич
> Cc: nut-upsdev at lists.alioth.debian.org
> Subject: Re: [Nut-upsdev] newhidups with APC Smart-UPS - workaround!
> 
> Thanks for your bug report and fix. As it happens, I just fixed this
> bug two days ago (Oct 16). So if you get the newest version from SVN,
> this bug should be no longer present. 
Thank you.

> 
> Nut developers: I am curious... why did upsmon shut down the system
> when the driver segfaulted? This should not really happen. What I
> expected is that the data should go stale and upsmon would send
> "communications with driver lost" type messages, not shut down the
> system. 

Weeeelll... It probably should.

You see, the driver has just enough time to say "UPS is on battery!" before segfaulting.
And it's reasonable to just shutdown now if the UPS on battery and we no longer know how much juice left in it.

If the driver segfaults while the UPS is online - upsmon just complains about "communications with driver lost" periodically.

> 
> -- Peter
> 
> 
> 
> =?koi8-r?B?69Xa2M3FzsvPIOHMxcvTxcog98HTyczYxdfJ3g==?= wrote:
> > 
> > Hi.
> > 
> > I had a problem recently with %subj, and I've solved it.
> > Sent a letter with solution to maintainers, but it seems 
> like I've lost =
> > it somewhere.
> > May be just simply forgot to write it.. But anyway.
> > 
> > I've noticed that I'm not the only one who had it. So I post the =
> > workaround.
> > 
> > The problem is similar to the one mentioned in letter with 
> alike subject =
> > at Oct. 5.
> > When the UPS (Smart-UPS 2200 in my case) switches to 
> battery, upsmon =
> > crashes instantly.
> > It's last words usually "ups.status =3D !chrg", and "bt" 
> doesn't tell =
> > anything easily understandable.
> > 
> > It was caused by a bug(?) in libusb - it disregards the 
> buffer size =
> > parameter when you get UPS data, and when switching to 
> battery, UPS =
> > fires a salvo of 15, IIRC, events, and the buffer holds 10. 
> Instant =
> > segfault!
> > 
> > The quick-and-dirty (but it hasn't failed me yet for 3 
> months in several =
> > installations) patch is below:
> > 
> > --- nut-2.0.4/drivers/newhidups.c.orig  2006-08-09 
> 11:35:32.000000000 =
> > +0400
> > +++ nut-2.0.4/drivers/newhidups.c       2006-08-09 
> 11:35:44.000000000 =
> > +0400
> > @@ -452,7 +452,7 @@
> >         hid_info_t *item;
> >         char *nutvalue;
> >         int retcode, evtCount =3D 0;
> > -       HIDItem *eventsList[10];
> > +       HIDItem *eventsList[30];
> > 
> >         upsdebugx(1, "upsdrv_updateinfo...");
> > 
> > 
> > 
> > _______________________________________________
> > Nut-upsdev mailing list
> > Nut-upsdev at lists.alioth.debian.org
> > http://lists.alioth.debian.org/mailman/listinfo/nut-upsdev
> > 
> 
> 
> 




More information about the Nut-upsdev mailing list