]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sbin/devd/devd.conf
Add UPDATING entries and bump version.
[FreeBSD/FreeBSD.git] / sbin / devd / devd.conf
1 # $FreeBSD$
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
10 options {
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";
18
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|aha|ahc|ahd|aic|amr|bt|ciss|dpt|\
23                 esp|ida|iir|ips|isp|mlx|mly|mpr|mps|mpt|ncr|ncv|nsp|stg|sym|\
24                 trm)\
25                 [0-9]+";
26         set wifi-driver-regex
27                 "(ath|bwi|bwn|ipw|iwi|iwm|iwn|malo|mwl|otus|ral|rsu|rtwn|rum|\
28                 run|uath|upgt|ural|urtw|wi|wpi|wtap|zyd)[0-9]+";
29 };
30
31 # Note that the attach/detach with the highest value wins, so that one can
32 # override these general rules.
33
34 #
35 # Configure the interface on attach.  Due to a historical accident, this
36 # script is called pccard_ether.
37 #
38 # NB: DETACH events are ignored; the kernel should handle all cleanup
39 #     (routes, arp cache).  Beware of races against immediate create
40 #     of a device with the same name; e.g.
41 #     ifconfig bridge0 destroy; ifconfig bridge0 create
42 #
43 notify 0 {
44         match "system"          "IFNET";
45         match "subsystem"       "!(usbus|wlan)[0-9]+";
46         match "type"            "ATTACH";
47         action "/etc/pccard_ether $subsystem start";
48 };
49
50 #
51 # Try to start dhclient on Ethernet-like interfaces when the link comes
52 # up.  Only devices that are configured to support DHCP will actually
53 # run it.  No link down rule exists because dhclient automatically exits
54 # when the link goes down.
55 #
56 notify 0 {
57         match "system"          "IFNET";
58         match "type"            "LINK_UP";
59         media-type              "ethernet";
60         action "service dhclient quietstart $subsystem";
61 };
62
63 #
64 # Like Ethernet devices, but separate because 802.11 require spawning
65 # wlan(4) interface.
66 #
67 attach 0 {
68         device-name "$wifi-driver-regex";
69         action "/etc/pccard_ether $device-name startchildren";
70 };
71 detach 0 {
72         device-name "$wifi-driver-regex";
73         action "/etc/pccard_ether $device-name stopchildren";
74 };
75 notify 0 {
76         match "system"          "IFNET";
77         match "type"            "LINK_UP";
78         media-type              "802.11";
79         action "service dhclient quietstart $subsystem";
80 };
81
82 # An entry like this might be in a different file, but is included here
83 # as an example of how to override things.  Normally 'ed50' would match
84 # the above attach/detach stuff, but the value of 100 makes it
85 # hard wired to 1.2.3.4.
86 attach 100 {
87         device-name "ed50";
88         action "ifconfig $device-name inet 1.2.3.4 netmask 0xffff0000";
89 };
90 detach 100 {
91         device-name "ed50";
92 };
93
94 # When a USB Bluetooth dongle appears, activate it
95 attach 100 {
96         device-name "ubt[0-9]+";
97         action "service bluetooth quietstart $device-name";
98 };
99 detach 100 {
100         device-name "ubt[0-9]+";
101         action "service bluetooth quietstop $device-name";
102 };
103
104 # Firmware downloader for Atheros AR3011 based USB Bluetooth devices
105 #attach 100 {
106 #       match "vendor" "0x0cf3";
107 #       match "product" "0x3000";
108 #       action "sleep 2 && /usr/sbin/ath3kfw -d $device-name -f /usr/local/etc/ath3k-1.fw";
109 #};
110
111 # When a USB keyboard arrives, attach it as the console keyboard.
112 attach 100 {
113         device-name "ukbd0";
114         action "service syscons setkeyboard /dev/ukbd0";
115 };
116 detach 100 {
117         device-name "ukbd0";
118         action "service syscons setkeyboard /dev/kbd0";
119 };
120
121 notify 100 {
122         match "system" "DEVFS";
123         match "subsystem" "CDEV";
124         match "type" "CREATE";
125         match "cdev" "atp[0-9]+";
126
127         action "service moused quietstart $cdev";
128 };
129
130 notify 100 {
131         match "system" "DEVFS";
132         match "subsystem" "CDEV";
133         match "type" "CREATE";
134         match "cdev" "ums[0-9]+";
135
136         action "service moused quietstart $cdev";
137 };
138
139 notify 100 {
140         match "system" "DEVFS";
141         match "subsystem" "CDEV";
142         match "type" "CREATE";
143         match "cdev" "wsp[0-9]+";
144
145         action "service moused quietstart $cdev";
146 };
147
148 notify 100 {
149         match "system" "DEVFS";
150         match "subsystem" "CDEV";
151         match "type" "DESTROY";
152         match "cdev" "ums[0-9]+";
153
154         action "service moused stop $cdev";
155 };
156
157 # This entry starts the ColdSync tool in daemon mode. Make sure you have an up
158 # to date /usr/local/etc/palms. We override the 'listen' settings for port and
159 # type in /usr/local/etc/coldsync.conf.
160 notify 100 {
161         match "system"          "USB";
162         match "subsystem"       "DEVICE";
163         match "type"            "ATTACH";
164         match "vendor"          "0x082d";
165         match "product"         "0x0100";
166         match "release"         "0x0100";
167         action "/usr/local/bin/coldsync -md -p /dev/$cdev -t usb";
168 };
169
170 #
171 # Rescan SCSI device-names on attach, but not detach.  However, it is
172 # disabled by default due to reports of problems.
173 #
174 attach 0 {
175         device-name "$scsi-controller-regex";
176 //      action "camcontrol rescan all";
177 };
178
179 # Don't even try to second guess what to do about drivers that don't
180 # match here.  Instead, pass it off to syslog.  Commented out for the
181 # moment, as the pnpinfo variable isn't set in devd yet.  Individual
182 # variables within the bus supplied pnpinfo are set.
183 nomatch 0 {
184 #       action "logger Unknown device: $pnpinfo $location $bus";
185 };
186
187 # Various logging of unknown devices.
188 nomatch 10 {
189         match "bus" "uhub[0-9]+";
190         action "logger Unknown USB device: vendor $vendor product $product \
191                 bus $bus";
192 };
193
194 # Some Cardbus cards don't offer numerical manufacturer/product IDs, just
195 # show the CIS info there.
196 nomatch 10 {
197         match "bus" "cardbus[0-9]+";
198         action "logger Unknown Cardbus device: device $device class $class \
199                 vendor $vendor bus $bus";
200 };
201
202 # Switch power profiles when the AC line state changes.
203 notify 10 {
204         match "system"          "ACPI";
205         match "subsystem"       "ACAD";
206         action "service power_profile $notify";
207 };
208
209 # Notify all users before beginning emergency shutdown when we get
210 # a _CRT or _HOT thermal event and we're going to power down the system
211 # very soon.
212 notify 10 {
213         match "system"          "ACPI";
214         match "subsystem"       "Thermal";
215         match "notify"          "0xcc";
216         action "logger -p kern.emerg 'WARNING: system temperature too high, shutting down soon!'";
217 };
218
219 # User requested suspend, so perform preparation steps and then execute
220 # the actual suspend process.
221 notify 10 {
222         match "system"          "ACPI";
223         match "subsystem"       "Suspend";
224         action "/etc/rc.suspend acpi $notify";
225 };
226 notify 10 {
227         match "system"          "ACPI";
228         match "subsystem"       "Resume";
229         action "/etc/rc.resume acpi $notify";
230 };
231
232 /* EXAMPLES TO END OF FILE
233
234 # Examples of notify hooks.  A notify is a generic way for a kernel
235 # subsystem to send event notification to userland.
236
237 # Here are some examples of ACPI notify handlers.  ACPI subsystems that
238 # generate notifies include the AC adapter, power/sleep buttons,
239 # control method batteries, lid switch, and thermal zones.
240 #
241 # Information returned is not always the same as the ACPI notify
242 # events.  See the ACPI specification for more information about
243 # notifies.  Here is the information returned for each subsystem:
244 #
245 # ACAD:            AC line state (0 is offline, 1 is online)
246 # Button:          Button pressed (0 for power, 1 for sleep)
247 # CMBAT:           ACPI battery events
248 # Lid:             Lid state (0 is closed, 1 is open)
249 # Suspend, Resume: Suspend and resume notification
250 # Thermal:         ACPI thermal zone events
251 #
252 # This example calls a script when the AC state changes, passing the
253 # notify value as the first argument.  If the state is 0x00, it might
254 # call some sysctls to implement economy mode.  If 0x01, it might set
255 # the mode to performance.
256 notify 10 {
257         match "system"          "ACPI";
258         match "subsystem"       "ACAD";
259         action                  "/etc/acpi_ac $notify";
260 };
261
262 # This example works around a memory leak in PostgreSQL, restarting
263 # it when the "user:postgres:swap:devctl=1G" rctl(8) rule gets triggered.
264 notify 0 {
265         match "system"          "RCTL";
266         match "rule"            "user:770:swap:.*";
267         action                  "service postgresql restart";
268 };
269
270 # Discard autofs caches, useful for the -media special map.
271 notify 100 {
272         match "system" "GEOM";
273         match "subsystem" "DEV";
274         action "/usr/sbin/automount -c";
275 };
276
277 # Handle userland coredumps.
278 # This commented out handler makes it possible to run an
279 # automated debugging session after the core dump is generated.
280 # Replace action with a proper coredump handler, but be aware that
281 # it will run with elevated privileges.
282 notify 10 {
283         match "system"          "kernel";
284         match "subsystem"       "signal";
285         match "type"            "coredump";
286         action "logger $comm $core";
287 };
288
289 # Let the init(8) know there's a new USB serial interface it might
290 # want to run getty(8) for.  This includes device-side tty created
291 # by usb_template(4).
292 notify 100 {
293         match "system"          "DEVFS";
294         match "subsystem"       "CDEV";
295         match "type"            "CREATE";
296         match "cdev"            "ttyU[0-9]+";
297         action "/sbin/init q";
298 };
299
300 */