dbus icon indicating copy to clipboard operation
dbus copied to clipboard

How to enable introspection

Open Ambrevar opened this issue 6 years ago • 5 comments

When I run D-Feet to introspect the object, it appears in the object list on the session. When I click on it however, I get the following error message:

Missing method-call handler at path / interface
org.freedesktop.DBus.Introspectable name Introspect (36)

Do I need to do something special to enable introspection or is it simply lacking in this library?

Ambrevar avatar May 28 '19 14:05 Ambrevar

Support for introspection is not currently implemented in this repository. There is a fork by @phmarek that has a WIP implementation. [0] There is also the note I wrote a while ago [1]. I don't currently use dbus, but patches are welcome.

[0] https://github.com/phmarek/dbus/commit/d729db68f71f0db926e3b97070dc20ac4e43e122 [1] https://gist.github.com/death/1c5780c5dcf6a838a867d8701969982f.

death avatar May 28 '19 16:05 death

On a similar topic, is it possible to use this library to call the method of an object that does not expose any introspection element?

The only way I know to call methods using this library is to introspect objects as follows:

(dbus:with-open-bus (bus (dbus:session-server-addresses))
    (dbus:with-introspected-object (object bus +object-path+ +name+)
      (apply #'object +interface+ method args)))

Ambrevar avatar May 30 '19 10:05 Ambrevar

I've managed to call an object method without introspection like this:

(dbus:with-open-bus (bus (dbus:session-server-addresses))
    (let ((object (dbus/introspect::make-object
                   (dbus:bus-connection bus) +core-object+ +core-name+
                   (list (dbus/introspect::make-interface
                          +core-interface+
                          (list
                           (dbus/introspect::make-method "make_buffers"
                                        "as"
                                        '("urls")
                                        '("as")
                                        '()))
                          nil nil)))))
      (apply #'dbus:object-invoke object +core-interface+ method args)))

This requires access to a lot of unexposed methods. I believe that introspection is not a requirement of D-Bus and in fact glib's dbus API supports them (that's how I can call Common Lisp methods).

So what about exposing a convenience function that roughly does the above?

Ambrevar avatar May 30 '19 11:05 Ambrevar

If you don't want to use introspection, use dbus:invoke-method.

death avatar May 30 '19 13:05 death

Thanks!

I will send a pull request for a documentation update listing the most useful methods and some more examples.

Ambrevar avatar May 31 '19 07:05 Ambrevar