diff --git a/armsrc/hitagS.c b/armsrc/hitagS.c index 00f976d8d5..f82c5a75ac 100644 --- a/armsrc/hitagS.c +++ b/armsrc/hitagS.c @@ -450,21 +450,21 @@ static void hts_handle_reader_command(uint8_t *rx, const size_t rxlen, tag.pstate = HT_READY; tag.tstate = HT_NO_OP; - if ((rx[0] & 0xf0) == HITAGS_UID_REQ_STD) { + if (rx[0] == HITAGS_UID_REQ_STD) { DBG Dbprintf("HT_STANDARD"); tag.mode = HT_STANDARD; sof_bits = 1; m = AC2K; } - if ((rx[0] & 0xf0) == HITAGS_UID_REQ_ADV) { + if (rx[0] == HITAGS_UID_REQ_ADV) { DBG Dbprintf("HT_ADVANCED"); tag.mode = HT_ADVANCED; sof_bits = 3; m = AC2K; } - if ((rx[0] & 0xf0) == HITAGS_UID_REQ_FADV) { + if (rx[0] == HITAGS_UID_REQ_FADV) { DBG Dbprintf("HT_FAST_ADVANCED"); tag.mode = HT_FAST_ADVANCED; sof_bits = 3; @@ -730,7 +730,6 @@ void hts_simulate(bool tag_mem_supplied, const uint8_t *data, bool ledcontrol) { clear_trace(); DbpString("Starting Hitag S simulation"); - if (ledcontrol) LED_D_ON(); tag.pstate = HT_READY; tag.tstate = HT_NO_OP; @@ -874,6 +873,8 @@ void hts_simulate(bool tag_mem_supplied, const uint8_t *data, bool ledcontrol) { // synchronized startup procedure while (AT91C_BASE_TC0->TC_CV != 0); // wait until TC0 returned to zero + if (ledcontrol) LED_D_ON(); + while ((BUTTON_PRESS() == false) && (data_available() == false)) { WDT_HIT(); @@ -1210,7 +1211,7 @@ static int hts_select_tag(const lf_hitag_data_t *packet, uint8_t *tx, size_t siz hts_send_receive(tx, txlen, rx, sizeofrx, &rxlen, t_wait, ledcontrol, true); if (rxlen != 32) { - DBG DbpString("UID Request failed!"); + DbpString("UID Request failed!"); return -1; } @@ -1229,7 +1230,7 @@ static int hts_select_tag(const lf_hitag_data_t *packet, uint8_t *tx, size_t siz hts_send_receive(tx, txlen, rx, sizeofrx, &rxlen, HITAG_T_WAIT_SC, ledcontrol, false); if (rxlen != 40) { - DBG Dbprintf("Select UID failed! %i", rxlen); + Dbprintf("Select UID failed! %i", rxlen); return -1; } @@ -1334,7 +1335,7 @@ static int hts_select_tag(const lf_hitag_data_t *packet, uint8_t *tx, size_t siz hts_send_receive(tx, txlen, rx, sizeofrx, &rxlen, HITAG_T_WAIT_SC, ledcontrol, false); if ((rxlen != 2) || (rx[0] >> (8 - 2) != 0x01)) { - DBG Dbprintf("no write access on page " _YELLOW_("64") ". not 82xx?"); + Dbprintf("no write access on page " _YELLOW_("64") ". not 82xx?"); return -1; } @@ -1346,23 +1347,23 @@ static int hts_select_tag(const lf_hitag_data_t *packet, uint8_t *tx, size_t siz hts_send_receive(tx, txlen, rx, sizeofrx, &rxlen, HITAG_T_WAIT_SC, ledcontrol, false); if ((rxlen != 2) || (rx[0] >> (8 - 2) != 0x01)) { - DBG Dbprintf("write to page " _YELLOW_("64") " failed! wrong password?"); + Dbprintf("write to page " _YELLOW_("64") " failed! wrong password?"); return -1; } return 0; } else if (packet->cmd == RHTSF_PLAIN || packet->cmd == WHTSF_PLAIN) { - DBG Dbprintf("Error, " _YELLOW_("AUT=1") " This tag is configured in Authentication Mode"); + Dbprintf("Error, " _YELLOW_("AUT=1") " This tag is configured in Authentication Mode"); return -1; } else { - DBG Dbprintf("Error, unknown function: " _RED_("%d"), packet->cmd); + Dbprintf("Error, unknown function: " _RED_("%d"), packet->cmd); return -1; } hts_send_receive(tx, txlen, rx, sizeofrx, &rxlen, HITAG_T_WAIT_SC, ledcontrol, false); if (rxlen != 40) { - DBG Dbprintf("Authenticate failed! " _RED_("%i"), rxlen); + Dbprintf("Authenticate failed! " _RED_("%i"), rxlen); return -1; }