Searching HAL for a specific device type

Jono Bacon jonobacon at yahoo.com
Sun Jan 16 18:29:02 PST 2005


Hi all,

Right, I have been making progress with my HAL and
Python coding, and thanks for the help you have given
me. I have successfully managed to connect to HAL and
dig out some information, but I am only getting
information about the Computer (at the top of the HAL
Device Manager). Here is my code:

		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")

		# Add listeners for all devices
		try:
			device_names = hal_manager.GetAllDevices()
		except:
			print "Could not get device list"
			sys.exit(0)

		for name in device_names:
			device_udi_obj =
hal_service.get_object("/org/freedesktop/Hal/devices/pci_8086_24c7",
"org.freedesktop.Hal.Device")
			device_dbus_obj = hal_service.get_object(name,
"org.freedesktop.Hal.Device")
			properties = device_dbus_obj.GetAllProperties()

		print properties		
		item = ("kernel", properties['kernel.machine'])
               	self.model.append(item)

I now need to figure out how I can find out if there
are USB Mass Storage devices attached to the system,
so I can list them in my tree view. How can I do this?

Cheers,

  Jono


=====
Jono Bacon - http://www.jonobacon.org/
Professional Writer / Web Developer / Musician


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250
_______________________________________________
hal mailing list
hal at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/hal



More information about the Hal mailing list