diff options
Diffstat (limited to 'powermanager/hal-test.py')
-rw-r--r-- | powermanager/hal-test.py | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/powermanager/hal-test.py b/powermanager/hal-test.py deleted file mode 100644 index f9ef90c..0000000 --- a/powermanager/hal-test.py +++ /dev/null @@ -1,35 +0,0 @@ -import dbus - -bus = dbus.SystemBus() -hal_manager_obj = bus.get_object("org.freedesktop.Hal", "/org/freedesktop/Hal/Manager") -hal_manager = dbus.Interface(hal_manager_obj, "org.freedesktop.Hal.Manager") -#device_names = hal_manager.GetAllDevices() - -ac = hal_manager.FindDeviceByCapability("ac_adapter") - -#all_devices = hal_manager.GetAllDevices() - -#for n in device_names: print n -#obj = bus.get_object("org.freedesktop.Hal", u'/org/freedesktop/Hal/devices/acpi_AC') -#obj.GetAllProperties() - -name = ac[0] -device_dbus_obj = bus.get_object("org.freedesktop.Hal" ,ac[0]) -properties = device_dbus_obj.GetAllProperties(dbus_interface="org.freedesktop.Hal.Device") - -try: - parent_name = properties["info.parent"] -except KeyError: - # no parent, must be parent of virtual_root - parent_name = "/" -except TypeError: - print "Error: no properties for device %s"%name - #continue -print properties['ac_adapter.present'] -#for p in properties: -# print p, " :: ", properties[p] -if properties['ac_adapter.present']: - print "plugged in" -else: - print "unplugged" - |