blob: 496ece2b29e89fa0136f9c194cfb9c3430d5878a [file] [log] [blame]
Ben_Paic53430a2019-07-15 16:19:02 +08001#!/bin/sh
2# Toggle the state of identify LED Group
3
4SERVICE="xyz.openbmc_project.LED.GroupManager"
5INTERFACE="xyz.openbmc_project.Led.Group"
6PROPERTY="Asserted"
7
8# Get current state
9object=$(busctl tree $SERVICE --list | grep identify)
Ben Paidfef3e02020-03-02 13:32:10 +080010led=$(cat /sys/devices/platform/leds/leds/front-id/brightness)
Ben_Paic53430a2019-07-15 16:19:02 +080011if [ "$led" == "0" ]; then
12 busctl set-property $SERVICE $object $INTERFACE $PROPERTY b false
13else
14 busctl set-property $SERVICE $object $INTERFACE $PROPERTY b true
15fi
16
17state=$(busctl get-property $SERVICE $object $INTERFACE $PROPERTY \
18 | awk '{print $NF;}')
19
20if [ "$state" == "false" ]; then
21 target='true'
22else
23 target='false'
24fi
25
26# Set target state
27busctl set-property $SERVICE $object $INTERFACE $PROPERTY b $target