X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/7381e8f2f285aad4ce3919fa1964638cc08c3899..ac86b656816e0368353921991e59226f38e5b698:/winsrc/command.cpp diff --git a/winsrc/command.cpp b/winsrc/command.cpp index 08feb3dd..061ea456 100644 --- a/winsrc/command.cpp +++ b/winsrc/command.cpp @@ -663,6 +663,15 @@ static void CmdLosim(char *str) SendCommand(&c, FALSE); } +static void CmdLosimBidir(char *str) +{ + UsbCommand c; + c.cmd = CMD_LF_SIMULATE_BIDIR; + c.ext1 = 47; /* Set ADC to twice the carrier for a slight supersampling */ + c.ext2 = 384; + SendCommand(&c, FALSE); +} + static void CmdLoread(char *str) { UsbCommand c; @@ -1799,6 +1808,40 @@ static void CmdNorm(char *str) RepaintGraphWindow(); } +static void CmdAmp(char *str) +{ + int i, rising, falling; + int max = INT_MIN, min = INT_MAX; + for(i = 10; i < GraphTraceLen; i++) { + if(GraphBuffer[i] > max) { + max = GraphBuffer[i]; + } + if(GraphBuffer[i] < min) { + min = GraphBuffer[i]; + } + } + if(max != min) { + rising= falling= 0; + for(i = 0; i < GraphTraceLen; i++) { + if(GraphBuffer[i+1] < GraphBuffer[i]) { + if(rising) { + GraphBuffer[i]= max; + rising= 0; + } + falling= 1; + } + if(GraphBuffer[i+1] > GraphBuffer[i]) { + if(falling) { + GraphBuffer[i]= min; + falling= 0; + } + rising= 1; + } + } + } + RepaintGraphWindow(); +} + static void CmdDec(char *str) { int i; @@ -2229,9 +2272,11 @@ static void Cmdaskdemod(char *str) { int c, high = 0, low = 0; // TODO: complain if we do not give 2 arguments here ! + // (AL - this doesn't make sense! we're only using one argument!!!) sscanf(str, "%i", &c); /* Detect high and lows and clock */ + // (AL - clock???) for (i = 0; i < GraphTraceLen; i++) { if (GraphBuffer[i] > high) @@ -2239,6 +2284,10 @@ static void Cmdaskdemod(char *str) { else if (GraphBuffer[i] < low) low = GraphBuffer[i]; } + if(c != 0 && c != 1) { + PrintToScrollback("Invalid argument: %s",str); + return; + } if (GraphBuffer[0] > 0) { GraphBuffer[0] = 1-c; @@ -2483,7 +2532,12 @@ static void Cmdmanchesterdemod(char *str) { /* Detect first transition */ /* Lo-Hi (arbitrary) */ - for (i = 0; i < GraphTraceLen; i++) + /* skip to the first high */ + for (i= 0; i < GraphTraceLen; i++) + if(GraphBuffer[i] == high) + break; + /* now look for the first low */ + for (; i < GraphTraceLen; i++) { if (GraphBuffer[i] == low) { @@ -2732,6 +2786,13 @@ static void CmdReadmem(char *str) SendCommand(&c, FALSE); } +static void CmdVersion(char *str) +{ + UsbCommand c; + c.cmd = CMD_VERSION; + SendCommand(&c, FALSE); +} + static void CmdLcdReset(char *str) { UsbCommand c; @@ -2778,7 +2839,8 @@ static struct { int offline; // 1 if the command can be used when in offline mode char *docString; } CommandTable[] = { - {"askdemod", Cmdaskdemod, 1, " <0|1> -- Attempt to demodulate simple ASK tags"}, + {"amp", CmdAmp, 1, "Amplify peaks"}, + {"askdemod", Cmdaskdemod, 1, "<0|1> -- Attempt to demodulate simple ASK tags"}, {"autocorr", CmdAutoCorr, 1, " -- Autocorrelation over window"}, {"bitsamples", CmdBitsamples, 0, "Get raw samples as bitstring"}, {"bitstream", Cmdbitstream, 1, "[clock rate] -- Convert waveform into a bitstream"}, @@ -2827,6 +2889,7 @@ static struct { {"loread", CmdLoread, 0, "['h'] -- Read 125/134 kHz LF ID-only tag (option 'h' for 134)"}, {"losamples", CmdLosamples, 0, "[128 - 16000] -- Get raw samples for LF tag"}, {"losim", CmdLosim, 0, "Simulate LF tag"}, + {"losimbidir", CmdLosimBidir, 0, "Simulate LF tag (with bidirectional data transmission between reader and tag)"}, {"ltrim", CmdLtrim, 1, " -- Trim samples from left of trace"}, {"mandemod", Cmdmanchesterdemod, 1, "[i] [clock rate] -- Manchester demodulate binary stream (option 'i' to invert output)"}, {"manmod", Cmdmanchestermod, 1, "[clock rate] -- Manchester modulate a binary stream"}, @@ -2845,6 +2908,7 @@ static struct { {"threshold", CmdThreshold, 1, "Maximize/minimize every value in the graph window depending on threshold"}, {"tune", CmdTune, 0, "Measure antenna tuning"}, {"vchdemod", CmdVchdemod, 0, "['clone'] -- Demodulate samples for VeriChip"}, + {"version", CmdVersion, 0, "Show version inforation about the connected Proxmark"}, {"zerocrossings", CmdZerocrossings, 1, "Count time between zero-crossings"}, };