mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
remove spurious spaces & tabs at end of lines
This commit is contained in:
parent
edc19f202a
commit
60f292b18e
249 changed files with 8481 additions and 8481 deletions
|
@ -86,7 +86,7 @@ void uart_close(const serial_port sp);
|
|||
*
|
||||
* Returns FALSE if there was an error reading from the device. Note that a
|
||||
* partial read may have completed into the buffer by the corresponding
|
||||
* implementation, so pszRxLen should be checked to see if any data was written.
|
||||
* implementation, so pszRxLen should be checked to see if any data was written.
|
||||
*/
|
||||
bool uart_receive(const serial_port sp, uint8_t* pbtRx, size_t pszMaxRxLen, size_t* pszRxLen);
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
*/
|
||||
|
||||
// Test if we are dealing with posix operating systems
|
||||
#ifndef _WIN32
|
||||
#ifndef _WIN32
|
||||
#define _DEFAULT_SOURCE
|
||||
|
||||
#include "uart.h"
|
||||
|
@ -88,7 +88,7 @@ serial_port uart_open(const char* pcPortName) {
|
|||
}
|
||||
|
||||
timeout.tv_usec = 300000; // 300 000 micro seconds
|
||||
|
||||
|
||||
char *colon = strrchr(addrstr, ':');
|
||||
char *portstr;
|
||||
if (colon) {
|
||||
|
@ -142,7 +142,7 @@ serial_port uart_open(const char* pcPortName) {
|
|||
return sp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
sp->fd = open(pcPortName, O_RDWR | O_NOCTTY | O_NDELAY | O_NONBLOCK);
|
||||
if (sp->fd == -1) {
|
||||
uart_close(sp);
|
||||
|
@ -196,12 +196,12 @@ serial_port uart_open(const char* pcPortName) {
|
|||
|
||||
#ifdef WITH_FPC
|
||||
if ( uart_set_speed(sp, 115200) ) {
|
||||
printf("[=] UART Setting serial baudrate 115200 [FPC enabled]\n");
|
||||
printf("[=] UART Setting serial baudrate 115200 [FPC enabled]\n");
|
||||
} else {
|
||||
uart_set_speed(sp, 9600);
|
||||
printf("[=] UART Setting serial baudrate 9600 [FPC enabled]\n");
|
||||
printf("[=] UART Setting serial baudrate 9600 [FPC enabled]\n");
|
||||
}
|
||||
#else
|
||||
#else
|
||||
// set speed, works for UBUNTU 14.04
|
||||
bool success = uart_set_speed(sp, 460800);
|
||||
if (success) {
|
||||
|
@ -210,7 +210,7 @@ serial_port uart_open(const char* pcPortName) {
|
|||
uart_set_speed(sp, 115200);
|
||||
printf("[=] UART Setting serial baudrate 115200\n");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return sp;
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ void uart_close(const serial_port sp) {
|
|||
int err = fcntl(spu->fd, F_SETLK, &fl);
|
||||
if ( err == -1) {
|
||||
//perror("fcntl");
|
||||
}
|
||||
}
|
||||
close(spu->fd);
|
||||
free(sp);
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ bool uart_receive(const serial_port sp, uint8_t* pbtRx, size_t pszMaxRxLen, size
|
|||
|
||||
// Reset the output count
|
||||
*pszRxLen = 0;
|
||||
|
||||
|
||||
do {
|
||||
// Reset file descriptor
|
||||
FD_ZERO(&rfds);
|
||||
|
@ -365,11 +365,11 @@ bool uart_set_speed(serial_port sp, const uint32_t uiPortSpeed) {
|
|||
# endif
|
||||
default: return false;
|
||||
};
|
||||
|
||||
|
||||
struct termios ti;
|
||||
if (tcgetattr(spu->fd,&ti) == -1)
|
||||
if (tcgetattr(spu->fd,&ti) == -1)
|
||||
return false;
|
||||
|
||||
|
||||
// Set port speed (Input and Output)
|
||||
cfsetispeed(&ti, stPortSpeed);
|
||||
cfsetospeed(&ti, stPortSpeed);
|
||||
|
@ -380,10 +380,10 @@ uint32_t uart_get_speed(const serial_port sp) {
|
|||
struct termios ti;
|
||||
uint32_t uiPortSpeed;
|
||||
const serial_port_unix* spu = (serial_port_unix*)sp;
|
||||
|
||||
if (tcgetattr(spu->fd, &ti) == -1)
|
||||
|
||||
if (tcgetattr(spu->fd, &ti) == -1)
|
||||
return 0;
|
||||
|
||||
|
||||
// Set port speed (Input)
|
||||
speed_t stPortSpeed = cfgetispeed(&ti);
|
||||
switch (stPortSpeed) {
|
||||
|
|
|
@ -67,8 +67,8 @@ serial_port uart_open(const char* pcPortName) {
|
|||
uart_close(sp);
|
||||
return INVALID_SERIAL_PORT;
|
||||
}
|
||||
|
||||
// Prepare the device control
|
||||
|
||||
// Prepare the device control
|
||||
// doesn't matter since PM3 device ignors this CDC command: set_line_coding in usb_cdc.c
|
||||
memset(&sp->dcb, 0, sizeof(DCB));
|
||||
sp->dcb.DCBlength = sizeof(DCB);
|
||||
|
@ -77,7 +77,7 @@ serial_port uart_open(const char* pcPortName) {
|
|||
printf("[!] UART error cdc setup\n");
|
||||
return INVALID_SERIAL_PORT;
|
||||
}
|
||||
|
||||
|
||||
// Update the active serial port
|
||||
if (!SetCommState(sp->hPort, &sp->dcb)) {
|
||||
uart_close(sp);
|
||||
|
@ -92,20 +92,20 @@ serial_port uart_open(const char* pcPortName) {
|
|||
sp->ct.ReadTotalTimeoutConstant = 1500;
|
||||
sp->ct.WriteTotalTimeoutMultiplier = 1000;
|
||||
sp->ct.WriteTotalTimeoutConstant = 0;
|
||||
#else
|
||||
#else
|
||||
sp->ct.ReadIntervalTimeout = 30;
|
||||
sp->ct.ReadTotalTimeoutMultiplier = 0;
|
||||
sp->ct.ReadTotalTimeoutConstant = 30;
|
||||
sp->ct.WriteTotalTimeoutMultiplier = 30;
|
||||
sp->ct.WriteTotalTimeoutConstant = 0;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
if (!SetCommTimeouts(sp->hPort, &sp->ct)) {
|
||||
uart_close(sp);
|
||||
printf("[!] UART error while setting comm time outs\n");
|
||||
return INVALID_SERIAL_PORT;
|
||||
}
|
||||
|
||||
|
||||
PurgeComm(sp->hPort, PURGE_RXABORT | PURGE_RXCLEAR);
|
||||
|
||||
#ifdef WITH_FPC
|
||||
|
@ -113,7 +113,7 @@ serial_port uart_open(const char* pcPortName) {
|
|||
printf("[=] UART Setting serial baudrate 115200 [FPC enabled]\n");
|
||||
} else {
|
||||
uart_set_speed(sp, 9600);
|
||||
printf("[=] UART Setting serial baudrate 9600 [FPC enabled]\n");
|
||||
printf("[=] UART Setting serial baudrate 9600 [FPC enabled]\n");
|
||||
}
|
||||
#else
|
||||
bool success = uart_set_speed(sp, 460800);
|
||||
|
@ -123,7 +123,7 @@ serial_port uart_open(const char* pcPortName) {
|
|||
uart_set_speed(sp, 115200);
|
||||
printf("[=] UART Setting serial baudrate 115200\n");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return sp;
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ bool uart_set_speed(serial_port sp, const uint32_t uiPortSpeed) {
|
|||
default:
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
spw = (serial_port_windows*)sp;
|
||||
spw->dcb.BaudRate = uiPortSpeed;
|
||||
bool result = SetCommState(spw->hPort, &spw->dcb);
|
||||
|
@ -170,7 +170,7 @@ bool uart_receive(const serial_port sp, uint8_t* p_rx, size_t pszMaxRxLen, size_
|
|||
}
|
||||
|
||||
bool uart_send(const serial_port sp, const uint8_t* p_tx, const size_t len) {
|
||||
DWORD txlen = 0;
|
||||
DWORD txlen = 0;
|
||||
return WriteFile(((serial_port_windows*)sp)->hPort, p_tx, len, &txlen, NULL);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue