Add usart dev cmds & dynamic flash support capability

This commit is contained in:
Philippe Teuwen 2019-05-03 22:30:17 +02:00
commit 3176684f4a
18 changed files with 185 additions and 205 deletions

View file

@ -485,47 +485,7 @@ static char *pb(uint32_t b) {
static int CmdAnalyseA(const char *Cmd) {
int hexlen = 0;
uint8_t cmdp = 0;
bool errors = false;
uint8_t data[PM3_CMD_DATA_SIZE] = {0x00};
if (!IfPm3Fpc()) {
PrintAndLogEx(ERR, "Device has no FPC USART support");
return PM3_EDEVNOTSUPP;
}
while (param_getchar(Cmd, cmdp) != 0x00 && !errors) {
switch (tolower(param_getchar(Cmd, cmdp))) {
case 'd':
param_gethex_ex(Cmd, cmdp + 1, data, &hexlen);
hexlen >>= 1;
if (hexlen != sizeof(data)) {
PrintAndLogEx(WARNING, "Read %d bytes of %u", hexlen, sizeof(data));
}
cmdp += 2;
break;
case 'h':
return usage_analyse_a();
default:
PrintAndLogEx(WARNING, "Unknown parameter '%c'", param_getchar(Cmd, cmdp));
errors = true;
break;
}
}
//Validations
if (errors || cmdp == 0) return usage_analyse_a();
clearCommandBuffer();
SendCommandOLD(CMD_FPC_SEND, 0, 0, 0, data, PM3_CMD_DATA_SIZE);
PacketResponseNG resp;
if (!WaitForResponseTimeout(CMD_ACK, &resp, 2500)) {
return 1;
}
PrintAndLogEx(NORMAL, "got ack. Status %d", resp.oldarg[0]);
return 0;
return usage_analyse_a();
/*
PrintAndLogEx(NORMAL, "-- " _BLUE_("its my message") "\n");
PrintAndLogEx(NORMAL, "-- " _RED_("its my message") "\n");