Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Omit interfaces not in specified top interfaces #246

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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