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
70
client/ui.c
70
client/ui.c
|
@ -45,18 +45,18 @@ void PrintAndLogOptions(char *str[][2], size_t size, size_t space) {
|
|||
}
|
||||
void PrintAndLogEx(logLevel_t level, char *fmt, ...) {
|
||||
|
||||
// skip debug messages if client debugging is turned off i.e. 'DATA SETDEBUG 0'
|
||||
// skip debug messages if client debugging is turned off i.e. 'DATA SETDEBUG 0'
|
||||
if (g_debugMode == 0 && level == DEBUG)
|
||||
return;
|
||||
|
||||
char prefix[20] = {0};
|
||||
char prefix[20] = {0};
|
||||
char buffer[MAX_PRINT_BUFFER] = {0};
|
||||
char buffer2[MAX_PRINT_BUFFER+20] = {0};
|
||||
char *token = NULL;
|
||||
int size = 0;
|
||||
// {NORMAL, SUCCESS, INFO, FAILED, WARNING, ERR, DEBUG}
|
||||
static char *prefixes[7] = { "", "[+] ", "[=] ", "[-] ", "[!] ", "[!!] ", "[#] "};
|
||||
|
||||
|
||||
switch( level ) {
|
||||
case ERR:
|
||||
strncpy(prefix,_RED_([!!] ), sizeof(prefix)-1);
|
||||
|
@ -65,19 +65,19 @@ void PrintAndLogEx(logLevel_t level, char *fmt, ...) {
|
|||
strncpy(prefix,_RED_([-] ), sizeof(prefix)-1);
|
||||
break;
|
||||
case DEBUG:
|
||||
strncpy(prefix,_BLUE_([#] ), sizeof(prefix)-1);
|
||||
strncpy(prefix,_BLUE_([#] ), sizeof(prefix)-1);
|
||||
break;
|
||||
case SUCCESS:
|
||||
case SUCCESS:
|
||||
strncpy(prefix,_GREEN_([+] ), sizeof(prefix)-1);
|
||||
break;
|
||||
case WARNING:
|
||||
strncpy(prefix,_CYAN_([!] ), sizeof(prefix)-1);
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
strncpy(prefix, prefixes[level], sizeof(prefix)-1);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vsnprintf(buffer, sizeof(buffer), fmt, args);
|
||||
|
@ -88,26 +88,26 @@ void PrintAndLogEx(logLevel_t level, char *fmt, ...) {
|
|||
PrintAndLog("%s", buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (strchr(buffer, '\n')) {
|
||||
|
||||
const char delim[2] = "\n";
|
||||
|
||||
|
||||
// line starts with newline
|
||||
if (buffer[0] == '\n')
|
||||
if (buffer[0] == '\n')
|
||||
PrintAndLog("");
|
||||
|
||||
|
||||
token = strtok(buffer, delim);
|
||||
|
||||
|
||||
while (token != NULL) {
|
||||
|
||||
|
||||
size = strlen(buffer2);
|
||||
|
||||
|
||||
if (strlen(token))
|
||||
snprintf(buffer2+size, sizeof(buffer2)-size, "%s%s\n", prefix, token);
|
||||
else
|
||||
snprintf(buffer2+size, sizeof(buffer2)-size, "\n");
|
||||
|
||||
|
||||
token = strtok(NULL, delim);
|
||||
}
|
||||
PrintAndLog("%s", buffer2);
|
||||
|
@ -123,10 +123,10 @@ void PrintAndLog(char *fmt, ...) {
|
|||
va_list argptr, argptr2;
|
||||
static FILE *logfile = NULL;
|
||||
static int logging = 1;
|
||||
|
||||
|
||||
// lock this section to avoid interlacing prints from different threads
|
||||
pthread_mutex_lock(&print_lock);
|
||||
|
||||
|
||||
if (logging && !logfile) {
|
||||
logfile = fopen(logfilename, "a");
|
||||
if (!logfile) {
|
||||
|
@ -135,10 +135,10 @@ void PrintAndLog(char *fmt, ...) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// If there is an incoming message from the hardware (eg: lf hid read) in
|
||||
// the background (while the prompt is displayed and accepting user input),
|
||||
// stash the prompt and bring it back later.
|
||||
// stash the prompt and bring it back later.
|
||||
#ifdef RL_STATE_READCMD
|
||||
// We are using GNU readline. libedit (OSX) doesn't support this flag.
|
||||
int need_hack = (rl_readline_state & RL_STATE_READCMD) > 0;
|
||||
|
@ -151,7 +151,7 @@ void PrintAndLog(char *fmt, ...) {
|
|||
rl_redisplay();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
va_start(argptr, fmt);
|
||||
va_copy(argptr2, argptr);
|
||||
vprintf(fmt, argptr);
|
||||
|
@ -169,7 +169,7 @@ void PrintAndLog(char *fmt, ...) {
|
|||
free(saved_line);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (logging && logfile) {
|
||||
vfprintf(logfile, fmt, argptr2);
|
||||
fprintf(logfile, "\n");
|
||||
|
@ -181,13 +181,13 @@ void PrintAndLog(char *fmt, ...) {
|
|||
fflush(stdout);
|
||||
|
||||
//release lock
|
||||
pthread_mutex_unlock(&print_lock);
|
||||
pthread_mutex_unlock(&print_lock);
|
||||
}
|
||||
|
||||
void SetLogFilename(char *fn) {
|
||||
logfilename = fn;
|
||||
}
|
||||
|
||||
|
||||
void SetFlushAfterWrite(bool value) {
|
||||
flushAfterWrite = value;
|
||||
}
|
||||
|
@ -195,29 +195,29 @@ void SetFlushAfterWrite(bool value) {
|
|||
void iceIIR_Butterworth(int *data, const size_t len){
|
||||
|
||||
int i,j;
|
||||
|
||||
int * output = (int* ) calloc(sizeof(int) * len, sizeof(uint8_t));
|
||||
|
||||
int * output = (int* ) calloc(sizeof(int) * len, sizeof(uint8_t));
|
||||
if ( !output ) return;
|
||||
|
||||
|
||||
// clear mem
|
||||
memset(output, 0x00, len);
|
||||
|
||||
|
||||
size_t adjustedLen = len;
|
||||
float fc = 0.1125f; // center frequency
|
||||
|
||||
|
||||
// create very simple low-pass filter to remove images (2nd-order Butterworth)
|
||||
float complex iir_buf[3] = {0,0,0};
|
||||
float b[3] = {0.003621681514929, 0.007243363029857, 0.003621681514929};
|
||||
float a[3] = {1.000000000000000, -1.822694925196308, 0.837181651256023};
|
||||
|
||||
|
||||
float sample = 0; // input sample read from array
|
||||
float complex x_prime = 1.0f; // save sample for estimating frequency
|
||||
float complex x;
|
||||
|
||||
|
||||
for (i = 0; i < adjustedLen; ++i) {
|
||||
|
||||
sample = data[i];
|
||||
|
||||
|
||||
// remove DC offset and mix to complex baseband
|
||||
x = (sample - 127.5f) * cexpf( _Complex_I * 2 * M_PI * fc * i );
|
||||
|
||||
|
@ -228,27 +228,27 @@ void SetFlushAfterWrite(bool value) {
|
|||
x = b[0]*iir_buf[0] +
|
||||
b[1]*iir_buf[1] +
|
||||
b[2]*iir_buf[2];
|
||||
|
||||
|
||||
// compute instantaneous frequency by looking at phase difference
|
||||
// between adjacent samples
|
||||
float freq = cargf(x * conjf(x_prime));
|
||||
x_prime = x; // retain this sample for next iteration
|
||||
|
||||
output[i] =(freq > 0) ? 127 : -127;
|
||||
}
|
||||
}
|
||||
|
||||
// show data
|
||||
//memcpy(data, output, adjustedLen);
|
||||
for (j=0; j<adjustedLen; ++j)
|
||||
data[j] = output[j];
|
||||
|
||||
|
||||
free(output);
|
||||
}
|
||||
|
||||
void iceSimple_Filter(int *data, const size_t len, uint8_t k){
|
||||
// ref: http://www.edn.com/design/systems-design/4320010/A-simple-software-lowpass-filter-suits-embedded-system-applications
|
||||
// parameter K
|
||||
#define FILTER_SHIFT 4
|
||||
#define FILTER_SHIFT 4
|
||||
|
||||
int32_t filter_reg = 0;
|
||||
int16_t input, output;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue