diff --git a/armsrc/appmain.c b/armsrc/appmain.c index fbe0c2da6..738425105 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -103,32 +103,33 @@ uint8_t g_tearoff_skip = 0; int tearoff_hook(void) { - if (g_tearoff_enabled) { + if (g_tearoff_enabled == false) { + Dbprintf("no tear off"); + return PM3_SUCCESS; + } + + // tear off is happening... - if (g_tearoff_delay_us == 0) { + if (g_tearoff_delay_us == 0) { - if (g_dbglevel >= DBG_ERROR) Dbprintf(_RED_("No tear-off delay configured!")); - g_tearoff_enabled = false; - return PM3_SUCCESS; // SUCCESS = the hook didn't do anything - } - - if (g_tearoff_skip > 0) { - if (g_dbglevel >= DBG_INFO) Dbprintf(_GREEN_("Tear-off skipped!")); - g_tearoff_skip--; - return PM3_SUCCESS; // SUCCESS = the hook didn't do anything - } - - SpinDelayUsPrecision(g_tearoff_delay_us); - FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); + if (g_dbglevel >= DBG_ERROR) Dbprintf(_RED_("No tear-off delay configured!")); g_tearoff_enabled = false; - - if (g_dbglevel >= DBG_INFO) Dbprintf(_YELLOW_("Tear-off triggered!")); - - return PM3_ETEAROFF; - - } else { - return PM3_SUCCESS; // SUCCESS = the hook didn't do anything + return PM3_SUCCESS; // SUCCESS = the hook didn't do anything } + + if (g_tearoff_skip > 0) { + if (g_dbglevel >= DBG_INFO) Dbprintf(_GREEN_("Tear-off skipped!")); + g_tearoff_skip--; + return PM3_SUCCESS; // SUCCESS = the hook didn't do anything + } + + SpinDelayUsPrecision(g_tearoff_delay_us); + FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); + g_tearoff_enabled = false; + + if (g_dbglevel >= DBG_INFO) Dbprintf(_YELLOW_("Tear-off triggered!")); + + return PM3_ETEAROFF; } void hf_field_off(void) { diff --git a/client/src/cmdhw.c b/client/src/cmdhw.c index 553f63fb8..8bceeb8d0 100644 --- a/client/src/cmdhw.c +++ b/client/src/cmdhw.c @@ -1412,6 +1412,7 @@ static int CmdTearoff(const char *Cmd) { PrintAndLogEx(INFO, " lf em 4x05_unlock"); PrintAndLogEx(INFO, " lf t55xx dangerraw"); PrintAndLogEx(INFO, " hf iclass tear"); + PrintAndLogEx(INFO, " hf iclass blacktears"); PrintAndLogEx(INFO, " hf mfu otptear"); PrintAndLogEx(INFO, " Standalone mode HF_ST25_TEAROFF"); return PM3_SUCCESS;