Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

Commit

Permalink
chg: textual, and increase cmds receive buffer to 100.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris committed Jun 30, 2018
1 parent ed5367a commit 942e647
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
35 changes: 18 additions & 17 deletions client/cmdmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,25 @@ static int CmdQuit(const char *Cmd);
static int CmdRev(const char *Cmd);

//For storing command that are received from the device
#define CMD_BUFFER_SIZE 50
static UsbCommand cmdBuffer[CMD_BUFFER_SIZE];

//Points to the next empty position to write to
static int cmd_head;//Starts as 0
static int cmd_head = 0;

//Points to the position of the last unread command
static int cmd_tail;//Starts as 0
static int cmd_tail = 0;

// to lock cmdBuffer operations from different threads
static pthread_mutex_t cmdBufferMutex = PTHREAD_MUTEX_INITIALIZER;

int CmdQuit(const char *Cmd) {
return 99;
}

int CmdRev(const char *Cmd) {
CmdCrc(Cmd);
return 0;
}

static command_t CommandTable[] = {
{"help", CmdHelp, 1, "This help. Use '<command> help' for details of a particular command."},
{"analyse", CmdAnalyse, 1, "{ Analyse bytes... }"},
{"analyse", CmdAnalyse, 1, "{ Analyse utils... }"},
{"data", CmdData, 1, "{ Plot window / data buffer manipulation... }"},
{"hf", CmdHF, 1, "{ High Frequency commands... }"},
{"hw", CmdHW, 1, "{ Hardware commands... }"},
{"lf", CmdLF, 1, "{ Low Frequency commands... }"},
{"reveng", CmdRev, 1, "Crc calculations from the software reveng 1.44"},
{"reveng", CmdRev, 1, "{ Crc calculations from the software reveng 1.51... }"},
{"script", CmdScript, 1, "{ Scripting commands }"},
{"trace", CmdTrace, 1, "{ Trace manipulation... }"},
#ifdef WITH_FLASH
Expand All @@ -60,6 +52,15 @@ int CmdHelp(const char *Cmd) {
return 0;
}

int CmdQuit(const char *Cmd) {
return 99;
}

int CmdRev(const char *Cmd) {
CmdCrc(Cmd);
return 0;
}

bool dl_it(uint8_t *dest, uint32_t bytes, uint32_t start_index, UsbCommand *response, size_t ms_timeout, bool show_warning, uint32_t rec_cmd);
/**
* @brief This method should be called when sending a new command to the pm3. In case any old
Expand All @@ -85,6 +86,7 @@ void storeCommand(UsbCommand *command) {
//If these two are equal, we're about to overwrite in the
// circular buffer.
PrintAndLogEx(FAILED, "WARNING: Command buffer about to overwrite command! This needs to be fixed!");
fflush(NULL);
}
//Store the command at the 'head' location
UsbCommand* destination = &cmdBuffer[cmd_head];
Expand Down Expand Up @@ -197,12 +199,11 @@ void UsbCommandReceived(UsbCommand* _ch) {

// print debug line on same row. escape seq \r
if ( c->arg[1] == CMD_MEASURE_ANTENNA_TUNING_HF) {
printf("\r#db# %s", s);
fflush(NULL);
PrintAndLogEx(NORMAL, "\r#db# %s", s);
} else {
PrintAndLogEx(NORMAL, "#db# %s", s);
fflush(NULL);
}
fflush(NULL);
break;
}
case CMD_DEBUG_PRINT_INTEGERS: {
Expand Down
2 changes: 1 addition & 1 deletion client/cmdmain.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "cmdflashmem.h" // rdv40 flashmem commands

//For storing command that are received from the device
#define CMD_BUFFER_SIZE 50
#define CMD_BUFFER_SIZE 100
typedef enum {
BIG_BUF,
BIG_BUF_EML,
Expand Down

0 comments on commit 942e647

Please sign in to comment.