diff options
author | Raptor Engineering Development Team <support@raptorengineering.com> | 2018-06-03 19:27:51 +0000 |
---|---|---|
committer | Raptor Engineering Development Team <support@raptorengineering.com> | 2018-06-03 19:27:51 +0000 |
commit | 257b47cc072d5ac64cb2cafdde3f9de26246c747 (patch) | |
tree | 1a17ef8fdafbd6433daacb10f8e90b5e42528e60 | |
parent | 2e0db9d4b90ba1567f2a78739996d247a359d272 (diff) | |
download | vpdtools-257b47cc072d5ac64cb2cafdde3f9de26246c747.tar.gz vpdtools-257b47cc072d5ac64cb2cafdde3f9de26246c747.zip |
Suppress transient I2C failure messages
-rw-r--r-- | woferclock/README | 3 | ||||
-rwxr-xr-x | woferclock/write_vpd | 22 |
2 files changed, 13 insertions, 12 deletions
diff --git a/woferclock/README b/woferclock/README index 910ca47..be4bb6b 100644 --- a/woferclock/README +++ b/woferclock/README @@ -10,6 +10,3 @@ python To overclock: ./woferclock_cpu - -Known issues: -Depending on system version and/or kernel version, the VPD write step may spew write errors. This is normal, and the VPD is successfully updated if no VPD mismatch error is printed at the end of the update process. diff --git a/woferclock/write_vpd b/woferclock/write_vpd index 0105d83..225d32a 100755 --- a/woferclock/write_vpd +++ b/woferclock/write_vpd @@ -5,7 +5,9 @@ import sys import os +import time import binascii +import subprocess eeprom_bus = int(sys.argv[1]) if sys.argv[2].startswith("0x") or sys.argv[2].startswith("0X"): @@ -48,15 +50,17 @@ for i in range(0, vpd_length, 2): address_low = hex(address & 255) command = "i2cset -y " + str(eeprom_bus) + " 0x" + format(eeprom_address, '02x') + " " + address_high + " " + address_low + " 0x" + raw_data[i:(i+2)] + " i" i2c_ret = os.system(command) - exit_code = os.WEXITSTATUS(i2c_ret) - if exit_code != 0: - # Retry - i2c_ret = os.system(command) - exit_code = os.WEXITSTATUS(i2c_ret) - if exit_code != 0: - print "[ERROR] Write failed!" - print "\tCommand was: " + command - sys.exit(1) + try: + subprocess.check_call(command, stderr=subprocess.STDOUT, shell=True) + except: + # Retry, giving the SEEPROM some time to recover + time.sleep(0.1) + try: + subprocess.check_call(command, shell=True) + except: + print "[ERROR] Write failed!" + print "\tCommand was: " + command + sys.exit(1) address = address + 1 sys.stdout.write(format(address, '05d') + " / " + format((vpd_length / 2), '05d') + "\r") sys.stdout.flush() |