From: <lu...@us...> - 2009-11-28 16:08:09
|
Revision: 362 http://pyscard.svn.sourceforge.net/pyscard/?rev=362&view=rev Author: ludov Date: 2009-11-28 16:08:02 +0000 (Sat, 28 Nov 2009) Log Message: ----------- correctly handle invalid TA1 byte Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2009-11-28 15:38:19 UTC (rev 361) +++ trunk/contrib/parseATR/parseATR.py 2009-11-28 16:08:02 UTC (rev 362) @@ -137,9 +137,16 @@ FMax = (4, 5, 6, 8, 12, 16, 20, "RFU", "RFU", 5, 7.5, 10, 15, 20, "RFU", "RFU") F = v >> 4 D = v & 0xF - value = Fi[F] / Di[D] - return "Fi=%s, Di=%s, %g cycles/ETU (%d bits/s at 4.00 MHz, %d bits/s for fMax=%d MHz)" % (Fi[F], Di[D], value, 4000000 / value, FMax[F] * 1000000 / value, FMax[F]) + text = "Fi=%s, Di=%s" % (Fi[F], Di[D]) + if "RFU" in [Fi[F], Di[D]]: + text += ", INVALID VALUE" + else: + value = Fi[F] / Di[D] + text += ", %g cycles/ETU (%d bits/s at 4.00 MHz, %d bits/s for fMax=%d MHz)" % (value, 4000000 / value, FMax[F] * 1000000 / value, FMax[F]) + + return text + def TA2(v): F = v >> 4 D = v & 0xF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |