1# $FreeBSD: src/etc/devd.conf,v 1.42 2008/06/27 12:04:36 rpaulo Exp $ 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 the list of directories 12 # that we scan for files. Files are read-in in the order that they 13 # are returned from readdir(3). The rule-sets are combined to 14 # create a DFA that's used to match events to actions. 15 directory "/etc/devd"; 16 directory "/usr/local/etc/devd"; 17 18 # Setup some shorthand for regex that we use later in the file. 19 #XXX Yes, these are gross -- imp 20 set scsi-controller-regex 21 "(aac|adv|adw|aha|ahc|ahd|aic|amd|amr|asr|bt|ciss|ct|dpt|\ 22 esp|ida|iir|ips|isp|mlx|mly|mpt|ncr|ncv|nsp|stg|sym|trm|wds)\ 23 [0-9]+"; 24}; 25 26# Note that the attach/detach with the highest value wins, so that one can 27# override these general rules. 28 29# 30# Configure the interface on attach. Due to a historical accident, this 31# script is called pccard_ether. 32# 33# notify 0 { 34# match "system" "IFNET"; 35# match "type" "ATTACH"; 36# action "/etc/pccard_ether $subsystem start"; 37# }; 38# 39# notify 0 { 40# match "system" "IFNET"; 41# match "type" "DETACH"; 42# action "/etc/pccard_ether $subsystem stop"; 43# }; 44 45# 46# Try to start dhclient on Ethernet like interfaces when the link comes 47# up. Only devices that are configured to support DHCP will actually 48# run it. No link down rule exists because dhclient automaticly exits 49# when the link goes down. 50# 51# notify 0 { 52# match "system" "IFNET"; 53# match "type" "LINK_UP"; 54# media-type "ethernet"; 55# action "/etc/rc.d/dhclient start $subsystem"; 56# }; 57 58# 59# Like Ethernet devices, but separate because 60# they have a different media type. We may want 61# to exploit this later. 62# 63# detach 0 { 64# media-type "802.11"; 65# action "/etc/pccard_ether $device-name stop"; 66# }; 67# attach 0 { 68# media-type "802.11"; 69# action "/etc/pccard_ether $device-name start"; 70# }; 71# notify 0 { 72# match "system" "IFNET"; 73# match "type" "LINK_UP"; 74# media-type "802.11"; 75# action "/etc/rc.d/dhclient start $subsystem"; 76# }; 77 78# 79# An entry like this might be in a different file, but is included here 80# as an example of how to override things. Normally 'ed50' would match 81# the above attach/detach stuff, but the value of 100 makes it 82# hard wired to 1.2.3.4. 83# attach 100 { 84# device-name "ed50"; 85# action "ifconfig $device-name inet 1.2.3.4 netmask 0xffff0000"; 86# }; 87# detach 100 { 88# device-name "ed50"; 89# }; 90 91# 92# When a USB Bluetooth dongle appears activate it. 93# XXX FIX for DragonFly XXX 94# attach 100 { 95# device-name "ubt[0-9]+"; 96# action "/etc/rc.d/bluetooth start $device-name"; 97# }; 98# detach 100 { 99# device-name "ubt[0-9]+"; 100# action "/etc/rc.d/bluetooth stop $device-name"; 101# }; 102 103# 104# When a USB keyboard arrives, attach it as the console keyboard. 105# XXX Fix for DragonFly XXX 106# attach 100 { 107# device-name "ukbd0"; 108# action "/etc/rc.d/syscons setkeyboard /dev/ukbd0"; 109# }; 110# detach 100 { 111# device-name "ukbd0"; 112# action "/etc/rc.d/syscons setkeyboard /dev/kbd0"; 113# }; 114# 115# attach 100 { 116# device-name "ums[0-9]+"; 117# action "/etc/rc.d/moused start $device-name"; 118# }; 119# 120# detach 100 { 121# device-name "ums[0-9]+"; 122# action "/etc/rc.d/moused stop $device-name"; 123# }; 124 125# 126# Rescan scsi device-names on attach, but not detach. However, it is 127# disabled by default due to reports of problems. 128# 129# attach 0 { 130# device-name "$scsi-controller-regex"; 131# action "camcontrol rescan all"; 132# }; 133# 134# Don't even try to second guess what to do about drivers that don't 135# match here. Instead, pass it off to syslog. Commented out for the 136# moment, as the pnpinfo variable isn't set in devd yet. Individual 137# variables within the bus supplied pnpinfo are set. 138# nomatch 0 { 139# action "logger Unknown device: $pnpinfo $location $bus"; 140#}; 141 142# 143# Various logging of unknown devices. 144# nomatch 10 { 145# match "bus" "uhub[0-9]+"; 146# action "logger Unknown USB device: vendor $vendor product $product \ 147# bus $bus"; 148# }; 149 150# 151# Some PC-CARDs don't offer numerical manufacturer/product IDs, just 152# show the CIS info there. 153# nomatch 20 { 154# match "bus" "pccard[0-9]+"; 155# match "manufacturer" "0xffffffff"; 156# match "product" "0xffffffff"; 157# action "logger Unknown PCCARD device: CISproduct $cisproduct \ 158# CIS-vendor $cisvendor bus $bus"; 159# }; 160# 161# nomatch 10 { 162# match "bus" "pccard[0-9]+"; 163# action "logger Unknown PCCARD device: manufacturer $manufacturer \ 164# product $product CISproduct $cisproduct CIS-vendor \ 165# $cisvendor bus $bus"; 166# }; 167# 168# nomatch 10 { 169# match "bus" "cardbus[0-9]+"; 170# action "logger Unknown Cardbus device: device $device class $class \ 171# vendor $vendor bus $bus"; 172# }; 173 174# 175# Switch power profiles when the AC line state changes. 176# notify 10 { 177# match "system" "ACPI"; 178# match "subsystem" "ACAD"; 179# action "/etc/rc.d/power_profile $notify"; 180# }; 181 182# 183# Notify all users before beginning emergency shutdown when we get 184# a _CRT or _HOT thermal event and we're going to power down the system 185# very soon. 186# notify 10 { 187# match "system" "ACPI"; 188# match "subsystem" "Thermal"; 189# match "notify" "0xcc"; 190# action "logger -p kern.emerg \ 191# 'WARNING: system temperature too high, shutting down soon!'"; 192#}; 193 194# 195# User requested suspend, so perform preparation steps and then execute 196# the actual suspend process. 197# notify 10 { 198# match "system" "ACPI"; 199# match "subsystem" "Suspend"; 200# action "/etc/rc.suspend acpi $notify"; 201# }; 202# notify 10 { 203# match "system" "ACPI"; 204# match "subsystem" "Resume"; 205# action "/etc/rc.resume acpi $notify"; 206# }; 207 208# 209# The next blocks enable volume hotkeys that can be found on the Asus EeePC 210# XXX ASUS-Eee subsystem isn't available in DragonFly 211# notify 0 { 212# match "system" "ACPI"; 213# match "subsystem" "ASUS-Eee"; 214# match "notify" "0x13"; 215# action "mixer 0"; 216# }; 217# 218# notify 0 { 219# match "system" "ACPI"; 220# match "subsystem" "ASUS-Eee"; 221# match "notify" "0x14"; 222# action "mixer vol -10"; 223# }; 224# 225# notify 0 { 226# match "system" "ACPI"; 227# match "subsystem" "ASUS-Eee"; 228# match "notify" "0x15"; 229# action "mixer vol +10"; 230# }; 231 232# 233# The following might be an example of something that a vendor might 234# install if you were to add their device. This might reside in 235# /usr/local/etc/devd/deqna.conf. A deqna is, in this hypothetical 236# example, a pccard ethernet-like device. Students of history may 237# know other devices by this name, and will get the in-jokes in this 238# entry. 239# nomatch 10 { 240# match "bus" "pccard[0-9]+"; 241# match "manufacturer" "0x1234"; 242# match "product" "0x2323"; 243# action "kldload if_deqna"; 244# }; 245# attach 10 { 246# device-name "deqna[0-9]+"; 247# action "/etc/pccard_ether $device-name start"; 248# }; 249# detach 10 { 250# device-name "deqna[0-9]+"; 251# action "/etc/pccard_ether $device-name stop"; 252# }; 253 254# 255# Examples of notify hooks. A notify is a generic way for a kernel 256# subsystem to send event notification to userland. 257# 258# Here are some examples of ACPI notify handlers. ACPI subsystems that 259# generate notifies include the AC adapter, power/sleep buttons, 260# control method batteries, lid switch, and thermal zones. 261# 262# Information returned is not always the same as the ACPI notify 263# events. See the ACPI specification for more information about 264# notifies. Here is the information returned for each subsystem: 265# 266# ACAD: AC line state (0 is offline, 1 is online) 267# Button: Button pressed (0 for power, 1 for sleep) 268# CMBAT: ACPI battery events 269# Lid: Lid state (0 is closed, 1 is open) 270# Suspend, Resume: Suspend and resume notification 271# Thermal: ACPI thermal zone events 272# 273# This example calls a script when the AC state changes, passing the 274# notify value as the first argument. If the state is 0x00, it might 275# call some sysctls to implement economy mode. If 0x01, it might set 276# the mode to performance. 277# notify 10 { 278# match "system" "ACPI"; 279# match "subsystem" "ACAD"; 280# action "/etc/acpi_ac $notify"; 281# }; 282