dbus2 / zbus-old

Rust D-Bus crate.
https://gitlab.freedesktop.org/dbus/zbus
Other
49 stars 13 forks source link

Monitoring question #250

Closed zeenix closed 1 year ago

zeenix commented 2 years ago

In GitLab by @Reshad-Rahman on Jan 13, 2022, 04:26

I tried monitoring based on the example @ https://gitlab.freedesktop.org/dbus/zbus/-/blob/main/zbus/src/connection.rs#L231

I do see some messages at startup but don't see messages when I restart a service such as rsyslog. OTOH if I use "sudo busctl monitor org.freedesktop.systemd1" I see messages. I checked busctl code and there is a call to sd_bus_set_monitor() to be able to use the bus to monitor. So I was wondering if this is done automatically by zbus? Or is it a policy thing (not a D-Bus expert....)

I am on 1.9.2.

Thanks!

zeenix commented 2 years ago

I am on 1.9.2.

The example code you're trying is for zbus 2 API so you should use the latest: 2.0.1. There was also a bug (#238) with this code sample that was fixed in 2.0.1. See if that helps. If not, please re-open this issue.

zeenix commented 2 years ago

In GitLab by @Reshad-Rahman on Jan 16, 2022, 17:25

Thanks, turns out I was connecting to the session bus instead of the system bus, all good with 1.9.2!