Bug 242111 - devd.conf(5) attach rule doesn't work for USB devices
Summary: devd.conf(5) attach rule doesn't work for USB devices
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 12.0-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-usb (Nobody)
Depends on:
Reported: 2019-11-20 16:34 UTC by Yuri Victorovich
Modified: 2019-11-22 23:42 UTC (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Victorovich freebsd_committer 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 2019-11-20 16:42:08 UTC
Additionally, $device-name expands to the empty string for in the above command.