From e05c36d4eadf739c84d750d30bf46eb8853b96ce Mon Sep 17 00:00:00 2001 From: Jakub Kramarz Date: Mon, 27 Jan 2025 20:23:23 +0100 Subject: [PATCH] cmdhfseos: change from SendCommandMix to SendCommandNG --- armsrc/sam_seos.c | 10 ++++++---- client/src/cmdhfseos.c | 12 +++++++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/armsrc/sam_seos.c b/armsrc/sam_seos.c index 492a684a9..facdb2545 100644 --- a/armsrc/sam_seos.c +++ b/armsrc/sam_seos.c @@ -271,11 +271,13 @@ out: * @return Status code indicating success or failure of the operation. */ int sam_seos_get_pacs(PacketCommandNG *c) { - bool disconnectAfter = c->oldarg[0] & 0x01; - bool skipDetect = c->oldarg[1] & 0x01; + const uint8_t flags = c->data.asBytes[0]; + const bool disconnectAfter = !!(flags & BITMASK(0)); + const bool skipDetect = !!(flags & BITMASK(1)); + + uint8_t *cmd = c->data.asBytes + 1; + uint16_t cmd_len = c->length - 1; - uint8_t *cmd = c->data.asBytes; - uint16_t cmd_len = (uint16_t) c->oldarg[2]; int res = PM3_EFAILED; diff --git a/client/src/cmdhfseos.c b/client/src/cmdhfseos.c index d697d1b41..4d59a19e2 100644 --- a/client/src/cmdhfseos.c +++ b/client/src/cmdhfseos.c @@ -1652,9 +1652,15 @@ static int CmdHfSeosSAM(const char *Cmd) { bool skipDetect = arg_get_lit(ctx, 3); bool decodeTLV = arg_get_lit(ctx, 4); + uint8_t flags = 0; + if (disconnectAfter) flags |= BITMASK(0); + if (skipDetect) flags |= BITMASK(1); + uint8_t data[PM3_CMD_DATA_SIZE] = {0}; - int datalen = 0; - CLIGetHexBLessWithReturn(ctx, 5, data, &datalen, 0); + data[0] = flags; + + int cmdlen = 0; + CLIGetHexBLessWithReturn(ctx, 5, data+1, &cmdlen, 0); CLIParserFree(ctx); @@ -1663,7 +1669,7 @@ static int CmdHfSeosSAM(const char *Cmd) { } clearCommandBuffer(); - SendCommandMIX(CMD_HF_SAM_SEOS, disconnectAfter, skipDetect, datalen, data, datalen); + SendCommandNG(CMD_HF_SAM_SEOS, data, cmdlen+1); PacketResponseNG resp; if (WaitForResponseTimeout(CMD_HF_SAM_SEOS, &resp, 4000) == false) { PrintAndLogEx(WARNING, "SAM timeout");