summaryrefslogtreecommitdiff
path: root/meta-ibm/meta-romulus/recipes-phosphor/gpio/id-button/toggle_identify_led.sh
blob: 0d1ff32c636f10c474b0807d8448768066d9cbd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh
# Toggle the state of identify LED Group

SERVICE="xyz.openbmc_project.LED.GroupManager"
INTERFACE="xyz.openbmc_project.Led.Group"
PROPERTY="Asserted"

# Get current state
object=$(busctl tree $SERVICE --list | grep identify)
state=$(busctl get-property $SERVICE "$object" $INTERFACE $PROPERTY \
	  |  awk '{print $NF;}')

if [ "$state" = "false" ]; then
    target='true'
else
    target='false'
fi

# Set target state
busctl set-property $SERVICE "$object" $INTERFACE $PROPERTY b $target