// High frequency ISO14443B commands
//-----------------------------------------------------------------------------
// High frequency ISO14443B commands
//-----------------------------------------------------------------------------
PrintAndLog(" -r do not read response");
PrintAndLog(" -c calculate and append CRC");
PrintAndLog(" -p leave the field on after receive");
PrintAndLog(" -s active signal field ON with select");
PrintAndLog(" -r do not read response");
PrintAndLog(" -c calculate and append CRC");
PrintAndLog(" -p leave the field on after receive");
PrintAndLog(" -s active signal field ON with select");
if (HF14BCmdRaw(true, &crc2, true, cmd2, &cmdLen, false)==0) return rawClose();
if (HF14BCmdRaw(true, &crc2, true, cmd2, &cmdLen, false)==0) return rawClose();
- if (cmd2[0] != 0x50 || cmdLen != 14 || !crc2) return rawClose();
-
- cmd2[0] = 0x1D;
- // UID from data[1 - 4]
- cmd2[5] = 0x00;
- cmd2[6] = 0x08;
- cmd2[7] = 0x01;
- cmd2[8] = 0x00;
- cmdLen = 9;
+ if ( SRx && (cmdLen != 3 || !crc2) ) return rawClose();
+ else if (cmd2[0] != 0x50 || cmdLen != 14 || !crc2) return rawClose();
+
+ uint8_t chipID = 0;
+ if (SRx) {
+ // select
+ chipID = cmd2[0];
+ cmd2[0] = 0x0E;
+ cmd2[1] = chipID;
+ cmdLen = 2;
+ } else {
+ // attrib
+ cmd2[0] = 0x1D;
+ // UID from cmd2[1 - 4]
+ cmd2[5] = 0x00;
+ cmd2[6] = 0x08;
+ cmd2[7] = 0x01;
+ cmd2[8] = 0x00;
+ cmdLen = 9;
+ }
if (HF14BCmdRaw(true, &crc2, true, cmd2, &cmdLen, false)==0) return rawClose();
if (cmdLen != 3 || !crc2) return rawClose();
if (HF14BCmdRaw(true, &crc2, true, cmd2, &cmdLen, false)==0) return rawClose();
if (cmdLen != 3 || !crc2) return rawClose();
return HF14BCmdRaw(reply, &crc, power, data, &datalen, true);
}
return HF14BCmdRaw(reply, &crc, power, data, &datalen, true);
}
if (HF14BCmdRaw(true, &crc, true, data, datalen, false)==0) return rawClose();
if (HF14BCmdRaw(true, &crc, true, data, datalen, false)==0) return rawClose();