Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Feb 2013 14:15:41 +1100
From:      Andrew Reilly <areilly@bigpond.net.au>
To:        freebsd-ports@freebsd.org
Subject:   sysutils/nut vs 9-stable vs Eaton Ellipse MAX UPS - permissions problem?
Message-ID:  <20130203031541.GA24537@johnny.reilly.home>

next in thread | raw e-mail | index | archive | help
Hi all,

Anyone have sysutils/nut successfully configured to talk to a
UPS that relies on the usbhid-ups "driver" module?  I've been
beating my head against it for a couple of days: it tastes
close, but still no cigar.

The crux of the problem seems to be that usbhid-ups can't do
what it needs to do to the usb device after it drops root privs
and becomes user uucp, even though the various device files
appear to be owned/permissioned appropriately.  For example:

$ sudo /usr/local/libexec/nut/usbhid-ups -a eaton -DDDDDDD
Password:
Network UPS Tools - Generic HID driver 0.37 (2.6.5-Unversioned
directory)
USB communication driver 0.31
   0.000000	debug level is '7'
   0.000727	upsdrv_initups...
   0.000820	No appropriate HID device found
   0.000831	No matching HID UPS found
$ sudo /usr/local/libexec/nut/usbhid-ups -a eaton
-DDDDDDD -u root
Network UPS Tools - Generic HID driver 0.37 (2.6.5-Unversioned
directory)
USB communication driver 0.31
   0.000000	debug level is '7'
   0.000651	upsdrv_initups...
   0.001164	Checking device (0463/FFFF)
(/dev/usb//dev/ugen2.2)
   0.727679	- VendorID: 0463
   0.727702	- ProductID: ffff
   0.727706	- Manufacturer: EATON
   0.727710	- Product: Ellipse MAX
   0.727713	- Serial Number: ADYM20019
   0.727716	- Bus: /dev/usb
   0.727720	Trying to match device
   0.727752	Device matches
   6.918371	HID descriptor, method 1: (9 bytes) => 09 21 10
01 21 01 22 72 03
   6.918391	i=0, extra[i]=09, extra[i+1]=21

and on and on and on....

If I tweak the /usr/local/etc/rc.d/nut script so that the
nut_prestart and nut_poststop functions call upsdrvctl with -u
root, then the usbhid-ups driver appears to succeed and do its
thing, but then the monitor complains of not being able to open
usbhid-ups-eaton, which is presumably the monitoring socket,
which winds up being owned by root, rather than uucp.

Any pointers or suggestions gratefully accepted!

-- 
Andrew

Details: uname -a says:
FreeBSD johnny.reilly.home 9.1-STABLE FreeBSD 9.1-STABLE #3 r246214: Sat Feb  2 12:41:06 EST 2013     root@johnny.reilly.home:/usr/obj/usr/src/sys/GENERIC  amd64

nut has been installed from ports and is up-to-date.  My main
config files in /usr/local/etc/nut look like (comments elided):

nut.conf:
MODE=standalone

ups.conf:
[eaton]
        driver = usbhid-ups
        port = auto
        vendor = "EATON"
        product = "Ellipse MAX"
        vendorid = 0463
        productid = ffff
        offdelay = 120
        ondelay = 130

upsd.conf: (unchanged from install)

upsd.users:
[admin]
	password = my_ups_pass
	actions = SET
	instcmds = ALL

[upsmon]
	password = my_ups_pass
	upsmon master

upsmon.conf:
MONITOR eaton@localhost 1 upsmon my_ups_pass master
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -h +0"
POLLFREQ 5
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 15
POWERDOWNFLAG /etc/killpower
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130203031541.GA24537>