Update of /cvsroot/freevo/freevo/src/plugins/idlebar
In directory sc8-pr-cvs1:/tmp/cvs-serv13930

Modified Files:
        system.py 
Log Message:
some fixes from den_RDC. adds 2.6 support too

Index: system.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/plugins/idlebar/system.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** system.py   2 Nov 2003 18:02:09 -0000       1.4
--- system.py   2 Nov 2003 20:06:44 -0000       1.5
***************
*** 14,17 ****
--- 14,20 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.5  2003/11/02 20:06:44  mikeruelle
+ # some fixes from den_RDC. adds 2.6 support too
+ #
  # Revision 1.4  2003/11/02 18:02:09  dischi
  # fix case temp
***************
*** 196,199 ****
--- 199,204 ----
          def __init__(self, sensor, compute_expression, hotstack):
              self.initpath = "/proc/sys/dev/sensors/"
+             self.k6path = '/sys/bus/i2c/devices'
+             self.k6 = 0
              self.senspath = self.getSensorPath()
              self.sensor = sensor
***************
*** 214,224 ****
                  return "?"        
              
!             file = os.path.join( self.senspath, self.sensor )
              f = open(file)
              data = f.read()
              f.close()
              
!             temp = int(temp_compute (float(string.split(data)[2])))
!             hot = int(temp_compute (float(string.split(data)[0])))
              if temp > hot:
                  if self.washot == False:
--- 219,244 ----
                  return "?"        
              
!             if self.k6 :
!                 file = os.path.join( self.senspath, 'temp_input' + self.sensor[-1] )
!                 fhot = os.path.join( self.senspath, 'temp_max' + self.sensor[-1] )
!                 f = open(fhot)
!                 hotdata = f.read()
!                 f.close()
!             
!             else:
!                 file = os.path.join( self.senspath, self.sensor )
!             
              f = open(file)
              data = f.read()
              f.close()
              
!             if self.k6:
!                 temp = int(temp_compute(float(data[0:2])))
!                 hot = int(temp_compute(float(hotdata[0:2])))
!                 
!             else:
!                 temp = int(temp_compute (float(string.split(data)[2])))
!                 hot = int(temp_compute (float(string.split(data)[0])))
!             
              if temp > hot:
                  if self.washot == False:
***************
*** 233,240 ****
              
          def getSensorPath(self):
              if not os.path.exists(self.initpath):
!                 print "LM_Sensors proc data not available? Did you load i2c-proc"
!                 print "and configured lm_sensors?"
!                 print "temperatures will be bogus"
                  return -1 #failure
                  
--- 253,275 ----
              
          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
+                 #print "Detected kernel 2.6 sys fs"
+                 for senspath in os.listdir(self.k6path):
+                     testpath = os.path.join(self.k6path , senspath)
+                     for pos_sensors in os.listdir(testpath):
+                         if pos_sensors == "temp_input1":
+                             return testpath
+                             
              if not os.path.exists(self.initpath):
!                 if self.k6:
!                     print "Kernel 2.5/2.6 detected, but no i2c sensors found"
!                     print "Did u 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 "and configured lm_sensors?"
!                     print "temperatures will be bogus"
                  return -1 #failure
                  




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to