summaryrefslogtreecommitdiff
path: root/meta-facebook/meta-yosemite4/recipes-phosphor/state/phosphor-state-manager/host-poweron
blob: 5dcb1daccabb60ddf2cf43bf5094b350e8fa1ca8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash

# Provide source directive to shellcheck.
# shellcheck source=meta-facebook/recipes-phosphor/state/phosphor-state-manager/greatlakes/power-cmd
source /usr/libexec/phosphor-state-manager/power-cmd

# TODO: check power status before do power on
# Set state effecter state: Entity ID 0x0000 for host power control, 0x1 for power on
GETEID=$(busctl call "$MCTP_BUS_NAME" "$MCTP_OBJ_PATH" "$MCTP_INTF_NAME" LearnEndpoint say "mctpi2c$(($1-1))" 1 0x20)
EID=$(echo "$GETEID" | awk '{print $2}')
if ! pldmtool raw -d 0x80 0x02 0x39 0x00 0x00 0x01 0x00 0x01 -m "$EID"
then
    echo "Failed to set host$1 power on"
else
    echo "Host is power on"
fi