Skip to content

Commit

Permalink
Merge pull request #246 from mulkieran/do-not-add-intf
Browse files Browse the repository at this point in the history
Omit interfaces not in specified top interfaces
  • Loading branch information
mulkieran authored Mar 6, 2024
2 parents aa7a5ac + 43c85d6 commit 95775cd
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions scripts/monitor_dbus_signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ def _interfaces_added(object_path, interfaces_added):
:param str object_path: D-Bus object path
:param dict interfaces_added: map of interfaces to D-Bus properties
"""
if object_path == _TOP_OBJECT_PATH:
interfaces_added = {
k: v for k, v in interfaces_added.items() if k in _TOP_OBJECT_INTERFACES
}

try:
print(
"Interfaces added:",
Expand Down Expand Up @@ -197,6 +202,11 @@ def _interfaces_removed(object_path, interfaces):
:param str object_path: D-Bus object path
:param list interfaces: list of interfaces removed
"""
if object_path == _TOP_OBJECT_PATH:
interfaces = {
k: v for k, v in interfaces.items() if k in _TOP_OBJECT_INTERFACES
}

try:
print(
"Interfaces removed:",
Expand Down Expand Up @@ -270,6 +280,11 @@ def _properties_changed(*props_changed, object_path=None):
) from err

if interface_name not in data:
if (
object_path == _TOP_OBJECT_PATH
and interface_name not in _TOP_OBJECT_INTERFACES
):
return
data[interface_name] = MISSING_INTERFACE

if data[interface_name] is MISSING_INTERFACE:
Expand Down

0 comments on commit 95775cd

Please sign in to comment.