diff options
author | David Zeuthen <davidz@redhat.com> | 2007-03-25 18:25:32 -0400 |
---|---|---|
committer | David Zeuthen <davidz@redhat.com> | 2007-03-25 18:25:32 -0400 |
commit | ce1a29366fa816ade302159db0f64efe8000d310 (patch) | |
tree | 800d9482e97a6e354dfb70533e217cd03eef7542 /examples | |
parent | f7cb7e7828ae6d54f06dad49b63b0f8c0a553a41 (diff) |
add interface locking and remove generic locking API committed yesterday
Now to write some docs how all this works...
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/interface-locking-test.py | 51 | ||||
-rwxr-xr-x | examples/mandatory-locking-test.py | 20 |
2 files changed, 51 insertions, 20 deletions
diff --git a/examples/interface-locking-test.py b/examples/interface-locking-test.py new file mode 100755 index 00000000..ff0c7ddc --- /dev/null +++ b/examples/interface-locking-test.py @@ -0,0 +1,51 @@ +#!/usr/bin/python + + +import dbus +import sys +import time +import os + +# this is just various test code + +bus = dbus.Bus(dbus.Bus.TYPE_SYSTEM) + +manager = dbus.Interface(bus.get_object("org.freedesktop.Hal", + "/org/freedesktop/Hal/Manager"), + "org.freedesktop.Hal.Manager") + +computer = dbus.Interface(bus.get_object("org.freedesktop.Hal", + "/org/freedesktop/Hal/devices/computer"), + "org.freedesktop.Hal.Device") + +# "/org/freedesktop/Hal/devices/volume_uuid_456C_AAA8"), + +device = dbus.Interface(bus.get_object("org.freedesktop.Hal", + "/org/freedesktop/Hal/devices/macbook_pro_keyboard_backlight"), + "org.freedesktop.Hal.Device") +device2 = dbus.Interface(bus.get_object("org.freedesktop.Hal", + "/org/freedesktop/Hal/devices/macbook_pro_keyboard_backlight"), + "org.freedesktop.Hal.Device.KeyboardBacklight") + +device3 = dbus.Interface(bus.get_object("org.freedesktop.Hal", + "/org/freedesktop/Hal/devices/storage_serial_Kingston_DataTraveler_2_0_07F0E4611101494D"), + "org.freedesktop.Hal.Device") + +manager.AcquireGlobalInterfaceLock("org.freedesktop.Hal.Device.Storage", True) +time.sleep(10000) + +#device3.AcquireInterfaceLock("org.freedesktop.Hal.Device.Storage", True) +#time.sleep(100000) + +#manager.AcquireGlobalInterfaceLock("org.freedesktop.Hal.Device.KeyboardBacklight") +#device.AcquireInterfaceLock("org.freedesktop.Hal.Device.KeyboardBacklight") +#n = 0 +#while True: +# time.sleep(1) +# device2.SetBrightness (n) +# n = n + 10 +# if (n > 200): +# n = 0 +#manager.ReleaseGlobalInterfaceLock("org.freedesktop.Hal.Device.KeyboardBacklight") +#device.ReleaseInterfaceLock("org.freedesktop.Hal.Device.KeyboardBacklight") + diff --git a/examples/mandatory-locking-test.py b/examples/mandatory-locking-test.py deleted file mode 100755 index d863814f..00000000 --- a/examples/mandatory-locking-test.py +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/python - - -import dbus -import sys -import time -import os - -bus = dbus.Bus(dbus.Bus.TYPE_SYSTEM) -device = dbus.Interface(bus.get_object("org.freedesktop.Hal", - "/org/freedesktop/Hal/devices/computer"), -# "/org/freedesktop/Hal/devices/volume_label_EOS_DIGITAL"), - "org.freedesktop.Hal.Device") - -device.AcquireMandatoryLock("foo") -device.AcquireMandatoryLock("foo2") -time.sleep(2) -device.ReleaseMandatoryLock("foo2") -#device.ReleaseMandatoryLock("foo") -time.sleep(2) |