diff --git a/armsrc/Standalone/hf_15sniff.c b/armsrc/Standalone/hf_15sniff.c index 45d837859..069266580 100644 --- a/armsrc/Standalone/hf_15sniff.c +++ b/armsrc/Standalone/hf_15sniff.c @@ -100,7 +100,7 @@ void RunMod(void) { Dbprintf(_YELLOW_("HF 15693 SNIFF started")); rdv40_spiffs_lazy_mount(); - SniffIso15693(0, NULL); + SniffIso15693(0, NULL, false); Dbprintf("Stopped sniffing"); SpinDelay(200); diff --git a/armsrc/appmain.c b/armsrc/appmain.c index 07b44d8a4..01ba06a60 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -1232,7 +1232,7 @@ static void PacketReceived(PacketCommandNG *packet) { break; } case CMD_HF_ISO15693_SNIFF: { - SniffIso15693(0, NULL); + SniffIso15693(0, NULL, false); reply_ng(CMD_HF_ISO15693_SNIFF, PM3_SUCCESS, NULL, 0); break; } diff --git a/armsrc/iclass.c b/armsrc/iclass.c index 134b633a8..e261efc59 100644 --- a/armsrc/iclass.c +++ b/armsrc/iclass.c @@ -91,7 +91,7 @@ static uint8_t get_pagemap(const picopass_hdr_t *hdr) { // Both sides of communication! //============================================================================= void SniffIClass(uint8_t jam_search_len, uint8_t *jam_search_string) { - SniffIso15693(jam_search_len, jam_search_string); + SniffIso15693(jam_search_len, jam_search_string, true); } static void rotateCSN(const uint8_t *original_csn, uint8_t *rotated_csn) { diff --git a/armsrc/iso15693.c b/armsrc/iso15693.c index c864d6368..c064d7733 100644 --- a/armsrc/iso15693.c +++ b/armsrc/iso15693.c @@ -1575,7 +1575,8 @@ static int RAMFUNC Handle15693FSKSamplesFromTag(uint8_t freq, DecodeTagFSK_t *De } return false; } -void SniffIso15693(uint8_t jam_search_len, uint8_t *jam_search_string) { + +void SniffIso15693(uint8_t jam_search_len, uint8_t *jam_search_string, bool iclass) { LEDsoff(); LED_A_ON(); @@ -1601,6 +1602,7 @@ void SniffIso15693(uint8_t jam_search_len, uint8_t *jam_search_string) { DecodeReaderInit(&dreader, cmd, sizeof(cmd), jam_search_len, jam_search_string); FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER | FPGA_HF_READER_MODE_SNIFF_AMPLITUDE | FPGA_HF_READER_2SUBCARRIERS_424_484_KHZ); + LED_D_OFF(); SetAdcMuxFor(GPIO_MUXSEL_HIPKD); @@ -1622,7 +1624,7 @@ void SniffIso15693(uint8_t jam_search_len, uint8_t *jam_search_string) { bool reader_is_active = false; bool expect_tag_answer = false; bool expect_fsk_answer = false; - bool expect_fast_answer = false; + bool expect_fast_answer = true; // default to true is required for iClass int dma_start_time = 0; // Count of samples received so far, so that we can include timing @@ -1686,8 +1688,11 @@ void SniffIso15693(uint8_t jam_search_len, uint8_t *jam_search_string) { - 16 * 16; // time for EOF transfer LogTrace_ISO15693(dreader.output, dreader.byteCount, (sof_time * 4), (eof_time * 4), NULL, true); - expect_fsk_answer = dreader.output[0] & ISO15_REQ_SUBCARRIER_TWO; - expect_fast_answer = dreader.output[0] & ISO15_REQ_DATARATE_HIGH; + if (!iclass) // Those flags don't exist in iClass + { + expect_fsk_answer = dreader.output[0] & ISO15_REQ_SUBCARRIER_TWO; + expect_fast_answer = dreader.output[0] & ISO15_REQ_DATARATE_HIGH; + } } // And ready to receive another command. //DecodeReaderReset(&dreader); // already reseted @@ -1704,9 +1709,11 @@ void SniffIso15693(uint8_t jam_search_len, uint8_t *jam_search_string) { - 32 * 16 // time for SOF transfer - 16 * 16; // time for EOF transfer LogTrace_ISO15693(dreader.output, dreader.byteCount, (sof_time * 4), (eof_time * 4), NULL, true); - - expect_fsk_answer = dreader.output[0] & ISO15_REQ_SUBCARRIER_TWO; - expect_fast_answer = dreader.output[0] & ISO15_REQ_DATARATE_HIGH; + if (!iclass) // Those flags don't exist in iClass + { + expect_fsk_answer = dreader.output[0] & ISO15_REQ_SUBCARRIER_TWO; + expect_fast_answer = dreader.output[0] & ISO15_REQ_DATARATE_HIGH; + } } // And ready to receive another command //DecodeReaderReset(&dreader); // already reseted diff --git a/armsrc/iso15693.h b/armsrc/iso15693.h index 29d266709..31ca6e6c1 100644 --- a/armsrc/iso15693.h +++ b/armsrc/iso15693.h @@ -50,7 +50,7 @@ void SimTagIso15693(uint8_t *uid); // simulate an ISO15693 tag - greg void BruteforceIso15693Afi(uint32_t speed); // find an AFI of a tag - atrox void DirectTag15693Command(uint32_t datalen, uint32_t speed, uint32_t recv, uint8_t *data); // send arbitrary commands from CLI - atrox -void SniffIso15693(uint8_t jam_search_len, uint8_t *jam_search_string); +void SniffIso15693(uint8_t jam_search_len, uint8_t *jam_search_string, bool iclass); int SendDataTag(uint8_t *send, int sendlen, bool init, bool speed_fast, uint8_t *recv, uint16_t max_recv_len, uint32_t start_time, uint16_t timeout, uint32_t *eof_time);