Skip to content
Advertisement

Dbus instrospection incomplete for UDisks2?

I am using the java dbus interface. As it is not complete, we have to use the dbus introspection tool to generate xml files that will be converted into Java classes.

I want to be able to receive signals when a drive is inserted or removed from the system.

For that, I found that the signals InterfacesAdded and InterfacesRemoved are what I am searching for.

I have used this command to generate the xml introspection file :

JavaScript

It have generated a file, that I have converted with this command :

JavaScript

I am now able to receive the InterfacesAdded signal, but not the InterfacesRemoved one.

There seems to be a problem, this signal want’s to give some information that are in the block_devices node. But for this node the xml file is empty :

JavaScript

And as such the java code don’t know how to create the signal.

What could I do for that ?

Advertisement

Answer

I think the core misunderstanding is this: You generate interface files for object /org/freedesktop/UDisks2 but then in your code you use those interface files to create proxies for interfaces implemented by /org/freedesktop/UDisks2/block_devices/sdb. These objects implement different interfaces.

You will need interface definitions for all interfaces you create proxies for. I can’t give the exact commands to do that with introspection but you can use the same method to generate them as long as you find a suitable object. As an example:

JavaScript

produces the interface definition for org.freedesktop.UDisks2.Block and org.freedesktop.UDisks2.PartitionTable on my machine.

That said, UDisks2 does seem to have all of the org.freedesktop.UDisks2.* interfaces available in source code: org.freedesktop.UDisks2.xml.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement