meta-gbmc-staging: dbus-sensors: gpiosensor: Publish interface after the Present property is set
The existing code set the Present property false as default and then
intialize the interface immediately. This causes the interface to be
published with Present = false. If actual state of the sensor is
asserted true, there will be a false negative happening between the time
the interface is published and the time the property is updated to true.
In order to avoid this false negative, move the interface publishing
after the Present property is set to the actual state.
Tested:
[Before this change]
Step 1. dbus-monitor path=/xyz/openbmc_project/inventory/item/$SENSOR_NAME interface=xyz.openbmc_project.gpiosensor --system
Step 2. systemctl restart xyz.openbmc_project.gpiosensor
Test result:
dbus-monitor path=/xyz/openbmc_project/inventory/item/$SENSOR_NAME interface=xyz.openbmc_project.gpiosensor --system
signal time=1728627723.100853 sender=org.freedesktop.DBus -> destination=:1.2898 serial=4294967295 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
string ":1.2898"
signal time=1728627723.100961 sender=org.freedesktop.DBus -> destination=:1.2898 serial=4294967295 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameLost
string ":1.2898"
signal time=1728627727.461779 sender=:1.2907 -> destination=(null destination) serial=17 path=/xyz/openbmc_project/inventory/item/$SENSOR_NAME; interface=org.freedesktop.DBus.Properties; member=Propertied
string "xyz.openbmc_project.GPIOStatus"
array [
dict entry(
string "Present"
variant boolean false
)
]
array [
]
signal time=1728627727.461983 sender=:1.2907 -> destination=(null destination) serial=18 path=/xyz/openbmc_project/inventory/item/$SENSOR_NAME; interface=org.freedesktop.DBus.Properties; member=Propertied
string "xyz.openbmc_project.GPIOStatus"
array [
dict entry(
string "Name"
variant string "$SENSOR_NAME"
)
]
array [
]
method call time=1728627732.623678 sender=:1.81 -> destination=xyz.openbmc_project.GPIOStatus serial=6246 path=/xyz/openbmc_project/inventory/item/$SENSOR_NAME; interface=org.freedesktop.DBus.Properties;l
string "xyz.openbmc_project.GPIOStatus"
signal time=1728627740.524104 sender=:1.2907 -> destination=(null destination) serial=114 path=/xyz/openbmc_project/inventory/item/$SENSOR_NAME; interface=org.freedesktop.DBus.Properties; member=Propertid
string "xyz.openbmc_project.GPIOStatus"
array [
dict entry(
string "Present"
variant boolean true
)
]
array [
]
method call time=1728627745.695646 sender=:1.81 -> destination=xyz.openbmc_project.GPIOStatus serial=6805 path=/xyz/openbmc_project/inventory/item/$SENSOR_NAME; interface=org.freedesktop.DBus.Properties;l
string "xyz.openbmc_project.GPIOStatus"
[After this change]
Step 1. dbus-monitor path=/xyz/openbmc_project/inventory/item/$SENSOR_NAME interface=xyz.openbmc_project.gpiosensor --system
Step 2. systemctl restart xyz.openbmc_project.gpiosensor
Test result:
dbus-monitor path=/xyz/openbmc_project/inventory/item/$SENSOR_NAME interface=xyz.openbmc_project.gpiosensor --system
Failed to open connection to session bus: Using X11 for dbus-daemon autolaunch was disabled at compile time, set your DBUS_SESSION_BUS_ADDRESS instead
root@cig:~# dbus-monitor path=/xyz/openbmc_project/inventory/item/$SENSOR_NAME interface=xyz.openbmc_project.gpiosensor --system
signal time=1728626779.647020 sender=org.freedesktop.DBus -> destination=:1.7505 serial=4294967295 path=/org/freedesktop/DBus; interface=org.freedesktop.DBusd
string ":1.7505"
signal time=1728626779.647144 sender=org.freedesktop.DBus -> destination=:1.7505 serial=4294967295 path=/org/freedesktop/DBus; interface=org.freedesktop.DBust
string ":1.7505"
signal time=1728626812.774611 sender=:1.7544 -> destination=(null destination) serial=62 path=/xyz/openbmc_project/inventory/item/$SENSOR_NAME; interfaced
string "xyz.openbmc_project.GPIOStatus"
array [
dict entry(
string "Name"
variant string "$SENSOR_NAME"
)
]
array [
]
signal time=1728626812.775064 sender=:1.7544 -> destination=(null destination) serial=63 path=/xyz/openbmc_project/inventory/item/$SENSOR_NAME; interfaced
string "xyz.openbmc_project.GPIOStatus"
array [
dict entry(
string "Present"
variant boolean true
)
]
array [
]
method call time=1728626817.932756 sender=:1.136 -> destination=xyz.openbmc_project.GPIOStatus serial=6972 path=/xyz/openbmc_project/inventory/item/BP_12V_CAl
string "xyz.openbmc_project.GPIOStatus"
Fusion-Link:
platform11: https://fusion2.corp.google.com/20a5e907-03d3-3e65-94d0-3c33ec0dea0f
platform5: https://fusion2.corp.google.com/2e2f42cd-7eb8-3abd-8c47-8cb78e576d5d
platform15: https://fusion2.corp.google.com/124f9f34-065c-3311-8c1d-6432f3ecb99f
platform17: https://fusion2.corp.google.com/2fef2479-f9ec-3742-8468-56f69b907699
Platforms-Affected: All
Google-Bug-Id: 441433977
Change-Id: Ia3b6e50da077ac45115be1a6e9bdb94b371b08ab
Signed-off-by: Brian Chiang <chiang.brian@inventec.corp-partner.google.com>
(cherry picked from commit e1bac3c2109b9f79449616e3c5da0b06a6974932)
2 files changed