refactor: cleanup PacketResponseNG init
This commit is contained in:
1 parent
9129cd6442
commit
ef0bae7bc6
4 files changed
+11
-57
No files matched your search
@@ -1565,18 +1565,8 @@ static int acquire_nonces(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_
|
|||||||
FILE *fnonces = NULL;
|
FILE *fnonces = NULL;
|
||||||
|
|
||||||
// init to ZERO
|
// init to ZERO
|
||||||
PacketResponseNG resp = {
|
PacketResponseNG resp;
|
||||||
.cmd = 0,
|
memset(&resp, 0, sizeof(resp));
|
||||||
.length = 0,
|
|
||||||
.magic = 0,
|
|
||||||
.status = 0,
|
|
||||||
.crc = 0,
|
|
||||||
.ng = false,
|
|
||||||
};
|
|
||||||
resp.oldarg[0] = 0;
|
|
||||||
resp.oldarg[1] = 0;
|
|
||||||
resp.oldarg[2] = 0;
|
|
||||||
memset(resp.data.asBytes, 0, PM3_CMD_DATA_SIZE);
|
|
||||||
|
|
||||||
uint8_t write_buf[9];
|
uint8_t write_buf[9];
|
||||||
char progress_text[80];
|
char progress_text[80];
|
||||||
|
|||||||
+2
-11
@@ -426,18 +426,9 @@ int CmdLFCommandRead(const char *Cmd) {
|
|||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_LF_MOD_THEN_ACQ_RAW_ADC, (uint8_t *)&payload, PAYLOAD_HEADER_SIZE + cmd_len + 1);
|
SendCommandNG(CMD_LF_MOD_THEN_ACQ_RAW_ADC, (uint8_t *)&payload, PAYLOAD_HEADER_SIZE + cmd_len + 1);
|
||||||
|
|
||||||
PacketResponseNG resp;
|
|
||||||
// init to ZERO
|
// init to ZERO
|
||||||
resp.cmd = 0,
|
PacketResponseNG resp;
|
||||||
resp.length = 0,
|
memset(&resp, 0, sizeof(resp));
|
||||||
resp.magic = 0,
|
|
||||||
resp.status = 0,
|
|
||||||
resp.crc = 0,
|
|
||||||
resp.ng = false,
|
|
||||||
resp.oldarg[0] = 0;
|
|
||||||
resp.oldarg[1] = 0;
|
|
||||||
resp.oldarg[2] = 0;
|
|
||||||
memset(resp.data.asBytes, 0, PM3_CMD_DATA_SIZE);
|
|
||||||
|
|
||||||
i = 10;
|
i = 10;
|
||||||
// 20sec wait loop
|
// 20sec wait loop
|
||||||
|
|||||||
@@ -1259,18 +1259,9 @@ static int CmdEM4x50Sim(const char *Cmd) {
|
|||||||
|
|
||||||
PrintAndLogEx(INFO, "Press " _GREEN_("pm3 button") " or " _GREEN_("<Enter>") " to abort simulation");
|
PrintAndLogEx(INFO, "Press " _GREEN_("pm3 button") " or " _GREEN_("<Enter>") " to abort simulation");
|
||||||
|
|
||||||
PacketResponseNG resp;
|
|
||||||
// init to ZERO
|
// init to ZERO
|
||||||
resp.cmd = 0,
|
PacketResponseNG resp;
|
||||||
resp.length = 0,
|
memset(&resp, 0, sizeof(resp));
|
||||||
resp.magic = 0,
|
|
||||||
resp.status = 0,
|
|
||||||
resp.crc = 0,
|
|
||||||
resp.ng = false,
|
|
||||||
resp.oldarg[0] = 0;
|
|
||||||
resp.oldarg[1] = 0;
|
|
||||||
resp.oldarg[2] = 0;
|
|
||||||
memset(resp.data.asBytes, 0, PM3_CMD_DATA_SIZE);
|
|
||||||
|
|
||||||
bool keypress;
|
bool keypress;
|
||||||
do {
|
do {
|
||||||
|
|||||||
+5
-23
@@ -1030,18 +1030,9 @@ size_t WaitForRawDataTimeout(uint8_t *buffer, size_t len, size_t ms_timeout, boo
|
|||||||
*/
|
*/
|
||||||
bool WaitForResponseTimeoutW(uint32_t cmd, PacketResponseNG *response, size_t ms_timeout, bool show_warning) {
|
bool WaitForResponseTimeoutW(uint32_t cmd, PacketResponseNG *response, size_t ms_timeout, bool show_warning) {
|
||||||
|
|
||||||
PacketResponseNG resp;
|
|
||||||
// init to ZERO
|
// init to ZERO
|
||||||
resp.cmd = 0,
|
PacketResponseNG resp;
|
||||||
resp.length = 0,
|
memset(&resp, 0, sizeof(resp));
|
||||||
resp.magic = 0,
|
|
||||||
resp.status = 0,
|
|
||||||
resp.crc = 0,
|
|
||||||
resp.ng = false,
|
|
||||||
resp.oldarg[0] = 0;
|
|
||||||
resp.oldarg[1] = 0;
|
|
||||||
resp.oldarg[2] = 0;
|
|
||||||
memset(resp.data.asBytes, 0, PM3_CMD_DATA_SIZE);
|
|
||||||
|
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
response = &resp;
|
response = &resp;
|
||||||
@@ -1118,23 +1109,14 @@ bool GetFromDevice(DeviceMemType_t memtype, uint8_t *dest, uint32_t bytes, uint3
|
|||||||
|
|
||||||
if (dest == NULL) return false;
|
if (dest == NULL) return false;
|
||||||
|
|
||||||
|
// init to ZERO
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
|
memset(&resp, 0, sizeof(resp));
|
||||||
|
|
||||||
if (response == NULL) {
|
if (response == NULL) {
|
||||||
response = &resp;
|
response = &resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// init to ZERO
|
|
||||||
resp.cmd = 0,
|
|
||||||
resp.length = 0,
|
|
||||||
resp.magic = 0,
|
|
||||||
resp.status = 0,
|
|
||||||
resp.crc = 0,
|
|
||||||
resp.ng = false,
|
|
||||||
resp.oldarg[0] = 0;
|
|
||||||
resp.oldarg[1] = 0;
|
|
||||||
resp.oldarg[2] = 0;
|
|
||||||
memset(resp.data.asBytes, 0, PM3_CMD_DATA_SIZE);
|
|
||||||
|
|
||||||
if (bytes == 0) return true;
|
if (bytes == 0) return true;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user