From 2e6699273e4df4c34d57c34b51a99141f56b8eeb Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Wed, 18 Apr 2018 20:17:00 +0200 Subject: [PATCH] chg: cleanup from offical repo --- client/cmdmain.c | 7 +++---- client/flash.c | 3 --- client/hid-flasher/flash.c | 3 --- client/hid-flasher/proxusb.c | 3 +-- common/Makefile.common | 2 +- common/iso15693tools.h | 3 --- 6 files changed, 5 insertions(+), 16 deletions(-) diff --git a/client/cmdmain.c b/client/cmdmain.c index 92555c613..fcf7e0e6b 100644 --- a/client/cmdmain.c +++ b/client/cmdmain.c @@ -30,8 +30,6 @@ #include "cmdcrc.h" #include "cmdanalyse.h" -unsigned int current_command = CMD_UNKNOWN; - static int CmdHelp(const char *Cmd); static int CmdQuit(const char *Cmd); static int CmdRev(const char *Cmd); @@ -140,7 +138,7 @@ int getCommand(UsbCommand* response) { * Waits for a certain response type. This method waits for a maximum of * ms_timeout milliseconds for a specified response command. *@brief WaitForResponseTimeout - * @param cmd command to wait for + * @param cmd command to wait for, or CMD_UNKNOWN to take any command. * @param response struct to copy received command into. * @param ms_timeout * @return true if command was returned, otherwise false @@ -158,7 +156,7 @@ bool WaitForResponseTimeoutW(uint32_t cmd, UsbCommand* response, size_t ms_timeo while (true) { while ( getCommand(response) ) { - if (response->cmd == cmd) + if (cmd == CMD_UNKNOWN || response->cmd == cmd) return true; } @@ -166,6 +164,7 @@ bool WaitForResponseTimeoutW(uint32_t cmd, UsbCommand* response, size_t ms_timeo break; if (msclock() - start_time > 3000 && show_warning) { + // 3 seconds elapsed (but this doesn't mean the timeout was exceeded) PrintAndLogEx(NORMAL, "Waiting for a response from the proxmark..."); PrintAndLogEx(NORMAL, "You can cancel this operation by pressing the pm3 button"); show_warning = false; diff --git a/client/flash.c b/client/flash.c index ff661fd0e..43052d894 100644 --- a/client/flash.c +++ b/client/flash.c @@ -15,9 +15,6 @@ void ReceiveCommand(UsbCommand* rxcmd); void CloseProxmark(); int OpenProxmark(); -// FIXME: what the fuckity fuck -unsigned int current_command = CMD_UNKNOWN; - #define FLASH_START 0x100000 #ifdef HAS_512_FLASH diff --git a/client/hid-flasher/flash.c b/client/hid-flasher/flash.c index 8e932da10..8fd59427d 100644 --- a/client/hid-flasher/flash.c +++ b/client/hid-flasher/flash.c @@ -17,9 +17,6 @@ #include "elf.h" #include "proxendian.h" -// FIXME: what the fuckity fuck -unsigned int current_command = CMD_UNKNOWN; - #define FLASH_START 0x100000 #define FLASH_SIZE (256*1024) #define FLASH_END (FLASH_START + FLASH_SIZE) diff --git a/client/hid-flasher/proxusb.c b/client/hid-flasher/proxusb.c index 3b96be372..eb0860ec1 100644 --- a/client/hid-flasher/proxusb.c +++ b/client/hid-flasher/proxusb.c @@ -19,7 +19,6 @@ usb_dev_handle *devh = NULL; static unsigned int claimed_iface = 0; unsigned char return_on_error = 0; unsigned char error_occured = 0; -extern unsigned int current_command; void SendCommand(UsbCommand *c) { @@ -28,7 +27,7 @@ void SendCommand(UsbCommand *c) #if 0 printf("Sending %d bytes\n", sizeof(UsbCommand)); #endif - current_command = c->cmd; + ret = usb_bulk_write(devh, 0x01, (char*)c, sizeof(UsbCommand), 1000); if (ret<0) { error_occured = 1; diff --git a/common/Makefile.common b/common/Makefile.common index 4aad51425..ec291e44a 100644 --- a/common/Makefile.common +++ b/common/Makefile.common @@ -29,7 +29,7 @@ GZIP=gzip OBJDIR = obj -INCLUDE = -I../include -I../common +INCLUDE = -I../include -I../common -I. TAR=tar TARFLAGS = -C .. -rvf diff --git a/common/iso15693tools.h b/common/iso15693tools.h index 4f3532a08..053ca56ca 100644 --- a/common/iso15693tools.h +++ b/common/iso15693tools.h @@ -11,7 +11,6 @@ #include "crc16.h" // REQUEST FLAGS - #define ISO15_REQ_SUBCARRIER_SINGLE 0x00 // Tag should respond using one subcarrier (ASK) #define ISO15_REQ_SUBCARRIER_TWO 0x01 // Tag should respond using two subcarriers (FSK) #define ISO15_REQ_DATARATE_LOW 0x00 // Tag should respond using low data rate @@ -22,13 +21,11 @@ #define ISO15_REQ_PROTOCOL_EXT 0x08 // RFU // REQUEST FLAGS when INVENTORY is not set - #define ISO15_REQ_SELECT 0x10 // only selected cards response #define ISO15_REQ_ADDRESS 0x20 // this req contains an address #define ISO15_REQ_OPTION 0x40 // Command specific option selector //REQUEST FLAGS when INVENTORY is set - #define ISO15_REQINV_AFI 0x10 // AFI Field is present #define ISO15_REQINV_SLOT1 0x20 // 1 Slot #define ISO15_REQINV_SLOT16 0x00 // 16 Slots