xref: /dragonfly/etc/devd.conf (revision 3d33658b)
1# $FreeBSD: head/etc/devd.conf 261894 2014-02-14 15:31:48Z avg $
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# NB: device-name is shorthand for 'match device-name'
9
10options {
11	# Each "directory" directive adds a directory to the list of
12	# directories that we scan for files.  Files are loaded in the order
13	# that they are returned from readdir(3).  The rule-sets are combined
14	# to create a DFA that's used to match events to actions.
15	directory "/etc/devd";
16	directory "/usr/local/etc/devd";
17	pid-file "/var/run/devd.pid";
18
19	# Setup some shorthand for regex that we use later in the file.
20	#XXX Yes, these are gross -- imp
21	set scsi-controller-regex
22		"(aac|adv|adw|amd|amr|asr|bt|ciss|dpt|\
23		ida|iir|ips|isp|mlx|mly|mpr|mps|mpt|ncr|sym|trm)\
24		[0-9]+";
25	set wifi-driver-regex
26		"(ath|bwi|bwn|ipw|iwi|iwn|malo|mwl|ral|rsu|rum|run|\
27		urtw|urtwn|wi|wpi|wtap)[0-9]+";
28};
29
30# Note that the attach/detach with the highest value wins, so that one can
31# override these general rules.
32
33#
34# Configure the interface on attach.  Due to a historical accident, this
35# script is called pccard_ether.
36#
37# NB: DETACH events are ignored; the kernel should handle all cleanup
38#     (routes, arp cache).  Beware of races against immediate create
39#     of a device with the same name; e.g.
40#     ifconfig bridge0 destroy; ifconfig bridge0 create
41#
42#notify 0 {
43#	match "system"		"IFNET";
44#	match "subsystem"	"!usbus[0-9]+";
45#	match "type"		"ATTACH";
46#	action "/etc/pccard_ether $subsystem start";
47#};
48
49#
50# Try to start DHCP client on Ethernet-like interfaces when the link comes
51# up.  Only devices that are configured to support DHCP will actually
52# run it.  No link down rule exists because DHCP client automatically exits
53# when the link goes down.
54#
55#notify 0 {
56#	match "system"		"IFNET";
57#	match "type"		"LINK_UP";
58#	media-type		"ethernet";
59#	action "/etc/rc.d/dhcp_client quietstart $subsystem";
60#};
61
62#
63# Like Ethernet devices, but separate because 802.11 requires spawning
64# wlan(4) interface.
65#
66#attach 0 {
67#	device-name "$wifi-driver-regex";
68#	action "/etc/pccard_ether $device-name startchildren";
69#};
70#detach 0 {
71#	device-name "$wifi-driver-regex";
72#	action "/etc/pccard_ether $device-name stopchildren";
73#};
74#notify 0 {
75#	match "system"		"IFNET";
76#	match "type"		"LINK_UP";
77#	media-type		"802.11";
78#	action "/etc/rc.d/dhcp_client quietstart $subsystem";
79#};
80
81# An entry like this might be in a different file, but is included here
82# as an example of how to override things.  Normally 'ed50' would match
83# the above attach/detach stuff, but the value of 100 makes it
84# hard wired to 1.2.3.4.
85attach 100 {
86	device-name "ed50";
87	action "ifconfig $device-name inet 1.2.3.4 netmask 0xffff0000";
88};
89detach 100 {
90	device-name "ed50";
91};
92
93# When a USB Bluetooth dongle appears, activate it
94#attach 100 {
95#	device-name "ubt[0-9]+";
96#	action "/etc/rc.d/bluetooth quietstart $device-name";
97#};
98#detach 100 {
99#	device-name "ubt[0-9]+";
100#	action "/etc/rc.d/bluetooth quietstop $device-name";
101#};
102
103# Firmware downloader for Atheros AR3011 based USB Bluetooth devices
104#attach 100 {
105#	match "vendor" "0x0cf3";
106#	match "product" "0x3000";
107#	action "sleep 2 && /usr/sbin/ath3kfw -d $device-name -f /usr/local/etc/ath3k-1.fw";
108#};
109
110# When a USB keyboard arrives, attach it as the console keyboard.
111#attach 100 {
112#	device-name "ukbd0";
113#	action "/etc/rc.d/syscons setkeyboard /dev/ukbd0";
114#};
115#detach 100 {
116#	device-name "ukbd0";
117#	action "/etc/rc.d/syscons setkeyboard /dev/kbd0";
118#};
119
120#notify 100 {
121#	match "system" "DEVFS";
122#	match "subsystem" "CDEV";
123#	match "type" "CREATE";
124#	match "cdev" "atp[0-9]+";
125#
126#	action "/etc/rc.d/moused quietstart $cdev";
127#};
128
129notify 100 {
130	match "system" "DEVFS";
131	match "subsystem" "CDEV";
132	match "type" "CREATE";
133	match "cdev" "ums[0-9]+";
134
135	action "/etc/rc.d/moused quietstart $cdev";
136};
137
138#notify 100 {
139#	match "system" "DEVFS";
140#	match "subsystem" "CDEV";
141#	match "type" "CREATE";
142#	match "cdev" "wsp[0-9]+";
143#
144#	action "/etc/rc.d/moused quietstart $cdev";
145#};
146
147notify 100 {
148	match "system" "DEVFS";
149	match "subsystem" "CDEV";
150	match "type" "DESTROY";
151	match "cdev" "ums[0-9]+";
152
153	action "/etc/rc.d/moused quietstop $cdev";
154};
155
156# Firmware download into the ActiveWire board. After the firmware download is
157# done, the device detaches and reappears as something new and shiny
158# automatically.
159attach 100 {
160	match "vendor"	"0x0854";
161	match "product"	"0x0100";
162	match "release"	"0x0000";
163	action "/usr/local/bin/ezdownload -f /usr/local/share/usb/firmware/0854.0100.0_01.hex $device-name";
164};
165
166# Firmware download for Entrega Serial DB25 adapter.
167attach 100 {
168	match "vendor"	"0x1645";
169	match "product"	"0x8001";
170	match "release"	"0x0101";
171	action "if ! kldstat -n usio > /dev/null 2>&1 ; then kldload usio; fi; /usr/sbin/ezdownload -v -f /usr/share/usb/firmware/1645.8001.0101 /dev/$device-name";
172};
173
174# This entry starts the ColdSync tool in daemon mode. Make sure you have an up
175# to date /usr/local/etc/palms. We override the 'listen' settings for port and
176# type in /usr/local/etc/coldsync.conf.
177notify 100 {
178	match "system"		"USB";
179	match "subsystem"	"DEVICE";
180	match "type"		"ATTACH";
181	match "vendor"		"0x082d";
182	match "product"		"0x0100";
183	match "release"		"0x0100";
184	action "/usr/local/bin/coldsync -md -p /dev/$cdev -t usb";
185};
186
187#
188# Rescan SCSI device-names on attach, but not detach.  However, it is
189# disabled by default due to reports of problems.
190#
191attach 0 {
192	device-name "$scsi-controller-regex";
193//	action "camcontrol rescan all";
194};
195
196# Don't even try to second guess what to do about drivers that don't
197# match here.  Instead, pass it off to syslog.  Commented out for the
198# moment, as the pnpinfo variable isn't set in devd yet.  Individual
199# variables within the bus supplied pnpinfo are set.
200nomatch 0 {
201#	action "logger Unknown device: $pnpinfo $location $bus";
202};
203
204# Various logging of unknown devices.
205nomatch 10 {
206	match "bus" "uhub[0-9]+";
207	action "logger Unknown USB device: vendor $vendor product $product \
208		bus $bus";
209};
210
211# Some PC-CARDs don't offer numerical manufacturer/product IDs, just
212# show the CIS info there.
213nomatch 20 {
214	match "bus" "pccard[0-9]+";
215	match "manufacturer" "0xffffffff";
216	match "product" "0xffffffff";
217	action "logger Unknown PCCARD device: CISproduct $cisproduct \
218		CIS-vendor $cisvendor bus $bus";
219};
220
221nomatch 10 {
222	match "bus" "pccard[0-9]+";
223	action "logger Unknown PCCARD device: manufacturer $manufacturer \
224		product $product CISproduct $cisproduct CIS-vendor \
225		$cisvendor bus $bus";
226};
227
228nomatch 10 {
229	match "bus" "cardbus[0-9]+";
230	action "logger Unknown Cardbus device: device $device class $class \
231		vendor $vendor bus $bus";
232};
233
234# Switch power profiles when the AC line state changes.
235#notify 10 {
236#	match "system"		"ACPI";
237#	match "subsystem"	"ACAD";
238#	action "/etc/rc.d/power_profile $notify";
239#};
240
241# Notify all users before beginning emergency shutdown when we get
242# a _CRT or _HOT thermal event and we're going to power down the system
243# very soon.
244notify 10 {
245	match "system"		"ACPI";
246	match "subsystem"	"Thermal";
247	match "notify"		"0xcc";
248	action "logger -p kern.emerg 'WARNING: system temperature too high, shutting down soon!'";
249};
250
251# User requested suspend, so perform preparation steps and then execute
252# the actual suspend process.
253notify 10 {
254	match "system"		"ACPI";
255	match "subsystem"	"Suspend";
256	action "/etc/rc.suspend acpi $notify";
257};
258notify 10 {
259	match "system"		"ACPI";
260	match "subsystem"	"Resume";
261	action "/etc/rc.resume acpi $notify";
262};
263
264/* EXAMPLES TO END OF FILE
265
266# An example of something that a vendor might install if you were to
267# add their device.  This might reside in /usr/local/etc/devd/deqna.conf.
268# A deqna is, in this hypothetical example, a pccard ethernet-like device.
269# Students of history may know other devices by this name, and will get
270# the in-jokes in this entry.
271nomatch 10 {
272	match "bus" "pccard[0-9]+";
273	match "manufacturer" "0x1234";
274	match "product" "0x2323";
275	action "kldload if_deqna";
276};
277attach 10 {
278	device-name "deqna[0-9]+";
279	action "/etc/pccard_ether $device-name start";
280};
281detach 10 {
282	device-name "deqna[0-9]+";
283	action "/etc/pccard_ether $device-name stop";
284};
285
286# Examples of notify hooks.  A notify is a generic way for a kernel
287# subsystem to send event notification to userland.
288
289# Here are some examples of ACPI notify handlers.  ACPI subsystems that
290# generate notifies include the AC adapter, power/sleep buttons,
291# control method batteries, lid switch, and thermal zones.
292#
293# Information returned is not always the same as the ACPI notify
294# events.  See the ACPI specification for more information about
295# notifies.  Here is the information returned for each subsystem:
296#
297# ACAD:            AC line state (0 is offline, 1 is online)
298# Button:          Button pressed (0 for power, 1 for sleep)
299# CMBAT:           ACPI battery events
300# Lid:             Lid state (0 is closed, 1 is open)
301# RCTL:            Resource limits
302# Suspend, Resume: Suspend and resume notification
303# Thermal:         ACPI thermal zone events
304#
305# This example calls a script when the AC state changes, passing the
306# notify value as the first argument.  If the state is 0x00, it might
307# call some sysctls to implement economy mode.  If 0x01, it might set
308# the mode to performance.
309notify 10 {
310	match "system"		"ACPI";
311	match "subsystem"	"ACAD";
312	action			"/etc/acpi_ac $notify";
313};
314
315# This example works around a memory leak in PostgreSQL, restarting
316# it when the "user:pgsql:swap:devctl=1G" rctl(8) rule gets triggered.
317notify 0 {
318	match "system"		"RCTL";
319	match "rule"		"user:70:swap:.*";
320	action			"/usr/local/etc/rc.d/postgresql restart";
321};
322
323*/
324