[pkg-fso-commits] [SCM] FSO frameworkd Debian packaging branch, master, updated. milestone4-368-g700ab82
Michael 'Mickey' Lauer
mickey at vanille-media.de
Mon Feb 2 18:51:57 UTC 2009
The following commit has been merged in the master branch:
commit a1216dcb9db470ea65006ae026f1c0d66c7e0842
Author: Michael 'Mickey' Lauer <mickey at vanille-media.de>
Date: Thu Jan 15 15:29:07 2009 +0100
oeventsd: Serialize dbus requests with a Queue. This (and removing a race in the RingToneAction)
should fix the problems with neverending vibration and audio ringtone on short calls (FSO ticket #205)
diff --git a/ChangeLog b/ChangeLog
index 2b6ce10..cfa5566 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2009-01-15 Michael Lauer <mlauer at vanille-media.de>
+ * [oeventsd] Serialize dbus requests with a Queue. This (and removing a race in the RingToneAction)
+ should fix the problems with neverending vibration and audio ringtone on short calls (FSO ticket #205)
+
+2009-01-14 Michael Lauer <mlauer at vanille-media.de>
+
* [ogsmd] Implemented org.freesmartphone.GSM.Phone.StartAutoOnline(apn, user, password)
This works the same way as StartAutoRegister(pin), trying to keep the connection online.
diff --git a/framework/subsystems/oeventsd/action.py b/framework/subsystems/oeventsd/action.py
index 366499b..b391036 100644
--- a/framework/subsystems/oeventsd/action.py
+++ b/framework/subsystems/oeventsd/action.py
@@ -131,10 +131,23 @@ class DBusAction(Action):
def __repr__(self):
return "%s(%s)" % (self.method, self.args)
+#=========================================================================#
+class PeekholeQueue( Queue.Queue ):
+#=========================================================================#
+ """
+ This class extends the Queue with a method to peek at the
+ first element without having to remove this from the queue.
+ """
+ def peek( self ):
+ if self.empty():
+ return None
+ else:
+ return self.queue[0]
+
#============================================================================#
class QueuedDBusAction( DBusAction ):
#============================================================================#
- q = Queue.Queue()
+ q = PeekholeQueue()
def enqueue( self, method, args, kargs ):
logger.debug( "enqueing dbus call %s.%s", method, args )
@@ -144,9 +157,9 @@ class QueuedDBusAction( DBusAction ):
self.workDaQueue()
def workDaQueue( self ):
- logger.debug( "working on queue w/ size %d", self.q.qsize() )
+ logger.debug( "working on queue: %s", self.q )
if self.q.qsize():
- method, args, kargs = self.q.get()
+ method, args, kargs = self.q.peek()
# async dbus call now
method( *args, **kargs )
@@ -164,8 +177,10 @@ class QueuedDBusAction( DBusAction ):
def on_reply(self, *args):
# We don't pass the reply to anything
logger.info("signal %s responded : %s", self.method, args)
+ self.q.get()
self.workDaQueue()
def on_error(self, error):
logger.error("signal %s emited an error %s", self.method, error)
+ self.q.get()
self.workDaQueue()
diff --git a/framework/subsystems/oeventsd/fso_actions.py b/framework/subsystems/oeventsd/fso_actions.py
index 459b2f8..5c51bb6 100644
--- a/framework/subsystems/oeventsd/fso_actions.py
+++ b/framework/subsystems/oeventsd/fso_actions.py
@@ -13,7 +13,7 @@ Module: fso_actions
"""
-__VERSION__ = "0.4.0"
+__VERSION__ = "0.4.1"
MODULE_NAME = "oeventsd"
import framework.patterns.tasklet as tasklet
@@ -23,6 +23,7 @@ from action import QueuedDBusAction as DBusAction
from framework.controller import Controller
from framework.config import installprefix
+import gobject
import dbus
import os, subprocess, shlex
@@ -194,12 +195,23 @@ class RingToneAction(Action):
#=========================================================================#
function_name = 'RingTone'
+ def __init__( self, *args, **kwargs ):
+ Action.__init__( self )
+ logger.debug( "%s: init" )
+ self.audio_action = None
+ self.vibrator_action = None
+ gobject.idle_add( self.initFromMainloop )
+
+ def initFromMainloop( self ):
+ self.__init().start()
+ return False # mainloop: don't call me again
+
# We need to make DBus calls and wait for the result,
# So we use a tasklet to avoid blocking the mainloop.
- @tasklet.tasklet
- def __trigger(self):
- logger.info( "RingToneAction play" )
+ @tasklet.tasklet
+ def __init(self):
+ logger.debug( "ring tone action init from mainloop" )
# We get the 'phone' preferences service and
# retreive the ring-tone and ring-volume config values
# We are careful to use 'yield' cause the calls could be blocking.
@@ -223,26 +235,23 @@ class RingToneAction(Action):
ring_length = yield tasklet.WaitDBus( phone_prefs.GetValue, "ring-length" )
self.sound_path = os.path.join( installprefix, "share/sounds/", ring_tone )
- logger.info( "Start ringing : tone=%s, volume=%s, loop=%d, length=%d", ring_tone, ring_volume, ring_loop, ring_length )
- # FIXME: We don't set the ringing volume.
- # Here we only disable the ringing action if the volume is 0
self.audio_action = AudioAction(self.sound_path, ring_loop, ring_length) if ring_volume != 0 else None
self.vibrator_action = VibratorAction()
+ logger.debug( "ring tone action: audio=%s, vibrator=%s", self.audio_action, self.vibrator_action )
+
+ def trigger(self, **kargs):
+ logger.info( "RingToneAction play" )
if self.audio_action:
self.audio_action.trigger()
self.vibrator_action.trigger()
- def trigger(self, **kargs):
- self.audio_action = None
- self.vibrator_action = None
- # Start the tasklet
- self.__trigger().start()
-
def untrigger(self, **kargs):
logger.info( "RingToneAction stop" )
- if self.audio_action: self.audio_action.untrigger()
- if self.vibrator_action : self.vibrator_action.untrigger()
+ if self.audio_action:
+ self.audio_action.untrigger()
+ if self.vibrator_action:
+ self.vibrator_action.untrigger()
def __repr__(self):
return "RingToneAction()"
--
FSO frameworkd Debian packaging
More information about the pkg-fso-commits
mailing list