mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -07:00
style
This commit is contained in:
parent
f49d7e6d39
commit
68e5b3c355
21 changed files with 106 additions and 106 deletions
|
@ -1636,7 +1636,7 @@ void __attribute__((noreturn)) AppMain(void) {
|
|||
PacketReceived(&rx);
|
||||
} else if (ret != PM3_ENODATA) {
|
||||
|
||||
Dbprintf("Error in frame reception: %d %s", ret, (ret == PM3_EIO)?"PM3_EIO":"");
|
||||
Dbprintf("Error in frame reception: %d %s", ret, (ret == PM3_EIO) ? "PM3_EIO" : "");
|
||||
// TODO if error, shall we resync ?
|
||||
}
|
||||
|
||||
|
|
|
@ -483,9 +483,9 @@ static int CmdPing(const char *Cmd) {
|
|||
bool error = false;
|
||||
if (len) {
|
||||
error = memcmp(data, resp.data.asBytes, len) != 0;
|
||||
PrintAndLogEx((error)? ERR:SUCCESS, "Ping response " _GREEN_("received") "and content is %s", error ? _RED_("NOT ok") : _GREEN_("ok"));
|
||||
PrintAndLogEx((error) ? ERR : SUCCESS, "Ping response " _GREEN_("received") "and content is %s", error ? _RED_("NOT ok") : _GREEN_("ok"));
|
||||
} else {
|
||||
PrintAndLogEx((error)? ERR:SUCCESS, "Ping response " _GREEN_("received"));
|
||||
PrintAndLogEx((error) ? ERR : SUCCESS, "Ping response " _GREEN_("received"));
|
||||
}
|
||||
} else
|
||||
PrintAndLogEx(WARNING, "Ping response " _RED_("timeout"));
|
||||
|
@ -500,9 +500,9 @@ static int CmdConnect(const char *Cmd) {
|
|||
char *port = NULL;
|
||||
|
||||
// default back to previous used serial port
|
||||
if (strlen(Cmd) == 0 ) {
|
||||
if (strlen(Cmd) == 0) {
|
||||
int len = strlen((char *)conn.serial_port_name);
|
||||
if ( len == 0 ) {
|
||||
if (len == 0) {
|
||||
return usage_hw_connect();
|
||||
}
|
||||
port = (char *)conn.serial_port_name;
|
||||
|
@ -510,10 +510,10 @@ static int CmdConnect(const char *Cmd) {
|
|||
port = (char *)Cmd;
|
||||
}
|
||||
|
||||
if ( port == NULL )
|
||||
if (port == NULL)
|
||||
return usage_hw_connect();
|
||||
|
||||
if ( session.pm3_present ) {
|
||||
if (session.pm3_present) {
|
||||
CloseProxmark();
|
||||
}
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ static int CmdUsartBtPin(const char *Cmd) {
|
|||
case 'h':
|
||||
return usage_usart_bt_pin();
|
||||
case 'd':
|
||||
if (param_getstr(Cmd, cmdp + 1, pin, sizeof(pin)) != sizeof(pin)-1) {
|
||||
if (param_getstr(Cmd, cmdp + 1, pin, sizeof(pin)) != sizeof(pin) - 1) {
|
||||
PrintAndLogEx(FAILED, "PIN has wrong length, must be 4 digits");
|
||||
errors = true;
|
||||
break;
|
||||
|
@ -201,7 +201,7 @@ static int CmdUsartBtPin(const char *Cmd) {
|
|||
return ret;
|
||||
}
|
||||
// PrintAndLogEx(NORMAL, "RX (%3u):%.*s", len, len, data);
|
||||
if (strcmp((char*)data, "OKsetPIN") == 0) {
|
||||
if (strcmp((char *)data, "OKsetPIN") == 0) {
|
||||
PrintAndLogEx(NORMAL, "PIN changed " _GREEN_("successfully"));
|
||||
} else {
|
||||
PrintAndLogEx(WARNING, "Unexpected answer: %.*s", len, data);
|
||||
|
|
|
@ -329,7 +329,7 @@ __attribute__((force_align_arg_pointer))
|
|||
|
||||
// Signal to main thread that communications seems off.
|
||||
// main thread will kill and restart this thread.
|
||||
if ( commfailed ) {
|
||||
if (commfailed) {
|
||||
PrintAndLogEx(WARNING, "Communicating with Proxmark3 device " _RED_("failed"));
|
||||
__atomic_test_and_set(&comm_thread_dead, __ATOMIC_SEQ_CST);
|
||||
break;
|
||||
|
@ -352,7 +352,7 @@ __attribute__((force_align_arg_pointer))
|
|||
if ((!error) && (length > 0)) { // Get the variable length payload
|
||||
|
||||
res = uart_receive(sp, (uint8_t *)&rx_raw.data, length, &rxlen);
|
||||
if ( (res != PM3_SUCCESS) || (rxlen != length)) {
|
||||
if ((res != PM3_SUCCESS) || (rxlen != length)) {
|
||||
PrintAndLogEx(WARNING, "Received packet frame error variable part too short? %d/%d", rxlen, length);
|
||||
error = true;
|
||||
} else {
|
||||
|
@ -551,8 +551,8 @@ bool OpenProxmark(void *port, bool wait_for_port, int timeout, bool flash_mode,
|
|||
return false;
|
||||
} else {
|
||||
// start the communication thread
|
||||
if ( portname != (char*)conn.serial_port_name) {
|
||||
uint16_t len = MIN( strlen(portname), FILE_PATH_SIZE - 1);
|
||||
if (portname != (char *)conn.serial_port_name) {
|
||||
uint16_t len = MIN(strlen(portname), FILE_PATH_SIZE - 1);
|
||||
memset(conn.serial_port_name, 0, FILE_PATH_SIZE);
|
||||
memcpy(conn.serial_port_name, portname, len);
|
||||
}
|
||||
|
|
|
@ -54,9 +54,9 @@ static void showBanner(void) {
|
|||
|
||||
int check_comm(void) {
|
||||
// If communications thread goes down. Device disconnected then this should hook up PM3 again.
|
||||
if ( IsCommunicationThreadDead() && session.pm3_present) {
|
||||
if (IsCommunicationThreadDead() && session.pm3_present) {
|
||||
rl_set_prompt("[offline] "PROXPROMPT);
|
||||
rl_forced_update_display ();
|
||||
rl_forced_update_display();
|
||||
CloseProxmark();
|
||||
PrintAndLogEx(INFO, "Running in " _YELLOW_("OFFLINE") "mode. Use \"hw connect\" to reconnect\n");
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ main_loop(char *script_cmds_file, char *script_cmd) {
|
|||
|
||||
} else {
|
||||
rl_event_hook = check_comm;
|
||||
if (session.pm3_present )
|
||||
if (session.pm3_present)
|
||||
cmd = readline(PROXPROMPT);
|
||||
else
|
||||
cmd = readline("[offline] "PROXPROMPT);
|
||||
|
|
|
@ -139,30 +139,30 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
uint32_t baudrate;
|
||||
bool via_fpc :1;
|
||||
bool via_fpc : 1;
|
||||
// rdv4
|
||||
bool compiled_with_flash :1;
|
||||
bool compiled_with_smartcard :1;
|
||||
bool compiled_with_fpc_usart :1;
|
||||
bool compiled_with_fpc_usart_dev :1;
|
||||
bool compiled_with_fpc_usart_host :1;
|
||||
bool compiled_with_flash : 1;
|
||||
bool compiled_with_smartcard : 1;
|
||||
bool compiled_with_fpc_usart : 1;
|
||||
bool compiled_with_fpc_usart_dev : 1;
|
||||
bool compiled_with_fpc_usart_host : 1;
|
||||
// lf
|
||||
bool compiled_with_lf :1;
|
||||
bool compiled_with_hitag :1;
|
||||
bool compiled_with_lf : 1;
|
||||
bool compiled_with_hitag : 1;
|
||||
// hf
|
||||
bool compiled_with_hfsniff :1;
|
||||
bool compiled_with_iso14443a :1;
|
||||
bool compiled_with_iso14443b :1;
|
||||
bool compiled_with_iso15693 :1;
|
||||
bool compiled_with_felica :1;
|
||||
bool compiled_with_legicrf :1;
|
||||
bool compiled_with_iclass :1;
|
||||
bool compiled_with_hfsniff : 1;
|
||||
bool compiled_with_iso14443a : 1;
|
||||
bool compiled_with_iso14443b : 1;
|
||||
bool compiled_with_iso15693 : 1;
|
||||
bool compiled_with_felica : 1;
|
||||
bool compiled_with_legicrf : 1;
|
||||
bool compiled_with_iclass : 1;
|
||||
// misc
|
||||
bool compiled_with_lcd :1;
|
||||
bool compiled_with_lcd : 1;
|
||||
|
||||
// rdv4
|
||||
bool hw_available_flash :1;
|
||||
bool hw_available_smartcard :1;
|
||||
bool hw_available_flash : 1;
|
||||
bool hw_available_smartcard : 1;
|
||||
} PACKED capabilities_t;
|
||||
|
||||
extern capabilities_t pm3_capabilities;
|
||||
|
|
|
@ -161,7 +161,7 @@ uint32_t uart_get_speed(const serial_port sp) {
|
|||
|
||||
int uart_receive(const serial_port sp, uint8_t *pbtRx, uint32_t pszMaxRxLen, uint32_t *pszRxLen) {
|
||||
int res = ReadFile(((serial_port_windows *)sp)->hPort, pbtRx, pszMaxRxLen, (LPDWORD)pszRxLen, NULL);
|
||||
if ( res )
|
||||
if (res)
|
||||
return PM3_SUCCESS;
|
||||
|
||||
int errorcode = GetLastError();
|
||||
|
@ -171,14 +171,14 @@ int uart_receive(const serial_port sp, uint8_t *pbtRx, uint32_t pszMaxRxLen, uin
|
|||
return PM3_EIO;
|
||||
}
|
||||
|
||||
printf("[!]res %d | rx errorcode == %d \n",res, errorcode);
|
||||
printf("[!]res %d | rx errorcode == %d \n", res, errorcode);
|
||||
return res;
|
||||
}
|
||||
|
||||
int uart_send(const serial_port sp, const uint8_t *p_tx, const uint32_t len) {
|
||||
DWORD txlen = 0;
|
||||
int res = WriteFile(((serial_port_windows *)sp)->hPort, p_tx, len, &txlen, NULL);
|
||||
if ( res )
|
||||
if (res)
|
||||
return PM3_SUCCESS;
|
||||
|
||||
int errorcode = GetLastError();
|
||||
|
@ -186,7 +186,7 @@ int uart_send(const serial_port sp, const uint8_t *p_tx, const uint32_t len) {
|
|||
return PM3_EIO;
|
||||
}
|
||||
|
||||
printf("[!!]res %d | send errorcode == %d \n",res, errorcode);
|
||||
printf("[!!]res %d | send errorcode == %d \n", res, errorcode);
|
||||
return PM3_ENOTTY;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue