mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
style
This commit is contained in:
parent
43608589e3
commit
83571f02a0
6 changed files with 23 additions and 24 deletions
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue