1# gpio-presence-sensor 2 3This program was originally implemented following the [design][]. 4 5## Configuration 6 7See the full [design][] for more details. 8 9Example EM config fragments: 10 11```json 12{ 13 Exposes: 14 [ 15 { 16 "Name": "com.meta.Hardware.Yv4.cable0", 17 "PresencePinNames": ["presence-cable0"], 18 "PresencePinValues": [1], 19 "Type": "GPIODeviceDetect" 20 }, 21 { 22 "Name": "com.meta.Hardware.Yv4.ComputeCard", 23 "PresencePinNames": ["presence-slot0a", "presence-slot0b"], 24 "PresencePinValues": [0, 1], 25 "Type": "GPIODeviceDetect" 26 }, 27 { 28 "Name": "com.meta.Hardware.Yv4.SidecarExpansion", 29 "PresencePinNames": ["presence-slot0a", "presence-slot0b"], 30 "PresencePinValues": [1, 0], 31 "Type": "GPIODeviceDetect" 32 }, 33 { 34 "Name": "com.meta.Hardware.Yv4.AirBlocker", 35 "PresencePinNames": ["presence-slot0a", "presence-slot0b"], 36 "PresencePinValues": [1, 1], 37 "Type": "GPIODeviceDetect" 38 }, 39 { 40 "Name": "com.meta.Hardware.Yv4.fanboard0", 41 "PresencePinNames": ["presence-fanboard0"], 42 "PresencePinValues": [0], 43 "Type": "GPIODeviceDetect" 44 }, 45 ... 46 ], 47 ... 48 "Name": "My Chassis", 49 "Probe": "xyz.openbmc_project.FruDevice({'BOARD_PRODUCT_NAME': 'MYBOARDPRODUCT*'})", 50 "Type": "Board", 51} 52``` 53 54The above configuration can then cause a Probe match in another configuration, 55like below: 56 57```json 58{ 59 Exposes: 60 [ 61 { 62 "Address": "0x28", 63 "Bus": 5, 64 "EntityId": 7, 65 "EntityInstance": 0, 66 "Name": "fanboard_air_inlet", 67 "Name1": "fanboard_air_outlet", 68 "Type": "NCT7802" 69 }, 70 ... 71 ], 72 ... 73 "Name": "My Fan Board 0", 74 "Probe": "xyz.openbmc_project.Inventory.Source.DevicePresence({'Name': 'com.meta.Hardware.Yv4.fanboard0'})", 75 "Type": "Board", 76} 77``` 78 79Notice the **xyz.openbmc_project.Inventory.Source.DevicePresence** interface. 80This is what the gpio-presence daemon exposes on dbus when the hardware is 81detected as present. The **Name** property in the Probe statement is the same as 82configured as in the first json fragment. 83 84## Applications 85 86Applications include detecting fan boards, air blockers, cables and other simple 87components for which no standard / well-defined way exists to detect them 88otherwise. 89 90It can also be used as detection redundancy in case another detection mechanism 91like FRU eeprom is corrupted or unavailable. 92 93## References 94 95[design]: 96 https://github.com/openbmc/docs/blob/master/designs/inventory/gpio-based-hardware-inventory.md 97