From 252d6a29db65abbd22e6380003382e41b422cc4d Mon Sep 17 00:00:00 2001 From: douniwan5788 Date: Tue, 15 Oct 2024 13:30:37 +0800 Subject: [PATCH] fix: switch Hitag S UID REQUEST to HITAGS_UID_REQ_ADV1 for Hitag 1 compatibility --- armsrc/hitagS.c | 6 +++--- include/protocols.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/armsrc/hitagS.c b/armsrc/hitagS.c index 2c7311697..edee23a4d 100644 --- a/armsrc/hitagS.c +++ b/armsrc/hitagS.c @@ -480,7 +480,7 @@ static void hts_handle_reader_command(uint8_t *rx, const size_t rxlen, m = AC2K; } - if (rx[0] == HITAGS_UID_REQ_ADV) { + if (rx[0] == HITAGS_UID_REQ_ADV1 || rx[0] == HITAGS_UID_REQ_ADV2) { DBG Dbprintf("HT_ADVANCED"); tag.mode = HT_ADVANCED; sof_bits = 3; @@ -1112,7 +1112,7 @@ static int hts_select_tag(const lf_hitag_data_t *packet, uint8_t *tx, size_t siz // UID request FAdvanced 11010 size_t txlen = 0; size_t rxlen = 0; - uint8_t cmd = HITAGS_UID_REQ_ADV; + uint8_t cmd = HITAGS_UID_REQ_ADV1; txlen = concatbits(tx, txlen, &cmd, 0, 5); hts_send_receive(tx, txlen, rx, sizeofrx, &rxlen, t_wait, ledcontrol, true); @@ -1505,7 +1505,7 @@ int hts_read_uid(uint32_t *uid, bool ledcontrol, bool send_answer) { // UID request standard 00110 // UID request Advanced 1100x // UID request FAdvanced 11010 - uint8_t cmd = HITAGS_UID_REQ_ADV; + uint8_t cmd = HITAGS_UID_REQ_ADV1; size_t rxlen = 0; uint8_t rx[HITAG_FRAME_LEN] = { 0x00 }; diff --git a/include/protocols.h b/include/protocols.h index 23ee85f6b..58c857a6f 100644 --- a/include/protocols.h +++ b/include/protocols.h @@ -921,8 +921,8 @@ ISO 7816-4 Basic interindustry commands. For command APDU's. // HITAG S commands #define HITAGS_UID_REQ_STD 0x30 // 00110 UID REQUEST Std -#define HITAGS_UID_REQ_ADV 0xC0 // 11000 UID REQUEST Adv -#define HITAGS_UID_REQ_ADV2 0xC8 // 11001 UID REQUEST Adv +#define HITAGS_UID_REQ_ADV2 0xC0 // 11000 UID REQUEST Adv compatible with HITAG2_START_AUTH +#define HITAGS_UID_REQ_ADV1 0xC8 // 11001 UID REQUEST Adv compatible with HITAG1_SET_CCNEW #define HITAGS_UID_REQ_FADV 0xD0 // 11010 UID REQUEST FAdv #define HITAGS_SELECT 0x00 // 00000 SELECT (UID) #define HITAGS_READ_PAGE 0xC0 // 1100 READ PAGE