1// $FreeBSD$ 2// 3// Refer to devd.conf(5) and devd(8) man pages for the details on how to 4// run and configure devd. 5// 6 7// NB: All regular expressions have an implicit ^$ around them. 8 9options { 10 // Each directory directive adds a directory the list of directories 11 // that we scan for files. Files are read-in in the order that they 12 // are returned from readdir(3). The rule-sets are combined to 13 // create a DFA that's used to match events to actions. 14 directory "/etc/devd"; 15 directory "/usr/local/etc/devd"; 16 pid-file "/var/run/devd.pid"; 17 18 // Setup some shorthand for regex that we use later in the file. 19 set ethernet-nic-regex 20 "(an|ar|aue|awi|bge|cm|cnw|cs|cue|dc|de|ed|el|em|ep|ex|\ 21 fe|fxp|gem|gx|hme|ie|kue|lge|lnc|my|nge|pcn|ray|rl|\ 22 sf|sis|sk|sn|snc|ste|ti|tl|tx|txp|vr|vx|wb|wi|xe|xl)[0-9]+"; 23 set scsi-controller-regex 24 "(adv|advw|aic|aha|ahb|ahc|ahd|bt|ct|iir|isp|mly|mpt|ncv|nsp|\ 25 stg|sym|wds)[0-9]+"; 26}; 27 28// Note that the attach/detach with the highest value wins, so that one can 29// override these general rules. 30 31// NB: device-name is shorthand for 'match device-name' 32 33// 34// For ethernet like devices, the default is to run dhclient. Due to 35// a historical accident, the name of this script it called pccard_ether 36// 37attach 0 { 38 device-name "$ethernet-nic-regex"; 39 action "/etc/pccard_ether $device-name start"; 40}; 41 42detach 0 { 43 device-name "$ethernet-nic-regex"; 44 action "/etc/pccard_ether $device-name stop"; 45}; 46 47// An entry like this might be in a different file, but is included here 48// as an example of how to override things. Normally 'ed20' would match 49// the above attach/detach stuff, but the value of 100 makes it 50// ed20 is hard wired to 1.2.3.4 51attach 100 { 52 device-name "ed20"; 53 action "ifconfig $device-name inet 1.2.3.4 netmask 0xffff0000"; 54}; 55detach 100 { 56 device-name "ed20"; 57}; 58 59// 60// Rescan scsi device-names on attach, but not detach. 61// 62attach 0 { 63 device-name "$scsi-controller-regex"; 64 action "camcontrol rescan all"; 65}; 66 67// Don't even try to second guess what to do about drivers that don't 68// match here. Instead, pass it off to a smart script to deal. 69nomatch 0 { 70 action "/usr/local/bin/smart-loader $pnpinfo $location $bus"; 71}; 72 73// The following might be an example of something that a vendor might 74// install if you were to add their device. This might reside in 75// /usr/local/etc/devd/deqna.conf. A deqna is, in this hypothetical 76// example, a pccard ethernet-like device. Students of history may 77// know other devices by this name, and will get the in-jokes in this 78// entry. 79nomatch 10 { 80 match "bus" "pccard[0-9]+"; 81 match "manufacturer" "0x1234"; 82 match "product" "0x2323"; 83 action "kldload if_deqna"; 84}; 85attach 10 { 86 device-name "^deqna[0-9]+"; 87 action "/etc/pccard_ether $device-name start"; 88}; 89detach 10 { 90 device-name "^deqna[0-9]+"; 91 action "/etc/pccard_ether $device-name stop"; 92}; 93