armsrc check: skip if no src available; postpone warning

This commit is contained in:
Philippe Teuwen 2022-02-14 13:37:20 +01:00
commit 14f62eaa88
3 changed files with 15 additions and 7 deletions

View file

@ -287,6 +287,7 @@ static void SendVersion(void) {
strncat(VersionString, "\n", sizeof(VersionString) - strlen(VersionString) - 1);
}
FormatVersionInformation(temp, sizeof(temp), " os: ", &g_version_information);
strncat(VersionString, temp, sizeof(VersionString) - strlen(VersionString) - 1);
strncat(VersionString, "\n", sizeof(VersionString) - strlen(VersionString) - 1);

View file

@ -1072,22 +1072,27 @@ void pm3_version(bool verbose, bool oneliner) {
struct p *payload = (struct p *)&resp.data.asBytes;
PrintAndLogEx(NORMAL, payload->versionstr);
bool armsrc_mismatch = false;
char *ptr = strstr(payload->versionstr, " os: ");
if (ptr != NULL) {
ptr = strstr(ptr, "\n");
if (ptr != NULL) {
if ((ptr != NULL) && (strlen(g_version_information.armsrc) == 9)) {
if (strncmp(ptr-9, g_version_information.armsrc, 9) != 0) {
PrintAndLogEx(NORMAL, "\n:warning: " _RED_("ARM os does not match the source at the time the client was compiled") " :warning:");
PrintAndLogEx(NORMAL, "Make sure to flash a correct and up-to-date version");
armsrc_mismatch = true;
}
}
}
PrintAndLogEx(NORMAL, payload->versionstr);
if (strstr(payload->versionstr, "2s30vq100") == NULL) {
PrintAndLogEx(NORMAL, " FPGA firmware... %s", _RED_("chip mismatch"));
}
lookupChipID(payload->id, payload->section_size);
if (armsrc_mismatch) {
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(WARNING, _RED_("ARM firmware does not match the source at the time the client was compiled"));
PrintAndLogEx(WARNING, "Make sure to flash a correct and up-to-date version");
}
}
}
PrintAndLogEx(NORMAL, "");

View file

@ -61,6 +61,8 @@ fi
sha=$(
pm3path=$(dirname -- "$0")/..
cd "$pm3path" || return
# did we find the src?
[ -f armsrc/appmain.c ] || return
ls armsrc/*.[ch] common_arm/*.[ch]|grep -v disabled|grep -v version_pm3|xargs sha256sum|sha256sum|grep -o '^.........'
)
cat <<EOF