hal/examples locking.py,NONE,1.1
David Zeuthen
david at freedesktop.org
Sun Sep 19 09:32:17 PDT 2004
- Previous message: hal/doc/spec hal-arch.dia, 1.2, 1.3 hal-arch.png, 1.2,
1.3 hal-linux26.dia, 1.2, 1.3 hal-linux26.png, 1.2,
1.3 hal-spec.html, 1.21, 1.22 hal-spec.xml.in, 1.19, 1.20
- Next message: hal/hald hald_dbus.c,1.12,1.13
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/hal/hal/examples
In directory gabe:/tmp/cvs-serv15910/examples
Added Files:
locking.py
Log Message:
2004-09-19 David Zeuthen <david at fubar.dk>
* hald/hald_dbus.c (agent_device_matches): Removed
(agent_merge_properties): Removed
(agent_manager_remove): Removed
(agent_manager_commit_to_gdl): Removed
(agent_manager_new_device): Removed
(filter_function): Removed all the AgentManager methods
(raise_udi_in_use): Removed
* doc/spec/hal-spec.xml.in: Add docs for info.locked. Remove section
about HAL agents as they are now gone. Fixed up renaming of scsi_device
to scsi.
* doc/spec/hal-arch.dia: Remove HAL Agents
* doc/spec/hal-linux26.dia: Update diagram since we now use a local
socket from hal.hotplug and hal.dev helpers.
* examples/locking.py: New file; shows how to use locking
--- NEW FILE: locking.py ---
#!/usr/bin/python
# Simple program to test locking; will acquire a lock on the hal device
# object representing the computer.
#
# usage: locking.py <numsecs>
import dbus
import sys
import time
import os
dev_udi = "/org/freedesktop/Hal/devices/computer"
duration = int(sys.argv[1])
pid = os.getpid()
reason = "locking.py pid %d"%pid
bus = dbus.Bus(dbus.Bus.TYPE_SYSTEM)
hal_service = bus.get_service("org.freedesktop.Hal")
print "I am %s with pid %d"%(bus.get_connection().get_base_service(), pid)
print
dev = hal_service.get_object (dev_udi, "org.freedesktop.Hal.Device")
print "Attempting to lock %s for %d secs"%(dev_udi, duration)
print "with reason '%s'"%reason
print
try:
dev.Lock(reason)
except Exception, e:
print "Locking failed"
reason = dev.GetProperty("info.locked.reason")
lock_svc = dev.GetProperty("info.locked.dbus_service")
print "Reason: '%s'"%reason
print "Locked by D-BUS basesvc: '%s'"%lock_svc
sys.exit(1)
print "Lock acquired; sleeping %d seconds"%duration
time.sleep(duration)
print "Releasing lock"
dev.Unlock()
print "Lock released"
- Previous message: hal/doc/spec hal-arch.dia, 1.2, 1.3 hal-arch.png, 1.2,
1.3 hal-linux26.dia, 1.2, 1.3 hal-linux26.png, 1.2,
1.3 hal-spec.html, 1.21, 1.22 hal-spec.xml.in, 1.19, 1.20
- Next message: hal/hald hald_dbus.c,1.12,1.13
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the hal-commit
mailing list