import os
def usage():
- print "Usage: %s PHYTYPES COREREVS /path/to/extracted/firmware" % sys.argv[0]
- print ""
- print "PHYTYPES is a comma separated list of:"
- print "A => A-PHY"
- print "AG => Dual A-PHY G-PHY"
- print "G => G-PHY"
- print "LP => LP-PHY"
- print "N => N-PHY"
- print ""
- print "COREREVS is a comma separated list of core revision numbers."
+ print("Usage: %s PHYTYPES COREREVS /path/to/extracted/firmware" % sys.argv[0])
+ print("")
+ print("PHYTYPES is a comma separated list of:")
+ print("A => A-PHY")
+ print("AG => Dual A-PHY G-PHY")
+ print("G => G-PHY")
+ print("LP => LP-PHY")
+ print("N => N-PHY")
+ print("")
+ print("COREREVS is a comma separated list of core revision numbers.")
if len(sys.argv) != 4:
usage()
try:
corerevs = map(lambda r: int(r), corerevs.split(','))
except ValueError:
- print "ERROR: \"%s\" is not a valid COREREVS string\n" % corerevs
+ print("ERROR: \"%s\" is not a valid COREREVS string\n" % corerevs)
usage()
sys.exit(1)
fwfiles = os.listdir(fwpath)
fwfiles = filter(lambda str: str.endswith(".fw"), fwfiles)
if not fwfiles:
- print "ERROR: No firmware files found in %s" % fwpath
+ print("ERROR: No firmware files found in %s" % fwpath)
sys.exit(1)
required_fwfiles = []
return False
revmapping = {
- "ucode2.fw" : (2,),
+ "ucode2.fw" : (2,3,),
"ucode4.fw" : (4,),
"ucode5.fw" : (5,6,7,8,9,10,),
"ucode11.fw" : (11,12,),
phytypes_match(phytypes, initvalmapping[f][1]):
required_fwfiles += [f]
continue
- print "WARNING: Firmware file %s not found in the mapping lists" % f
+ print("WARNING: Firmware file %s not found in the mapping lists" % f)
for f in fwfiles:
if f not in required_fwfiles:
- print "Deleting %s" % f
+ print("Deleting %s" % f)
os.unlink(fwpath + '/' + f)