[Nut-upsdev] Re: the future libusb interface for newhidups

Peter Selinger
Tue, 07 Feb 2006 23:42:11 -0000

I don't see this as a great problem. I simply put this in my shutdown
script, just before telling the UPS to shut off:

    if [ ! -f /proc/bus/usb/devices ]; then
        # USB has already been unmounted, but we need it to access the UPS
        echo "Re-mounting USB filesystem"
        mount -t usbfs usbfs /proc/bus/usb
    fi

I think the problem is only when using a "stock" script, so what
should really be fixed is the distribution's scripts. I don't see a
need for any libusb workaround, and there is no good way to map USB
devices to /dev entries as far as I know.

I have some instructions, by the way, on how to set up newhidups, at
http://www.mathstat.dal.ca/~selinger/ups/backups.html.
I originally wrote this before I joined the NUT developer team.
It contains what you have to put in the shutdown script.
It might still be useful as a set of step-by-step instructions.

-- Peter

Alfred Ganz wrote:
>
> Peter,
>
> You may want to have a look at the comments to Bug 164524 at
> bugzilla@redhat.com:
> 	https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=164524
> I filed this a long while ago, because of the mess we get into when
> shutting down Linux via /etc/rc.d/init.d/halt, and the UPS device no
> longer being reachable when we want shut it down.
>
> There seem to be some changes to libusb on the way, that expect us to
> use the /dev entry, which it is implied that that will be available at
> shutdown without the /proc/bus/usb tree. I sure hope there will be a
> proper way to correlate from the carefully identifed device by newhidups
> to the proper /dev device.
>
> Hope this will not be too messy! AG
>
> --
>  ----------------------------------------------------------------------
>    Alfred Ganz					alfred-ganz:at:agci.com
>    AG Consulting, Inc.				(203) 624-9667
>    440 Prospect Street # 11
>    New Haven, CT 06511
>  ----------------------------------------------------------------------
>