summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony Wilson <wilsonan@us.ibm.com>2018-09-13 14:28:07 -0500
committerAnthony Wilson <wilsonan@us.ibm.com>2018-10-23 10:40:35 -0500
commit0f35983dd47670c9ecf261071b56f03deafdabf6 (patch)
treeda2b8d8d1f121e8fb42d1942e0ba539fc4da6e02
parent50c5f88d85780ab21f696b258cc789dba3976d78 (diff)
downloadphosphor-state-manager-0f35983dd47670c9ecf261071b56f03deafdabf6.tar.gz
phosphor-state-manager-0f35983dd47670c9ecf261071b56f03deafdabf6.zip
obmcutil: Add 'power' option
Change-Id: I50dea20337599d33a6f90aad3d39df4874228936 Signed-off-by: Anthony Wilson <wilsonan@us.ibm.com>
-rw-r--r--obmcutil21
1 files changed, 19 insertions, 2 deletions
diff --git a/obmcutil b/obmcutil
index 35a1752..68b5454 100644
--- a/obmcutil
+++ b/obmcutil
@@ -2,8 +2,10 @@
set -euo pipefail
+OPTS="bmcstate,bootprogress,chassisstate,hoststate,power,state,status"
+
USAGE="Usage: obmcutil [-h]
- {bmcstate,bootprogress,chassisstate,hoststate,state,status}"
+ {$OPTS}"
INTERFACE_ROOT=xyz.openbmc_project
STATE_INTERFACE=$INTERFACE_ROOT.State
@@ -16,7 +18,7 @@ print_help ()
echo "$USAGE"
echo ""
echo "positional arguments:"
- echo " {bmcstate,bootprogress,chassisstate,hoststate,state,status}"
+ echo " {$OPTS}"
echo ""
echo "optional arguments:"
echo " -h, --help show this help message and exit"
@@ -71,6 +73,21 @@ handle_cmd ()
PROPERTY=BootProgress
state_query $SERVICE $OBJECT $INTERFACE $PROPERTY
;;
+ power)
+ OBJECT=/org/openbmc/control/power0
+ SERVICE=$(mapper get-service $OBJECT)
+ INTERFACE=org.openbmc.control.Power
+ for property in pgood state pgood_timeout
+ do
+ # get_property can potentially return several
+ # different formats of values, so we do the parsing outside
+ # of get_property depending on the query. These queries
+ # return 'i VALUE' formatted strings.
+ STATE=$(get_property $SERVICE $OBJECT $INTERFACE $property \
+ | sed 's/i[ ^I]*//')
+ printf "%s = %s\n" $property $STATE
+ done
+ ;;
-h|--help)
print_help
;;
OpenPOWER on IntegriCloud