hw ping - fix output text

This commit is contained in:
iceman1001 2023-10-19 11:08:53 +02:00
commit 34d8a41021

View file

@ -987,7 +987,7 @@ static int CmdPing(const char *Cmd) {
len = PM3_CMD_DATA_SIZE; len = PM3_CMD_DATA_SIZE;
if (len) { if (len) {
PrintAndLogEx(INFO, "Ping sent with payload len " _YELLOW_("%d"), len); PrintAndLogEx(INFO, "Ping sent with payload len... " _YELLOW_("%d"), len);
} else { } else {
PrintAndLogEx(INFO, "Ping sent"); PrintAndLogEx(INFO, "Ping sent");
} }
@ -996,14 +996,15 @@ static int CmdPing(const char *Cmd) {
PacketResponseNG resp; PacketResponseNG resp;
uint8_t data[PM3_CMD_DATA_SIZE] = {0}; uint8_t data[PM3_CMD_DATA_SIZE] = {0};
for (uint16_t i = 0; i < len; i++) for (uint16_t i = 0; i < len; i++) {
data[i] = i & 0xFF; data[i] = i & 0xFF;
}
SendCommandNG(CMD_PING, data, len); SendCommandNG(CMD_PING, data, len);
if (WaitForResponseTimeout(CMD_PING, &resp, 1000)) { if (WaitForResponseTimeout(CMD_PING, &resp, 1000)) {
if (len) { if (len) {
bool error = (memcmp(data, resp.data.asBytes, len) != 0); bool error = (memcmp(data, resp.data.asBytes, len) != 0);
PrintAndLogEx((error) ? ERR : SUCCESS, "Ping response " _GREEN_("received") " and content () %s )", error ? _RED_("fail") : _GREEN_("ok")); PrintAndLogEx((error) ? ERR : SUCCESS, "Ping response " _GREEN_("received") " and content ( %s )", error ? _RED_("fail") : _GREEN_("ok"));
} else { } else {
PrintAndLogEx(SUCCESS, "Ping response " _GREEN_("received")); PrintAndLogEx(SUCCESS, "Ping response " _GREEN_("received"));
} }