[Nut-upsuser] NUT + devd + FreeBSD

Daniel O'Connor doconnor at gsoft.com.au
Tue Aug 12 12:39:59 UTC 2014

On 18 Jul 2014, at 22:41, Charles Lepple <clepple at gmail.com> wrote:
> On Mon, Oct 29, 2007 at 9:45 PM, Daniel O'Connor <doconnor at gsoft.com.au> wrote:
>> I made the following devd script..
> Dusting off this thread, since the FreeBSD ports tree picked up NUT
> 2.7.2 and now includes an auto-generated nut-usb.conf devd file.
> However, I also noticed this PR filed against the port:
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191777
> Somewhere along the line, I must have changed things from "attach" to
> "notify", and dropped the device-name match. However, their solution
> to that bug was to remove the star after the device name. What was the
> rationale for the wildcard? Does this handle the bus scanning
> permissions?

Sorry for the delay in replying, I forgot about this email :(

I think the wildcard was there because of the way the previous USB stack worked - it created /dev/ugen0.1 (one node for each endpoint) but you only got /dev/ugen0 from devd and so if your program tried to do anything except send control messages it would fail.

With respect to device-name being empty - I guess things changed as it worked for me when I wrote it :)

I don't actually use devd.conf currently as I lost the patch so I resorted to putting the nut user in operator (bleh) which has access to the USB device nodes by default.

I did some fiddling and came up with..
notify 100 {
        match "system"          "USB";
        match "subsystem"       “DEVICE";
        match "type"            "ATTACH";
        match "vendor"          "0x0463";
        match "product"         "0xffff";
        action "chgrp uucp /dev/$cdev; chmod g+rw /dev/$cdev";

This works for my MGE Ellipse and I don’t see why it wouldn’t work more generally if your script was modified.

FYI devd sees the following when the device is connected

Processing event '!system=USB subsystem=DEVICE type=ATTACH ugen=ugen1.2 cdev=ugen1.2 vendor=0x0463 product=0xffff devclass=0x00 devsubclass=0x00 sernum="000000000" release=0x4241 mode=host port=1 parent=ugen1.1'
Pushing table
setting system=USB
setting subsystem=DEVICE
setting type=ATTACH
setting ugen=ugen1.2
setting cdev=ugen1.2
setting vendor=0x0463
setting product=0xffff
setting devclass=0x00
setting devsubclass=0x00
setting sernum=000000000
setting release=0x4241
setting mode=host
setting port=1
setting parent=ugen1.1

There is also a subsystem=INTERFACE event which is very similar.

Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
 -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C

More information about the Nut-upsuser mailing list