[Pcsclite-cvs-commit] r5038 - in /trunk/PCSC/UnitaryTests: stress_apdu.py stress_get_firmware.py
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Thu Jun 24 12:47:24 UTC 2010
Author: rousseau
Date: Thu Jun 24 12:47:18 2010
New Revision: 5038
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5038
Log:
- better display the list of available readers
- display the command duration and log to stderr if the duration is more
than 1 second indicating a problem
Modified:
trunk/PCSC/UnitaryTests/stress_apdu.py
trunk/PCSC/UnitaryTests/stress_get_firmware.py
Modified: trunk/PCSC/UnitaryTests/stress_apdu.py
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/UnitaryTests/stress_apdu.py?rev=5038&op=diff
==============================================================================
--- trunk/PCSC/UnitaryTests/stress_apdu.py (original)
+++ trunk/PCSC/UnitaryTests/stress_apdu.py Thu Jun 24 12:47:18 2010
@@ -20,6 +20,7 @@
# 51 franklin street, fifth floor, boston, ma 02110-1301 usa.
from smartcard.System import readers
+from time import time, ctime
def stress(reader):
@@ -37,9 +38,14 @@
i = 0
while True:
+ before = time()
data, sw1, sw2 = connection.transmit(COMMAND)
+ after = time()
print data
- print "%d Command: %02X %02X" % (i, sw1, sw2)
+ delta = after - before
+ print "%d Command: %02X %02X, delta: %f" % (i, sw1, sw2, delta)
+ if delta > 1:
+ sys.stderr.write(ctime() + " %f\n" % delta)
i += 1
if __name__ == "__main__":
@@ -47,7 +53,11 @@
# get all the available readers
readers = readers()
- print "Available readers:", readers
+ print "Available readers:"
+ i = 0
+ for r in readers:
+ print "%d: %s" % (i, r)
+ i += 1
try:
i = int(sys.argv[1])
Modified: trunk/PCSC/UnitaryTests/stress_get_firmware.py
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/UnitaryTests/stress_get_firmware.py?rev=5038&op=diff
==============================================================================
--- trunk/PCSC/UnitaryTests/stress_get_firmware.py (original)
+++ trunk/PCSC/UnitaryTests/stress_get_firmware.py Thu Jun 24 12:47:18 2010
@@ -22,6 +22,7 @@
from smartcard.pcsc.PCSCReader import readers
from smartcard.pcsc.PCSCPart10 import (SCARD_SHARE_DIRECT,
SCARD_LEAVE_CARD, SCARD_CTL_CODE)
+from time import time, ctime
def stress(reader):
@@ -33,10 +34,15 @@
IOCTL_SMARTCARD_VENDOR_IFD_EXCHANGE = SCARD_CTL_CODE(1)
i = 0
while True:
+ before = time()
res = cardConnection.control(IOCTL_SMARTCARD_VENDOR_IFD_EXCHANGE,
get_firmware)
- print "%d Reader: %s" % (i, reader)
+ after = time()
+ delta = after - before
+ print "%d Reader: %s, delta: %d" % (i, reader, delta)
print "Firmware:", "".join([chr(x) for x in res])
+ if delta > 1:
+ sys.stderr.write(ctime() + " %f\n" % delta)
i += 1
if __name__ == "__main__":
@@ -44,7 +50,11 @@
# get all the available readers
readers = readers()
- print "Available readers:", readers
+ print "Available readers:"
+ i = 0
+ for r in readers:
+ print "%d: %s" % (i, r)
+ i += 1
try:
i = int(sys.argv[1])
More information about the Pcsclite-cvs-commit
mailing list