From 958e14b476ebb79dd277153c35c55c1f78c1c276 Mon Sep 17 00:00:00 2001 From: horrordash Date: Thu, 18 Sep 2025 01:12:25 +0300 Subject: [PATCH] fix broken iso15693.c:SendRawCommand15693 (double answers) --- armsrc/iso15693.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/armsrc/iso15693.c b/armsrc/iso15693.c index 14e3c785f..855921e52 100644 --- a/armsrc/iso15693.c +++ b/armsrc/iso15693.c @@ -2729,26 +2729,29 @@ void SendRawCommand15693(iso15_raw_cmd_t *packet) { } else { // if tag answers with an error code, it don't care about EOF packet - if (recvlen) { - recvlen = MIN(recvlen, ISO15693_MAX_RESPONSE_LENGTH); - reply_ng(CMD_HF_ISO15693_COMMAND, res, buf, recvlen); - } + // normal tag answer without Option_flag also processed here + if (recvlen || !request_answer) { + if (request_answer || read_respone) { + recvlen = MIN(recvlen, ISO15693_MAX_RESPONSE_LENGTH); + reply_ng(CMD_HF_ISO15693_COMMAND, res, buf, recvlen); + } else { + reply_ng(CMD_HF_ISO15693_COMMAND, PM3_SUCCESS, NULL, 0); + } + } else { + // looking at the first byte of the RAW bytes to determine Subcarrier, datarate, request option + bool fsk = ((packet->raw[0] & ISO15_REQ_SUBCARRIER_TWO) == ISO15_REQ_SUBCARRIER_TWO); + bool recv_speed = ((packet->raw[0] & ISO15_REQ_DATARATE_HIGH) == ISO15_REQ_DATARATE_HIGH); - // looking at the first byte of the RAW bytes to determine Subcarrier, datarate, request option - bool fsk = ((packet->raw[0] & ISO15_REQ_SUBCARRIER_TWO) == ISO15_REQ_SUBCARRIER_TWO); - bool recv_speed = ((packet->raw[0] & ISO15_REQ_DATARATE_HIGH) == ISO15_REQ_DATARATE_HIGH); - - // send a single EOF to get the tag response - if (request_answer) { + // send a single EOF to get the tag response start_time = eof_time + DELAY_ISO15693_VICC_TO_VCD_READER; res = SendDataTagEOF((read_respone ? buf : NULL), sizeof(buf), start_time, ISO15693_READER_TIMEOUT, &eof_time, fsk, recv_speed, &recvlen); - } - if (read_respone) { - recvlen = MIN(recvlen, ISO15693_MAX_RESPONSE_LENGTH); - reply_ng(CMD_HF_ISO15693_COMMAND, res, buf, recvlen); - } else { - reply_ng(CMD_HF_ISO15693_COMMAND, PM3_SUCCESS, NULL, 0); + if (read_respone) { + recvlen = MIN(recvlen, ISO15693_MAX_RESPONSE_LENGTH); + reply_ng(CMD_HF_ISO15693_COMMAND, res, buf, recvlen); + } else { + reply_ng(CMD_HF_ISO15693_COMMAND, PM3_SUCCESS, NULL, 0); + } } }