chg: add response ack.

This commit is contained in:
iceman1001 2018-02-13 15:45:15 +01:00
parent 1709c1ce1a
commit 46d540490f
4 changed files with 22 additions and 0 deletions

View file

@ -30,6 +30,7 @@ extern "C" {
#include "desfire.h"
#include "iso14443b.h"
#include "Standalone/standalone.h"
#include "flashmem.h"
extern const uint8_t OddByteParity[256];
extern int rsamples; // = 0;
@ -240,6 +241,7 @@ extern void felica_sniff(uint32_t samples, uint32_t triggers);
extern void felica_sim_lite(uint64_t uid);
extern void felica_dump_lite_s();
#ifdef __cplusplus
}
#endif

View file

@ -190,4 +190,5 @@ void EXFLASH_TEST(void) {
Dbprintf("%s \r\n","TEST done!");
EXFLASH_Erase();
cmd_send(CMD_ACK, 1, 0, 0, 0,0);
}

View file

@ -461,6 +461,17 @@ char* pb(uint32_t b) {
int CmdAnalyseA(const char *Cmd){
UsbCommand c = {CMD_READ_FLASH_MEM, {0,0,0}};
clearCommandBuffer();
SendCommand(&c);
UsbCommand resp;
if ( !WaitForResponseTimeout(CMD_ACK, &resp, 2000) ) {
PrintAndLog("timeout while waiting for reply.");
return 1;
}
return 0;
printf("-- " _BLUE_(its my message) "\n");
printf("-- " _RED_(its my message) "\n");
printf("-- " _YELLOW_(its my message) "\n");
@ -482,6 +493,13 @@ int CmdAnalyseA(const char *Cmd){
shiftReg = shiftReg << 8 | rev;
printf("shiftreg after %08x | pattern %08x \n", shiftReg, SYNC_16BIT);
uint8_t n0 = 0, n1 = 0;
n0 = (rev & (uint8_t)(~(0xFF >> (8-4)))) >> 4;
n1 = (n1 << 4) | (rev & (uint8_t)(~(0xFF << 4)));
printf("rev %02X | %02X %s | %02X %s |\n", rev, n0, pb(n0), n1, pb(n1) );
/*
hex(0xb24d shr 0) 0xB24D 0b1011001001001101

View file

@ -762,6 +762,7 @@ int CmdBuffClear(const char *Cmd)
if (cmdp == 'h' || cmdp == 'H') return usage_data_buffclear();
UsbCommand c = {CMD_BUFF_CLEAR, {0,0,0}};
clearCommandBuffer();
SendCommand(&c);
ClearGraph(true);
return 0;