mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 13:00:42 -07:00
Capabilities versionning, would also detect platform struct pack issues
This commit is contained in:
parent
5aed3e04c9
commit
3412e9d8c5
3 changed files with 8 additions and 1 deletions
|
@ -428,6 +428,7 @@ void SendStatus(void) {
|
||||||
|
|
||||||
void SendCapabilities(void) {
|
void SendCapabilities(void) {
|
||||||
capabilities_t capabilities;
|
capabilities_t capabilities;
|
||||||
|
capabilities.version = CAPABILITIES_VERSION;
|
||||||
capabilities.via_fpc = reply_via_fpc;
|
capabilities.via_fpc = reply_via_fpc;
|
||||||
if (reply_via_fpc)
|
if (reply_via_fpc)
|
||||||
capabilities.baudrate = USART_BAUD_RATE;
|
capabilities.baudrate = USART_BAUD_RATE;
|
||||||
|
|
|
@ -613,6 +613,11 @@ int TestProxmark(void) {
|
||||||
|
|
||||||
SendCommandNG(CMD_CAPABILITIES, NULL, 0);
|
SendCommandNG(CMD_CAPABILITIES, NULL, 0);
|
||||||
if (WaitForResponseTimeoutW(CMD_CAPABILITIES, &resp, 1000, false)) {
|
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));
|
memcpy(&pm3_capabilities, resp.data.asBytes, MIN(sizeof(capabilities_t), resp.length));
|
||||||
conn.send_via_fpc_usart = pm3_capabilities.via_fpc;
|
conn.send_via_fpc_usart = pm3_capabilities.via_fpc;
|
||||||
conn.uart_speed = pm3_capabilities.baudrate;
|
conn.uart_speed = pm3_capabilities.baudrate;
|
||||||
|
|
|
@ -138,6 +138,7 @@ typedef struct {
|
||||||
} t55xx_config;
|
} t55xx_config;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
uint8_t version;
|
||||||
uint32_t baudrate;
|
uint32_t baudrate;
|
||||||
bool via_fpc : 1;
|
bool via_fpc : 1;
|
||||||
// rdv4
|
// rdv4
|
||||||
|
@ -164,7 +165,7 @@ typedef struct {
|
||||||
bool hw_available_flash : 1;
|
bool hw_available_flash : 1;
|
||||||
bool hw_available_smartcard : 1;
|
bool hw_available_smartcard : 1;
|
||||||
} PACKED capabilities_t;
|
} PACKED capabilities_t;
|
||||||
|
#define CAPABILITIES_VERSION 1
|
||||||
extern capabilities_t pm3_capabilities;
|
extern capabilities_t pm3_capabilities;
|
||||||
|
|
||||||
// For the bootloader
|
// For the bootloader
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue