diff --git a/client/comms.c b/client/comms.c index 1055f6dd4..a7f9ad42a 100644 --- a/client/comms.c +++ b/client/comms.c @@ -486,8 +486,7 @@ bool OpenProxmark(void *port, bool wait_for_port, int timeout, bool flash_mode, int TestProxmark(void) { clearCommandBuffer(); PacketResponseNG resp; - PacketCommandOLD c = {CMD_PING, {0, 0, 0}, {{0}}}; - SendCommand(&c); + SendCommandOLD(CMD_PING, 0, 0, 0, NULL, 0); if (WaitForResponseTimeout(CMD_ACK, &resp, 5000)) { send_via_fpc = resp.oldarg[0] == 1; PrintAndLogEx(INFO, "Communicating with PM3 over %s.", send_via_fpc ? "FPC" : "USB"); @@ -603,23 +602,19 @@ bool GetFromDevice(DeviceMemType_t memtype, uint8_t *dest, uint32_t bytes, uint3 switch (memtype) { case BIG_BUF: { - PacketCommandOLD c = {CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K, {start_index, bytes, 0}, {{0}}}; - SendCommand(&c); + SendCommandOLD(CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K, start_index, bytes, 0, NULL, 0); return dl_it(dest, bytes, start_index, response, ms_timeout, show_warning, CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K); } case BIG_BUF_EML: { - PacketCommandOLD c = {CMD_DOWNLOAD_EML_BIGBUF, {start_index, bytes, 0}, {{0}}}; - SendCommand(&c); + SendCommandOLD(CMD_DOWNLOAD_EML_BIGBUF, start_index, bytes, 0, NULL, 0); return dl_it(dest, bytes, start_index, response, ms_timeout, show_warning, CMD_DOWNLOADED_EML_BIGBUF); } case FLASH_MEM: { - PacketCommandOLD c = {CMD_FLASHMEM_DOWNLOAD, {start_index, bytes, 0}, {{0}}}; - SendCommand(&c); + SendCommandOLD(CMD_FLASHMEM_DOWNLOAD, start_index, bytes, 0, NULL, 0); return dl_it(dest, bytes, start_index, response, ms_timeout, show_warning, CMD_FLASHMEM_DOWNLOADED); } case SIM_MEM: { - //PacketCommandOLD c = {CMD_DOWNLOAD_SIM_MEM, {start_index, bytes, 0}, {{0}}}; - //SendCommand(&c); + //SendCommandOLD(CMD_DOWNLOAD_SIM_MEM, start_index, bytes, 0, NULL, 0); //return dl_it(dest, bytes, start_index, response, ms_timeout, show_warning, CMD_DOWNLOADED_SIMMEM); return false; } diff --git a/client/flash.c b/client/flash.c index 790edf49b..366c7094c 100644 --- a/client/flash.c +++ b/client/flash.c @@ -259,8 +259,7 @@ fail: // Get the state of the proxmark, backwards compatible static int get_proxmark_state(uint32_t *state) { - PacketCommandOLD c = {CMD_DEVICE_INFO}; - SendCommand(&c); + SendCommandOLD(CMD_DEVICE_INFO, 0, 0, 0, NULL, 0); PacketResponseNG resp; WaitForResponse(CMD_UNKNOWN, &resp); // wait for any response. No timeout. @@ -300,20 +299,16 @@ static int enter_bootloader(char *serial_port_name) { if (state & DEVICE_INFO_FLAG_CURRENT_MODE_OS) { fprintf(stdout, _BLUE_("Entering bootloader...") "\n"); - PacketCommandOLD c; - memset(&c, 0, sizeof(c)); if ((state & DEVICE_INFO_FLAG_BOOTROM_PRESENT) && (state & DEVICE_INFO_FLAG_OSIMAGE_PRESENT)) { // New style handover: Send CMD_START_FLASH, which will reset the board // and enter the bootrom on the next boot. - c.cmd = CMD_START_FLASH; - SendCommand(&c); + SendCommandOLD(CMD_START_FLASH, 0, 0, 0, NULL, 0); fprintf(stdout, "(Press and release the button only to abort)\n"); } else { // Old style handover: Ask the user to press the button, then reset the board - c.cmd = CMD_HARDWARE_RESET; - SendCommand(&c); + SendCommandOLD(CMD_HARDWARE_RESET, 0, 0, 0, NULL, 0); fprintf(stdout, "Press and hold down button NOW if your bootloader requires it.\n"); } msleep(100); @@ -361,19 +356,13 @@ int flash_start_flashing(int enable_bl_writes, char *serial_port_name) { if (state & DEVICE_INFO_FLAG_UNDERSTANDS_START_FLASH) { // This command is stupid. Why the heck does it care which area we're // flashing, as long as it's not the bootloader area? The mind boggles. - PacketCommandOLD c = {CMD_START_FLASH}; PacketResponseNG resp; if (enable_bl_writes) { - c.arg[0] = FLASH_START; - c.arg[1] = FLASH_END; - c.arg[2] = START_FLASH_MAGIC; + SendCommandOLD(CMD_START_FLASH, FLASH_START, FLASH_END, START_FLASH_MAGIC, NULL, 0); } else { - c.arg[0] = BOOTLOADER_END; - c.arg[1] = FLASH_END; - c.arg[2] = 0; + SendCommandOLD(CMD_START_FLASH,BOOTLOADER_END, FLASH_END, 0, NULL, 0); } - SendCommand(&c); return wait_for_ack(&resp); } else { fprintf(stderr, _RED_("Note: Your bootloader does not understand the new START_FLASH command") "\n"); @@ -386,10 +375,8 @@ static int write_block(uint32_t address, uint8_t *data, uint32_t length) { uint8_t block_buf[BLOCK_SIZE]; memset(block_buf, 0xFF, BLOCK_SIZE); memcpy(block_buf, data, length); - PacketCommandOLD c = {CMD_FINISH_WRITE, {address, 0, 0}}; PacketResponseNG resp; - memcpy(c.d.asBytes, block_buf, length); - SendCommand(&c); + SendCommandOLD(CMD_FINISH_WRITE, address, 0, 0, block_buf, length); int ret = wait_for_ack(&resp); if (ret && resp.oldarg[0]) { uint32_t lock_bits = resp.oldarg[0] >> 16; @@ -459,8 +446,7 @@ void flash_free(flash_file_t *ctx) { // just reset the unit int flash_stop_flashing(void) { - PacketCommandOLD c = {CMD_HARDWARE_RESET}; - SendCommand(&c); + SendCommandOLD(CMD_HARDWARE_RESET, 0, 0, 0, NULL, 0); msleep(100); return 0; } diff --git a/client/util.h b/client/util.h index 30077ec22..b55cfc435 100644 --- a/client/util.h +++ b/client/util.h @@ -150,7 +150,7 @@ #ifndef DropField #define DropField() { \ - PacketCommandOLD c_drop = {CMD_READER_ISO_14443a, {0,0,0}, {{0}}}; clearCommandBuffer(); SendCommand(&c_drop); \ + clearCommandBuffer(); SendCommandOLD(CMD_READER_ISO_14443a, 0, 0, 0, NULL, 0); \ } #endif