- // 0 : CSN
- // 1 : Configuration
- // 2 : e-purse
- // 3 : kd / debit / aa2 (write-only)
- // 4 : kc / credit / aa1 (write-only)
- // 5 : AIA, Application issuer area
- //Then we can 'ship' back the 6 * 8 bytes of data,
- // with 0xFF:s in block 3 and 4.
-
- LED_B_ON();
- //Send back to client, but don't bother if we already sent this -
- // only useful if looping in arm (not try_once && not abort_after_read)
- if (memcmp(last_csn, card_data, 8) != 0) {
- // If caller requires that we get Conf, CC, AA, continue until we got it
- if ( (result_status ^ FLAG_ICLASS_READER_CSN ^ flagReadConfig ^ flagReadCC ^ flagReadAA) == 0) {
- cmd_send(CMD_ACK, result_status, 0, 0, card_data, sizeof(card_data));
- if (abort_after_read) {
- FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
- LED_A_OFF();
- LED_B_OFF();
- return;
- }
- //Save that we already sent this....
- memcpy(last_csn, card_data, 8);
- }
-
+ //Read block 5, AA
+ if (flagReadAA) {
+ if (sendCmdGetResponseWithRetries(readAA, sizeof(readAA), resp, sizeof(resp), 10, 10, start_time, &eof_time)) {
+ result_status |= FLAG_ICLASS_READER_AA;
+ memcpy(card_data + (8*5), resp, 8);
+ } else {
+ Dbprintf("Failed to read AA block");