diff --git a/armsrc/appmain.c b/armsrc/appmain.c index fd3760bed..6506ef44d 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -1457,17 +1457,17 @@ static void UsbPacketReceived(bool cmd_ng, uint8_t *packet) { case CMD_PING: if (cmd_ng) { #ifdef WITH_FPC_HOST - cmd_send(CMD_ACK, reply_via_fpc, ((uint32_t *)data_ng)[0], ((uint32_t *)data_ng)[(datalen_ng-1)/4], 0, 0); + cmd_send(CMD_ACK, reply_via_fpc, ((uint32_t *)data_ng)[0], ((uint32_t *)data_ng)[(datalen_ng - 1) / 4], 0, 0); #else - cmd_send(CMD_ACK, 0, ((uint32_t *)data_ng)[0], ((uint32_t *)data_ng)[(c->arg[0]-1)/4], 0, 0); + cmd_send(CMD_ACK, 0, ((uint32_t *)data_ng)[0], ((uint32_t *)data_ng)[(c->arg[0] - 1) / 4], 0, 0); #endif } else { #ifdef WITH_FPC_HOST - cmd_send(CMD_ACK, reply_via_fpc, 0, 0, 0, 0); + cmd_send(CMD_ACK, reply_via_fpc, 0, 0, 0, 0); #else - cmd_send(CMD_ACK, 0, 0, 0, 0, 0); + cmd_send(CMD_ACK, 0, 0, 0, 0, 0); #endif - } + } break; #ifdef WITH_LCD case CMD_LCD_RESET: @@ -1611,10 +1611,10 @@ void __attribute__((noreturn)) AppMain(void) { } } if (!error) { - #ifdef WITH_FPC_HOST - reply_via_fpc = false; - #endif - UsbPacketReceived(true, rx); +#ifdef WITH_FPC_HOST + reply_via_fpc = false; +#endif + UsbPacketReceived(true, rx); } } else { // Old style command bytes = usb_read_ng(rx + sizeof(UsbCommandNGPreamble), sizeof(UsbCommand) - sizeof(UsbCommandNGPreamble)); @@ -1623,10 +1623,10 @@ void __attribute__((noreturn)) AppMain(void) { error = true; } if (!error) { - #ifdef WITH_FPC_HOST - reply_via_fpc = false; - #endif - UsbPacketReceived(false, rx); +#ifdef WITH_FPC_HOST + reply_via_fpc = false; +#endif + UsbPacketReceived(false, rx); } } } else { diff --git a/client/cmdhw.c b/client/cmdhw.c index 929d37b73..25f0e0f5d 100644 --- a/client/cmdhw.c +++ b/client/cmdhw.c @@ -448,9 +448,9 @@ static int CmdPingNG(const char *Cmd) { uint8_t data[USB_CMD_DATA_SIZE] = {0}; uint16_t cmd = CMD_PING; if (len >= 4) - ((uint32_t *)data)[0]=0xAABBCCDD; + ((uint32_t *)data)[0] = 0xAABBCCDD; if (len >= 8) - ((uint32_t *)data)[(len-1)/4] = 0xDDCCBBAA; + ((uint32_t *)data)[(len - 1) / 4] = 0xDDCCBBAA; SendCommandNG(cmd, data, len); if (WaitForResponseTimeout(CMD_ACK, &resp, 1000)) { PrintAndLogEx(NORMAL, "PingNG successful"); @@ -458,8 +458,7 @@ static int CmdPingNG(const char *Cmd) { PrintAndLogEx(NORMAL, "%08x -> %08x", 0xAABBCCDD, resp.arg[1]); if (len >= 8) PrintAndLogEx(NORMAL, "%08x -> %08x", 0xDDCCBBAA, resp.arg[2]); - } - else + } else PrintAndLogEx(NORMAL, "PingNG failed"); return 0; } diff --git a/client/comms.c b/client/comms.c index c6d15087c..e917b8d3e 100644 --- a/client/comms.c +++ b/client/comms.c @@ -31,7 +31,7 @@ size_t txBufferNGLen; static bool txBuffer_pending = false; static pthread_mutex_t txBufferMutex = PTHREAD_MUTEX_INITIALIZER; static pthread_cond_t txBufferSig = PTHREAD_COND_INITIALIZER; - + // Used by UsbReceiveCommand as a ring buffer for messages that are yet to be // processed by a command handler (WaitForResponse{,Timeout}) static UsbCommand rxBuffer[CMD_BUFFER_SIZE]; @@ -87,7 +87,7 @@ void SendCommand(UsbCommand *c) { //__atomic_test_and_set(&txcmd_pending, __ATOMIC_SEQ_CST); } -void SendCommandNG(uint16_t cmd, uint8_t* data, size_t len) { +void SendCommandNG(uint16_t cmd, uint8_t *data, size_t len) { #ifdef COMMS_DEBUG PrintAndLogEx(NORMAL, "Sending %d bytes of payload | cmd %04x\n", len, cmd); diff --git a/client/comms.h b/client/comms.h index f71c82f4c..f81540383 100644 --- a/client/comms.h +++ b/client/comms.h @@ -52,7 +52,7 @@ bool IsOffline(void); void *uart_receiver(void *targ); void SendCommand(UsbCommand *c); -void SendCommandNG(uint16_t cmd, uint8_t* data, size_t len); +void SendCommandNG(uint16_t cmd, uint8_t *data, size_t len); void clearCommandBuffer(void); #define FLASHMODE_SPEED 460800 diff --git a/client/proxmark3.c b/client/proxmark3.c index db4479c9a..47a50a6a4 100644 --- a/client/proxmark3.c +++ b/client/proxmark3.c @@ -467,7 +467,7 @@ int main(int argc, char *argv[]) { usb_present = OpenProxmark(port, waitCOMPort, 20, false, speed); if (TestProxmark() == 0) - usb_present = false; + usb_present = false; if (!usb_present) PrintAndLogEx(INFO, "Running in " _YELLOW_("OFFLINE") "mode. Check \"%s -h\" if it's not what you want.\n", exec_name); diff --git a/common/usb_cdc.c b/common/usb_cdc.c index c66593a33..9090d8dc2 100644 --- a/common/usb_cdc.c +++ b/common/usb_cdc.c @@ -647,8 +647,8 @@ uint32_t usb_read(uint8_t *data, size_t len) { } static uint8_t usb_read_ng_buffer[64]; -static size_t usb_read_ng_bufoff=0; -static size_t usb_read_ng_buflen=0; +static size_t usb_read_ng_bufoff = 0; +static size_t usb_read_ng_buflen = 0; uint32_t usb_read_ng(uint8_t *data, size_t len) { @@ -659,7 +659,7 @@ uint32_t usb_read_ng(uint8_t *data, size_t len) { uint32_t time_out = 0; // take first from local buffer - if ( len <= usb_read_ng_buflen ) { + if (len <= usb_read_ng_buflen) { for (uint32_t i = 0; i < len; i++) data[nbBytesRcv++] = usb_read_ng_buffer[usb_read_ng_bufoff + i]; usb_read_ng_buflen -= len;