trace list - now colors whole reader line output. Also little nasty buff-underflow bug fixed

This commit is contained in:
iceman1001 2021-04-19 22:18:37 +02:00
commit 5604afce7a
2 changed files with 61 additions and 25 deletions

View file

@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file.
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
## [unreleased][unreleased] ## [unreleased][unreleased]
- Change `hf 14a/14b/15 list etc alias commands now unified helptext (@doegox)
- Change `trace list` - now colors whole reader line (@iceman1001)
- Change `lf search` - add option `-c` to continue searching after first hit (@doegox) - Change `lf search` - add option `-c` to continue searching after first hit (@doegox)
- Fix DESFire mis-annotation (@VortixDev) - Fix DESFire mis-annotation (@VortixDev)
- Change `lf pac demod` - now also search for inverted bitstreams (@iceman1001) - Change `lf pac demod` - now also search for inverted bitstreams (@iceman1001)

View file

@ -308,9 +308,12 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
} }
m--; m--;
} }
line[(data_len - 1) / 16][((data_len - 1) % 16) * 4 + 2] = '(';
line[(data_len - 1) / 16][((data_len - 1) % 16) * 4 + 3] = m + 0x30; if (data_len) {
line[(data_len - 1) / 16][((data_len - 1) % 16) * 4 + 4] = ')'; line[(data_len - 1) / 16][((data_len - 1) % 16) * 4 + 2] = '(';
line[(data_len - 1) / 16][((data_len - 1) % 16) * 4 + 3] = m + 0x30;
line[(data_len - 1) / 16][((data_len - 1) % 16) * 4 + 4] = ')';
}
} }
} }
@ -400,32 +403,63 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
time2 = duration; time2 = duration;
} }
if (use_us) { if (hdr->isResponse) {
PrintAndLogEx(NORMAL, " %10.1f | %10.1f | %s |%-72s | %s| %s", // tag row
(float)time1 / 13.56, if (use_us) {
(float)time2 / 13.56, PrintAndLogEx(NORMAL, " %10.1f | %10.1f | Tag |%-72s | %s| %s",
(hdr->isResponse ? "Tag" : _YELLOW_("Rdr")), (float)time1 / 13.56,
line[j], (float)time2 / 13.56,
(j == num_lines - 1) ? crc : " ", line[j],
(j == num_lines - 1) ? explanation : "" (j == num_lines - 1) ? crc : " ",
); (j == num_lines - 1) ? explanation : ""
);
} else {
PrintAndLogEx(NORMAL, " %10u | %10u | Tag |%-72s | %s| %s",
(hdr->timestamp - first_hdr->timestamp),
(end_of_transmission_timestamp - first_hdr->timestamp),
line[j],
(j == num_lines - 1) ? crc : " ",
(j == num_lines - 1) ? explanation : ""
);
}
} else { } else {
PrintAndLogEx(NORMAL, " %10u | %10u | %s |%-72s | %s| %s", // reader row
(hdr->timestamp - first_hdr->timestamp), if (use_us) {
(end_of_transmission_timestamp - first_hdr->timestamp), PrintAndLogEx(NORMAL,
(hdr->isResponse ? "Tag" : _YELLOW_("Rdr")), _YELLOW_(" %10.1f") " | " _YELLOW_("%10.1f") " | " _YELLOW_("Rdr") " |" _YELLOW_("%-72s")" | " _YELLOW_("%s") "| " _YELLOW_("%s"),
line[j], (float)time1 / 13.56,
(j == num_lines - 1) ? crc : " ", (float)time2 / 13.56,
(j == num_lines - 1) ? explanation : "" line[j],
); (j == num_lines - 1) ? crc : " ",
(j == num_lines - 1) ? explanation : ""
);
} else {
PrintAndLogEx(NORMAL,
_YELLOW_(" %10u") " | " _YELLOW_("%10u") " | " _YELLOW_("Rdr") " |" _YELLOW_("%-72s")" | " _YELLOW_("%s") "| " _YELLOW_("%s"),
(hdr->timestamp - first_hdr->timestamp),
(end_of_transmission_timestamp - first_hdr->timestamp),
line[j],
(j == num_lines - 1) ? crc : " ",
(j == num_lines - 1) ? explanation : ""
);
}
} }
} else { } else {
PrintAndLogEx(NORMAL, " | | |%-72s | %s| %s", if (hdr->isResponse) {
line[j], PrintAndLogEx(NORMAL, " | | |%-72s | %s| %s",
(j == num_lines - 1) ? crc : " ", line[j],
(j == num_lines - 1) ? explanation : "" (j == num_lines - 1) ? crc : " ",
); (j == num_lines - 1) ? explanation : ""
);
} else {
PrintAndLogEx(NORMAL, " | | |" _YELLOW_("%-72s")" | " _YELLOW_("%s") "| " _YELLOW_("%s"),
line[j],
(j == num_lines - 1) ? crc : " ",
(j == num_lines - 1) ? explanation : ""
);
}
} }
} }