]> cvs.zerfleddert.de Git - proxmark3-svn/commitdiff
CHG; a fix for "HF TUNE", I always were annoyed with the hf tune where it printed...
authoriceman1001 <iceman@iuse.se>
Sun, 6 Mar 2016 09:35:25 +0000 (10:35 +0100)
committericeman1001 <iceman@iuse.se>
Sun, 6 Mar 2016 09:35:25 +0000 (10:35 +0100)
armsrc/appmain.c
client/cmdhf.c
client/cmdmain.c
common/lfdemod.h

index cc074815e1718ae5ac51bba804110f8aeab233a8..e2a1888edfaad3b59e2f433d874b9e416969944f 100644 (file)
@@ -80,16 +80,31 @@ void ToSendStuffBit(int b) {
 // Debug print functions, to go out over USB, to the usual PC-side client.
 //=============================================================================
 
+void DbpStringEx(char *str, uint32_t cmd){
+       byte_t len = strlen(str);
+       cmd_send(CMD_DEBUG_PRINT_STRING,len, cmd,0,(byte_t*)str,len);
+}
+
 void DbpString(char *str) {
-  byte_t len = strlen(str);
-  cmd_send(CMD_DEBUG_PRINT_STRING,len,0,0,(byte_t*)str,len);
+       DbpStringEx(str, 0);
 }
 
 #if 0
 void DbpIntegers(int x1, int x2, int x3) {
-  cmd_send(CMD_DEBUG_PRINT_INTEGERS,x1,x2,x3,0,0);
+       cmd_send(CMD_DEBUG_PRINT_INTEGERS,x1,x2,x3,0,0);
 }
 #endif
+void DbprintfEx(uint32_t cmd, const char *fmt, ...) {
+       // should probably limit size here; oh well, let's just use a big buffer
+       char output_string[128] = {0x00};
+       va_list ap;
+
+       va_start(ap, fmt);
+       kvsprintf(fmt, output_string, 10, ap);
+       va_end(ap);
+
+       DbpStringEx(output_string, cmd);
+}
 
 void Dbprintf(const char *fmt, ...) {
        // should probably limit size here; oh well, let's just use a big buffer
@@ -229,23 +244,18 @@ void MeasureAntennaTuning(void) {
 
 void MeasureAntennaTuningHf(void) {
        int vHf = 0;    // in mV
-
-       DbpString("Measuring HF antenna, press button to exit");
-
        // Let the FPGA drive the high-frequency antenna around 13.56 MHz.
        FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
        FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR);
 
-       for (;;) {
+       while ( !BUTTON_PRESS() ){
                SpinDelay(20);
                vHf = (MAX_ADC_HF_VOLTAGE * AvgAdc(ADC_CHAN_HF)) >> 10;
-
-               Dbprintf("%d mV",vHf);
-               if (BUTTON_PRESS()) break;
+               //Dbprintf("%d mV",vHf);
+               DbprintfEx(CMD_MEASURE_ANTENNA_TUNING_HF, "%d mV",vHf);
        }
-       
-       DbpString("cancelled");
        FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
+       DbpString("cancelled");
 }
 
 
index be842a34dce40f0e60b280c45df43a664ad8e6e5..969510df264d9244a3ff9ac1176fd2312d202270 100644 (file)
@@ -31,9 +31,11 @@ static int CmdHelp(const char *Cmd);
 
 int CmdHFTune(const char *Cmd)
 {
-  UsbCommand c={CMD_MEASURE_ANTENNA_TUNING_HF};
-  SendCommand(&c);
-  return 0;
+       PrintAndLog("Measuring HF antenna, press button to exit");
+       UsbCommand c = {CMD_MEASURE_ANTENNA_TUNING_HF};
+       clearCommandBuffer();
+       SendCommand(&c);
+       return 0;
 }
 
 
@@ -644,6 +646,8 @@ int usage_hf_snoop(){
 
 int CmdHFList(const char *Cmd)
 {
+       clearCommandBuffer();
+               
        bool showWaitCycles = false;
        bool markCRCBytes = false;
        char type[10] = {0};
@@ -759,27 +763,27 @@ int CmdHFSnoop(const char *Cmd)
        int skiptriggers =  param_get32ex(Cmd, 1, 0, 10);
        
        UsbCommand c = {CMD_HF_SNIFFER, {skippairs,skiptriggers,0}};
+       clearCommandBuffer();
        SendCommand(&c);
        return 0;
 }
 
-static command_t CommandTable[] = 
-{
-  {"help",        CmdHelp,          1, "This help"},
-  {"14a",         CmdHF14A,         1, "{ ISO14443A RFIDs... }"},
-  {"14b",         CmdHF14B,         1, "{ ISO14443B RFIDs... }"},
-  {"15",          CmdHF15,          1, "{ ISO15693 RFIDs... }"},
-  {"epa",         CmdHFEPA,         1, "{ German Identification Card... }"},
-  {"legic",       CmdHFLegic,       0, "{ LEGIC RFIDs... }"},
-  {"iclass",      CmdHFiClass,      1, "{ ICLASS RFIDs... }"},
-  {"mf",               CmdHFMF,                1, "{ MIFARE RFIDs... }"},
-  {"mfu",         CmdHFMFUltra,     1, "{ MIFARE Ultralight RFIDs... }"},
-  {"mfdes",                    CmdHFMFDes,             1, "{ MIFARE Desfire RFIDs... }"},
-  {"topaz",                    CmdHFTopaz,             1, "{ TOPAZ (NFC Type 1) RFIDs... }"},
-  {"tune",                     CmdHFTune,      0, "Continuously measure HF antenna tuning"},
-  {"list",        CmdHFList,        1, "List protocol data in trace buffer"},
-  {"search",      CmdHFSearch,      1, "Search for known HF tags [preliminary]"},
-  {"snoop",       CmdHFSnoop,       0, "<samples to skip (10000)> <triggers to skip (1)> Generic LF/HF Snoop in Testing stage"},
+static command_t CommandTable[] = {
+       {"help",        CmdHelp,          1, "This help"},
+       {"14a",         CmdHF14A,         1, "{ ISO14443A RFIDs... }"},
+       {"14b",         CmdHF14B,         1, "{ ISO14443B RFIDs... }"},
+       {"15",          CmdHF15,          1, "{ ISO15693 RFIDs... }"},
+       {"epa",         CmdHFEPA,         1, "{ German Identification Card... }"},
+       {"legic",       CmdHFLegic,       0, "{ LEGIC RFIDs... }"},
+       {"iclass",      CmdHFiClass,      1, "{ ICLASS RFIDs... }"},
+       {"mf",          CmdHFMF,                  1, "{ MIFARE RFIDs... }"},
+       {"mfu",         CmdHFMFUltra,     1, "{ MIFARE Ultralight RFIDs... }"},
+       {"mfdes",               CmdHFMFDes,               1, "{ MIFARE Desfire RFIDs... }"},
+       {"topaz",               CmdHFTopaz,               1, "{ TOPAZ (NFC Type 1) RFIDs... }"},
+       {"tune",                CmdHFTune,            0, "Continuously measure HF antenna tuning"},
+       {"list",        CmdHFList,        1, "List protocol data in trace buffer"},
+       {"search",      CmdHFSearch,      1, "Search for known HF tags [preliminary]"},
+       {"snoop",       CmdHFSnoop,       0, "<samples to skip (10000)> <triggers to skip (1)> Generic LF/HF Snoop in Testing stage"},
        {NULL, NULL, 0, NULL}
 };
 
index 790a0c37f2e559317cce5e89207cf86094bfb2b6..583bafcaaade1b87573f0083dffc0a7dba1c6f12 100644 (file)
@@ -185,7 +185,15 @@ void UsbCommandReceived(UsbCommand *UC)
                        memset(s, 0x00, sizeof(s)); 
                        size_t len = MIN(UC->arg[0],USB_CMD_DATA_SIZE);
                        memcpy(s, UC->d.asBytes, len);
-                       PrintAndLog("#db# %s", s);
+                       
+                       // test
+                       if ( UC->arg[1] == CMD_MEASURE_ANTENNA_TUNING_HF) {
+                               printf("\r#db# %s", s);
+                               fflush(stdout);
+                       }
+                       else 
+                               PrintAndLog("#db# %s", s);
+                       
                        return;
                } break;
 
index d1a8e854dce951605886c2b2ead9b2797c140feb..56c758ae7b2879fc48b3fa1f85646929c1941e39 100644 (file)
@@ -13,8 +13,8 @@
 
 #ifndef LFDEMOD_H__
 #define LFDEMOD_H__
-#include <stdint.h>
-#include "common.h"  //for bool
+#include <stdint.h>  // for uint_32+
+#include <stdbool.h> // for bool
 
 //generic
 size_t   addParity(uint8_t *BitSource, uint8_t *dest, uint8_t sourceLen, uint8_t pLen, uint8_t pType);
@@ -55,5 +55,4 @@ int ParadoxdemodFSK(uint8_t *dest, size_t *size, uint32_t *hi2, uint32_t *hi, ui
 int PyramiddemodFSK(uint8_t *dest, size_t *size);
 int VikingDemod_AM(uint8_t *dest, size_t *size);
 int PrescoDemod(uint8_t *dest, size_t *size);
-
 #endif
Impressum, Datenschutz