summaryrefslogtreecommitdiff
path: root/examples/mandatory-locking-test.py
blob: d863814f0aa7811bebebcc4de3d92209554df4e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/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)