Hi folks,

This patch fixes the confusing warnings discussed on the shr-user list
(http://lists.shr-project.org/pipermail/shr-user/2010-May/005362.html)

It was made & tested on my NEO Freerunner A6 running SHR-testing. It
took me only a few minutes to write this patch, which is a lot less than
it has cost all the confused users (and developers that had to handle
their bug reports).

Regards,
Sybren

--- om.py.orig  Fri May 21 18:11:52 2010
+++ om.py       Fri May 21 18:13:34 2010
@@ -23,8 +23,15 @@

 import gobject
 import os, sys, marshal, time
+import os.path
 from datetime import datetime, timedelta

+# Check which path exists, defaulting to the new path.
+if os.path.exists(DEVICE_POWER_PATH_OLD):
+    DEVICE_POWER_PATH = DEVICE_POWER_PATH_OLD
+else:
+    DEVICE_POWER_PATH = DEVICE_POWER_PATH_NEW
+
 import logging
 logger = logging.getLogger( MODULE_NAME )

@@ -34,11 +41,9 @@
     def __init__( self, bus, channel ):

         # Make sure the GPS is off
-        helpers.writeToFile( DEVICE_POWER_PATH_OLD, "1" )
-        helpers.writeToFile( DEVICE_POWER_PATH_NEW, "1" )
+        helpers.writeToFile( DEVICE_POWER_PATH, "1" )
         time.sleep( 0.5 )
-        helpers.writeToFile( DEVICE_POWER_PATH_OLD, "0" )
-        helpers.writeToFile( DEVICE_POWER_PATH_NEW, "0" )
+        helpers.writeToFile( DEVICE_POWER_PATH, "0" )

         self.aidingData = persist.get( "ogpsd", "aidingdata" )
         if self.aidingData is None:
@@ -49,8 +54,7 @@
         super( GTA02Device, self ).__init__( bus, channel )

     def initializeDevice( self ):
-        helpers.writeToFile( DEVICE_POWER_PATH_OLD, "1" )
-        helpers.writeToFile( DEVICE_POWER_PATH_NEW, "1" )
+        helpers.writeToFile( DEVICE_POWER_PATH, "1" )

         # Wait for the device to be powered up
         time.sleep(0.5)
@@ -82,8 +86,7 @@

         super( GTA02Device, self ).shutdownDevice()

-        helpers.writeToFile( DEVICE_POWER_PATH_OLD, "0" )
-        helpers.writeToFile( DEVICE_POWER_PATH_NEW, "0" )
+        helpers.writeToFile( DEVICE_POWER_PATH, "0" )

         # Save collected aiding data
         persist.set( "ogpsd", "aidingdata", self.aidingData )
_______________________________________________
Shr-devel mailing list
[email protected]
http://lists.shr-project.org/mailman/listinfo/shr-devel

Reply via email to