Im stalled... :(

Elric Milon truewhirm at yahoo.es
Thu Aug 5 16:23:55 PDT 2004


Well Im trying to read the messages that Hal generates on dbus...
on Ipython I'm doing that:
whirm at 9[~]$ ipython
Python 2.3.4 (#2, Jul 28 2004, 09:39:34)
Type "copyright", "credits" or "license" for more information.

IPython 0.6.0 -- An enhanced Interactive Python.
?       -> Introduction to IPython's features.
@magic  -> Information about IPython's 'magic' @ functions.
help    -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]: import dbus

In [2]: mybus =dbus.Bus(dbus.Bus.TYPE_SYSTEM)

In [3]: myservice=mybus.get_service('org.freedesktop.Hal.Manager')

In [4]: dir mybus
------> dir(mybus)
Out[4]:
['TYPE_ACTIVATION',
 'TYPE_SESSION',
 'TYPE_SYSTEM',
 '__doc__',
 '__init__',
 '__module__',
 '_connection',
 '_get_match_rule',
 '_match_rule_to_receivers',
 '_signal_func',
 'add_signal_receiver',
 'get_connection',
 'get_service',
 'remove_signal_receiver']

In [5]: dir myservice
myservice

In [5]: dir myservice
------> dir(myservice)
Out[5]:
['__doc__',
 '__init__',
 '__module__',
 '_connection',
 '_service_name',
 'get_object']

In [6]: 
myobject=myservice.get_object('org.freedesktop.Hal.Manager','org.freedesktop.Hal.Manager')

In [7]: dir myobject
------> dir(myobject)
Out[7]:
['__doc__',
 '__getattr__',
 '__init__',
 '__module__',
 '_connection',
 '_interface',
 '_object_path',
 '_service_name']

In [8]:


Im missing something? what should I do now to be able to receive the messages?

With dbus-monitor I can see them perfectly:

whirm at 3[src]$ dbus-monitor --system "interface=org.freedesktop.Hal.Manager"
signal interface=org.freedesktop.DBus; member=ServiceAcquired; 
sender=org.freedesktop.DBus
string::1.148
signal interface=org.freedesktop.Hal.Manager; member=DeviceAdded; sender=:1.0
string:/org/freedesktop/Hal/devices/usb_4e6_1_200_-1_noserial
signal interface=org.freedesktop.Hal.Manager; member=DeviceAdded; sender=:1.0
string:/org/freedesktop/Hal/devices/usbif_usb_4e6_1_200_-1_noserial_0
signal interface=org.freedesktop.Hal.Manager; member=DeviceAdded; sender=:1.0
string:/org/freedesktop/Hal/devices/scsi_host_8
signal interface=org.freedesktop.Hal.Manager; member=DeviceAdded; sender=:1.0
string:/org/freedesktop/Hal/devices/scsi_device_8_0_0_0
signal interface=org.freedesktop.Hal.Manager; member=DeviceAdded; sender=:1.0
string:/org/freedesktop/Hal/devices/block_8_0
signal interface=org.freedesktop.Hal.Manager; member=DeviceAdded; sender=:1.0
string:/org/freedesktop/Hal/devices/block_8_1

But in python I don't end to understand how it works the thing... But Im 
liking that! ^_^

Many thanks.

-- 
Elric Milon (whirm)


More information about the dbus mailing list