Capabilities versionning, would also detect platform struct pack issues

This commit is contained in:
Philippe Teuwen 2019-05-10 19:00:18 +02:00
commit 3412e9d8c5
3 changed files with 8 additions and 1 deletions

View file

@ -613,6 +613,11 @@ int TestProxmark(void) {
SendCommandNG(CMD_CAPABILITIES, NULL, 0);
if (WaitForResponseTimeoutW(CMD_CAPABILITIES, &resp, 1000, false)) {
if ((resp.length != sizeof(pm3_capabilities)) || (resp.data.asBytes[0] != CAPABILITIES_VERSION)) {
PrintAndLogEx(ERR, _RED_("Capabilities structure version sent by Proxmark3 is not the same as the one used by the client!"));
PrintAndLogEx(ERR, _RED_("Please flash the Proxmark with the same version as the client."));
return PM3_EDEVNOTSUPP;
}
memcpy(&pm3_capabilities, resp.data.asBytes, MIN(sizeof(capabilities_t), resp.length));
conn.send_via_fpc_usart = pm3_capabilities.via_fpc;
conn.uart_speed = pm3_capabilities.baudrate;