]>
cvs.zerfleddert.de Git - proxmark3-svn/blob - client/cmddata.c
b34ed8e017e3b294a01b5b71267b5085e390420c
1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2010 iZsh <izsh at fail0verflow.com>
4 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
5 // at your option, any later version. See the LICENSE.txt file for the text of
7 //-----------------------------------------------------------------------------
8 // Data and Graph commands
9 //-----------------------------------------------------------------------------
15 #include "proxmark3.h"
19 #include "cmdparser.h"
24 static int CmdHelp(const char *Cmd
);
26 int CmdAmp(const char *Cmd
)
28 int i
, rising
, falling
;
29 int max
= INT_MIN
, min
= INT_MAX
;
31 for (i
= 10; i
< GraphTraceLen
; ++i
) {
32 if (GraphBuffer
[i
] > max
)
34 if (GraphBuffer
[i
] < min
)
40 for (i
= 0; i
< GraphTraceLen
; ++i
) {
41 if (GraphBuffer
[i
+ 1] < GraphBuffer
[i
]) {
48 if (GraphBuffer
[i
+ 1] > GraphBuffer
[i
]) {
62 * Generic command to demodulate ASK.
64 * Argument is convention: positive or negative (High mod means zero
65 * or high mod means one)
67 * Updates the Graph trace with 0/1 values
72 int Cmdaskdemod(const char *Cmd
)
75 int c
, high
= 0, low
= 0;
77 // TODO: complain if we do not give 2 arguments here !
78 // (AL - this doesn't make sense! we're only using one argument!!!)
79 sscanf(Cmd
, "%i", &c
);
81 /* Detect high and lows and clock */
83 for (i
= 0; i
< GraphTraceLen
; ++i
)
85 if (GraphBuffer
[i
] > high
)
86 high
= GraphBuffer
[i
];
87 else if (GraphBuffer
[i
] < low
)
90 if (c
!= 0 && c
!= 1) {
91 PrintAndLog("Invalid argument: %s", Cmd
);
95 if (GraphBuffer
[0] > 0) {
100 for (i
= 1; i
< GraphTraceLen
; ++i
) {
101 /* Transitions are detected at each peak
102 * Transitions are either:
103 * - we're low: transition if we hit a high
104 * - we're high: transition if we hit a low
105 * (we need to do it this way because some tags keep high or
106 * low for long periods, others just reach the peak and go
109 if ((GraphBuffer
[i
] == high
) && (GraphBuffer
[i
- 1] == c
)) {
110 GraphBuffer
[i
] = 1 - c
;
111 } else if ((GraphBuffer
[i
] == low
) && (GraphBuffer
[i
- 1] == (1 - c
))){
115 GraphBuffer
[i
] = GraphBuffer
[i
- 1];
118 RepaintGraphWindow();
122 int CmdAutoCorr(const char *Cmd
)
124 static int CorrelBuffer
[MAX_GRAPH_TRACE_LEN
];
126 int window
= atoi(Cmd
);
129 PrintAndLog("needs a window");
132 if (window
>= GraphTraceLen
) {
133 PrintAndLog("window must be smaller than trace (%d samples)",
138 PrintAndLog("performing %d correlations", GraphTraceLen
- window
);
140 for (int i
= 0; i
< GraphTraceLen
- window
; ++i
) {
142 for (int j
= 0; j
< window
; ++j
) {
143 sum
+= (GraphBuffer
[j
]*GraphBuffer
[i
+ j
]) / 256;
145 CorrelBuffer
[i
] = sum
;
147 GraphTraceLen
= GraphTraceLen
- window
;
148 memcpy(GraphBuffer
, CorrelBuffer
, GraphTraceLen
* sizeof (int));
150 RepaintGraphWindow();
154 int CmdBitsamples(const char *Cmd
)
159 GetFromBigBuf(got
,sizeof(got
),0);
160 WaitForResponse(CMD_ACK
,NULL
);
162 for (int j
= 0; j
< sizeof(got
); j
++) {
163 for (int k
= 0; k
< 8; k
++) {
164 if(got
[j
] & (1 << (7 - k
))) {
165 GraphBuffer
[cnt
++] = 1;
167 GraphBuffer
[cnt
++] = 0;
172 RepaintGraphWindow();
177 * Convert to a bitstream
179 int CmdBitstream(const char *Cmd
)
187 int hithigh
, hitlow
, first
;
189 /* Detect high and lows and clock */
190 for (i
= 0; i
< GraphTraceLen
; ++i
)
192 if (GraphBuffer
[i
] > high
)
193 high
= GraphBuffer
[i
];
194 else if (GraphBuffer
[i
] < low
)
195 low
= GraphBuffer
[i
];
199 clock
= GetClock(Cmd
, high
, 1);
203 for (i
= 0; i
< (int)(gtl
/ clock
); ++i
)
208 /* Find out if we hit both high and low peaks */
209 for (j
= 0; j
< clock
; ++j
)
211 if (GraphBuffer
[(i
* clock
) + j
] == high
)
213 else if (GraphBuffer
[(i
* clock
) + j
] == low
)
215 /* it doesn't count if it's the first part of our read
216 because it's really just trailing from the last sequence */
217 if (first
&& (hithigh
|| hitlow
))
218 hithigh
= hitlow
= 0;
222 if (hithigh
&& hitlow
)
226 /* If we didn't hit both high and low peaks, we had a bit transition */
227 if (!hithigh
|| !hitlow
)
230 AppendGraph(0, clock
, bit
);
231 // for (j = 0; j < (int)(clock/2); j++)
232 // GraphBuffer[(i * clock) + j] = bit ^ 1;
233 // for (j = (int)(clock/2); j < clock; j++)
234 // GraphBuffer[(i * clock) + j] = bit;
237 RepaintGraphWindow();
241 int CmdBuffClear(const char *Cmd
)
243 UsbCommand c
= {CMD_BUFF_CLEAR
};
249 int CmdDec(const char *Cmd
)
251 for (int i
= 0; i
< (GraphTraceLen
/ 2); ++i
)
252 GraphBuffer
[i
] = GraphBuffer
[i
* 2];
254 PrintAndLog("decimated by 2");
255 RepaintGraphWindow();
259 /* Print our clock rate */
260 int CmdDetectClockRate(const char *Cmd
)
262 int clock
= DetectClock(0);
263 PrintAndLog("Auto-detected clock rate: %d", clock
);
267 int CmdFSKdemod(const char *Cmd
)
269 static const int LowTone
[] = {
270 1, 1, 1, 1, 1, -1, -1, -1, -1, -1,
271 1, 1, 1, 1, 1, -1, -1, -1, -1, -1,
272 1, 1, 1, 1, 1, -1, -1, -1, -1, -1,
273 1, 1, 1, 1, 1, -1, -1, -1, -1, -1,
274 1, 1, 1, 1, 1, -1, -1, -1, -1, -1
276 static const int HighTone
[] = {
277 1, 1, 1, 1, 1, -1, -1, -1, -1,
278 1, 1, 1, 1, -1, -1, -1, -1,
279 1, 1, 1, 1, -1, -1, -1, -1,
280 1, 1, 1, 1, -1, -1, -1, -1,
281 1, 1, 1, 1, -1, -1, -1, -1,
282 1, 1, 1, 1, -1, -1, -1, -1, -1,
285 int lowLen
= sizeof (LowTone
) / sizeof (int);
286 int highLen
= sizeof (HighTone
) / sizeof (int);
287 int convLen
= (highLen
> lowLen
) ? highLen
: lowLen
;
288 uint32_t hi
= 0, lo
= 0;
291 int minMark
= 0, maxMark
= 0;
293 for (i
= 0; i
< GraphTraceLen
- convLen
; ++i
) {
294 int lowSum
= 0, highSum
= 0;
296 for (j
= 0; j
< lowLen
; ++j
) {
297 lowSum
+= LowTone
[j
]*GraphBuffer
[i
+j
];
299 for (j
= 0; j
< highLen
; ++j
) {
300 highSum
+= HighTone
[j
] * GraphBuffer
[i
+ j
];
302 lowSum
= abs(100 * lowSum
/ lowLen
);
303 highSum
= abs(100 * highSum
/ highLen
);
304 GraphBuffer
[i
] = (highSum
<< 16) | lowSum
;
307 for(i
= 0; i
< GraphTraceLen
- convLen
- 16; ++i
) {
308 int lowTot
= 0, highTot
= 0;
309 // 10 and 8 are f_s divided by f_l and f_h, rounded
310 for (j
= 0; j
< 10; ++j
) {
311 lowTot
+= (GraphBuffer
[i
+j
] & 0xffff);
313 for (j
= 0; j
< 8; j
++) {
314 highTot
+= (GraphBuffer
[i
+ j
] >> 16);
316 GraphBuffer
[i
] = lowTot
- highTot
;
317 if (GraphBuffer
[i
] > maxMark
) maxMark
= GraphBuffer
[i
];
318 if (GraphBuffer
[i
] < minMark
) minMark
= GraphBuffer
[i
];
321 GraphTraceLen
-= (convLen
+ 16);
322 RepaintGraphWindow();
324 // Find bit-sync (3 lo followed by 3 high)
325 int max
= 0, maxPos
= 0;
326 for (i
= 0; i
< 6000; ++i
) {
328 for (j
= 0; j
< 3 * lowLen
; ++j
) {
329 dec
-= GraphBuffer
[i
+ j
];
331 for (; j
< 3 * (lowLen
+ highLen
); ++j
) {
332 dec
+= GraphBuffer
[i
+ j
];
340 // place start of bit sync marker in graph
341 GraphBuffer
[maxPos
] = maxMark
;
342 GraphBuffer
[maxPos
+ 1] = minMark
;
346 // place end of bit sync marker in graph
347 GraphBuffer
[maxPos
] = maxMark
;
348 GraphBuffer
[maxPos
+1] = minMark
;
350 PrintAndLog("actual data bits start at sample %d", maxPos
);
351 PrintAndLog("length %d/%d", highLen
, lowLen
);
354 bits
[sizeof(bits
)-1] = '\0';
356 // find bit pairs and manchester decode them
357 for (i
= 0; i
< arraylen(bits
) - 1; ++i
) {
359 for (j
= 0; j
< lowLen
; ++j
) {
360 dec
-= GraphBuffer
[maxPos
+ j
];
362 for (; j
< lowLen
+ highLen
; ++j
) {
363 dec
+= GraphBuffer
[maxPos
+ j
];
366 // place inter bit marker in graph
367 GraphBuffer
[maxPos
] = maxMark
;
368 GraphBuffer
[maxPos
+ 1] = minMark
;
370 // hi and lo form a 64 bit pair
371 hi
= (hi
<< 1) | (lo
>> 31);
373 // store decoded bit as binary (in hi/lo) and text (in bits[])
381 PrintAndLog("bits: '%s'", bits
);
382 PrintAndLog("hex: %08x %08x", hi
, lo
);
386 int CmdGrid(const char *Cmd
)
388 sscanf(Cmd
, "%i %i", &PlotGridX
, &PlotGridY
);
389 PlotGridXdefault
= PlotGridX
;
390 PlotGridYdefault
= PlotGridY
;
391 RepaintGraphWindow();
395 int CmdHexsamples(const char *Cmd
)
401 char* string_ptr
= string_buf
;
404 sscanf(Cmd
, "%i %i", &requested
, &offset
);
406 /* if no args send something */
407 if (requested
== 0) {
410 if (offset
+ requested
> sizeof(got
)) {
411 PrintAndLog("Tried to read past end of buffer, <bytes> + <offset> > 40000");
415 GetFromBigBuf(got
,requested
,offset
);
416 WaitForResponse(CMD_ACK
,NULL
);
419 for (j
= 0; j
< requested
; j
++) {
421 string_ptr
+= sprintf(string_ptr
, "%02x ", got
[j
]);
423 *(string_ptr
- 1) = '\0'; // remove the trailing space
424 PrintAndLog("%s", string_buf
);
425 string_buf
[0] = '\0';
426 string_ptr
= string_buf
;
429 if (j
== requested
- 1 && string_buf
[0] != '\0') { // print any remaining bytes
430 *(string_ptr
- 1) = '\0';
431 PrintAndLog("%s", string_buf
);
432 string_buf
[0] = '\0';
438 int CmdHide(const char *Cmd
)
444 int CmdHpf(const char *Cmd
)
449 for (i
= 10; i
< GraphTraceLen
; ++i
)
450 accum
+= GraphBuffer
[i
];
451 accum
/= (GraphTraceLen
- 10);
452 for (i
= 0; i
< GraphTraceLen
; ++i
)
453 GraphBuffer
[i
] -= accum
;
455 RepaintGraphWindow();
459 int CmdSamples(const char *Cmd
)
465 n
= strtol(Cmd
, NULL
, 0);
467 if (n
> sizeof(got
)) n
= sizeof(got
);
469 PrintAndLog("Reading %d samples\n", n
);
470 GetFromBigBuf(got
,n
,0);
471 WaitForResponse(CMD_ACK
,NULL
);
472 for (int j
= 0; j
< n
; j
++) {
473 GraphBuffer
[cnt
++] = ((int)got
[j
]) - 128;
476 PrintAndLog("Done!\n");
478 RepaintGraphWindow();
482 int CmdTuneSamples(const char *Cmd
)
488 PrintAndLog("Reading %d samples\n", n
);
489 GetFromBigBuf(got
,n
,7256); // armsrc/apps.h: #define FREE_BUFFER_OFFSET 7256
490 WaitForResponse(CMD_ACK
,NULL
);
491 for (int j
= 0; j
< n
; j
++) {
492 GraphBuffer
[cnt
++] = ((int)got
[j
]) - 128;
495 PrintAndLog("Done! Divisor 89 is 134khz, 95 is 125khz.\n");
498 RepaintGraphWindow();
502 int CmdLoad(const char *Cmd
)
504 FILE *f
= fopen(Cmd
, "r");
506 PrintAndLog("couldn't open '%s'", Cmd
);
512 while (fgets(line
, sizeof (line
), f
)) {
513 GraphBuffer
[GraphTraceLen
] = atoi(line
);
517 PrintAndLog("loaded %d samples", GraphTraceLen
);
518 RepaintGraphWindow();
522 int CmdLtrim(const char *Cmd
)
526 for (int i
= ds
; i
< GraphTraceLen
; ++i
)
527 GraphBuffer
[i
-ds
] = GraphBuffer
[i
];
530 RepaintGraphWindow();
535 * Manchester demodulate a bitstream. The bitstream needs to be already in
536 * the GraphBuffer as 0 and 1 values
538 * Give the clock rate as argument in order to help the sync - the algorithm
539 * resyncs at each pulse anyway.
541 * Not optimized by any means, this is the 1st time I'm writing this type of
542 * routine, feel free to improve...
544 * 1st argument: clock rate (as number of samples per clock rate)
545 * Typical values can be 64, 32, 128...
547 int CmdManchesterDemod(const char *Cmd
)
555 int hithigh
, hitlow
, first
;
561 /* check if we're inverting output */
564 PrintAndLog("Inverting output");
569 while(*Cmd
== ' '); // in case a 2nd argument was given
572 /* Holds the decoded bitstream: each clock period contains 2 bits */
573 /* later simplified to 1 bit after manchester decoding. */
574 /* Add 10 bits to allow for noisy / uncertain traces without aborting */
575 /* int BitStream[GraphTraceLen*2/clock+10]; */
577 /* But it does not work if compiling on WIndows: therefore we just allocate a */
579 uint8_t BitStream
[MAX_GRAPH_TRACE_LEN
] = {0};
581 /* Detect high and lows */
582 for (i
= 0; i
< GraphTraceLen
; i
++)
584 if (GraphBuffer
[i
] > high
)
585 high
= GraphBuffer
[i
];
586 else if (GraphBuffer
[i
] < low
)
587 low
= GraphBuffer
[i
];
591 clock
= GetClock(Cmd
, high
, 1);
593 int tolerance
= clock
/4;
595 /* Detect first transition */
596 /* Lo-Hi (arbitrary) */
597 /* skip to the first high */
598 for (i
= 0; i
< GraphTraceLen
; i
++)
599 if (GraphBuffer
[i
] == high
)
601 /* now look for the first low */
602 for (; i
< GraphTraceLen
; i
++)
604 if (GraphBuffer
[i
] == low
)
611 /* If we're not working with 1/0s, demod based off clock */
614 bit
= 0; /* We assume the 1st bit is zero, it may not be
615 * the case: this routine (I think) has an init problem.
618 for (; i
< (int)(GraphTraceLen
/ clock
); i
++)
624 /* Find out if we hit both high and low peaks */
625 for (j
= 0; j
< clock
; j
++)
627 if (GraphBuffer
[(i
* clock
) + j
] == high
)
629 else if (GraphBuffer
[(i
* clock
) + j
] == low
)
632 /* it doesn't count if it's the first part of our read
633 because it's really just trailing from the last sequence */
634 if (first
&& (hithigh
|| hitlow
))
635 hithigh
= hitlow
= 0;
639 if (hithigh
&& hitlow
)
643 /* If we didn't hit both high and low peaks, we had a bit transition */
644 if (!hithigh
|| !hitlow
)
647 BitStream
[bit2idx
++] = bit
^ invert
;
651 /* standard 1/0 bitstream */
655 /* Then detect duration between 2 successive transitions */
656 for (bitidx
= 1; i
< GraphTraceLen
; i
++)
658 if (GraphBuffer
[i
-1] != GraphBuffer
[i
])
663 // Error check: if bitidx becomes too large, we do not
664 // have a Manchester encoded bitstream or the clock is really
666 if (bitidx
> (GraphTraceLen
*2/clock
+8) ) {
667 PrintAndLog("Error: the clock you gave is probably wrong, aborting.");
670 // Then switch depending on lc length:
671 // Tolerance is 1/4 of clock rate (arbitrary)
672 if (abs(lc
-clock
/2) < tolerance
) {
673 // Short pulse : either "1" or "0"
674 BitStream
[bitidx
++]=GraphBuffer
[i
-1];
675 } else if (abs(lc
-clock
) < tolerance
) {
676 // Long pulse: either "11" or "00"
677 BitStream
[bitidx
++]=GraphBuffer
[i
-1];
678 BitStream
[bitidx
++]=GraphBuffer
[i
-1];
682 PrintAndLog("Warning: Manchester decode error for pulse width detection.");
683 PrintAndLog("(too many of those messages mean either the stream is not Manchester encoded, or clock is wrong)");
687 PrintAndLog("Error: too many detection errors, aborting.");
694 // At this stage, we now have a bitstream of "01" ("1") or "10" ("0"), parse it into final decoded bitstream
695 // Actually, we overwrite BitStream with the new decoded bitstream, we just need to be careful
696 // to stop output at the final bitidx2 value, not bitidx
697 for (i
= 0; i
< bitidx
; i
+= 2) {
698 if ((BitStream
[i
] == 0) && (BitStream
[i
+1] == 1)) {
699 BitStream
[bit2idx
++] = 1 ^ invert
;
700 } else if ((BitStream
[i
] == 1) && (BitStream
[i
+1] == 0)) {
701 BitStream
[bit2idx
++] = 0 ^ invert
;
703 // We cannot end up in this state, this means we are unsynchronized,
707 PrintAndLog("Unsynchronized, resync...");
708 PrintAndLog("(too many of those messages mean the stream is not Manchester encoded)");
712 PrintAndLog("Error: too many decode errors, aborting.");
719 PrintAndLog("Manchester decoded bitstream");
720 // Now output the bitstream to the scrollback by line of 16 bits
721 for (i
= 0; i
< (bit2idx
-16); i
+=16) {
722 PrintAndLog("%i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i",
743 /* Modulate our data into manchester */
744 int CmdManchesterMod(const char *Cmd
)
748 int bit
, lastbit
, wave
;
751 clock
= GetClock(Cmd
, 0, 1);
755 for (i
= 0; i
< (int)(GraphTraceLen
/ clock
); i
++)
757 bit
= GraphBuffer
[i
* clock
] ^ 1;
759 for (j
= 0; j
< (int)(clock
/2); j
++)
760 GraphBuffer
[(i
* clock
) + j
] = bit
^ lastbit
^ wave
;
761 for (j
= (int)(clock
/2); j
< clock
; j
++)
762 GraphBuffer
[(i
* clock
) + j
] = bit
^ lastbit
^ wave
^ 1;
764 /* Keep track of how we start our wave and if we changed or not this time */
765 wave
^= bit
^ lastbit
;
769 RepaintGraphWindow();
773 int CmdNorm(const char *Cmd
)
776 int max
= INT_MIN
, min
= INT_MAX
;
778 for (i
= 10; i
< GraphTraceLen
; ++i
) {
779 if (GraphBuffer
[i
] > max
)
780 max
= GraphBuffer
[i
];
781 if (GraphBuffer
[i
] < min
)
782 min
= GraphBuffer
[i
];
786 for (i
= 0; i
< GraphTraceLen
; ++i
) {
787 GraphBuffer
[i
] = (GraphBuffer
[i
] - ((max
+ min
) / 2)) * 1000 /
791 RepaintGraphWindow();
795 int CmdPlot(const char *Cmd
)
801 int CmdSave(const char *Cmd
)
803 FILE *f
= fopen(Cmd
, "w");
805 PrintAndLog("couldn't open '%s'", Cmd
);
809 for (i
= 0; i
< GraphTraceLen
; i
++) {
810 fprintf(f
, "%d\n", GraphBuffer
[i
]);
813 PrintAndLog("saved to '%s'", Cmd
);
817 int CmdScale(const char *Cmd
)
819 CursorScaleFactor
= atoi(Cmd
);
820 if (CursorScaleFactor
== 0) {
821 PrintAndLog("bad, can't have zero scale");
822 CursorScaleFactor
= 1;
824 RepaintGraphWindow();
828 int CmdThreshold(const char *Cmd
)
830 int threshold
= atoi(Cmd
);
832 for (int i
= 0; i
< GraphTraceLen
; ++i
) {
833 if (GraphBuffer
[i
] >= threshold
)
838 RepaintGraphWindow();
842 int CmdDirectionalThreshold(const char *Cmd
)
844 int8_t upThres
= param_get8(Cmd
, 0);
845 int8_t downThres
= param_get8(Cmd
, 1);
847 printf("Applying Up Threshold: %d, Down Threshold: %d\n", upThres
, downThres
);
849 int lastValue
= GraphBuffer
[0];
850 GraphBuffer
[0] = 0; // Will be changed at the end, but init 0 as we adjust to last samples value if no threshold kicks in.
852 for (int i
= 1; i
< GraphTraceLen
; ++i
) {
853 // Apply first threshold to samples heading up
854 if (GraphBuffer
[i
] >= upThres
&& GraphBuffer
[i
] > lastValue
)
856 lastValue
= GraphBuffer
[i
]; // Buffer last value as we overwrite it.
859 // Apply second threshold to samples heading down
860 else if (GraphBuffer
[i
] <= downThres
&& GraphBuffer
[i
] < lastValue
)
862 lastValue
= GraphBuffer
[i
]; // Buffer last value as we overwrite it.
867 lastValue
= GraphBuffer
[i
]; // Buffer last value as we overwrite it.
868 GraphBuffer
[i
] = GraphBuffer
[i
-1];
872 GraphBuffer
[0] = GraphBuffer
[1]; // Aline with first edited sample.
873 RepaintGraphWindow();
877 int CmdZerocrossings(const char *Cmd
)
879 // Zero-crossings aren't meaningful unless the signal is zero-mean.
886 for (int i
= 0; i
< GraphTraceLen
; ++i
) {
887 if (GraphBuffer
[i
] * sign
>= 0) {
888 // No change in sign, reproduce the previous sample count.
890 GraphBuffer
[i
] = lastZc
;
892 // Change in sign, reset the sample count.
894 GraphBuffer
[i
] = lastZc
;
902 RepaintGraphWindow();
906 static command_t CommandTable
[] =
908 {"help", CmdHelp
, 1, "This help"},
909 {"amp", CmdAmp
, 1, "Amplify peaks"},
910 {"askdemod", Cmdaskdemod
, 1, "<0 or 1> -- Attempt to demodulate simple ASK tags"},
911 {"autocorr", CmdAutoCorr
, 1, "<window length> -- Autocorrelation over window"},
912 {"bitsamples", CmdBitsamples
, 0, "Get raw samples as bitstring"},
913 {"bitstream", CmdBitstream
, 1, "[clock rate] -- Convert waveform into a bitstream"},
914 {"buffclear", CmdBuffClear
, 1, "Clear sample buffer and graph window"},
915 {"dec", CmdDec
, 1, "Decimate samples"},
916 {"detectclock", CmdDetectClockRate
, 1, "Detect clock rate"},
917 {"fskdemod", CmdFSKdemod
, 1, "Demodulate graph window as a HID FSK"},
918 {"grid", CmdGrid
, 1, "<x> <y> -- overlay grid on graph window, use zero value to turn off either"},
919 {"hexsamples", CmdHexsamples
, 0, "<bytes> [<offset>] -- Dump big buffer as hex bytes"},
920 {"hide", CmdHide
, 1, "Hide graph window"},
921 {"hpf", CmdHpf
, 1, "Remove DC offset from trace"},
922 {"load", CmdLoad
, 1, "<filename> -- Load trace (to graph window"},
923 {"ltrim", CmdLtrim
, 1, "<samples> -- Trim samples from left of trace"},
924 {"mandemod", CmdManchesterDemod
, 1, "[i] [clock rate] -- Manchester demodulate binary stream (option 'i' to invert output)"},
925 {"manmod", CmdManchesterMod
, 1, "[clock rate] -- Manchester modulate a binary stream"},
926 {"norm", CmdNorm
, 1, "Normalize max/min to +/-500"},
927 {"plot", CmdPlot
, 1, "Show graph window (hit 'h' in window for keystroke help)"},
928 {"samples", CmdSamples
, 0, "[512 - 40000] -- Get raw samples for graph window"},
929 {"tune", CmdTuneSamples
, 0, "Get hw tune samples for graph window"},
930 {"save", CmdSave
, 1, "<filename> -- Save trace (from graph window)"},
931 {"scale", CmdScale
, 1, "<int> -- Set cursor display scale"},
932 {"threshold", CmdThreshold
, 1, "<threshold> -- Maximize/minimize every value in the graph window depending on threshold"},
933 {"zerocrossings", CmdZerocrossings
, 1, "Count time between zero-crossings"},
934 {"dirthreshold", CmdDirectionalThreshold
, 1, "<thres up> <thres down> -- Max rising higher up-thres/ Min falling lower down-thres, keep rest as prev."},
935 {NULL
, NULL
, 0, NULL
}
938 int CmdData(const char *Cmd
)
940 CmdsParse(CommandTable
, Cmd
);
944 int CmdHelp(const char *Cmd
)
946 CmdsHelp(CommandTable
);