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

Peter Selinger selinger at mathstat.dal.ca
Wed Oct 18 16:56:36 UTC 2006


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. 

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. 

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