1# presence_detection
2
3## Description
4
5Specifies how to detect whether a device is present.
6
7Some devices are only present in certain system configurations. For example:
8
9- A regulator is only present when a related processor or memory module is
10  present.
11- A system supports multiple storage backplane types, and the device only exists
12  on one of the backplanes.
13
14Device presence is detected by executing actions, such as
15[compare_presence](compare_presence.md) and [compare_vpd](compare_vpd.md).
16
17Device operations like [configuration](configuration.md),
18[sensor monitoring](sensor_monitoring.md), and
19[phase fault detection](phase_fault_detection.md) will only be performed if the
20actions indicate the device is present.
21
22The actions can be specified in two ways:
23
24- Use the "rule_id" property to specify a standard rule to run.
25- Use the "actions" property to specify an array of actions that are unique to
26  this device.
27
28The return value of the rule or the last action in the array indicates whether
29the device is present. A return value of true means the device is present; false
30means the device is missing.
31
32Device presence will only be detected once per boot of the system. Presence will
33be determined prior to the first device operation (such as configuration). When
34the system is re-booted, presence will be re-detected. As a result, presence
35detection is not supported for devices that can be removed or added
36(hot-plugged) while the system is booted and running.
37
38## Properties
39
40| Name     |      Required       | Type                          | Description                                                  |
41| :------- | :-----------------: | :---------------------------- | :----------------------------------------------------------- |
42| comments |         no          | array of strings              | One or more comment lines describing the presence detection. |
43| rule_id  | see [notes](#notes) | string                        | Unique ID of the [rule](rule.md) to execute.                 |
44| actions  | see [notes](#notes) | array of [actions](action.md) | One or more actions to execute.                              |
45
46### Notes
47
48- You must specify either "rule_id" or "actions".
49
50## Examples
51
52```json
53{
54  "comments": ["Regulator is only present on the FooBar backplane"],
55  "rule_id": "is_foobar_backplane_installed_rule"
56}
57```
58
59```json
60{
61  "comments": ["Regulator is only present when CPU 3 is present"],
62  "actions": [
63    {
64      "compare_presence": {
65        "fru": "system/chassis/motherboard/cpu3",
66        "value": true
67      }
68    }
69  ]
70}
71```
72