[Pcsclite-cvs-commit] r5985 - in /trunk/PCSC/src/spy: pcsc-spy.c pcsc-spy.py
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Thu Sep 29 12:59:23 UTC 2011
Author: rousseau
Date: Thu Sep 29 12:59:23 2011
New Revision: 5985
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5985
Log:
Convert return value from hexa to text
SCARD_E_NOT_TRANSACTED is more human friendly than 0x80100016
Modified:
trunk/PCSC/src/spy/pcsc-spy.c
trunk/PCSC/src/spy/pcsc-spy.py
Modified: trunk/PCSC/src/spy/pcsc-spy.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/spy/pcsc-spy.c?rev=5985&op=diff
==============================================================================
--- trunk/PCSC/src/spy/pcsc-spy.c (original)
+++ trunk/PCSC/src/spy/pcsc-spy.c Thu Sep 29 12:59:23 2011
@@ -176,7 +176,7 @@
struct timeval profile_time;
gettimeofday(&profile_time, NULL);
- spy_line("<|%d|%d|%s|%s (0x%08X)", profile_time.tv_sec,
+ spy_line("<|%d|%d|%s|%s|0x%08X", profile_time.tv_sec,
profile_time.tv_usec, fname, spy.pcsc_stringify_error(rv), rv);
}
Modified: trunk/PCSC/src/spy/pcsc-spy.py
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/spy/pcsc-spy.py?rev=5985&op=diff
==============================================================================
--- trunk/PCSC/src/spy/pcsc-spy.py (original)
+++ trunk/PCSC/src/spy/pcsc-spy.py Thu Sep 29 12:59:23 2011
@@ -37,28 +37,94 @@
if line == "":
raise Exception("Empty line (application exited?)")
- (direction, sec, usec, function, rv) = line.split('|')
+ (direction, sec, usec, function, code, rv) = line.split('|')
if direction != '<':
raise Exception("Wrong line:", line)
sec = int(sec)
usec = int(usec)
- return (rv, sec, usec)
+
+ return (code, rv, sec, usec)
def _log_rv(self):
""" log the return value """
line = self.filedesc.readline().strip()
- (rv, sec, usec) = self._parse_rv(line)
+ (code, rv, sec, usec) = self._parse_rv(line)
delta_sec = sec - self.sec
delta_usec = usec - self.usec
if delta_usec < 0:
delta_sec -= 1
delta_usec += 1000000
time = " [%d.%09d]" % (delta_sec, delta_usec)
- if not "0x00000000" in rv:
- print PCSCspy.color_red + " => " + rv + PCSCspy.color_normal + time
+
+ rvs = {
+ 0x00000000: "SCARD_S_SUCCESS",
+ 0x80100001: "SCARD_F_INTERNAL_ERROR",
+ 0x80100002: "SCARD_E_CANCELLED",
+ 0x80100003: "SCARD_E_INVALID_HANDLE",
+ 0x80100004: "SCARD_E_INVALID_PARAMETER",
+ 0x80100005: "SCARD_E_INVALID_TARGET",
+ 0x80100006: "SCARD_E_NO_MEMORY",
+ 0x80100007: "SCARD_F_WAITED_TOO_LONG",
+ 0x80100008: "SCARD_E_INSUFFICIENT_BUFFER",
+ 0x80100009: "SCARD_E_UNKNOWN_READER",
+ 0x8010000A: "SCARD_E_TIMEOUT",
+ 0x8010000B: "SCARD_E_SHARING_VIOLATION",
+ 0x8010000C: "SCARD_E_NO_SMARTCARD",
+ 0x8010000D: "SCARD_E_UNKNOWN_CARD",
+ 0x8010000E: "SCARD_E_CANT_DISPOSE",
+ 0x8010000F: "SCARD_E_PROTO_MISMATCH",
+ 0x80100010: "SCARD_E_NOT_READY",
+ 0x80100011: "SCARD_E_INVALID_VALUE",
+ 0x80100012: "SCARD_E_SYSTEM_CANCELLED",
+ 0x80100013: "SCARD_F_COMM_ERROR",
+ 0x80100014: "SCARD_F_UNKNOWN_ERROR",
+ 0x80100015: "SCARD_E_INVALID_ATR",
+ 0x80100016: "SCARD_E_NOT_TRANSACTED",
+ 0x80100017: "SCARD_E_READER_UNAVAILABLE",
+ 0x80100018: "SCARD_P_SHUTDOWN",
+ 0x80100019: "SCARD_E_PCI_TOO_SMALL",
+ 0x8010001A: "SCARD_E_READER_UNSUPPORTED",
+ 0x8010001B: "SCARD_E_DUPLICATE_READER",
+ 0x8010001C: "SCARD_E_CARD_UNSUPPORTED",
+ 0x8010001D: "SCARD_E_NO_SERVICE",
+ 0x8010001E: "SCARD_E_SERVICE_STOPPED",
+ 0x8010001F: "SCARD_E_UNSUPPORTED_FEATURE",
+ 0x80100020: "SCARD_E_ICC_INSTALLATION",
+ 0x80100021: "SCARD_E_ICC_CREATEORDER",
+ 0x80100023: "SCARD_E_DIR_NOT_FOUND",
+ 0x80100024: "SCARD_E_FILE_NOT_FOUND",
+ 0x80100025: "SCARD_E_NO_DIR",
+ 0x80100026: "SCARD_E_NO_FILE",
+ 0x80100027: "SCARD_E_NO_ACCESS",
+ 0x80100028: "SCARD_E_WRITE_TOO_MANY",
+ 0x80100029: "SCARD_E_BAD_SEEK",
+ 0x8010002A: "SCARD_E_INVALID_CHV",
+ 0x8010002B: "SCARD_E_UNKNOWN_RES_MNG",
+ 0x8010002C: "SCARD_E_NO_SUCH_CERTIFICATE",
+ 0x8010002D: "SCARD_E_CERTIFICATE_UNAVAILABLE",
+ 0x8010002E: "SCARD_E_NO_READERS_AVAILABLE",
+ 0x8010002F: "SCARD_E_COMM_DATA_LOST",
+ 0x80100030: "SCARD_E_NO_KEY_CONTAINER",
+ 0x80100031: "SCARD_E_SERVER_TOO_BUSY",
+ 0x80100065: "SCARD_W_UNSUPPORTED_CARD",
+ 0x80100066: "SCARD_W_UNRESPONSIVE_CARD",
+ 0x80100067: "SCARD_W_UNPOWERED_CARD",
+ 0x80100068: "SCARD_W_RESET_CARD",
+ 0x80100069: "SCARD_W_REMOVED_CARD",
+ 0x8010006A: "SCARD_W_SECURITY_VIOLATION",
+ 0x8010006B: "SCARD_W_WRONG_CHV",
+ 0x8010006C: "SCARD_W_CHV_BLOCKED",
+ 0x8010006D: "SCARD_W_EOF",
+ 0x8010006E: "SCARD_W_CANCELLED_BY_USER",
+ 0x8010006F: "SCARD_W_CARD_NOT_AUTHENTICATED",
+ }
+ rv_text = rvs[int(rv, 16)]
+ data = " => " + code + " (" + rv_text + " [" + rv + "]) "
+ if "0x00000000" != rv:
+ print PCSCspy.color_red + data + PCSCspy.color_normal + time
else:
- print " =>", rv + time
+ print data + time
def log_in(self, line):
""" generic log for IN line """
More information about the Pcsclite-cvs-commit
mailing list