-
- PrintAndLog("\n-- Tag Information ---------");
- PrintAndLog("-------------------------------------------------------------");
-
- c.cmd = CMD_READER_ISO_14443a;
- c.arg[0] = ISO14A_CONNECT | ISO14A_RAW | ISO14A_APPEND_CRC;
- c.arg[1] = 1;
- c.arg[2] = 0;
- c.d.asBytes[0] = 0x60;
- SendCommand(&c);
- WaitForResponse(CMD_ACK, &resp);
-
- if ( resp.arg[0] ) {
- if (WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {
-
- uint8_t version[8] = {0,0,0,0,0,0,0,0};
- memcpy(&version, resp.d.asBytes, sizeof(version));
- uint8_t len = resp.arg[0] & 0xff;
-
- if ( len == 0x0A && version[6] == 0x0B )
- tagtype = UL_EV1_48;
- else if ( len == 0x0A && version[6] != 0x0B )
- tagtype = UL_EV1_128;
- else if ( len == 0x01 )
- tagtype = UL_C | UL_C_MAGIC;
- else if ( len == 0x00 )
- tagtype = UL | UL_MAGIC | UL_C_MAGIC;
- }
- }
-
- // Magic UL-C, mine have a static nonce response to 0x1A command.
- uint8_t nonce1[8] = {0,0,0,0,0,0,0,0};
- uint8_t nonce2[8] = {0,0,0,0,0,0,0,0};
- uint8_t status = requestAuthentication(nonce1);
- if ( status ) {
- requestAuthentication(nonce2);
- if ( !memcmp(nonce1, nonce2, 8) )
- tagtype = UL_C_MAGIC;
- } else {
-
- //remove UL_C_MAGIC
- tagtype = tagtype & UL_C_MAGIC;
-
- // Magic Ultralight test here
- }
-
- switch(tagtype){
- case UNKNOWN : PrintAndLog(" TYPE : Unknown"); return 0;
- case UL : PrintAndLog(" TYPE : MIFARE Ultralight");break;
- case UL_C : PrintAndLog(" TYPE : MIFARE Ultralight C");break;
- case UL_EV1_48 : PrintAndLog(" TYPE : MIFARE Ultralight EV1 48 bytes"); break;
- case UL_EV1_128 : PrintAndLog(" TYPE : MIFARE Ultralight EV1 128 bytes"); break;
- case UL_MAGIC : PrintAndLog(" TYPE : MIFARE Ultralight (MAGIC)");break;
- case UL_C_MAGIC : PrintAndLog(" TYPE : MIFARE Ultralight-C (MAGIC)");break;
- }