devd.conf revision 114852
1248782Sadrian# $FreeBSD: head/etc/devd.conf 114852 2003-05-09 05:58:22Z imp $
2248782Sadrian#
3248782Sadrian# Refer to devd.conf(5) and devd(8) man pages for the details on how to
4248782Sadrian# run and configure devd.
5248782Sadrian#
6248782Sadrian
7248782Sadrian# NB: All regular expressions have an implicit ^$ around them.
8248782Sadrian# NB: device-name is shorthand for 'match device-name'
9248782Sadrian
10248782Sadrianoptions {
11248782Sadrian	# Each directory directive adds a directory the list of directories
12248782Sadrian	# that we scan for files.  Files are read-in in the order that they
13248782Sadrian	# are returned from readdir(3).  The rule-sets are combined to
14248782Sadrian	# create a DFA that's used to match events to actions.
15248782Sadrian	directory "/etc/devd";
16248782Sadrian	directory "/usr/local/etc/devd";
17248782Sadrian	pid-file "/var/run/devd.pid";
18248782Sadrian
19248782Sadrian	# Setup some shorthand for regex that we use later in the file.
20248782Sadrian	set ethernet-nic-regex 
21248782Sadrian		"(an|ar|ath|aue|awi|bge|cm|cnw|cs|cue|dc|de|ed|el|em|ep|ex|\
22248782Sadrian		fe|fxp|gem|gx|hme|ie|kue|lge|lnc|my|nge|pcn|ray|rl|rue|\
23248782Sadrian		sf|sis|sk|sn|snc|ste|ti|tl|tx|txp|vr|vx|wb|wi|xe|xl)[0-9]+";
24248782Sadrian	set scsi-controller-regex
25248782Sadrian		"(adv|advw|aic|aha|ahb|ahc|ahd|bt|ct|iir|isp|mly|mpt|ncv|nsp|\
26248782Sadrian		stg|sym|wds)[0-9]+";
27248782Sadrian};
28248782Sadrian
29248782Sadrian# Note that the attach/detach with the highest value wins, so that one can
30248782Sadrian# override these general rules.
31248782Sadrian
32248782Sadrian#
33248782Sadrian# For ethernet like devices, the default is to run dhclient.  Due to
34248782Sadrian# a historical accident, the name of this script it called pccard_ether
35248782Sadrian#
36248782Sadrianattach 0 {
37248782Sadrian	device-name "$ethernet-nic-regex";
38248782Sadrian	action "/etc/pccard_ether $device-name start";
39248782Sadrian};
40248782Sadrian
41248782Sadriandetach 0 {
42248782Sadrian	device-name "$ethernet-nic-regex";
43248782Sadrian	action "/etc/pccard_ether $device-name stop";
44248782Sadrian};
45248782Sadrian
46248782Sadrian# An entry like this might be in a different file, but is included here
47248782Sadrian# as an example of how to override things.  Normally 'ed50' would match
48248782Sadrian# the above attach/detach stuff, but the value of 100 makes it
49248782Sadrian# ed50 is hard wired to 1.2.3.4
50248782Sadrianattach 100 {
51248782Sadrian	device-name "ed50";
52248782Sadrian	action "ifconfig $device-name inet 1.2.3.4 netmask 0xffff0000";
53248782Sadrian};
54248782Sadriandetach 100 {
55248782Sadrian	device-name "ed50";
56248782Sadrian};
57248782Sadrian
58248782Sadrian#
59248782Sadrian# Rescan scsi device-names on attach, but not detach.
60248782Sadrian#
61248782Sadrianattach 0 {
62248782Sadrian	device-name "$scsi-controller-regex";
63248782Sadrian	action "camcontrol rescan all";
64248782Sadrian};
65248782Sadrian
66248782Sadrian# Don't even try to second guess what to do about drivers that don't
67248782Sadrian# match here.  Instead, pass it off to syslog.  Commented out for the
68248782Sadrian# moment, as pnpinfo isn't set in devd yet
69248782Sadrian#nomatch 0 {
70248782Sadrian#	action "logger Unknown device: $pnpinfo $location $bus";
71248866Sadrian#};
72248782Sadrian
73248782Sadrian/* EXAMPLES TO END OF FILE
74248866Sadrian
75248782Sadrian# The following might be an example of something that a vendor might
76248866Sadrian# install if you were to add their device.  This might reside in
77248866Sadrian# /usr/local/etc/devd/deqna.conf.  A deqna is, in this hypothetical
78248866Sadrian# example, a pccard ethernet-like device.  Students of history may
79248782Sadrian# know other devices by this name, and will get the in-jokes in this
80248782Sadrian# entry.
81248782Sadriannomatch 10 {
82248782Sadrian	match "bus" "pccard[0-9]+";
83248782Sadrian	match "manufacturer" "0x1234";
84248782Sadrian	match "product" "0x2323";
85248782Sadrian	action "kldload if_deqna";
86248782Sadrian};
87248782Sadrianattach 10 {
88248782Sadrian	device-name "deqna[0-9]+";
89248782Sadrian	action "/etc/pccard_ether $device-name start";
90248782Sadrian};
91248782Sadriandetach 10 {
92	device-name "deqna[0-9]+";
93	action "/etc/pccard_ether $device-name stop";
94};
95
96*/
97