2 .\" Copyright (c) 2002 M. Warner Losh
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. The name of the author may not be used to endorse or promote products
11 .\" derived from this software without specific prior written permission.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 .\" The section on comments was taken from named.conf.5, which has the
28 .\" following copyright:
29 .\" Copyright (c) 1999-2000 by Internet Software Consortium
31 .\" Permission to use, copy, modify, and distribute this software for any
32 .\" purpose with or without fee is hereby granted, provided that the above
33 .\" copyright notice and this permission notice appear in all copies.
35 .\" THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
36 .\" ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
37 .\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
38 .\" CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
39 .\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
40 .\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
41 .\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
49 .Nd configuration file for
55 configuration consists of two general features, statements
57 All statements end with a semicolon.
58 Many statements can contain substatements, which are also
59 terminated with a semicolon.
61 The following statements are supported:
62 .Bl -tag -width ".Ic options"
64 Specifies various matching criteria and actions to perform when
65 a newly attached device matches said criteria.
67 Specifies various matching criteria and actions to perform when
68 a newly detached device matches said criteria.
70 Specifies various matching criteria and actions to perform when
71 no device driver currently loaded in the kernel claims a (new)
74 Specifies various matching criteria and actions to perform when the kernel
75 sends an event notification to userland.
77 Specifies various options and parameters for the operation of
81 Statements may occur in any order in the configuration file, and may be
82 repeated as often as required.
83 Further details on the syntax and meaning of each statement and their
84 substatements are explained below.
86 Each statement, except
88 has a priority (an arbitrary number) associated with it, where
90 is defined as the lowest priority.
91 If two statements match the same event, only the action of the statement with
92 highest priority will be executed.
93 In this way generic statements can be overridden for devices or
94 notifications that require special attention.
96 The general syntax of a statement is:
97 .Bd -literal -offset indent
101 substatement "value";
105 The following sub-statements are supported within the
108 .Bl -tag -width ".Ic directory"
109 .It Ic directory Qq Ar /some/path ;
110 Adds the given directory to the list of directories from which
112 will read all files named "*.conf" as further
116 statements can be used.
117 .It Ic pid-file Qq Pa /var/run/devd.pid ;
119 .It Ic set Ar regexp-name Qq Ar (some|regexp) ;
120 Creates a regular expression and assigns it to the variable
122 The variable is available throughout the rest of
123 the configuration file.
124 If the string begins with
126 it matches if the regular expression formed by the rest of the string
128 All regular expressions have an implicit
133 The following sub-statements are supported within the
138 .Bl -tag -width ".Ic directory"
139 .It Ic action Qq Ar command ;
140 Command to execute upon a successful match.
142 .Dq Li "/etc/pccard_ether $device-name start" .
143 .It Ic class Qq Ar string ;
144 This is shorthand for
145 .Dq Ic match Qo Li class Qc Qq Ar string .
146 .It Ic device-name Qq string ;
147 This is shorthand for
148 .Dq Ic match Qo Li device-name Qc Qq Ar string .
149 This matches a device named
151 which is allowed to be a regular expression or a variable previously created
152 containing a regular expression.
156 is available for later use with the
159 .It Ic match Qo Ar variable Qc Qq Ar value ;
160 Matches the content of
166 may be a regular expression.
173 statement takes care of all device matching.
174 For a partial list of variables, see below.
175 .It Ic media-type Qq Ar string ;
178 will match devices that have the given media type.
179 Valid media types are:
186 .It Ic subdevice Qq Ar string ;
187 This is shorthand for
188 .Dq Ic match Qo Li subdevice Qc Qq Ar string .
191 The following sub-statements are supported within the
194 .Bl -tag -width ".Ic directory"
195 .It Ic action Qq Ar command ;
197 .It Ic match Qo Ar variable Qc Qq Ar value ;
198 Matches the content of
204 may be a regular expression.
205 For a partial list of variables, see below.
208 The following sub-statements are supported within the
213 variable is available inside this statement and contains, a value, depending
214 on which system and subsystem that delivered the event.
215 .Bl -tag -width ".Ic directory"
216 .It Ic action Qq Ar command ;
217 Command to execute upon a successful match.
219 .Dq Li "/etc/rc.d/power_profile $notify" .
220 .It Ic match Qo Ar system | subsystem | type | notify Qc Qq Ar value ;
223 statements can exist within a
227 can be either a fixed string or a regular expression.
228 Below is a list of available systems, subsystems, and types.
229 .It Ic media-type Qq Ar string ;
232 .Ss Variables that can be used with the match statement
233 A partial list of variables and their possible values that can be used together
237 The variables are published by the bus based on characteristics of the device
238 that generated the event (for device events).
239 Variables for other classes of events are dependent on those events.
241 .Bl -tag -width ".Li manufacturer" -compact
245 The entire message from the current event.
247 The entire message from the current event, after the initial type character.
249 The time this event was processed, in seconds since 1970 dot fraction.
251 Device name of parent bus.
253 Device node path if one is created by the
259 Executable name (kernel).
261 Path to core file (kernel).
267 Device Sub-class (USB).
269 Name of attached/detached device.
271 Endpoint count (USB).
277 Interface Class (USB).
279 Interface Protocol (USB).
281 Interface Sub-class (USB).
283 Jail name for the process triggering the rule (RCTL).
285 Peripheral mode (USB).
287 Match the value of the
293 PID of the process triggering the rule (RCTL).
295 Hub port number (USB).
299 Hardware revision (USB).
301 Real UID of the process triggering the rule (RCTL).
313 Matches a subsystem of a system, see below.
315 Matches a system type, see below.
317 Type of notification, see below.
322 A partial list of systems, subsystems, and types used within the
326 .\" Please keep these tables sorted. Also, please use the same parameters
327 .\" for each of the tables so that things line up in columns nicely.
328 .\" Please do not omit the type column for notifiers that omit it.
330 .Bl -column "System" "Subsystem" "1234567" -compact
331 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
333 Events related to the ACPI Subsystem.
334 .It Li ACPI Ta Li ACAD Ta Ta
335 AC line state ($notify=0x00 is offline, 0x01 is online).
336 .It Li ACPI Ta Li Button Ta Ta
337 Button state ($notify=0x00 is power, 0x01 is sleep).
338 .It Li ACPI Ta Li CMBAT Ta Ta
340 .It Li ACPI Ta Li Dock Ta Ta
341 Dock state ($notify=0x00 is undocked, 0x01 is docked).
342 .It Li ACPI Ta Li Lid Ta Ta
343 Lid state ($notify=0x00 is closed, 0x01 is open).
344 .It Li ACPI Ta Li PROCESSOR Ta Ta
345 Processor state/configuration ($notify=0x81 is a change in available Cx states).
346 .It Li ACPI Ta Li Resume Ta Ta
348 .It Li ACPI Ta Li Suspend Ta Ta
349 Suspend notification.
350 .It Li ACPI Ta Li Thermal Ta Ta
354 .Bl -column "System" "Subsystem" "1234567" -compact
355 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
356 .It Li AEON Ta Li power Ta Li press Ta
357 The power button on an Amiga has been pressed.
360 .Bl -column "System" "Subsystem" "1234567" -compact
361 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
363 Events related to the
366 .It Li CAM Ta Li periph Ta Ta
367 Events related to peripheral devices.
368 .It Li CAM Ta Li periph Ta Li error Ta
370 .It Li CAM Ta Li periph Ta Li timeout Ta
374 .Bl -column "System" "Subsystem" "1234567" -compact
375 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
377 Events related to the
380 .It CARP Ta Ar vhid@inet Ta Ta
383 contains the actual CARP vhid and the name of the network interface
384 on which the event took place.
385 .It CARP Ta Ar vhid@inet Ta MASTER Ta
386 Node become the master for a virtual host.
387 .It CARP Ta Ar vhid@inet Ta BACKUP Ta
388 Node become the backup for a virtual host.
391 .Bl -column "System" "Subsystem" "1234567" -compact
392 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
393 .It Li coretemp Ta Ta Ta
394 Events related to the
397 .It Li coretemp Ta Li Thermal Ta Ta
398 Notification that the CPU core has reached critical temperature.
399 .It Li coretemp Ta Li Thermal Ta Li temperature Ta
400 String containing the temperature of the core that has become too hot.
403 .Bl -column "System" "Subsystem" "1234567" -compact
404 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
406 .It Li IFNET Ta Ar inet Ta Ta
409 is the actual name of the network interface on which the event
411 .It Li IFNET Ta Ar inet Ta Li LINK_UP Ta
412 Carrier status changed to UP.
413 .It Li IFNET Ta Ar inet Ta Li LINK_DOWN Ta
414 Carrier status changed to DOWN.
415 .It Li IFNET Ta Ar inet Ta Li ATTACH Ta
416 The network interface is attached to the system.
417 .It Li IFNET Ta Ar inet Ta Li DETACH Ta
418 The network interface is detached from the system.
421 .Bl -column "System" "Subsystem" "1234567" -compact
422 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
424 .It Li DEVFS Ta Li CDEV Ta Li CREATE Ta
428 .It Li DEVFS Ta Li CDEV Ta Li DESTROY Ta
434 .Bl -column "System" "Subsystem" "1234567" -compact
435 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
437 Events related to the
440 The difference compared to
444 only includes disk-like devices.
445 .It Li GEOM Ta Li DEV Ta Li CREATE Ta
448 device node is created.
449 .It Li GEOM Ta Li DEV Ta Li DESTROY Ta
452 device node is destroyed.
453 .It Li GEOM Ta Li DEV Ta Li GEOM::physpath Ta
454 The physical path of a device has changed.
455 .It Li GEOM Ta Li DEV Ta Li GEOM::rotation_rate Ta
456 The rotation rate of the disk has changed.
457 .It Li GEOM Ta Li DEV Ta Li MEDIACHANGE Ta
458 Physical media has changed.
459 .It Li GEOM Ta Li DEV Ta Li SIZECHANGE Ta
462 provider size has changed.
465 .Bl -column "System" "Subsystem" "1234567" -compact
466 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
467 .It Li kern Ta Li power Ta Li resume Ta
468 Notification that the system has woken from the suspended state.
469 Note: this notification is deprecated and will be removed in
474 .Bl -column "System" "Subsystem" "1234567" -compact
475 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
476 .It Li kernel Ta Li signal Ta Li coredump Ta
477 Notification that a process has crashed and dumped core.
478 .It Li kernel Ta Li power Ta Li resume Ta
479 Notification that the system has woken from the suspended state.
482 .Bl -column "System" "Subsystem" "1234567" -compact
483 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
485 Notification of events from various types of Power Management Units.
486 .It Li PMU Ta Li "AC" Ta Ta
487 Notifications of AC power related events.
488 .It Li PMU Ta Li "AC" Ta Li overvoltage Ta
489 An over-voltage condition was detected on the AC power line.
490 .It Li PMU Ta Li "AC" Ta Li plugged Ta
491 Power has been applied to the AC power line.
492 .It Li PMU Ta Li "AC" Ta Li unplugged Ta
493 Power has been removed from the AC power line.
494 .It Li PMU Ta Li Battery Ta Ta
495 .It Li PMU Ta Li Battery Ta absent Ta
496 Battery is no longer absent.
497 .It Li PMU Ta Li Battery Ta charged Ta
498 The battery has become charged.
499 .It Li PMU Ta Li Battery Ta charging Ta
500 The battery has started charging.
501 .It Li PMU Ta Li Battery Ta disconnected Ta
502 The battery has been disconnected.
503 .It Li PMU Ta Li Battery Ta high-temp Ta
504 The battery reported a temperature over the limit.
505 .It Li PMU Ta Li Battery Ta low-temp Ta
506 The battery reported a temperature under the limit.
507 .It Li PMU Ta Li Battery Ta plugged Ta
508 The battery has become plugged (eg connected).
509 .It Li PMU Ta Li Battery Ta shutdown-threshold Ta
510 The power in the battery has fallen below the shutdown threshold.
511 .It Li PMU Ta Li Battery Ta warning-threshold Ta
512 The power in the battery has fallen below the warn the user threshold.
513 .It Li PMU Ta Li Button Ta pressed Ta
519 .It Li PMU Ta Li keys Ta Ta
520 One of the keys on the
522 keyboard has been pressed.
523 .It Li PMU Ta Li keys Ta brightness Ta
524 A brightness level change has been requested.
525 Direction is in the $notify variable.
526 .It Li PMU Ta Li keys Ta mute Ta
528 .It Li PMU Ta Li keys Ta volume Ta
529 A volume level change has been requested.
530 Direction is in the $notify variable.
531 .It Li PMU Ta Li keys Ta eject Ta
532 An ejection has been requested.
533 .It Li PMU Ta Li lid Ta close Ta
536 device has detected the lid closing.
537 .It Li PMU Ta Li lid Ta open Ta
540 device has detected the lid openinging.
541 .It Li PMU Ta Li POWER Ta ACLINE Ta
544 device has deteted an AC line state ($notify=0x00 is offline, 0x01 is online).
545 .It Li PMU Ta Li USB Ta overvoltage Ta
546 An over-voltage condition on the power lines for the USB power pins.
547 .It Li PMU Ta Li USB Ta plugged Ta
548 A device has been plugged into a USB device.
549 .It Li PMU Ta Li USB Ta undervoltage Ta
550 An under-voltage condition on the power lines for the USB power pins.
551 .It Li PMU Ta Li USB Ta unplugged Ta
552 A device has been unplugged into a USB device.
555 .Bl -column "System" "Subsystem" "1234567" -compact
556 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
558 Events related to the
561 .It Li RCTL Ta Li rule Ta Li matched Ta
562 A rule with action specified as "devctl" was triggered.
565 .Bl -column "System" "Subsystem" "1234567" -compact
566 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
568 Events related to the USB subsystem.
569 .It Li USB Ta Li DEVICE Ta Li ATTACH Ta
570 USB device is attached to the system.
571 .It Li USB Ta Li DEVICE Ta Li DETACH Ta
572 USB device is detached to the system.
573 .It Li USB Ta Li INTERFACE Ta Li ATTACH Ta
574 USB interface is attached to a device.
575 .It Li USB Ta Li INTERFACE Ta Li DETACH Ta
576 USB interface is detached from a device.
582 A link state change to UP on the interface
584 would result in the following notify event:
585 .Bd -literal -offset indent
586 system=IFNET subsystem=fxp0 type=LINK_UP
589 An AC line state change to
591 would result in the following event:
592 .Bd -literal -offset indent
593 system=ACPI subsystem=ACAD notify=0x00
596 Comments may appear anywhere that whitespace may appear in a
598 To appeal to programmers of all kinds, they can
599 be written in C, C++, or shell/Perl constructs.
601 C-style comments start with the two characters
603 (slash, star) and end with
606 Because they are completely delimited with these characters,
607 they can be used to comment only a portion of a line or to span
610 C-style comments cannot be nested.
611 For example, the following is
612 not valid because the entire comment ends with the first
614 .Bd -literal -offset indent
615 /* This is the start of a comment.
616 This is still part of the comment.
617 /* This is an incorrect attempt at nesting a comment. */
618 This is no longer in any comment. */
621 C++-style comments start with the two characters
623 (slash, slash) and continue to the end of the physical line.
624 They cannot be continued across multiple physical lines; to have
625 one logical comment span multiple lines, each line must use the
629 .Bd -literal -offset indent
630 // This is the start of a comment. The next line
631 // is a new comment, even though it is logically
632 // part of the previous comment.
635 .Bl -tag -width ".Pa /etc/devd.conf" -compact
636 .It Pa /etc/devd.conf
644 # This will catch link down events on the interfaces fxp0 and ath0
647 match "system" "IFNET";
648 match "subsystem" "(fxp0|ath0)";
649 match "type" "LINK_DOWN";
650 action "logger $subsystem is DOWN";
654 # Match lid open/close events
655 # These can be combined to a single event, by passing the
656 # value of $notify to the external script.
659 match "system" "ACPI";
660 match "subsystem" "Lid";
661 match "notify" "0x00";
662 action "logger Lid closed, we can sleep now!";
666 match "system" "ACPI";
667 match "subsystem" "Lid";
668 match "notify" "0x01";
669 action "logger Lid opened, the sleeper must awaken!";
673 # Match a USB device type
676 match "system" "USB";
677 match "subsystem" "INTERFACE";
678 match "type" "ATTACH";
679 match "intclass" "0x0e";
680 action "logger USB video device attached";
684 # Try to configure ath and iwn devices with pccard_ether
685 # as they are attached.
688 device-name "(ath|iwn)[0-9]+";
689 action "/etc/pccard_ether $device-name start";
693 # Stop ath and iwn devices as they are detached from
697 device-name "(ath|iwn)[0-9]+";
698 action "/etc/pccard_ether $device-name stop";
704 has many additional examples.