#1# Refer to devd.conf(5) and devd(8) man pages for the details on how to2# run and configure devd.3#45# NB: All regular expressions have an implicit ^$ around them.6# NB: device-name is shorthand for 'match device-name'78options {9# Each "directory" directive adds a directory to the list of10# directories that we scan for files. Files are loaded in the order11# that they are returned from readdir(3). The rule-sets are combined12# to create a DFA that's used to match events to actions.13directory "/etc/devd";14directory "/usr/local/etc/devd";15pid-file "/var/run/devd.pid";1617# Setup some shorthand for regex that we use later in the file.18#XXX Yes, this is gross -- imp19set wifi-driver-regex20"(ath|ath[0-9]+k|bwi|bwn|ipw|iwlwifi|iwi|iwm|iwn|malo|mwl|mt79|mtw|otus|\21ral|rsu|rtw|rtwn|rum|run|uath|upgt|ural|urtw|wpi|wtap|zyd)[0-9]+";22};2324# Note that the attach/detach with the highest value wins, so that one can25# override these general rules.2627#28# Configure the interface on attach. Due to a historical accident, this29# script is called pccard_ether. We omit the usbus devices because those30# devices are associated with the USB Bus and provide an ifnet device to31# allow usb traffic to be captured with usbdump(8).32#33# NB: DETACH events are ignored; the kernel should handle all cleanup34# (routes, arp cache). Beware of races against immediate create35# of a device with the same name; e.g.36# ifconfig bridge0 destroy; ifconfig bridge0 create37#38notify 0 {39match "system" "IFNET";40match "subsystem" "!(usbus|wlan)[0-9]+";41match "type" "ATTACH";42action "/etc/pccard_ether $subsystem start";43};4445#46# Like Ethernet devices, but separate because 802.11 require spawning47# wlan(4) interface.48#49attach 0 {50device-name "$wifi-driver-regex";51action "/etc/pccard_ether $device-name startchildren";52};53detach 0 {54device-name "$wifi-driver-regex";55action "/etc/pccard_ether $device-name stopchildren";56};5758# An entry like this might be in a different file, but is included here59# as an example of how to override things. Normally 'ed50' would match60# the above attach/detach stuff, but the value of 100 makes it61# hard wired to 1.2.3.4.62attach 100 {63device-name "ed50";64action "ifconfig $device-name inet 1.2.3.4 netmask 0xffff0000";65};66detach 100 {67device-name "ed50";68};6970# Firmware downloader for Atheros AR3011 based USB Bluetooth devices71#attach 100 {72# match "vendor" "0x0cf3";73# match "product" "0x3000";74# action "sleep 2 && /usr/sbin/ath3kfw -d $device-name -f /usr/local/etc/ath3k-1.fw";75#};7677# Notify all users before beginning emergency shutdown when we get78# a _CRT or _HOT thermal event and we're going to power down the system79# very soon.80notify 10 {81match "system" "ACPI";82match "subsystem" "Thermal";83match "notify" "0xcc";84action "logger -p kern.emerg WARNING: system temperature too high, shutting down soon!";85};8687# User requested suspend, so perform preparation steps and then execute88# the actual suspend process.89notify 10 {90match "system" "ACPI";91match "subsystem" "Suspend";92action "/etc/rc.suspend acpi $notify";93};94notify 10 {95match "system" "ACPI";96match "subsystem" "Resume";97action "/etc/rc.resume acpi $notify";98};99100/* EXAMPLES TO END OF FILE101102# Examples of notify hooks. A notify is a generic way for a kernel103# subsystem to send event notification to userland.104105# Here are some examples of ACPI notify handlers. ACPI subsystems that106# generate notifies include the AC adapter, power/sleep buttons,107# control method batteries, lid switch, and thermal zones.108#109# Information returned is not always the same as the ACPI notify110# events. See the ACPI specification for more information about111# notifies. Here is the information returned for each subsystem:112#113# ACAD: AC line state (0 is offline, 1 is online)114# Button: Button pressed (0 for power, 1 for sleep)115# CMBAT: ACPI battery events116# Lid: Lid state (0 is closed, 1 is open)117# Suspend, Resume: Suspend and resume notification118# Thermal: ACPI thermal zone events119#120# This example calls a script when the AC state changes, passing the121# notify value as the first argument. If the state is 0x00, it might122# call some sysctls to implement economy mode. If 0x01, it might set123# the mode to performance.124notify 10 {125match "system" "ACPI";126match "subsystem" "ACAD";127action "/etc/acpi_ac $notify";128};129130# This example works around a memory leak in PostgreSQL, restarting131# it when the "user:postgres:swap:devctl=1G" rctl(8) rule gets triggered.132notify 0 {133match "system" "RCTL";134match "rule" "user:770:swap:.*";135action "service postgresql restart";136};137138# Handle userland coredumps.139# This commented out handler makes it possible to run an140# automated debugging session after the core dump is generated.141# Replace action with a proper coredump handler, but be aware that142# it will run with elevated privileges.143notify 10 {144match "system" "kernel";145match "subsystem" "signal";146match "type" "coredump";147action "logger $comm $core";148};149150# Let the init(8) know there's a new USB serial interface it might151# want to run getty(8) for. This includes device-side tty created152# by usb_template(4).153notify 100 {154match "system" "DEVFS";155match "subsystem" "CDEV";156match "type" "CREATE";157match "cdev" "ttyU[0-9]+";158action "/sbin/init q";159};160161*/162163164