[Bug 198015] devd(8) overwrites "bus" on ugen event

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Feb 24 21:47:23 UTC 2015


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198015

            Bug ID: 198015
           Summary: devd(8) overwrites "bus" on ugen event
           Product: Base System
           Version: 10.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: usb
          Assignee: freebsd-usb at FreeBSD.org
          Reporter: johan at stromnet.se

Problem:
When trying to match a uftdi device arrival, "bus" variable is overwritten.
This means I cannot know which /dev/ugenN.N node to work with (which in my case
is chown to a specific user).

Example: (FreeBSD 10.1, devd in console mode):

Sample devd script:
   attach 10 {
      device-name "uftdi[0-9]+";
      action "chgrp dialer /dev/ugen$bus.$devaddr; chmod 660
/dev/ugen$bus.$devaddr"
   };

Processing event '+uftdi0 at bus=0 hubaddr=1 port=3 devaddr=2 interface=0
vendor=0x1781 product=0x0c30 devclass=0x00 devsubclass=0x00 sernum="XXXXXX"
release=0x0600 mode=host intclass=0xff intsubclass=0xff intprotocol=0xff 
ttyname=U0 ttyports=1 on uhub1'
Pushing table
setting device-name=uftdi0
setting bus=0
setting hubaddr=1
setting port=3
setting devaddr=2
setting interface=0
setting vendor=0x1781
setting product=0x0c30
setting devclass=0x00
setting devsubclass=0x00
setting sernum=A6008W8a
setting release=0x0600
setting mode=host
setting intclass=0xff
setting intsubclass=0xff
setting intprotocol=0xff
setting ttyname=U0
setting ttyports=1
setting bus=uhub1
Processing attach event
Testing device-name=uftdi0 against ^ed50$, invert=0
Testing device-name=uftdi0 against ^ubt[0-9]+$, invert=0
Testing device-name=uftdi0 against ^ukbd0$, invert=0
Testing vendor=0x1781 against ^0x0854$, invert=0
Testing vendor=0x1781 against ^0x1645$, invert=0
Testing device-name=uftdi0 against ^uftdi[0-9]+$, invert=0
Testing vendor=0x1781 against ^0x0403$, invert=0
Testing device-name=uftdi0 against ^uftdi[0-9]+$, invert=0
Testing vendor=0x1781 against ^0x1781$, invert=0
Testing product=0x0c30 against ^0x0c30$, invert=0
Executing 'chgrp dialer /dev/ugenuhub1.2; chmod 660 /dev/ugenuhub1.2'
chgrp: /dev/ugenuhub1.2: No such file or directory
chmod: /dev/ugenuhub1.2: No such file or directory
Popping table


My suspect:
https://github.com/freebsd/freebsd/blob/master/sbin/devd/devd.cc#L821



Is there any other way to reliably get the corresponding ugen device?

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-usb mailing list