Hi, I've have had some difficulties to run NUT on freebsd, but I finally managed to have something that work reliably enough. For those who may be interested, here is what I did.
Os: FreeBSD 6.2-RELEASE-p7, nut: 2.2.0, libusb: 0.1.12 First, I had to patch libusb with the changes submitted by Nevil Thatcher in the nutups forum in may 2006. Without this change, nothing works. (http://lists.alioth.debian.org/pipermail/nut-upsuser/2006-May/000992.html) At this point, I had something that more or less works, but the USB connection drops occasionaly for some reasons, and won't recover. I did not trace it enough to see what happens, but it seems that something occurs in freebsd kernel layers that bubbles to the reading process as an "IO error" (errno=EIO=5). The reason why it does not recover is still somehow obscurs to me, but I'm pretty much convinced it is related to the way the libusb layer deal with re-initialization. I'm new to this library, but it looks like the function usb_init(); (and friends) is not designed to run more than once in the process lifetime. Instead of "fixing" those parts, which would have taken a lot of time, I used another approach: I implemented a "respawn" option for the driver process, which automatically restarts the process when it exits. I also did a few changes in the driver code so that it exits whenever a USB connection problem occurs. At this point, I have something that works reliably enough. Using my UPS (MGE ellipse 750), I see about 20 losses of connection per day, and the system takes between 5 and 10s to recover. I did another change which is more cosmetic than anything else. In order to keep short reconnections silents (in my logging system), I added a grace period that delays the COMMBAD event. If the system recovers before this period, no event is issued. - Hervé
nut.patches.shar
Description: Unix shell archive
libusb.patches.shar
Description: Unix shell archive
_______________________________________________ Nut-upsuser mailing list Nut-upsuser@lists.alioth.debian.org http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser