1 # $FreeBSD: head/etc/devd.conf 261894 2014-02-14 15:31:48Z avg $
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|adv|adw|amd|amr|asr|bt|ciss|dpt|\
23 ida|iir|ips|isp|mlx|mly|mpr|mps|mpt|ncr|sym|trm)\
26 "(ath|bwi|bwn|ipw|iwi|iwn|malo|mwl|ral|rsu|rum|run|\
27 urtw|urtwn|wi|wpi|wtap)[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.
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
43 # match "system" "IFNET";
44 # match "subsystem" "!usbus[0-9]+";
45 # match "type" "ATTACH";
46 # action "/etc/pccard_ether $subsystem start";
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.
56 # match "system" "IFNET";
57 # match "type" "LINK_UP";
58 # media-type "ethernet";
59 # action "/etc/rc.d/dhcp_client quietstart $subsystem";
63 # Like Ethernet devices, but separate because 802.11 requires spawning
67 # device-name "$wifi-driver-regex";
68 # action "/etc/pccard_ether $device-name startchildren";
71 # device-name "$wifi-driver-regex";
72 # action "/etc/pccard_ether $device-name stopchildren";
75 # match "system" "IFNET";
76 # match "type" "LINK_UP";
77 # media-type "802.11";
78 # action "/etc/rc.d/dhcp_client quietstart $subsystem";
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.
87 action "ifconfig $device-name inet 1.2.3.4 netmask 0xffff0000";
93 # When a USB Bluetooth dongle appears, activate it
95 # device-name "ubt[0-9]+";
96 # action "/etc/rc.d/bluetooth quietstart $device-name";
99 # device-name "ubt[0-9]+";
100 # action "/etc/rc.d/bluetooth quietstop $device-name";
103 # Firmware downloader for Atheros AR3011 based USB Bluetooth devices
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";
110 # When a USB keyboard arrives, attach it as the console keyboard.
112 # device-name "ukbd0";
113 # action "/etc/rc.d/syscons setkeyboard /dev/ukbd0";
116 # device-name "ukbd0";
117 # action "/etc/rc.d/syscons setkeyboard /dev/kbd0";
121 # match "system" "DEVFS";
122 # match "subsystem" "CDEV";
123 # match "type" "CREATE";
124 # match "cdev" "atp[0-9]+";
126 # action "/etc/rc.d/moused quietstart $cdev";
130 match "system" "DEVFS";
131 match "subsystem" "CDEV";
132 match "type" "CREATE";
133 match "cdev" "ums[0-9]+";
135 action "/etc/rc.d/moused quietstart $cdev";
139 # match "system" "DEVFS";
140 # match "subsystem" "CDEV";
141 # match "type" "CREATE";
142 # match "cdev" "wsp[0-9]+";
144 # action "/etc/rc.d/moused quietstart $cdev";
148 match "system" "DEVFS";
149 match "subsystem" "CDEV";
150 match "type" "DESTROY";
151 match "cdev" "ums[0-9]+";
153 action "/etc/rc.d/moused quietstop $cdev";
156 # Firmware download into the ActiveWire board. After the firmware download is
157 # done, the device detaches and reappears as something new and shiny
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";
166 # Firmware download for Entrega Serial DB25 adapter.
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";
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.
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";
188 # Rescan SCSI device-names on attach, but not detach. However, it is
189 # disabled by default due to reports of problems.
192 device-name "$scsi-controller-regex";
193 // action "camcontrol rescan all";
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.
201 # action "logger Unknown device: $pnpinfo $location $bus";
204 # Various logging of unknown devices.
206 match "bus" "uhub[0-9]+";
207 action "logger Unknown USB device: vendor $vendor product $product \
211 # Some PC-CARDs don't offer numerical manufacturer/product IDs, just
212 # show the CIS info there.
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";
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";
229 match "bus" "cardbus[0-9]+";
230 action "logger Unknown Cardbus device: device $device class $class \
231 vendor $vendor bus $bus";
234 # Switch power profiles when the AC line state changes.
236 # match "system" "ACPI";
237 # match "subsystem" "ACAD";
238 # action "/etc/rc.d/power_profile $notify";
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
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!'";
251 # User requested suspend, so perform preparation steps and then execute
252 # the actual suspend process.
254 match "system" "ACPI";
255 match "subsystem" "Suspend";
256 action "/etc/rc.suspend acpi $notify";
259 match "system" "ACPI";
260 match "subsystem" "Resume";
261 action "/etc/rc.resume acpi $notify";
264 /* EXAMPLES TO END OF FILE
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.
272 match "bus" "pccard[0-9]+";
273 match "manufacturer" "0x1234";
274 match "product" "0x2323";
275 action "kldload if_deqna";
278 device-name "deqna[0-9]+";
279 action "/etc/pccard_ether $device-name start";
282 device-name "deqna[0-9]+";
283 action "/etc/pccard_ether $device-name stop";
286 # Examples of notify hooks. A notify is a generic way for a kernel
287 # subsystem to send event notification to userland.
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.
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:
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
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.
310 match "system" "ACPI";
311 match "subsystem" "ACAD";
312 action "/etc/acpi_ac $notify";
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.
318 match "system" "RCTL";
319 match "rule" "user:70:swap:.*";
320 action "/usr/local/etc/rc.d/postgresql restart";