Subscribe to SYSTEM dbus
I am trying to subscribe to system bus messages, but it won't show any message. Could you help me?
This is the code I am using:
from jeepney import DBusAddress, new_method_call, MatchRule
from jeepney.io.blocking import open_dbus_connection
connection = open_dbus_connection(bus='SYSTEM')
sleep_match = MatchRule(type="signal")
connection.send_and_get_reply(
new_method_call(
DBusAddress("/org/freedesktop/DBus", "org.freedesktop.DBus"),
"AddMatch",
"s",
(sleep_match.serialise(),)
)
)
while True:
message = connection.receive()
print(message)