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