Author: duncan
Date: Wed Jun  6 16:33:16 2007
New Revision: 9655

Modified:
   branches/rel-1/freevo/ChangeLog
   branches/rel-1/freevo/freevo_config.py
   branches/rel-1/freevo/src/plugins/idlebar/system.py

Log:
[ 1731892 ] idlebar plugin has wrong sensors path for 2.6.21
Added configurable items for the paths


Modified: branches/rel-1/freevo/ChangeLog
==============================================================================
--- branches/rel-1/freevo/ChangeLog     (original)
+++ branches/rel-1/freevo/ChangeLog     Wed Jun  6 16:33:16 2007
@@ -19,6 +19,7 @@
  * Added personal web pages to the webserver, using PERSONAL_WWW_PAGE 
(F#1729595)
  * Updated childapp to use subprocess instead of popen (F#1729597)
  * Updated local_conf.py.example with MPLAYER_HAS_FIELD_DOMINANCE (F#1729404)
+ * Updated system sensors for a configurable path (B#1731892)
  * Updated xine video plug-in to allow bookmarks to work (F#1729024)
  * Updated xine video plug-in to process stdout and stderr message (F#1729603)
  * Fixed audio channel selection for AVI files, when no id is present 
(B#1731232)

Modified: branches/rel-1/freevo/freevo_config.py
==============================================================================
--- branches/rel-1/freevo/freevo_config.py      (original)
+++ branches/rel-1/freevo/freevo_config.py      Wed Jun  6 16:33:16 2007
@@ -279,6 +279,7 @@
         Added LOGGING, can be one of CRITICAL, ERROR, WARNING, INFO, DEBUG
         Added RECORDSERVER_LOGGING to allow different levels of errors to be 
reported
         Changed VIDEO_INTERLACING to VIDEO_DEINTERLACE to be more consistent 
with autovars
+        Added SENSORS_PLATFORM_PATH and SENSORS_I2CDEV_PATH for sensor paths
      ''' ),
 ]
 

Modified: branches/rel-1/freevo/src/plugins/idlebar/system.py
==============================================================================
--- branches/rel-1/freevo/src/plugins/idlebar/system.py (original)
+++ branches/rel-1/freevo/src/plugins/idlebar/system.py Wed Jun  6 16:33:16 2007
@@ -190,15 +190,21 @@
         small class defining a temperature sensor
         """
         def __init__(self, sensor, compute_expression, hotstack):
-            self.initpath = "/proc/sys/dev/sensors/"
-            self.k6path = '/sys/bus/i2c/devices'
-            self.k6 = 0
+            self.pathform_path = config.SENSORS_PLATFORM_PATH
+            self.i2cdev_path = config.SENSORS_I2CDEV_PATH
+            self.kernel26 = False
             self.senspath = self.getSensorPath()
             self.sensor = sensor
             self.compute_expression = compute_expression
             self.hotstack = hotstack
             self.washot = False
 
+        def config(self):
+            return [
+                ( 'SENSORS_PLATFORM_PATH', '/sys/devices/platform', 'path to 
the sensor devices' ),
+                ( 'SENSORS_I2CDEV_PATH', '/sys/bus/i2c/devices', 'path to the 
i2c devices' ),
+            ]
+
         def temp(self):
             def temp_compute (rawvalue):
                 try:
@@ -211,7 +217,7 @@
             if self.senspath == -1 or not self.senspath:
                 return "?"
 
-            if self.k6 :
+            if self.kernel26:
                 file = os.path.join( self.senspath, 'temp_input' + 
self.sensor[-1] )
                 fhot = os.path.join( self.senspath, 'temp_max' + 
self.sensor[-1] )
                 if not os.path.exists(file):
@@ -228,7 +234,7 @@
             data = f.read()
             f.close()
 
-            if self.k6:
+            if self.kernel26:
                 temp = int(temp_compute(float(data[0:2])))
                 hot = int(temp_compute(float(hotdata[0:2])))
 
@@ -249,30 +255,30 @@
 
         def getSensorPath(self):
             #let's try if we find a sys filesystem (and kernel2.6 style 
sensors)
-            if os.path.exists(self.k6path):
-                self.k6 = 1
+            if os.path.exists(self.i2cdev_path):
+                self.kernel26 = True
                 #print "Detected kernel 2.6 sys fs"
-                for senspath in os.listdir(self.k6path):
-                    testpath = os.path.join(self.k6path , senspath)
+                for senspath in os.listdir(self.i2cdev_path):
+                    testpath = os.path.join(self.i2cdev_path , senspath)
                     for pos_sensors in os.listdir(testpath):
                         if pos_sensors == "temp_input1":
                             return testpath
                         if pos_sensors == "temp1_input":
                             return testpath
 
-            if not os.path.exists(self.initpath):
-                if self.k6:
+            if not os.path.exists(self.pathform_path):
+                if self.kernel26:
                     print "Kernel 2.5/2.6 detected, but no i2c sensors found"
-                    print "Did u load (or compile) the necessary bus driver"
+                    print "Did you load (or compile) the necessary bus driver"
                     print "and sensor chip modules"
                 else:
-                    print "LM_Sensors proc data not available? Did you load 
i2c-proc"
+                    print "LM_Sensors data not available? Did you load 
i2c-proc"
                     print "and configured lm_sensors?"
                     print "temperatures will be bogus"
                 return -1 #failure
 
-            for senspath in os.listdir(self.initpath):
-                testpath = os.path.join(self.initpath , senspath)
+            for senspath in os.listdir(self.pathform_path):
+                testpath = os.path.join(self.pathform_path , senspath)
                 if os.path.isdir(testpath):
                     return testpath
 

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to