3 # Refer to devd.conf(5) and devd(8) man pages for the details on how to
4 # run and configure devd.
7 # NB: All regular expressions have an implicit ^$ around them.
8 # NB: device-name is shorthand for 'match device-name'
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";
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|aacraid|ahc|ahd|amr|ciss|\
23 esp|ida|iir|ips|isp|mlx|mly|mpr|mps|mpt|sym|trm)\
26 "(ath|bwi|bwn|ipw|iwi|iwm|iwn|malo|mwl|otus|ral|rsu|rtwn|rum|\
27 run|uath|upgt|ural|urtw|wi|wpi|wtap|zyd)[0-9]+";
30 # Note that the attach/detach with the highest value wins, so that one can
31 # override these general rules.
34 # Configure the interface on attach. Due to a historical accident, this
35 # script is called pccard_ether. We omit the usbus devices because those
36 # devices are assocaited with the USB Bus and provide an ifnet device to
37 # allow usb traffic to be captured with usbdump(8).
39 # NB: DETACH events are ignored; the kernel should handle all cleanup
40 # (routes, arp cache). Beware of races against immediate create
41 # of a device with the same name; e.g.
42 # ifconfig bridge0 destroy; ifconfig bridge0 create
45 match "system" "IFNET";
46 match "subsystem" "!(usbus|wlan)[0-9]+";
47 match "type" "ATTACH";
48 action "/etc/pccard_ether $subsystem start";
52 # Try to start dhclient on Ethernet-like interfaces when the link comes
53 # up. Only devices that are configured to support DHCP will actually
54 # run it. No link down rule exists because dhclient automatically exits
55 # when the link goes down.
58 match "system" "IFNET";
59 match "type" "LINK_UP";
60 media-type "ethernet";
61 action "service dhclient quietstart $subsystem";
65 # Like Ethernet devices, but separate because 802.11 require spawning
69 device-name "$wifi-driver-regex";
70 action "/etc/pccard_ether $device-name startchildren";
73 device-name "$wifi-driver-regex";
74 action "/etc/pccard_ether $device-name stopchildren";
77 match "system" "IFNET";
78 match "type" "LINK_UP";
80 action "service dhclient quietstart $subsystem";
83 # An entry like this might be in a different file, but is included here
84 # as an example of how to override things. Normally 'ed50' would match
85 # the above attach/detach stuff, but the value of 100 makes it
86 # hard wired to 1.2.3.4.
89 action "ifconfig $device-name inet 1.2.3.4 netmask 0xffff0000";
95 # When a USB Bluetooth dongle appears, activate it
97 device-name "ubt[0-9]+";
98 action "service bluetooth quietstart $device-name";
101 device-name "ubt[0-9]+";
102 action "service bluetooth quietstop $device-name";
105 # Firmware downloader for Atheros AR3011 based USB Bluetooth devices
107 # match "vendor" "0x0cf3";
108 # match "product" "0x3000";
109 # action "sleep 2 && /usr/sbin/ath3kfw -d $device-name -f /usr/local/etc/ath3k-1.fw";
112 # When a USB keyboard arrives, attach it as the console keyboard.
115 action "service syscons setkeyboard /dev/ukbd0";
119 action "service syscons setkeyboard /dev/kbd0";
123 match "system" "DEVFS";
124 match "subsystem" "CDEV";
125 match "type" "CREATE";
126 match "cdev" "atp[0-9]+";
128 action "service moused quietstart $cdev";
132 match "system" "DEVFS";
133 match "subsystem" "CDEV";
134 match "type" "CREATE";
135 match "cdev" "ums[0-9]+";
137 action "service moused quietstart $cdev";
141 match "system" "DEVFS";
142 match "subsystem" "CDEV";
143 match "type" "CREATE";
144 match "cdev" "wsp[0-9]+";
146 action "service moused quietstart $cdev";
150 match "system" "DEVFS";
151 match "subsystem" "CDEV";
152 match "type" "DESTROY";
153 match "cdev" "ums[0-9]+";
155 action "service moused stop $cdev";
158 # This entry starts the ColdSync tool in daemon mode. Make sure you have an up
159 # to date /usr/local/etc/palms. We override the 'listen' settings for port and
160 # type in /usr/local/etc/coldsync.conf.
162 match "system" "USB";
163 match "subsystem" "DEVICE";
164 match "type" "ATTACH";
165 match "vendor" "0x082d";
166 match "product" "0x0100";
167 match "release" "0x0100";
168 action "/usr/local/bin/coldsync -md -p /dev/$cdev -t usb";
172 # Rescan SCSI device-names on attach, but not detach. However, it is
173 # disabled by default due to reports of problems.
176 device-name "$scsi-controller-regex";
177 // action "camcontrol rescan all";
180 # Don't even try to second guess what to do about drivers that don't
181 # match here. Instead, pass it off to syslog. Commented out for the
182 # moment, as the pnpinfo variable isn't set in devd yet. Individual
183 # variables within the bus supplied pnpinfo are set.
185 # action "logger Unknown device: $pnpinfo $location $bus";
188 # Various logging of unknown devices.
190 match "bus" "uhub[0-9]+";
191 action "logger Unknown USB device: vendor $vendor product $product \
195 # Some PC-CARDs don't offer numerical manufacturer/product IDs, just
196 # show the CIS info there.
198 match "bus" "pccard[0-9]+";
199 match "manufacturer" "0xffffffff";
200 match "product" "0xffffffff";
201 action "logger Unknown PCCARD device: CISproduct $cisproduct \
202 CIS-vendor $cisvendor bus $bus";
206 match "bus" "pccard[0-9]+";
207 action "logger Unknown PCCARD device: manufacturer $manufacturer \
208 product $product CISproduct $cisproduct CIS-vendor \
209 $cisvendor bus $bus";
213 match "bus" "cardbus[0-9]+";
214 action "logger Unknown Cardbus device: device $device class $class \
215 vendor $vendor bus $bus";
218 # Switch power profiles when the AC line state changes.
220 match "system" "ACPI";
221 match "subsystem" "ACAD";
222 action "service power_profile $notify";
225 # Notify all users before beginning emergency shutdown when we get
226 # a _CRT or _HOT thermal event and we're going to power down the system
229 match "system" "ACPI";
230 match "subsystem" "Thermal";
231 match "notify" "0xcc";
232 action "logger -p kern.emerg WARNING: system temperature too high, shutting down soon!";
235 # User requested suspend, so perform preparation steps and then execute
236 # the actual suspend process.
238 match "system" "ACPI";
239 match "subsystem" "Suspend";
240 action "/etc/rc.suspend acpi $notify";
243 match "system" "ACPI";
244 match "subsystem" "Resume";
245 action "/etc/rc.resume acpi $notify";
248 /* EXAMPLES TO END OF FILE
250 # An example of something that a vendor might install if you were to
251 # add their device. This might reside in /usr/local/etc/devd/deqna.conf.
252 # A deqna is, in this hypothetical example, a pccard ethernet-like device.
253 # Students of history may know other devices by this name, and will get
254 # the in-jokes in this entry.
256 match "bus" "pccard[0-9]+";
257 match "manufacturer" "0x1234";
258 match "product" "0x2323";
259 action "kldload -n if_deqna";
262 device-name "deqna[0-9]+";
263 action "/etc/pccard_ether $device-name start";
266 device-name "deqna[0-9]+";
267 action "/etc/pccard_ether $device-name stop";
270 # Examples of notify hooks. A notify is a generic way for a kernel
271 # subsystem to send event notification to userland.
273 # Here are some examples of ACPI notify handlers. ACPI subsystems that
274 # generate notifies include the AC adapter, power/sleep buttons,
275 # control method batteries, lid switch, and thermal zones.
277 # Information returned is not always the same as the ACPI notify
278 # events. See the ACPI specification for more information about
279 # notifies. Here is the information returned for each subsystem:
281 # ACAD: AC line state (0 is offline, 1 is online)
282 # Button: Button pressed (0 for power, 1 for sleep)
283 # CMBAT: ACPI battery events
284 # Lid: Lid state (0 is closed, 1 is open)
285 # Suspend, Resume: Suspend and resume notification
286 # Thermal: ACPI thermal zone events
288 # This example calls a script when the AC state changes, passing the
289 # notify value as the first argument. If the state is 0x00, it might
290 # call some sysctls to implement economy mode. If 0x01, it might set
291 # the mode to performance.
293 match "system" "ACPI";
294 match "subsystem" "ACAD";
295 action "/etc/acpi_ac $notify";
298 # This example works around a memory leak in PostgreSQL, restarting
299 # it when the "user:postgres:swap:devctl=1G" rctl(8) rule gets triggered.
301 match "system" "RCTL";
302 match "rule" "user:770:swap:.*";
303 action "service postgresql restart";
306 # Discard autofs caches, useful for the -media special map.
308 match "system" "GEOM";
309 match "subsystem" "DEV";
310 action "/usr/sbin/automount -c";
313 # Handle userland coredumps.
314 # This commented out handler makes it possible to run an
315 # automated debugging session after the core dump is generated.
316 # Replace action with a proper coredump handler, but be aware that
317 # it will run with elevated privileges.
319 match "system" "kernel";
320 match "subsystem" "signal";
321 match "type" "coredump";
322 action "logger $comm $core";
325 # Let the init(8) know there's a new USB serial interface it might
326 # want to run getty(8) for. This includes device-side tty created
327 # by usb_template(4).
329 match "system" "DEVFS";
330 match "subsystem" "CDEV";
331 match "type" "CREATE";
332 match "cdev" "ttyU[0-9]+";
333 action "/sbin/init q";