I made the following devd script.. sh cd /tmp fetch mkdir /usr/local/etc/devd sed -Ene 's/SYSFS\{idVendor\}==\"(.*)\", SYSFS\{idProduct\}==\"(.*)\", MODE=.*/attach 100 {\ device-name "ugen[0-9]+";\ match "vendor" "0x\1";\ match "product" "0x\2";\ action "chown @RUN_AS_GROUP@ \/dev\/$device-name*; chmod 660 \/dev\/$device-name*";\ };\ /p' </usr/ports/sysutils/nut/work/nut-2.2.0/scripts/udev/nut-usbups.rules.in | sed -e 's#@RUN_AS_GROUP@#uucp#g' > /usr/local/etc/devd/nut.conf /etc/rc.d/devd restart Unfortunately the uucp user is not in operator so it can't search the USB bus and hence the above doesn't work 100%. I think probably the best way would be to make a nutmon user that is a member of the uucp and operator group. I did that with.. echo '*LOCKED*' | pw useradd nutmon -u 95 -c 'NUT monitor user' -d /var/empty -g operator -G dialer -s /usr/sbin/nologin -H 0 then.. cd /usr/ports/sysutils/nut make NUT_USER=nutmon NUT_GROUP=operator And re-run the sed above but with operator instead of uucp. -- 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 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 187 bytes Desc: This is a digitally signed message part. Url : http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20071030/1189f9f9/attachment.pgp
On 10/29/07, Daniel O'Connor <doconnor at gsoft.com.au> wrote:> I made the following devd script..That's pretty intense, but it's a nice reuse of the udev data. If you want, we can create a packaging/FreeBSD directory (or just packaging/BSD, if devd is not specific to FreeBSD) to hold the script and instructions. Or how much of this should end up in the port files? -- - Charles Lepple
On Mon, Oct 29, 2007 at 9:45 PM, Daniel O'Connor <doconnor at gsoft.com.au> wrote:> I made the following devd script.. > > sh > cd /tmp > fetch > mkdir /usr/local/etc/devd > sed -Ene 's/SYSFS\{idVendor\}==\"(.*)\", SYSFS\{idProduct\}==\"(.*)\", MODE=.*/attach 100 {\ > device-name "ugen[0-9]+";\ > match "vendor" "0x\1";\ > match "product" "0x\2";\ > action "chown @RUN_AS_GROUP@ \/dev\/$device-name*; chmod 660 \/dev\/$device-name*";\ > };\ > /p' </usr/ports/sysutils/nut/work/nut-2.2.0/scripts/udev/nut-usbups.rules.in | sed -e 's#@RUN_AS_GROUP@#uucp#g' > /usr/local/etc/devd/nut.conf > /etc/rc.d/devd restartHi Daniel, 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? Thanks, -- - Charles Lepple
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
On Aug 13, 2014, at 11:46 PM, O'Connor, Daniel <darius at dons.net.au> wrote:> 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.Daniel, Thanks for the info. (Sorry for the delay; couldn't test on a FreeBSD box last week.) I think I have it generating things in that format now: https://github.com/clepple/nut/compare/freebsd_devd_take2 For reference, which version of FreeBSD are you using? I got this to work on 9.2 and 10.0. -- Charles Lepple clepple at gmail
On 18 Aug 2014, at 5:28, Charles Lepple <clepple at gmail.com> wrote:> On Aug 13, 2014, at 11:46 PM, O'Connor, Daniel <darius at dons.net.au> wrote: >> 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. > > Thanks for the info. (Sorry for the delay; couldn't test on a FreeBSD box last week.) I think I have it generating things in that format now: > https://github.com/clepple/nut/compare/freebsd_devd_take2Looks good!> For reference, which version of FreeBSD are you using? I got this to work on 9.2 and 10.0.It was tested on a 9.2 (ish) system. -- Daniel O'Connor "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
Reasonably Related Threads
- NUT + devd + FreeBSD
- Question on support for Upsonic Commercial UPS CXR 2000 - 2000VA/1200W - Rack/Tower on Freebsd 9.1.
- devd question
- Unable to find driver for a supported device
- Question on support for Upsonic Commercial UPS CXR 2000 - 2000VA/1200W - Rack/Tower on Freebsd 9.1.