3

I want to provide dbus methods and signals on a custom bus (i.e. not SessionBus or SystemBus). If I start a test copy of the dbus-daemon from the command line, as described in dbus-daemon man page, like so:

dbus-daemon --session --print-address

then this returns for example the address:

unix:abstract=/tmp/dbus-vthAiAw4am,guid=60da6b6ef244a0dbdb9710a800002218

I can use this address in d-feet to "Connect to Other Bus", and there is nothing there. Now, I would like to claim a name on that bus and export objects to provide dbus methods and signals using Python. I have tried reading the code behind dbus.service.BusName where I would normally pass in the Session or System bus, but I simply get lost. Anyone know how to do this (if even possible)?

1 Answer 1

3

Looking at the source code for d-feet was of course an easier way to find the answer than browsing the entire dbus-python lib. An address like the one in the question could be used when claiming a bus name, by passing in a dbus.bus.BusConnection object with the address as argument, like so:

bus_name = dbus.service.BusName('my.testbus.test', 
    dbus.bus.BusConnection('unix:abstract=/tmp/dbus-vthAiAw4am'))

I can then export methods and emit signals on this bus.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.