[Nut-upsuser] Some FreeBSD tips (was: OMNIVS1500XL and FreeBSD)
Charles Sprickman
spork at bway.net
Sat Mar 24 01:40:43 CET 2007
Hello all,
I just wanted to dump some info here for the archives.
Here's the original thread for reference:
http://lists.alioth.debian.org/pipermail/nut-upsuser/2007-March/002403.html
Charles Lepple did a tremendous amount of work to get my TrippLite USB
working on FreeBSD 6.2. I'm running an svn version (nut-2.1.0-r879) to
pick up his changes to tripplite_usb. So far, it is working well.
A few tips specific to FreeBSD that we worked out over the past month or
so follow...
If you're working with a UPS and you need to flip between talking to it as
a "ugen" device and a "uhid" device, you'll want to build a kernel that
does not include "uhid". Full kernel building instructions are here:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html
The change is pretty simple, just edit "GENERIC" and look for the "uhid"
line in the kernel config and comment it out. Build and install the new
kernel. Add a line to the boot loader config file (/boot/loader.conf)
like so: uhid_load="YES"
You now can load/unload uhid at will without rebooting.
If you currently have the uhid kernel module loaded, this will let you
start talking to the ups via ugen:
kldunload uhid.ko
unplug/replug usb connection
and vice-versa to go back to uhid:
kldload uhid.ko
unplug/replug usb connection
Another snag I ran into is that some configuration of devfs is required to
run all the NUT daemons as a non-root user. The FreeBSD port makes a
half-hearted attempt to fix this, but only for serial devices, not USB
devices.
In the following example, I've created a user/group "nut" and am going to
allow the nut user to read/write to one usb port (/dev/usb1) and the
actual UPS device (/dev/ugen0).
add the following to /etc/devfs.conf:
perm usb1 0660
own usb1 root:nut
create an /etc/devfs.rules with the following:
[usb_devices=10]
add path 'ugen*' mode 0660 group nut
add that rule to your startup settings in /etc/rc.conf:
devfs_system_ruleset="usb_devices"
and then restart devfs:
/etc/rc.d/devfs restart
Note that libusb seems to need the /dev/usbX device that your UPS hangs
off of readable by nut - it's not enough to just have /dev/ugen0 readable.
That's all for now...
Thanks,
Charles
___
Charles Sprickman
NetEng/SysAdmin
Bway.net - New York's Best Internet - www.bway.net
spork at bway.net - 212.655.9344
More information about the Nut-upsuser
mailing list