Bug 242111

Summary: devd.conf(5) attach rule doesn't work for USB devices
Product: Base System Reporter: Yuri Victorovich <yuri>
Component: miscAssignee: freebsd-usb (Nobody) <usb>
Status: New ---    
Severity: Affects Only Me CC: hselasky, imp
Priority: ---    
Version: 12.0-RELEASE   
Hardware: Any   
OS: Any   

Description Yuri Victorovich freebsd_committer freebsd_triage 2019-11-20 16:34:29 UTC
I tried to use this rule:
> attach 0 {
>         match "vendor"  "0x04b4";
>         match "product" "0x6022";
>         action "/bin/echo hello $device-name >> /tmp/dev.txt";
> };

but it doesn't work (no /tmp/dev.txt appears).


But this rule works:
> notify 100 {
>         match "system"          "USB";
>         match "subsystem"       "DEVICE";
>         match "type"            "ATTACH";
>         match "vendor"  "0x04b4";
>         match "product" "0x6022";
>         action "/bin/echo hello $device-name >> /tmp/dev.txt";
> };


Some other system-supplied rules in /etc/devd.conf use the first form too, which means that they also wouldn't work when the matching device would appear?




> ugen8.5: <vendor 0x04b4 product 0x6022> at usbus8

FreeBSD xx.xx.xx 12.0-STABLE FreeBSD 12.0-STABLE r347548 GENERIC  amd64
Comment 1 Yuri Victorovich freebsd_committer freebsd_triage 2019-11-20 16:42:08 UTC
Additionally, $device-name expands to the empty string for in the above command.