Changeset 3587
- Timestamp:
- 10/17/10 13:03:34 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/csctapi/icc_async.c
r3469 r3587 526 526 527 527 ATR_GetParameter (atr, ATR_PARAMETER_N, &(n)); 528 529 /* if TD1 is present then we might have multiple protocols avialable and/or be able to negotiate, 530 if TD1 is missing only T0 available */ 531 BYTE TD1; 532 if (ATR_GetInterfaceByte (atr, 1, ATR_INTERFACE_BYTE_TD, &TD1) == ATR_OK) { 528 533 ATR_GetProtocolType(atr,1,&(reader->protocol_type)); //get protocol from TD1 529 534 BYTE TA2; 530 bool SpecificMode = (ATR_GetInterfaceByte (atr, 2, ATR_INTERFACE_BYTE_TA, &TA2) == ATR_OK); //if TA2 present, specific mode, else negotiable mode 535 //if TA2 present, and specific mode bit (bit 8) set then specific mode, else negotiable mode 536 bool SpecificMode = ((ATR_GetInterfaceByte (atr, 2, ATR_INTERFACE_BYTE_TA, &TA2) == ATR_OK) && ((TA2 & 0x80) == 0x80)); 531 537 if (SpecificMode) { 532 538 reader->protocol_type = TA2 & 0x0F; … … 547 553 d = ATR_DEFAULT_D; 548 554 } 549 cs_debug("Specific mode : T%i, F=%.0f, D=%.6f, N=%.0f\n", reader->protocol_type, (double) atr_f_table[FI], d, n);555 cs_debug("Specific mode, selected protocol: T%i, F=%.0f, D=%.6f, N=%.0f\n", reader->protocol_type, (double) atr_f_table[FI], d, n); 550 556 } 551 557 else { //negotiable mode 552 553 558 bool PPS_success = FALSE; 554 559 bool NeedsPTS = ((reader->protocol_type != ATR_PROTOCOL_TYPE_T14) && (numprottype > 1 || (atr->ib[0][ATR_INTERFACE_BYTE_TA].present == TRUE && atr->ib[0][ATR_INTERFACE_BYTE_TA].value != 0x11) || n == 255)); //needs PTS according to old ISO 7816 … … 590 595 } 591 596 592 cs_debug("No PTS %s, selected protocol T%i, F=%.0f, D=%.6f, N=%.0f\n", NeedsPTS?"happened":"needed", reader->protocol_type, (double) atr_f_table[FI], d, n);597 cs_debug("No PTS %s, selected protocol: T%i, F=%.0f, D=%.6f, N=%.0f\n", NeedsPTS?"happened":"needed", reader->protocol_type, (double) atr_f_table[FI], d, n); 593 598 } 594 599 }//end negotiable mode 595 600 } 601 else { // No TD1 therefore T0 is the only protocol available 602 reader->protocol_type = 0; 603 BYTE TA1; 604 if (ATR_GetInterfaceByte (atr, 1 , ATR_INTERFACE_BYTE_TA, &TA1) == ATR_OK) { 605 FI = TA1 >> 4; 606 ATR_GetParameter (atr, ATR_PARAMETER_D, &(d)); 607 } 608 else { //do not obey TA1 609 FI = ATR_DEFAULT_FI; 610 d = ATR_DEFAULT_D; 611 } 612 cs_debug("Only TO available, selected protocol: T%i, F=%.0f, D=%.6f, N=%.0f\n", reader->protocol_type, (double) atr_f_table[FI], d, n); 613 } 614 596 615 //make sure no zero values 597 616 double F = (double) atr_f_table[FI];
Note:
See TracChangeset
for help on using the changeset viewer.