python hal/dbus question

John (J5) Palmieri johnp at redhat.com
Tue Oct 11 13:57:32 PDT 2005


On Mon, 2005-10-10 at 13:37 -0600, Jason Gerard DeRose wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> hello,
> 
> i'm writing a python application that needs to respond to optical disc
> insert/remove events, know what the disc type is, etc.  i'm developing
> against ubuntu breezy (hal 0.5.3, dbus 0.36.2).
> 
> i'm trying to create a device proxy object from a udi, but the examples
> i've found don't work with the current api.  could someone provide (or
> point me to) a quick example?
> 
> i've attached a snippet from what i have working so far.
> 
> much thanks!
> 
> - -jason
> 

udi_list = hal_manager.FindDeviceByCapability('storage.cdrom')
for udi in udi_list:
    devobj = bus.get_object('org.freedesktop.Hal', udi)
    deviface = dbus.Interface(devobj, 'org.freedesktop.Hal.Device')
    deviface.connect_to_signal('PropertyModified', property_modified)

That should work.
-- 



More information about the hal mailing list