Shell Plug and play with devd

I needed a devd.conf rule file that would automatically set the permission for a /dev/ugenX.Y device node. I put this in a file under /usr/local/etc/devd/ ...

Code:
notify 100 {
    match "system" "USB";
    match "subsystem" "DEVICE";
    match "type" "ATTACH";
    match "vendor" "0x0bda";
    match "product" "0x283[28]";
    action "chmod 660 /dev/$cdev";
};

The above is working. I no longer need to manually do 'sudo chmod' on the device. In an earlier iteration - I omitted the subsystem. This caused the action to run three times. No harm but not necessary. Turns out the device sent three notifications - one for the device and one for each of its two interfaces - in that order. Matching on "DEVICE" allowed the action to run once.

For debugging - you can add this action:

Code:
    action "logger $cdev $sernum";

If you're wondering - yes you can have multiple action lines.

Now for my question - I noticed the undocumented $ugen variable. It's the same as the $cdev variable (the device node symlink under /dev). Is $ugen deprecated or just an oversight in the man page? What other variables are hiding under the hood?
 
Back
Top