Hardware Database (WAS Re: RH recommends using Windows? plus a

David Zeuthen david at fubar.dk
Wed Nov 5 22:48:14 UTC 2003


On Wed, 2003-11-05 at 23:16, Alan Cox wrote:
> > Oh that's a really good question. HAL is a quite new initiative so right
> > now the focus have only been on what is stored on the desktop system and
> > how desktop applications access it. 
> 
> Dumb question - should "provide an XML description for the database" 
> be something each HAL module is defined to do ?
> 

Yes. For every bus-type there are/will be thorough requirements on
well-defined hardware specific properties that will always be available
for every device on that bus-type. And yeah, generating the XML is easy
as python got D-BUS bindings, so it's really as simple as

 import dbus
 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")
 device_names = hal_manager.GetAllDevices()
 for name in device_names:
     device = hal_service.get_object(name, "org.freedesktop.Hal.Device")
     properties = device.GetAllProperties()

and then selecting what subset to dump to XML. The spec currently only
mentions USB but I also got PCI working..

Thanks,
David





More information about the devel mailing list