[Pcsclite-cvs-commit] Drivers/ccid/src ccid.h,1.3,1.4 ifdhandler.c,1.15,1.16
rousseau@quantz.debian.org
rousseau@quantz.debian.org
Wed, 11 Feb 2004 15:37:02 +0100
Update of /cvsroot/pcsclite/Drivers/ccid/src
In directory quantz:/tmp/cvs-serv11346
Modified Files:
ccid.h ifdhandler.c
Log Message:
Index: ccid.h
===================================================================
RCS file: /cvsroot/pcsclite/Drivers/ccid/src/ccid.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ccid.h 11 Feb 2004 10:09:55 -0000 1.3
+++ ccid.h 11 Feb 2004 14:36:59 -0000 1.4
@@ -52,7 +52,9 @@
#define CCID_CLASS_AUTO_CONF_ATR 0x00000002
#define CCID_CLASS_AUTO_VOLTAGE 0x00000008
+#define CCID_CLASS_AUTO_BAUD 0x00000020
#define CCID_CLASS_AUTO_PPS_CUR 0x00000080
+#define CCID_CLASS_AUTO_IFSD 0x00000400
#define CCID_CLASS_TPDU 0x00010000
#define CCID_CLASS_SHORT_APDU 0x00020000
#define CCID_CLASS_EXTENDED_APDU 0x00040000
Index: ifdhandler.c
===================================================================
RCS file: /cvsroot/pcsclite/Drivers/ccid/src/ifdhandler.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- ifdhandler.c 11 Feb 2004 10:12:00 -0000 1.15
+++ ifdhandler.c 11 Feb 2004 14:36:59 -0000 1.16
@@ -567,13 +567,36 @@
ATR_GetNumberOfProtocols(&atr, &np);
+ /* PPS not negociated by reader, and TA1 present */
+ if (atr.ib[0][ATR_INTERFACE_BYTE_TA].present &&
+ ! (ccid_desc->dwFeatures & CCID_CLASS_AUTO_PPS_CUR) &&
+ ! (ccid_desc->dwFeatures & CCID_CLASS_AUTO_BAUD))
+ {
+ int len = 3;
+ BYTE pps[] = {
+ 0xFF, /* PTSS */
+ 0x10, /* PTS0: PTS1 present */
+ 0, /* PTS1 */
+ 0}; /* PCK: will be calculated */
+
+ /* TD1: protocol */
+ if (atr.ib[0][ATR_INTERFACE_BYTE_TD].present)
+ pps[1] |= (atr.ib[0][ATR_INTERFACE_BYTE_TD].value & 0x0F);
+
+ /* PTS1 = TA1 */
+ pps[2] = atr.ib[0][ATR_INTERFACE_BYTE_TA].value;
+
+ PPS_Exchange(lun, pps, &len);
+ }
+
/*
* Get protocol offered by interface bytes T*2 if available,
- * (that is, if TD1 is available), * otherwise use default T=0
+ * (that is, if TD1 is available), otherwise use default T=0
*/
if (np>1)
ATR_GetProtocolType(&atr, 2, &protocol);
+ /* SetParameters and negociate IFSD */
if ((protocol == ATR_PROTOCOL_TYPE_T1) &&
(ccid_desc->dwFeatures & CCID_CLASS_TPDU))
{
@@ -588,33 +611,17 @@
Protocol_T1_Init(t1, lun);
SetParameters(t1->lun, 1, 7, param);
-
- /* negotiate IFSD */
- Protocol_T1_Negociate_IFSD(t1, ccid_desc -> dwMaxIFSD);
-
- DEBUG_COMM3("T=1: IFSC=%d, IFSD=%d", t1->ifsc, t1->ifsd);
}
- /* PPS not negociated by reader, and TA1 present */
- if (atr.ib[0][ATR_INTERFACE_BYTE_TA].present &&
- ! (ccid_desc->dwFeatures & CCID_CLASS_AUTO_PPS_CUR))
+ /* negotiate IFSD in T=1 */
+ if ((protocol == ATR_PROTOCOL_TYPE_T1) &&
+ ! (ccid_desc->dwFeatures & CCID_CLASS_AUTO_IFSD))
{
Protocol_T1 *t1 = &(ccid_slot -> t1);
- int len = 3;
- BYTE pps[] = {
- 0xFF, /* PTSS */
- 0x10, /* PTS0: PTS1 present */
- 0, /* PTS1 */
- 0}; /* PCK: will be calculated */
-
- /* TD1: protocol */
- if (atr.ib[0][ATR_INTERFACE_BYTE_TD].present)
- pps[1] |= (atr.ib[0][ATR_INTERFACE_BYTE_TD].value & 0x0F);
- /* TA1 */
- pps[2] = atr.ib[0][ATR_INTERFACE_BYTE_TA].value;
+ Protocol_T1_Negociate_IFSD(t1, ccid_desc -> dwMaxIFSD);
- PPS_Exchange(t1, pps, &len);
+ DEBUG_COMM3("T=1: IFSC=%d, IFSD=%d", t1->ifsc, t1->ifsd);
}
return IFD_SUCCESS;