[Pcsclite-cvs-commit] PCSC/src atrhandler.c,1.11,1.12
rousseau@haydn.debian.org
rousseau@haydn.debian.org
Update of /cvsroot/pcsclite/PCSC/src
In directory haydn:/tmp/cvs-serv2345/src
Modified Files:
atrhandler.c
Log Message:
- set SCARD_PROTOCOL_T15 in CardCapabilities.AvailableProtocols if T=15
is defined (not yet used)
- in specific mode CardCapabilities.AvailableProtocols shall also be set
the the specified protocol
Index: atrhandler.c
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/atrhandler.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- atrhandler.c 21 Jun 2004 07:40:26 -0000 1.11
+++ atrhandler.c 23 Jun 2004 15:00:52 -0000 1.12
@@ -22,7 +22,7 @@
/*
* Uncomment the following for ATR debugging
*/
-/* #define ATR_DEBUG 1 */
+#undef ATR_DEBUG
#define SCARD_PROTOCOL_UNSET 0x00
@@ -40,7 +40,8 @@
p = K = TCK = Y1i = T = 0;
#ifdef ATR_DEBUG
- DebugXxd("ATR: ", pucAtr, dwLength);
+ if (dwLength > 0)
+ DebugXxd("ATR: ", pucAtr, dwLength);
#endif
if (dwLength < 2)
@@ -83,7 +84,8 @@
p = 2;
#ifdef ATR_DEBUG
- debug_msg("Conv: %02X, Y1: %02X, K: %02X",
+ debug_msg("%s:%d:%s Conv: %02X, Y1: %02X, K: %02X",
+ __FILE__, __LINE__, __FUNCTION__,
psExtension->CardCapabilities.Convention, Y1i, K);
#endif
@@ -100,7 +102,8 @@
TDi = (Y1i & 0x08) ? pucAtr[p++] : -1;
#ifdef ATR_DEBUG
- debug_msg("TA%d: %02X, TB%d: %02X, TC%d: %02X, TD%d: %02X",
+ debug_msg("%s:%d:%s TA%d: %02X, TB%d: %02X, TC%d: %02X, TD%d: %02X",
+ __FILE__, __LINE__, __FUNCTION__,
i, TAi, i, TBi, i, TCi, i, TDi);
#endif
@@ -132,11 +135,11 @@
}
}
- if (T == 0)
- {
#ifdef ATR_DEBUG
- debug_msg("T=0 Protocol Found");
+ DebugLogB("T=%d Protocol Found", T);
#endif
+ if (0 == T)
+ {
psExtension->CardCapabilities.AvailableProtocols |=
SCARD_PROTOCOL_T0;
psExtension->CardCapabilities.T0.BGT = 0;
@@ -146,11 +149,8 @@
psExtension->CardCapabilities.T0.WT = 0;
}
else
- if (T == 1)
+ if (1 == T)
{
-#ifdef ATR_DEBUG
- debug_msg("T=1 Protocol Found");
-#endif
psExtension->CardCapabilities.AvailableProtocols |=
SCARD_PROTOCOL_T1;
psExtension->CardCapabilities.T1.BGT = 0;
@@ -160,13 +160,18 @@
psExtension->CardCapabilities.T1.WT = 0;
}
else
- {
- psExtension->CardCapabilities.AvailableProtocols |= T;
- /*
- * Do nothing for now since other protocols are not
- * supported at this time
- */
- }
+ if (15 == T)
+ {
+ psExtension->CardCapabilities.AvailableProtocols |=
+ SCARD_PROTOCOL_T15;
+ }
+ else
+ {
+ /*
+ * Do nothing for now since other protocols are not
+ * supported at this time
+ */
+ }
/* test presence of TA2 */
if ((2 == i) && (TAi >= 0))
@@ -178,11 +183,15 @@
switch (T)
{
case 0:
- psExtension->CardCapabilities.CurrentProtocol = SCARD_PROTOCOL_T0;
+ psExtension->CardCapabilities.CurrentProtocol =
+ psExtension->CardCapabilities.AvailableProtocols =
+ SCARD_PROTOCOL_T0;
break;
case 1:
- psExtension->CardCapabilities.CurrentProtocol = SCARD_PROTOCOL_T1;
+ psExtension->CardCapabilities.CurrentProtocol =
+ psExtension->CardCapabilities.AvailableProtocols =
+ SCARD_PROTOCOL_T1;
break;
default: