how to traverse network devices in our system?
Franck Pommereau
pommereau at univ-paris12.fr
Thu May 18 11:41:14 EDT 2006
> Yes, it is Linux. I was just googling and found that there are kudzu
> bindings for python. From that i can query kudzu for any configured and
> unconfigured device (i hope so). is there any other method available
> other kudzu python bindings ?
I do it using DBus/Hal, for instance:
###############
import dbus
system_bus = dbus.SystemBus()
hal_manager_obj = system_bus.get_object('org.freedesktop.Hal',
'/org/freedesktop/Hal/Manager')
hal_manager = dbus.Interface(hal_manager_obj,
'org.freedesktop.Hal.Manager')
for udi in hal_manager.FindDeviceByCapability("net") :
obj = system_bus.get_object("org.freedesktop.Hal", udi)
dev = dbus.Interface(obj, 'org.freedesktop.Hal.Device')
print dev.GetProperty("net.interface"),
print dev.GetProperty("net.address")
###############
Cheers,
Franck
More information about the Python-list
mailing list