Looking for some Python dbus/hal help
Jesse Keating
jkeating at j2solutions.net
Thu Mar 17 11:47:14 PST 2005
On Thu, 2005-03-17 at 14:39 -0500, David Zeuthen wrote:
> (it's not considered good form to just bounce a message onto other
> mailing lists; the To: and Reply-To: fields are obviously wrong; I had
> to modify them)
Whoops sorry. I was trying Evolution's 'Forward as redirect' and it
wasn't exactly what I thought it would do. good to know (:
> On Thu, 2005-03-17 at 11:04 -0800, Jesse Keating wrote:
> > I need to plug into hal through dbus in python a bit. So I'm
> looking
> > for some good documentation that covers dbus and hal, specifically
> ways
> > to find hal entries for kernels and devices and such.
> >
> > I've 'borrowed' some code from system-config-packages, namely:
> >
> > # get the devices from HAL
> > bus = dbus.Bus (dbus.Bus.TYPE_SYSTEM)
> > hal_service = bus.get_service ('org.freedesktop.Hal')
> > hal_manager = hal_service.get_object
> > ('/org/freedesktop/Hal/Manager', 'org.freedesktop.Hal.Manager')
> > volume = hal_manager.FindDeviceStringMatch('volume.label',
> label)[0]
> > # Look for our disk label, return first one
> > props = hal_service.get_object(volume,
> > "org.freedesktop.Hal.Device").GetAllProperties() # Get all the
> > properties of the volume
> >
> > mount = props['volume.mount_point'] # Get the mount point and
> return
> > it...
> >
> > But I'm looking for alternatives to the 'FindDeviceStringMatch' and
> it's
> > friends. Can anybody help out as I pour through the sources to
> these
> > modules?
>
> Why do you need an alternative? What do want to achieve that the code
> snippet doesn't do?
Well, my immediate need is to find the kernel.machine and
kernel.version, and I'm not seeing a method to directly address a given
name space, I've only find examples of searching for a device through
either a string find, or FindDeviceByCapability. This led me to wonder
if there was a listing of all these 'Find' operators, and I've had no
luck yet.
> And you don't need to search the source; there's an extensive document
> here and an article here that may be of help
>
> http://cvs.freedesktop.org/*checkout*/hal/hal/doc/spec/hal-spec.html?
> only_with_tag=hal-0_4-stable-branch#dbus-api
> http://www.redhat.com/magazine/003jan05/features/hal/
Ah, thanks. I'll take a look at these.
--
Jesse Keating RHCE (geek.j2solutions.net)
Fedora Legacy Team (www.fedoralegacy.org)
GPG Public Key (geek.j2solutions.net/jkeating.j2solutions.pub)
Was I helpful? Let others know:
http://svcs.affero.net/rm.php?r=jkeating
_______________________________________________
hal mailing list
hal at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/hal
More information about the Hal
mailing list