Pass ISO7816_GetChar return val to higher layers

The return value of ISO7816_GetChar is 0 in case of a timeout
when trying to retrieve values, and status of US_CSR otherwise.

Proper handling of this return value is not yet implemented though.
With the naive approach of just not sending the ATR if it could not
be read the simtrace firmware did not work together with pcsc_scan
AT ALL.
This commit is contained in:
Christina Quast
2015-01-15 14:53:38 +01:00
parent 99de4e5753
commit 8d0f4a6675
3 changed files with 19 additions and 9 deletions

View File

@@ -665,10 +665,16 @@ static void RDRtoPCDatablock_ATR( void )
unsigned char i;
unsigned char Atr[ATR_SIZE_MAX];
unsigned char length;
uint32_t status;
//TRACE_DEBUG(".");
TRACE_DEBUG(".");
ISO7816_Datablock_ATR( Atr, &length );
status = ISO7816_Datablock_ATR( Atr, &length );
if (status == 0) {
TRACE_DEBUG("Timeout occured while reading ATR");
// FIXME: react properly to timeout..
// return;
}
if( length > 5 ) {
ccidDriver.ProtocolDataStructure[1] = Atr[5]&0x0F; // TD(1)