Thang Q. Nguyen | bd7d633 | 2021-12-06 10:18:21 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Toggle the state of identify LED Group |
| 4 | |
| 5 | socket=$1 |
| 6 | isOn=$2 |
| 7 | |
| 8 | # Create /tmp/fault* file |
| 9 | if [ "$isOn" == "on" ]; then |
| 10 | touch /tmp/fault"$socket" |
| 11 | else |
| 12 | rm /tmp/fault"$socket" |
| 13 | fi |
| 14 | |
| 15 | # Set Fault Led state |
| 16 | if [[ -f /tmp/fault0 ]] || [[ -f /tmp/fault1 ]]; then |
| 17 | target='true' |
| 18 | else |
| 19 | target='false' |
| 20 | fi |
| 21 | |
| 22 | SERVICE="xyz.openbmc_project.LED.GroupManager" |
| 23 | INTERFACE="xyz.openbmc_project.Led.Group" |
| 24 | PROPERTY="Asserted" |
| 25 | |
| 26 | # Get current state |
| 27 | object=$(busctl tree $SERVICE --list | grep system_fault) |
| 28 | |
| 29 | # Set target state |
| 30 | busctl set-property $SERVICE "$object" $INTERFACE $PROPERTY b $target |