* [PATCH skeleton] Fix the sensor scandirectory recovery bug when poll or readattribute fail
@ 2016-06-08 7:01 OpenBMC Patches
2016-06-08 7:01 ` OpenBMC Patches
0 siblings, 1 reply; 2+ messages in thread
From: OpenBMC Patches @ 2016-06-08 7:01 UTC (permalink / raw)
To: openbmc
Add except avoid readAttribute error interrupt.
Add self.sensors.pop so the next addobject can recreate the object.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/openbmc/skeleton/99)
<!-- Reviewable:end -->
https://github.com/openbmc/skeleton/pull/99
Ken (1):
Fix the sensor scandirectory recovery bug when poll or readattribute
fail
bin/hwmon.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--
2.8.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH skeleton] Fix the sensor scandirectory recovery bug when poll or readattribute fail
2016-06-08 7:01 [PATCH skeleton] Fix the sensor scandirectory recovery bug when poll or readattribute fail OpenBMC Patches
@ 2016-06-08 7:01 ` OpenBMC Patches
0 siblings, 0 replies; 2+ messages in thread
From: OpenBMC Patches @ 2016-06-08 7:01 UTC (permalink / raw)
To: openbmc; +Cc: Ken
From: Ken <ken.sk.lai@mail.foxconn.com>
---
bin/hwmon.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/bin/hwmon.py b/bin/hwmon.py
index 1209d46..19a2309 100755
--- a/bin/hwmon.py
+++ b/bin/hwmon.py
@@ -47,10 +47,13 @@ class Hwmons():
self.cache = {}
def readAttribute(self,filename):
- val = ""
+ val = "-1"
+ try:
with open(filename, 'r') as f:
for line in f:
val = line.rstrip('\n')
+ except (OSError, IOError):
+ print "Cannot read attributes:", filename
return val
def writeAttribute(self,filename,value):
@@ -78,6 +81,7 @@ class Hwmons():
self.writeAttribute(attribute,rtn[1])
except:
print "HWMON: Attibute no longer exists: "+attribute
+ self.sensors.pop(objpath,None)
if attribute in self.cache:
del self.cache[attribute]
return False
--
2.8.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-06-08 7:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-08 7:01 [PATCH skeleton] Fix the sensor scandirectory recovery bug when poll or readattribute fail OpenBMC Patches
2016-06-08 7:01 ` OpenBMC Patches
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.