summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaptor Engineering Development Team <support@raptorengineering.com>2018-02-19 12:48:13 -0600
committerRaptor Engineering Development Team <support@raptorengineering.com>2018-02-19 12:48:13 -0600
commit499ce30d5a590eb2d1bfdaa468786294215d771f (patch)
tree50b9f036618134fd442691944b889ca995b4306e
parent9499922bc067c34e6fa50467b5c341e2ebbf786a (diff)
downloadtalos-skeleton-499ce30d5a590eb2d1bfdaa468786294215d771f.tar.gz
talos-skeleton-499ce30d5a590eb2d1bfdaa468786294215d771f.zip
Fix IPL monitor failure
The I2C bus on which the FPGA resides is somewhat noisy / high traffic. This leads to frequent i2cget failures. Retry a failed FPGA register access up to 16 times before aborting.
-rw-r--r--pyiplledmonitor/ipl_status_led_monitor.py36
1 files changed, 9 insertions, 27 deletions
diff --git a/pyiplledmonitor/ipl_status_led_monitor.py b/pyiplledmonitor/ipl_status_led_monitor.py
index ac3d6ad..a67186a 100644
--- a/pyiplledmonitor/ipl_status_led_monitor.py
+++ b/pyiplledmonitor/ipl_status_led_monitor.py
@@ -67,34 +67,11 @@ class IPLStatusLEDMonitor(DbusProperties, DbusObjectManager):
print "IPLStatusLEDMonitor Init Done"
def IPLLEDReadI2CByte(self, byte):
+ retry_number = 0
retval = 0
- comm_fail = False;
- try:
- proc = subprocess.Popen(["i2cget", "-y", "12", "0x31", str(byte)], stdout=subprocess.PIPE, stderr=open(os.devnull, 'wb'), shell=False)
- (out, err) = proc.communicate()
- if (proc.returncode != 0):
- comm_fail = True
- else:
- retval = int(out, 16)
- except:
- comm_fail = True;
- pass
- if (comm_fail == True):
- comm_fail = False
- time.sleep(1)
- try:
- proc = subprocess.Popen(["i2cget", "-y", "12", "0x31", str(byte)], stdout=subprocess.PIPE, stderr=open(os.devnull, 'wb'), shell=False)
- (out, err) = proc.communicate()
- if (proc.returncode != 0):
- comm_fail = True
- else:
- retval = int(out, 16)
- except:
- comm_fail = True;
- pass
- if (comm_fail == True):
- comm_fail = False
- time.sleep(1)
+ comm_fail = True;
+ while (comm_fail == True):
+ comm_fail = False;
try:
proc = subprocess.Popen(["i2cget", "-y", "12", "0x31", str(byte)], stdout=subprocess.PIPE, stderr=open(os.devnull, 'wb'), shell=False)
(out, err) = proc.communicate()
@@ -105,6 +82,11 @@ class IPLStatusLEDMonitor(DbusProperties, DbusObjectManager):
except:
comm_fail = True;
pass
+ if (comm_fail == True):
+ retry_number += 1
+ if (retry_number > 16):
+ break
+ time.sleep(0.1)
return retval
def IPLLEDCheckSystem(self):
OpenPOWER on IntegriCloud