Skip to content

Commit 958e14b

Browse files
committed
fix broken iso15693.c:SendRawCommand15693 (double answers)
1 parent 6204b67 commit 958e14b

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

armsrc/iso15693.c

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2729,26 +2729,29 @@ void SendRawCommand15693(iso15_raw_cmd_t *packet) {
27292729
} else {
27302730

27312731
// if tag answers with an error code, it don't care about EOF packet
2732-
if (recvlen) {
2733-
recvlen = MIN(recvlen, ISO15693_MAX_RESPONSE_LENGTH);
2734-
reply_ng(CMD_HF_ISO15693_COMMAND, res, buf, recvlen);
2735-
}
2736-
2737-
// looking at the first byte of the RAW bytes to determine Subcarrier, datarate, request option
2738-
bool fsk = ((packet->raw[0] & ISO15_REQ_SUBCARRIER_TWO) == ISO15_REQ_SUBCARRIER_TWO);
2739-
bool recv_speed = ((packet->raw[0] & ISO15_REQ_DATARATE_HIGH) == ISO15_REQ_DATARATE_HIGH);
2732+
// normal tag answer without Option_flag also processed here
2733+
if (recvlen || !request_answer) {
2734+
if (request_answer || read_respone) {
2735+
recvlen = MIN(recvlen, ISO15693_MAX_RESPONSE_LENGTH);
2736+
reply_ng(CMD_HF_ISO15693_COMMAND, res, buf, recvlen);
2737+
} else {
2738+
reply_ng(CMD_HF_ISO15693_COMMAND, PM3_SUCCESS, NULL, 0);
2739+
}
2740+
} else {
2741+
// looking at the first byte of the RAW bytes to determine Subcarrier, datarate, request option
2742+
bool fsk = ((packet->raw[0] & ISO15_REQ_SUBCARRIER_TWO) == ISO15_REQ_SUBCARRIER_TWO);
2743+
bool recv_speed = ((packet->raw[0] & ISO15_REQ_DATARATE_HIGH) == ISO15_REQ_DATARATE_HIGH);
27402744

2741-
// send a single EOF to get the tag response
2742-
if (request_answer) {
2745+
// send a single EOF to get the tag response
27432746
start_time = eof_time + DELAY_ISO15693_VICC_TO_VCD_READER;
27442747
res = SendDataTagEOF((read_respone ? buf : NULL), sizeof(buf), start_time, ISO15693_READER_TIMEOUT, &eof_time, fsk, recv_speed, &recvlen);
2745-
}
27462748

2747-
if (read_respone) {
2748-
recvlen = MIN(recvlen, ISO15693_MAX_RESPONSE_LENGTH);
2749-
reply_ng(CMD_HF_ISO15693_COMMAND, res, buf, recvlen);
2750-
} else {
2751-
reply_ng(CMD_HF_ISO15693_COMMAND, PM3_SUCCESS, NULL, 0);
2749+
if (read_respone) {
2750+
recvlen = MIN(recvlen, ISO15693_MAX_RESPONSE_LENGTH);
2751+
reply_ng(CMD_HF_ISO15693_COMMAND, res, buf, recvlen);
2752+
} else {
2753+
reply_ng(CMD_HF_ISO15693_COMMAND, PM3_SUCCESS, NULL, 0);
2754+
}
27522755
}
27532756
}
27542757

0 commit comments

Comments
 (0)