linuxrustdbusbusctl

zbus connection not displayed in busctl list


I'm using the zbus crate to make a server able to get events from the dbus. It works well my code (basically the same as the example from the documentation) is able to receive events so it's fine.

I use busctl to send an event like in the example:

busctl --user call org.zbus.MyGreeter /org/zbus/MyGreeter org.zbus.MyGreeter1 SayHello s "Maria"

And my code is able to receive the event with the parameter just fine.

The thing is I'm having some issues with udev and while I was trying to fix it I found some weird things:

My question is: is it normal my program does not appear in the busctl list? Am I doing something wrong or do I use the wrong library to do what I want to do?


Solution

  • Ok it seems there are 2 busses and I was not using the system bus. I had to replace the method session to system to indicates I want my program to run on the system bus. Like this:

    let _ = ConnectionBuilder::system()?
            .name("org.zbus.MyGreeter")?
            .serve_at("/org/zbus/MyGreeter", greeter)?
            .build()
            .await?;
    

    Doing this is not enough because my program does not have to permission to create a service on the bus system. So I had to create a file in /usr/share/dbus-1/system.d where I did write the configuration needed.