I can't connect DeviceEvent signal

bobos26 bobos26 at mizi.com
Tue Apr 7 23:38:39 PDT 2009


Hello.

I like to make a program using DeviceKit daemon by python-dbus.
So I made a sample program to call DeviceKit method and connect 
Devicekit signal.
this is sample program

import gobject

import dbus
import dbus.service
import dbus.mainloop.glib

devkit_bus = "org.freedesktop.DeviceKit"
devkit_objpath = "/org/freedesktop/DeviceKit"
devkit_iface = "org.freedesktop.DeviceKit"

def on_device_event (*args, **kwds):
    print "on_device_event"

if __name__ == "__main__":
    dbus.mainloop.glib.DBusGMainLoop (set_as_default=True)

    bus = dbus.SystemBus ()
    proxy = bus.get_object (devkit_bus, devkit_objpath)
    iface = dbus.Interface (proxy, devkit_iface)
   
   for device in iface.EnumerateBySubsystem (["usb"]):
       print device
    print proxy.Introspect 
(dbus_interface="org.freedesktop.DBus.Introspectable")
    iface.connect_to_siganal ("DeviceEvent", on_device_event)

    mainloop = gobject.MainLoop ()
    print "running IO Manager"
    mainloop.run ()
================ result =======================
ERROR:dbus.connection:Unable to set arguments ('DeviceEvent', <function 
on_device_event at 0xb7a032cc>) according to signature None: <type 
'exceptions.TypeError'>: Don't know how which D-Bus type to use to 
encode type "function"
Traceback (most recent call last):
  File "iomgr.py", line 20, in <module>
    proxy.connect_to_siganal ("DeviceEvent", on_device_event)
  File "/var/lib/python-support/python2.5/dbus/proxies.py", line 68, in 
__call__
    return self._proxy_method(*args, **keywords)
  File "/var/lib/python-support/python2.5/dbus/proxies.py", line 140, in 
__call__
    **keywords)
  File "/var/lib/python-support/python2.5/dbus/connection.py", line 597, 
in call_blocking
    message.append(signature=signature, *args)
TypeError: Don't know how which D-Bus type to use to encode type "function"

I saw a error! calling a DeviceKit method(EnumerateBySubsystem) work 
well, but connecting a DeviceKit signal(DeviceEvent) don't work well.
I have tried to connect a HAL signal, but it work well.
what is a problem? please help me!





More information about the devkit-devel mailing list