devd.conf revision 121493
164562Sgshapiro# $FreeBSD: head/etc/devd.conf 121493 2003-10-25 05:03:25Z njl $
264562Sgshapiro#
3261194Sgshapiro# Refer to devd.conf(5) and devd(8) man pages for the details on how to
464562Sgshapiro# run and configure devd.
564562Sgshapiro#
664562Sgshapiro
764562Sgshapiro# NB: All regular expressions have an implicit ^$ around them.
864562Sgshapiro# NB: device-name is shorthand for 'match device-name'
964562Sgshapiro
1064562Sgshapirooptions {
1164562Sgshapiro	# Each directory directive adds a directory the list of directories
1264562Sgshapiro	# that we scan for files.  Files are read-in in the order that they
13266527Sgshapiro	# are returned from readdir(3).  The rule-sets are combined to
1464562Sgshapiro	# create a DFA that's used to match events to actions.
1564562Sgshapiro	directory "/etc/devd";
1664562Sgshapiro	directory "/usr/local/etc/devd";
1764562Sgshapiro	pid-file "/var/run/devd.pid";
1864562Sgshapiro
19132943Sgshapiro	# Setup some shorthand for regex that we use later in the file.
2064562Sgshapiro	set ethernet-nic-regex 
2164562Sgshapiro		"(an|ar|ath|aue|awi|bfe|bge|cm|cnw|cs|cue|dc|de|ed|el|em|ep|\
2264562Sgshapiro		ex|fe|fxp|gem|gx|hme|ie|kue|lge|lnc|my|nge|pcn|ray|re|rl|rue|\
2364562Sgshapiro		sf|sis|sk|sn|snc|ste|ti|tl|tx|txp|vr|vx|wb|wi|xe|xl)[0-9]+";
2464562Sgshapiro	set scsi-controller-regex
25132943Sgshapiro		"(adv|advw|aic|aha|ahb|ahc|ahd|bt|ct|iir|isp|mly|mpt|ncv|nsp|\
2664562Sgshapiro		stg|sym|wds)[0-9]+";
2764562Sgshapiro};
28132943Sgshapiro
2990792Sgshapiro# Note that the attach/detach with the highest value wins, so that one can
3090792Sgshapiro# override these general rules.
3190792Sgshapiro
3290792Sgshapiro#
33132943Sgshapiro# For ethernet like devices, the default is to run dhclient.  Due to
34132943Sgshapiro# a historical accident, the name of this script it called pccard_ether
35132943Sgshapiro#
36132943Sgshapiroattach 0 {
37132943Sgshapiro	device-name "$ethernet-nic-regex";
38285229Sgshapiro	action "/etc/pccard_ether $device-name start";
39285229Sgshapiro};
4064562Sgshapiro
4164562Sgshapirodetach 0 {
4264562Sgshapiro	device-name "$ethernet-nic-regex";
4394334Sgshapiro	action "/etc/pccard_ether $device-name stop";
44223067Sgshapiro};
4564562Sgshapiro
4664562Sgshapiro# An entry like this might be in a different file, but is included here
4794334Sgshapiro# as an example of how to override things.  Normally 'ed50' would match
48223067Sgshapiro# the above attach/detach stuff, but the value of 100 makes it
49# ed50 is hard wired to 1.2.3.4
50attach 100 {
51	device-name "ed50";
52	action "ifconfig $device-name inet 1.2.3.4 netmask 0xffff0000";
53};
54detach 100 {
55	device-name "ed50";
56};
57
58#
59# Rescan scsi device-names on attach, but not detach.
60#
61attach 0 {
62	device-name "$scsi-controller-regex";
63	action "camcontrol rescan all";
64};
65
66# Don't even try to second guess what to do about drivers that don't
67# match here.  Instead, pass it off to syslog.  Commented out for the
68# moment, as pnpinfo isn't set in devd yet
69nomatch 0 {
70#	action "logger Unknown device: $pnpinfo $location $bus";
71};
72
73/* EXAMPLES TO END OF FILE
74
75# The following might be an example of something that a vendor might
76# install if you were to add their device.  This might reside in
77# /usr/local/etc/devd/deqna.conf.  A deqna is, in this hypothetical
78# example, a pccard ethernet-like device.  Students of history may
79# know other devices by this name, and will get the in-jokes in this
80# entry.
81nomatch 10 {
82	match "bus" "pccard[0-9]+";
83	match "manufacturer" "0x1234";
84	match "product" "0x2323";
85	action "kldload if_deqna";
86};
87attach 10 {
88	device-name "deqna[0-9]+";
89	action "/etc/pccard_ether $device-name start";
90};
91detach 10 {
92	device-name "deqna[0-9]+";
93	action "/etc/pccard_ether $device-name stop";
94};
95
96# Examples of notify hooks.  A notify is a generic way for a kernel
97# subsystem to send event notification to userland.
98#
99# Here are some examples of ACPI notify handlers.  ACPI subsystems that
100# generate notifies include the AC adapter, power/sleep buttons,
101# control method batteries, lid switch, and thermal zones.
102#
103# Information returned is not always the same as the ACPI notify
104# events.  See the ACPI specification for more information about
105# notifies.  Here is the information returned for each subsystem:
106#
107# ACAD:		AC line state (0 is offline, 1 is online)
108# Button:	Button pressed (0 for power, 1 for sleep)
109# CMBAT:	ACPI battery events
110# Lid:		Lid state (0 is closed, 1 is open)
111# Thermal:	ACPI thermal zone events
112#
113# This example calls a script when the AC state changes, passing the
114# notify value as the first argument.  If the state is 0x00, it might
115# call some sysctls to implement economy mode.  If 0x01, it might set
116# the mode to performance.
117notify 10 {
118	match "system"		"ACPI";
119	match "subsystem"	"ACAD";
120	action			"/etc/acpi_ac $notify";
121};
122*/
123