1#!/bin/bash 2 3# shellcheck source=meta-facebook/recipes-fb/obmc_functions/files/fb-common-functions 4source /usr/libexec/fb-common-functions 5# shellcheck source=meta-facebook/meta-harma/recipes-phosphor/state/phosphor-state-manager/power-cmd 6source /usr/libexec/phosphor-state-manager/power-cmd 7 8gpio_logging_valid() { 9 # get gpio chip id 10 number=$1 11 12 # get assert or deassert message 13 action=$2 14 15 if [ -z "$number" ] || [ -z "$action" ]; then 16 return 0 17 fi 18 19 check_valid_sgpio 20 valid_sgpio=$? 21 22 if [ "$valid_sgpio" -eq 0 ] || [ "$number" -ne 2 ] || [ "$action" == "assert" ]; then 23 # This delay ensures the BMC does not receive abnormal events 24 # during CMM/MB AC cycling or tray unplugging. 25 # Such actions can cause the CPLD to lose power before the BMC, 26 # leading to abnormal events being received. 27 sleep 2 28 return 0 29 else 30 echo "Invalid gpio logging event" 31 return 1 32 fi 33} 34