Initial commit
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Detect GPIO Present Manager
|
||||
After=phosphor-gpio-presence@.service
|
||||
Wants=phosphor-gpio-presence@.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/detect-gpio-present.sh
|
||||
Type=simple
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
SERVICE_NAME="xyz.openbmc_project.Inventory.Manager"
|
||||
PRESENT_OBJPATH=("/xyz/openbmc_project/inventory/system/chassis/cable/ss_cab0_prsnt"
|
||||
"/xyz/openbmc_project/inventory/system/chassis/cable/ss_cab1_prsnt"
|
||||
"/xyz/openbmc_project/inventory/system/chassis/cable/ss_cab2_prsnt"
|
||||
"/xyz/openbmc_project/inventory/system/chassis/cable/ss_cab3_prsnt"
|
||||
"/xyz/openbmc_project/inventory/system/chassis/cable/hsbp_cab_prsnt"
|
||||
"/xyz/openbmc_project/inventory/system/chassis/cable/fanbd_cab_prsnt"
|
||||
"/xyz/openbmc_project/inventory/system/chassis/cable/bp12v_cab_prsnt"
|
||||
"/xyz/openbmc_project/inventory/system/chassis/entity/sata0_prsnt"
|
||||
"/xyz/openbmc_project/inventory/system/chassis/entity/pe_slot0_prsnt"
|
||||
"/xyz/openbmc_project/inventory/system/chassis/entity/pe_slot1_prsnt"
|
||||
"/xyz/openbmc_project/inventory/system/chassis/entity/fans_efuse_pg"
|
||||
"/xyz/openbmc_project/inventory/system/chassis/entity/pwrgd_p12v_slots")
|
||||
INTERFACE_NAME="xyz.openbmc_project.Inventory.Item"
|
||||
|
||||
IPMI_LOG_SERVICE="xyz.openbmc_project.Logging.IPMI"
|
||||
IPMI_LOG_OBJPATH="/xyz/openbmc_project/Logging/IPMI"
|
||||
IPMI_LOG_INTERFACE="xyz.openbmc_project.Logging.IPMI"
|
||||
IPMI_LOG_FUNCT="IpmiSelAdd"
|
||||
IPMI_LOG_PARA_FORMAT="ssaybq" #5 parameters, s : string, s : string, ay : byte array, b : boolean, y : UINT16
|
||||
LOG_ERR="Configuration Error(Incorrect_interconnection)"
|
||||
LOG_EVENT_DATA="3 0x01 0xff 0xfe"
|
||||
LOG_ASSERT_FLAG="true"
|
||||
LOG_DEASSERT_FLAG="false"
|
||||
LOG_GENID_FLAG="0x0020"
|
||||
present_state=("true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true")
|
||||
|
||||
for i in "${!PRESENT_OBJPATH[@]}"
|
||||
do
|
||||
mapper wait "${PRESENT_OBJPATH[$i]}"
|
||||
done
|
||||
|
||||
while true; do
|
||||
for i in "${!PRESENT_OBJPATH[@]}"
|
||||
do
|
||||
boot_status="$(busctl get-property $SERVICE_NAME "${PRESENT_OBJPATH[$i]}" $INTERFACE_NAME Present | awk '{print $2}')"
|
||||
|
||||
if [ "$boot_status" == "false" ] && [ "${present_state[$i]}" == "true" ];then
|
||||
echo "Update cable $((i+1)) state."
|
||||
present_state[i]="false"
|
||||
busctl call $IPMI_LOG_SERVICE $IPMI_LOG_OBJPATH $IPMI_LOG_INTERFACE $IPMI_LOG_FUNCT $IPMI_LOG_PARA_FORMAT "$LOG_ERR" "${PRESENT_OBJPATH[$i]}" "$LOG_EVENT_DATA" $LOG_ASSERT_FLAG $LOG_GENID_FLAG
|
||||
elif [ "$boot_status" == "true" ] && [ "${present_state[$i]}" == "false" ];then
|
||||
echo "Update cable $((i+1)) state."
|
||||
present_state[i]="true"
|
||||
busctl call $IPMI_LOG_SERVICE $IPMI_LOG_OBJPATH $IPMI_LOG_INTERFACE $IPMI_LOG_FUNCT $IPMI_LOG_PARA_FORMAT "$LOG_ERR" "${PRESENT_OBJPATH[$i]}" "$LOG_EVENT_DATA" $LOG_DEASSERT_FLAG $LOG_GENID_FLAG
|
||||
fi
|
||||
done
|
||||
sleep 1
|
||||
done
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,25 @@
|
||||
SUMMARY = "OpenBMC Quanta Detect Present Service"
|
||||
DESCRIPTION = "OpenBMC Quanta Detect Present Daemon."
|
||||
PR = "r1"
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
|
||||
inherit systemd
|
||||
|
||||
DEPENDS += "systemd"
|
||||
RDEPENDS:${PN} += "bash"
|
||||
|
||||
SRC_URI = " file://detect-gpio-present.sh \
|
||||
file://detect-gpio-present.service \
|
||||
"
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${bindir}
|
||||
install -m 0755 ${WORKDIR}/detect-gpio-present.sh ${D}${bindir}/
|
||||
|
||||
install -d ${D}${systemd_system_unitdir}
|
||||
install -m 0644 ${WORKDIR}/detect-gpio-present.service ${D}${systemd_system_unitdir}
|
||||
}
|
||||
|
||||
SYSTEMD_PACKAGES = "${PN}"
|
||||
SYSTEMD_SERVICE:${PN} = "detect-gpio-present.service"
|
||||
Reference in New Issue
Block a user