[pkg-fso-commits] [SCM] FSO frameworkd Debian packaging branch, debian, updated. upstream/0.9.5.5-717-g0f98819

Denis 'GNUtoo' Carikli GNUtoo at no-log.org
Sat Aug 6 08:20:12 UTC 2011


The following commit has been merged in the debian branch:
commit 4faa776055c7ca032ae45d9411a3949ed315e063
Author: Denis 'GNUtoo' Carikli <GNUtoo at no-log.org>
Date:   Thu Nov 4 16:12:11 2010 +0100

    ogpsd: msm.py: activate/desactivate gps by launching/killing the "gps" program
    
    I used subprocess for launching and killing the gps program.
    
    Here are the limitations:
    * playing too fast with gps's on/off in shr-settings can crash
      (and so reboot) the phone
    * The gps program must not be launched manually(not within frameworkd)
    
    Note that if we use shell=True for launching the gps program,
    the .kill() kills the shell instead of the gps program.
    Thanks a lot Yhg1s in #python on Freenode for help on debugging that
    
    Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at no-log.org>

diff --git a/framework/subsystems/ogpsd/msm.py b/framework/subsystems/ogpsd/msm.py
index 896af7c..3bbc4ec 100644
--- a/framework/subsystems/ogpsd/msm.py
+++ b/framework/subsystems/ogpsd/msm.py
@@ -10,6 +10,7 @@ Open GPS Daemon
 (C) 2008 Openmoko, Inc.
 GPLv2 or later
 """
+import os,subprocess
 
 from nmea import NMEADevice
 
@@ -22,20 +23,20 @@ class MSMDevice( NMEADevice ):
     """MSM SOC specific GPS device"""
 
     def __init__( self, bus, channel ):
-
-        #TODO: stop "gps" from android-rpc if already launched
-
         NMEADevice.__init__( self, bus, channel )
+        self.dev_null = os.open("/dev/null",777)
+        self.gps = None
 
     def initializeDevice( self ):
-        #TODO: launch "gps" from android-rpc
-
         NMEADevice.initializeDevice( self )
+        if not self.gps:
+            self.gps = subprocess.Popen(["gps"],stderr=self.dev_null,stdout=self.dev_null, shell=False)
 
     def shutdownDevice( self ):
-
+	if self.gps:
+            self.gps.kill()
+            self.gps.wait()
+            self.gps = None
         NMEADevice.shutdownDevice( self )
 
-        #TODO: stop "gps" from android-rpc
-
 #vim: expandtab

-- 
FSO frameworkd Debian packaging



More information about the pkg-fso-commits mailing list