Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/sbin/devd/devd.conf
39475 views
1
#
2
# Refer to devd.conf(5) and devd(8) man pages for the details on how to
3
# run and configure devd.
4
#
5
6
# NB: All regular expressions have an implicit ^$ around them.
7
# NB: device-name is shorthand for 'match device-name'
8
9
options {
10
# Each "directory" directive adds a directory to the list of
11
# directories that we scan for files. Files are loaded in the order
12
# that they are returned from readdir(3). The rule-sets are combined
13
# to create a DFA that's used to match events to actions.
14
directory "/etc/devd";
15
directory "/usr/local/etc/devd";
16
pid-file "/var/run/devd.pid";
17
18
# Setup some shorthand for regex that we use later in the file.
19
#XXX Yes, this is gross -- imp
20
set wifi-driver-regex
21
"(ath|ath[0-9]+k|bwi|bwn|ipw|iwlwifi|iwi|iwm|iwn|malo|mwl|mt79|mtw|otus|\
22
ral|rsu|rtw|rtwn|rum|run|uath|upgt|ural|urtw|wpi|wtap|zyd)[0-9]+";
23
};
24
25
# Note that the attach/detach with the highest value wins, so that one can
26
# override these general rules.
27
28
#
29
# Configure the interface on attach. Due to a historical accident, this
30
# script is called pccard_ether. We omit the usbus devices because those
31
# devices are associated with the USB Bus and provide an ifnet device to
32
# allow usb traffic to be captured with usbdump(8).
33
#
34
# NB: DETACH events are ignored; the kernel should handle all cleanup
35
# (routes, arp cache). Beware of races against immediate create
36
# of a device with the same name; e.g.
37
# ifconfig bridge0 destroy; ifconfig bridge0 create
38
#
39
notify 0 {
40
match "system" "IFNET";
41
match "subsystem" "!(usbus|wlan)[0-9]+";
42
match "type" "ATTACH";
43
action "/etc/pccard_ether $subsystem start";
44
};
45
46
#
47
# Like Ethernet devices, but separate because 802.11 require spawning
48
# wlan(4) interface.
49
#
50
attach 0 {
51
device-name "$wifi-driver-regex";
52
action "/etc/pccard_ether $device-name startchildren";
53
};
54
detach 0 {
55
device-name "$wifi-driver-regex";
56
action "/etc/pccard_ether $device-name stopchildren";
57
};
58
59
# An entry like this might be in a different file, but is included here
60
# as an example of how to override things. Normally 'ed50' would match
61
# the above attach/detach stuff, but the value of 100 makes it
62
# hard wired to 1.2.3.4.
63
attach 100 {
64
device-name "ed50";
65
action "ifconfig $device-name inet 1.2.3.4 netmask 0xffff0000";
66
};
67
detach 100 {
68
device-name "ed50";
69
};
70
71
# Firmware downloader for Atheros AR3011 based USB Bluetooth devices
72
#attach 100 {
73
# match "vendor" "0x0cf3";
74
# match "product" "0x3000";
75
# action "sleep 2 && /usr/sbin/ath3kfw -d $device-name -f /usr/local/etc/ath3k-1.fw";
76
#};
77
78
# Notify all users before beginning emergency shutdown when we get
79
# a _CRT or _HOT thermal event and we're going to power down the system
80
# very soon.
81
notify 10 {
82
match "system" "ACPI";
83
match "subsystem" "Thermal";
84
match "notify" "0xcc";
85
action "logger -p kern.emerg WARNING: system temperature too high, shutting down soon!";
86
};
87
88
# User requested suspend, so perform preparation steps and then execute
89
# the actual suspend process.
90
notify 10 {
91
match "system" "ACPI";
92
match "subsystem" "Suspend";
93
action "/etc/rc.suspend acpi $notify";
94
};
95
notify 10 {
96
match "system" "ACPI";
97
match "subsystem" "Resume";
98
action "/etc/rc.resume acpi $notify";
99
};
100
101
/* EXAMPLES TO END OF FILE
102
103
# Examples of notify hooks. A notify is a generic way for a kernel
104
# subsystem to send event notification to userland.
105
106
# Here are some examples of ACPI notify handlers. ACPI subsystems that
107
# generate notifies include the AC adapter, power/sleep buttons,
108
# control method batteries, lid switch, and thermal zones.
109
#
110
# Information returned is not always the same as the ACPI notify
111
# events. See the ACPI specification for more information about
112
# notifies. Here is the information returned for each subsystem:
113
#
114
# ACAD: AC line state (0 is offline, 1 is online)
115
# Button: Button pressed (0 for power, 1 for sleep)
116
# CMBAT: ACPI battery events
117
# Lid: Lid state (0 is closed, 1 is open)
118
# Suspend, Resume: Suspend and resume notification
119
# Thermal: ACPI thermal zone events
120
#
121
# This example calls a script when the AC state changes, passing the
122
# notify value as the first argument. If the state is 0x00, it might
123
# call some sysctls to implement economy mode. If 0x01, it might set
124
# the mode to performance.
125
notify 10 {
126
match "system" "ACPI";
127
match "subsystem" "ACAD";
128
action "/etc/acpi_ac $notify";
129
};
130
131
# This example works around a memory leak in PostgreSQL, restarting
132
# it when the "user:postgres:swap:devctl=1G" rctl(8) rule gets triggered.
133
notify 0 {
134
match "system" "RCTL";
135
match "rule" "user:770:swap:.*";
136
action "service postgresql restart";
137
};
138
139
# Handle userland coredumps.
140
# This commented out handler makes it possible to run an
141
# automated debugging session after the core dump is generated.
142
# Replace action with a proper coredump handler, but be aware that
143
# it will run with elevated privileges.
144
notify 10 {
145
match "system" "kernel";
146
match "subsystem" "signal";
147
match "type" "coredump";
148
action "logger $comm $core";
149
};
150
151
# Let the init(8) know there's a new USB serial interface it might
152
# want to run getty(8) for. This includes device-side tty created
153
# by usb_template(4).
154
notify 100 {
155
match "system" "DEVFS";
156
match "subsystem" "CDEV";
157
match "type" "CREATE";
158
match "cdev" "ttyU[0-9]+";
159
action "/sbin/init q";
160
};
161
162
*/
163
164