-
-/* if(resp_data)
- memcpy(resp_data->atqa, resp, 2);
-
- // OK we will select at least at cascade 1, lets see if first byte of UID was 0x88 in
- // which case we need to make a cascade 2 request and select - this is a long UID
- // While the UID is not complete, the 3nd bit (from the right) is set in the SAK.
- for(; sak & 0x04; cascade_level++)
- {
- // SELECT_* (L1: 0x93, L2: 0x95, L3: 0x97)
- sel_uid[0] = sel_all[0] = 0x93 + cascade_level * 2;
-
- // SELECT_ALL
- ReaderTransmit(sel_all,sizeof(sel_all));
- if (!ReaderReceive(resp)) return 0;
- if(uid_ptr) memcpy(uid_ptr + cascade_level*4, resp, 4);
-
- // calculate crypto UID
- if(cuid_ptr) *cuid_ptr = bytes_to_num(resp, 4);
-
- // Construct SELECT UID command
- memcpy(sel_uid+2,resp,5);
- AppendCrc14443a(sel_uid,7);
- ReaderTransmit(sel_uid,sizeof(sel_uid));
-
- // Receive the SAK
- if (!ReaderReceive(resp)) return 0;
- sak = resp[0];
- }
- if(resp_data) {
- resp_data->sak = sak;
- resp_data->ats_len = 0;
- }
- //-- this byte not UID, it CT. http://www.nxp.com/documents/application_note/AN10927.pdf page 3
- if (uid_ptr[0] == 0x88) {
- memcpy(uid_ptr, uid_ptr + 1, 7);
- uid_ptr[7] = 0;
- }
-
- if( (sak & 0x20) == 0)
- return 2; // non iso14443a compliant tag
-
- // Request for answer to select
- if(resp_data) { // JCOP cards - if reader sent RATS then there is no MIFARE session at all!!!
- AppendCrc14443a(rats, 2);
- ReaderTransmit(rats, sizeof(rats));
-
- if (!(len = ReaderReceive(resp))) return 0;
-
- memcpy(resp_data->ats, resp, sizeof(resp_data->ats));
- resp_data->ats_len = len;
- }
-*/