Comment 5 for bug 235134

Chris Cole (ccole) wrote :

Sorry, didn't mean to give you an ouchie :). After much digging I found the solution. Apparently using a dbus interface fixes the code. Here we go:

hal_dot = 'org.freedesktop.Hal'
hal_path = '/org/freedesktop/Hal'

bus = dbus.SystemBus()
hal_manager = bus.get_object(hal_dot, hal_path+'/Manager')
interface = dbus.Interface(hal_manager, hal_dot+'.Manager')
udi_list = interface.FindDeviceByCapability('volume')

and voila! it works.