]>
cvs.zerfleddert.de Git - proxmark3-svn/blob - client/cmddata.c
b4752b1f107a8a1a75b8aaf3a08139dbc548ec17
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"
25 static int CmdHelp(const char *Cmd
);
27 int CmdAmp(const char *Cmd
)
29 int i
, rising
, falling
;
30 int max
= INT_MIN
, min
= INT_MAX
;
32 for (i
= 10; i
< GraphTraceLen
; ++i
) {
33 if (GraphBuffer
[i
] > max
)
35 if (GraphBuffer
[i
] < min
)
41 for (i
= 0; i
< GraphTraceLen
; ++i
) {
42 if (GraphBuffer
[i
+ 1] < GraphBuffer
[i
]) {
49 if (GraphBuffer
[i
+ 1] > GraphBuffer
[i
]) {
63 * Generic command to demodulate ASK.
65 * Argument is convention: positive or negative (High mod means zero
66 * or high mod means one)
68 * Updates the Graph trace with 0/1 values
73 int Cmdaskdemod(const char *Cmd
)
76 int c
, high
= 0, low
= 0;
78 sscanf(Cmd
, "%i", &c
);
80 if (c
!= 0 && c
!= 1) {
81 PrintAndLog("Invalid argument: %s", Cmd
);
85 /* Detect high and lows */
86 for (i
= 0; i
< GraphTraceLen
; ++i
)
88 if (GraphBuffer
[i
] > high
)
89 high
= GraphBuffer
[i
];
90 else if (GraphBuffer
[i
] < low
)
94 if (GraphBuffer
[0] > 0) {
99 for (i
= 1; i
< GraphTraceLen
; ++i
) {
100 /* Transitions are detected at each peak
101 * Transitions are either:
102 * - we're low: transition if we hit a high
103 * - we're high: transition if we hit a low
104 * (we need to do it this way because some tags keep high or
105 * low for long periods, others just reach the peak and go
108 if ((GraphBuffer
[i
] == high
) && (GraphBuffer
[i
- 1] == c
)) {
109 GraphBuffer
[i
] = 1 - c
;
110 } else if ((GraphBuffer
[i
] == low
) && (GraphBuffer
[i
- 1] == (1 - c
))){
114 GraphBuffer
[i
] = GraphBuffer
[i
- 1];
117 RepaintGraphWindow();
121 int CmdAutoCorr(const char *Cmd
)
123 static int CorrelBuffer
[MAX_GRAPH_TRACE_LEN
];
125 int window
= atoi(Cmd
);
128 PrintAndLog("needs a window");
131 if (window
>= GraphTraceLen
) {
132 PrintAndLog("window must be smaller than trace (%d samples)",
137 PrintAndLog("performing %d correlations", GraphTraceLen
- window
);
139 for (int i
= 0; i
< GraphTraceLen
- window
; ++i
) {
141 for (int j
= 0; j
< window
; ++j
) {
142 sum
+= (GraphBuffer
[j
]*GraphBuffer
[i
+ j
]) / 256;
144 CorrelBuffer
[i
] = sum
;
146 GraphTraceLen
= GraphTraceLen
- window
;
147 memcpy(GraphBuffer
, CorrelBuffer
, GraphTraceLen
* sizeof (int));
149 RepaintGraphWindow();
153 int CmdBitsamples(const char *Cmd
)
158 GetFromBigBuf(got
,sizeof(got
),0);
159 WaitForResponse(CMD_ACK
,NULL
);
161 for (int j
= 0; j
< sizeof(got
); j
++) {
162 for (int k
= 0; k
< 8; k
++) {
163 if(got
[j
] & (1 << (7 - k
))) {
164 GraphBuffer
[cnt
++] = 1;
166 GraphBuffer
[cnt
++] = 0;
171 RepaintGraphWindow();
176 * Convert to a bitstream
178 int CmdBitstream(const char *Cmd
)
186 int hithigh
, hitlow
, first
;
188 /* Detect high and lows and clock */
189 for (i
= 0; i
< GraphTraceLen
; ++i
)
191 if (GraphBuffer
[i
] > high
)
192 high
= GraphBuffer
[i
];
193 else if (GraphBuffer
[i
] < low
)
194 low
= GraphBuffer
[i
];
198 clock
= GetClock(Cmd
, high
, 1);
202 for (i
= 0; i
< (int)(gtl
/ clock
); ++i
)
207 /* Find out if we hit both high and low peaks */
208 for (j
= 0; j
< clock
; ++j
)
210 if (GraphBuffer
[(i
* clock
) + j
] == high
)
212 else if (GraphBuffer
[(i
* clock
) + j
] == low
)
214 /* it doesn't count if it's the first part of our read
215 because it's really just trailing from the last sequence */
216 if (first
&& (hithigh
|| hitlow
))
217 hithigh
= hitlow
= 0;
221 if (hithigh
&& hitlow
)
225 /* If we didn't hit both high and low peaks, we had a bit transition */
226 if (!hithigh
|| !hitlow
)
229 AppendGraph(0, clock
, bit
);
230 // for (j = 0; j < (int)(clock/2); j++)
231 // GraphBuffer[(i * clock) + j] = bit ^ 1;
232 // for (j = (int)(clock/2); j < clock; j++)
233 // GraphBuffer[(i * clock) + j] = bit;
236 RepaintGraphWindow();
240 int CmdBuffClear(const char *Cmd
)
242 UsbCommand c
= {CMD_BUFF_CLEAR
};
248 int CmdDec(const char *Cmd
)
250 for (int i
= 0; i
< (GraphTraceLen
/ 2); ++i
)
251 GraphBuffer
[i
] = GraphBuffer
[i
* 2];
253 PrintAndLog("decimated by 2");
254 RepaintGraphWindow();
258 /* Print our clock rate */
259 int CmdDetectClockRate(const char *Cmd
)
261 int clock
= DetectClock(0);
262 PrintAndLog("Auto-detected clock rate: %d", clock
);
266 int CmdFSKdemod(const char *Cmd
)
268 static const int LowTone
[] = {
269 1, 1, 1, 1, 1, -1, -1, -1, -1, -1,
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
275 static const int HighTone
[] = {
276 1, 1, 1, 1, 1, -1, -1, -1, -1,
277 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, -1,
284 int lowLen
= sizeof (LowTone
) / sizeof (int);
285 int highLen
= sizeof (HighTone
) / sizeof (int);
286 int convLen
= (highLen
> lowLen
) ? highLen
: lowLen
;
287 uint32_t hi
= 0, lo
= 0;
290 int minMark
= 0, maxMark
= 0;
292 for (i
= 0; i
< GraphTraceLen
- convLen
; ++i
) {
293 int lowSum
= 0, highSum
= 0;
295 for (j
= 0; j
< lowLen
; ++j
) {
296 lowSum
+= LowTone
[j
]*GraphBuffer
[i
+j
];
298 for (j
= 0; j
< highLen
; ++j
) {
299 highSum
+= HighTone
[j
] * GraphBuffer
[i
+ j
];
301 lowSum
= abs(100 * lowSum
/ lowLen
);
302 highSum
= abs(100 * highSum
/ highLen
);
303 GraphBuffer
[i
] = (highSum
<< 16) | lowSum
;
306 for(i
= 0; i
< GraphTraceLen
- convLen
- 16; ++i
) {
307 int lowTot
= 0, highTot
= 0;
308 // 10 and 8 are f_s divided by f_l and f_h, rounded
309 for (j
= 0; j
< 10; ++j
) {
310 lowTot
+= (GraphBuffer
[i
+j
] & 0xffff);
312 for (j
= 0; j
< 8; j
++) {
313 highTot
+= (GraphBuffer
[i
+ j
] >> 16);
315 GraphBuffer
[i
] = lowTot
- highTot
;
316 if (GraphBuffer
[i
] > maxMark
) maxMark
= GraphBuffer
[i
];
317 if (GraphBuffer
[i
] < minMark
) minMark
= GraphBuffer
[i
];
320 GraphTraceLen
-= (convLen
+ 16);
321 RepaintGraphWindow();
323 // Find bit-sync (3 lo followed by 3 high)
324 int max
= 0, maxPos
= 0;
325 for (i
= 0; i
< 6000; ++i
) {
327 for (j
= 0; j
< 3 * lowLen
; ++j
) {
328 dec
-= GraphBuffer
[i
+ j
];
330 for (; j
< 3 * (lowLen
+ highLen
); ++j
) {
331 dec
+= GraphBuffer
[i
+ j
];
339 // place start of bit sync marker in graph
340 GraphBuffer
[maxPos
] = maxMark
;
341 GraphBuffer
[maxPos
+ 1] = minMark
;
345 // place end of bit sync marker in graph
346 GraphBuffer
[maxPos
] = maxMark
;
347 GraphBuffer
[maxPos
+1] = minMark
;
349 PrintAndLog("actual data bits start at sample %d", maxPos
);
350 PrintAndLog("length %d/%d", highLen
, lowLen
);
353 bits
[sizeof(bits
)-1] = '\0';
355 // find bit pairs and manchester decode them
356 for (i
= 0; i
< arraylen(bits
) - 1; ++i
) {
358 for (j
= 0; j
< lowLen
; ++j
) {
359 dec
-= GraphBuffer
[maxPos
+ j
];
361 for (; j
< lowLen
+ highLen
; ++j
) {
362 dec
+= GraphBuffer
[maxPos
+ j
];
365 // place inter bit marker in graph
366 GraphBuffer
[maxPos
] = maxMark
;
367 GraphBuffer
[maxPos
+ 1] = minMark
;
369 // hi and lo form a 64 bit pair
370 hi
= (hi
<< 1) | (lo
>> 31);
372 // store decoded bit as binary (in hi/lo) and text (in bits[])
380 PrintAndLog("bits: '%s'", bits
);
381 PrintAndLog("hex: %08x %08x", hi
, lo
);
385 int CmdGrid(const char *Cmd
)
387 sscanf(Cmd
, "%i %i", &PlotGridX
, &PlotGridY
);
388 PlotGridXdefault
= PlotGridX
;
389 PlotGridYdefault
= PlotGridY
;
390 RepaintGraphWindow();
394 int CmdHexsamples(const char *Cmd
)
400 char* string_ptr
= string_buf
;
403 sscanf(Cmd
, "%i %i", &requested
, &offset
);
405 /* if no args send something */
406 if (requested
== 0) {
409 if (offset
+ requested
> sizeof(got
)) {
410 PrintAndLog("Tried to read past end of buffer, <bytes> + <offset> > 40000");
414 GetFromBigBuf(got
,requested
,offset
);
415 WaitForResponse(CMD_ACK
,NULL
);
418 for (j
= 0; j
< requested
; j
++) {
420 string_ptr
+= sprintf(string_ptr
, "%02x ", got
[j
]);
422 *(string_ptr
- 1) = '\0'; // remove the trailing space
423 PrintAndLog("%s", string_buf
);
424 string_buf
[0] = '\0';
425 string_ptr
= string_buf
;
428 if (j
== requested
- 1 && string_buf
[0] != '\0') { // print any remaining bytes
429 *(string_ptr
- 1) = '\0';
430 PrintAndLog("%s", string_buf
);
431 string_buf
[0] = '\0';
437 int CmdHide(const char *Cmd
)
443 int CmdHpf(const char *Cmd
)
448 for (i
= 10; i
< GraphTraceLen
; ++i
)
449 accum
+= GraphBuffer
[i
];
450 accum
/= (GraphTraceLen
- 10);
451 for (i
= 0; i
< GraphTraceLen
; ++i
)
452 GraphBuffer
[i
] -= accum
;
454 RepaintGraphWindow();
458 int CmdSamples(const char *Cmd
)
460 uint8_t got
[36440] = {0x00};
462 int n
= strtol(Cmd
, NULL
, 0);
468 PrintAndLog("Reading %d samples from device memory\n", n
);
469 GetFromBigBuf(got
,n
,3560);
470 WaitForResponse(CMD_ACK
,NULL
);
471 for (int j
= 0; j
< n
; ++j
) {
472 GraphBuffer
[j
] = ((int)got
[j
]) - 128;
475 RepaintGraphWindow();
478 int CmdTuneSamples(const char *Cmd
)
482 uint8_t got
[255] = {0x00};
484 PrintAndLog("Reading %d samples\n", n
);
485 GetFromBigBuf(got
,n
,7256); // armsrc/apps.h: #define FREE_BUFFER_OFFSET 7256
486 WaitForResponse(CMD_ACK
,NULL
);
487 for (int j
= 0; j
< n
; j
++) {
488 GraphBuffer
[cnt
++] = ((int)got
[j
]) - 128;
491 PrintAndLog("Done! Divisor 89 is 134khz, 95 is 125khz.\n");
493 RepaintGraphWindow();
498 int CmdLoad(const char *Cmd
)
500 char filename
[FILE_PATH_SIZE
] = {0x00};
504 if (len
> FILE_PATH_SIZE
) len
= FILE_PATH_SIZE
;
505 memcpy(filename
, Cmd
, len
);
507 FILE *f
= fopen(filename
, "r");
509 PrintAndLog("couldn't open '%s'", filename
);
515 while (fgets(line
, sizeof (line
), f
)) {
516 GraphBuffer
[GraphTraceLen
] = atoi(line
);
520 PrintAndLog("loaded %d samples", GraphTraceLen
);
521 RepaintGraphWindow();
525 int CmdLtrim(const char *Cmd
)
529 for (int i
= ds
; i
< GraphTraceLen
; ++i
)
530 GraphBuffer
[i
-ds
] = GraphBuffer
[i
];
533 RepaintGraphWindow();
538 * Manchester demodulate a bitstream. The bitstream needs to be already in
539 * the GraphBuffer as 0 and 1 values
541 * Give the clock rate as argument in order to help the sync - the algorithm
542 * resyncs at each pulse anyway.
544 * Not optimized by any means, this is the 1st time I'm writing this type of
545 * routine, feel free to improve...
547 * 1st argument: clock rate (as number of samples per clock rate)
548 * Typical values can be 64, 32, 128...
550 int CmdManchesterDemod(const char *Cmd
)
558 int hithigh
, hitlow
, first
;
564 /* check if we're inverting output */
567 PrintAndLog("Inverting output");
572 while(*Cmd
== ' '); // in case a 2nd argument was given
575 /* Holds the decoded bitstream: each clock period contains 2 bits */
576 /* later simplified to 1 bit after manchester decoding. */
577 /* Add 10 bits to allow for noisy / uncertain traces without aborting */
578 /* int BitStream[GraphTraceLen*2/clock+10]; */
580 /* But it does not work if compiling on WIndows: therefore we just allocate a */
582 uint8_t BitStream
[MAX_GRAPH_TRACE_LEN
] = {0x00};
584 /* Detect high and lows */
585 for (i
= 0; i
< GraphTraceLen
; i
++)
587 if (GraphBuffer
[i
] > high
)
588 high
= GraphBuffer
[i
];
589 else if (GraphBuffer
[i
] < low
)
590 low
= GraphBuffer
[i
];
594 clock
= GetClock(Cmd
, high
, 1);
595 int tolerance
= clock
/4;
597 /* Detect first transition */
598 /* Lo-Hi (arbitrary) */
599 /* skip to the first high */
600 for (i
= 0; i
< GraphTraceLen
; i
++)
601 if (GraphBuffer
[i
] == high
)
603 /* now look for the first low */
604 for (; i
< GraphTraceLen
; i
++)
606 if (GraphBuffer
[i
] == low
)
613 /* If we're not working with 1/0s, demod based off clock */
616 PrintAndLog("Entering path A");
617 bit
= 0; /* We assume the 1st bit is zero, it may not be
618 * the case: this routine (I think) has an init problem.
621 for (; i
< (int)(GraphTraceLen
/ clock
); i
++)
627 /* Find out if we hit both high and low peaks */
628 for (j
= 0; j
< clock
; j
++)
630 if (GraphBuffer
[(i
* clock
) + j
] == high
)
632 else if (GraphBuffer
[(i
* clock
) + j
] == low
)
635 /* it doesn't count if it's the first part of our read
636 because it's really just trailing from the last sequence */
637 if (first
&& (hithigh
|| hitlow
))
638 hithigh
= hitlow
= 0;
642 if (hithigh
&& hitlow
)
646 /* If we didn't hit both high and low peaks, we had a bit transition */
647 if (!hithigh
|| !hitlow
)
650 BitStream
[bit2idx
++] = bit
^ invert
;
654 /* standard 1/0 bitstream */
658 /* Then detect duration between 2 successive transitions */
659 for (bitidx
= 1; i
< GraphTraceLen
; i
++)
661 if (GraphBuffer
[i
-1] != GraphBuffer
[i
])
666 // Error check: if bitidx becomes too large, we do not
667 // have a Manchester encoded bitstream or the clock is really
669 if (bitidx
> (GraphTraceLen
*2/clock
+8) ) {
670 PrintAndLog("Error: the clock you gave is probably wrong, aborting.");
673 // Then switch depending on lc length:
674 // Tolerance is 1/4 of clock rate (arbitrary)
675 if (abs(lc
-clock
/2) < tolerance
) {
676 // Short pulse : either "1" or "0"
677 BitStream
[bitidx
++]=GraphBuffer
[i
-1];
678 } else if (abs(lc
-clock
) < tolerance
) {
679 // Long pulse: either "11" or "00"
680 BitStream
[bitidx
++]=GraphBuffer
[i
-1];
681 BitStream
[bitidx
++]=GraphBuffer
[i
-1];
685 PrintAndLog("Warning: Manchester decode error for pulse width detection.");
686 PrintAndLog("(too many of those messages mean either the stream is not Manchester encoded, or clock is wrong)");
690 PrintAndLog("Error: too many detection errors, aborting.");
697 // At this stage, we now have a bitstream of "01" ("1") or "10" ("0"), parse it into final decoded bitstream
698 // Actually, we overwrite BitStream with the new decoded bitstream, we just need to be careful
699 // to stop output at the final bitidx2 value, not bitidx
701 //http://www.proxmark.org/forum/viewtopic.php?id=403
702 for (i
= 1; i
< bitidx
; i
+= 2) {
703 if ((BitStream
[i
] == 0) && (BitStream
[i
+1] == 1)) {
704 BitStream
[bit2idx
++] = 1 ^ invert
;
705 } else if ((BitStream
[i
] == 1) && (BitStream
[i
+1] == 0)) {
706 BitStream
[bit2idx
++] = 0 ^ invert
;
708 // We cannot end up in this state, this means we are unsynchronized,
712 PrintAndLog("Unsynchronized, resync...");
713 PrintAndLog("(too many of those messages mean the stream is not Manchester encoded)");
717 PrintAndLog("Error: too many decode errors, aborting.");
724 PrintAndLog("Manchester decoded bitstream");
725 // Now output the bitstream to the scrollback by line of 16 bits
726 for (i
= 0; i
< (bit2idx
-16); i
+=16) {
727 PrintAndLog("%i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i",
748 /* Modulate our data into manchester */
749 int CmdManchesterMod(const char *Cmd
)
752 int bit
, lastbit
, wave
;
753 int clock
= GetClock(Cmd
, 0, 1);
754 int clock1
= GetT55x7Clock( GraphBuffer
, GraphTraceLen
, 0 );
755 PrintAndLog("MAN MOD CLOCKS: %d ice %d", clock
,clock1
);
757 int half
= (int)(clock
/2);
761 for (i
= 0; i
< (int)(GraphTraceLen
/ clock
); i
++)
763 bit
= GraphBuffer
[i
* clock
] ^ 1;
765 for (j
= 0; j
< half
; ++j
)
766 GraphBuffer
[(i
* clock
) + j
] = bit
^ lastbit
^ wave
;
767 for (j
= half
; j
< clock
; ++j
)
768 GraphBuffer
[(i
* clock
) + j
] = bit
^ lastbit
^ wave
^ 1;
770 /* Keep track of how we start our wave and if we changed or not this time */
771 wave
^= bit
^ lastbit
;
775 RepaintGraphWindow();
779 int CmdNorm(const char *Cmd
)
782 int max
= INT_MIN
, min
= INT_MAX
;
784 for (i
= 10; i
< GraphTraceLen
; ++i
) {
785 if (GraphBuffer
[i
] > max
)
786 max
= GraphBuffer
[i
];
787 if (GraphBuffer
[i
] < min
)
788 min
= GraphBuffer
[i
];
792 for (i
= 0; i
< GraphTraceLen
; ++i
) {
793 GraphBuffer
[i
] = (GraphBuffer
[i
] - ((max
+ min
) / 2)) * 1000 /
797 RepaintGraphWindow();
801 int CmdPlot(const char *Cmd
)
807 int CmdSave(const char *Cmd
)
809 char filename
[FILE_PATH_SIZE
] = {0x00};
813 if (len
> FILE_PATH_SIZE
) len
= FILE_PATH_SIZE
;
814 memcpy(filename
, Cmd
, len
);
817 FILE *f
= fopen(filename
, "w");
819 PrintAndLog("couldn't open '%s'", filename
);
823 for (i
= 0; i
< GraphTraceLen
; i
++) {
824 fprintf(f
, "%d\n", GraphBuffer
[i
]);
827 PrintAndLog("saved to '%s'", Cmd
);
831 int CmdScale(const char *Cmd
)
833 CursorScaleFactor
= atoi(Cmd
);
834 if (CursorScaleFactor
== 0) {
835 PrintAndLog("bad, can't have zero scale");
836 CursorScaleFactor
= 1;
838 RepaintGraphWindow();
842 int CmdThreshold(const char *Cmd
)
844 int threshold
= atoi(Cmd
);
846 for (int i
= 0; i
< GraphTraceLen
; ++i
) {
847 if (GraphBuffer
[i
] >= threshold
)
852 RepaintGraphWindow();
856 int CmdDirectionalThreshold(const char *Cmd
)
858 int8_t upThres
= param_get8(Cmd
, 0);
859 int8_t downThres
= param_get8(Cmd
, 1);
861 printf("Applying Up Threshold: %d, Down Threshold: %d\n", upThres
, downThres
);
863 int lastValue
= GraphBuffer
[0];
864 GraphBuffer
[0] = 0; // Will be changed at the end, but init 0 as we adjust to last samples value if no threshold kicks in.
866 for (int i
= 1; i
< GraphTraceLen
; ++i
) {
867 // Apply first threshold to samples heading up
868 if (GraphBuffer
[i
] >= upThres
&& GraphBuffer
[i
] > lastValue
)
870 lastValue
= GraphBuffer
[i
]; // Buffer last value as we overwrite it.
873 // Apply second threshold to samples heading down
874 else if (GraphBuffer
[i
] <= downThres
&& GraphBuffer
[i
] < lastValue
)
876 lastValue
= GraphBuffer
[i
]; // Buffer last value as we overwrite it.
881 lastValue
= GraphBuffer
[i
]; // Buffer last value as we overwrite it.
882 GraphBuffer
[i
] = GraphBuffer
[i
-1];
886 GraphBuffer
[0] = GraphBuffer
[1]; // Aline with first edited sample.
887 RepaintGraphWindow();
891 int CmdZerocrossings(const char *Cmd
)
893 // Zero-crossings aren't meaningful unless the signal is zero-mean.
900 for (int i
= 0; i
< GraphTraceLen
; ++i
) {
901 if (GraphBuffer
[i
] * sign
>= 0) {
902 // No change in sign, reproduce the previous sample count.
904 GraphBuffer
[i
] = lastZc
;
906 // Change in sign, reset the sample count.
908 GraphBuffer
[i
] = lastZc
;
916 RepaintGraphWindow();
920 static command_t CommandTable
[] =
922 {"help", CmdHelp
, 1, "This help"},
923 {"amp", CmdAmp
, 1, "Amplify peaks"},
924 {"askdemod", Cmdaskdemod
, 1, "<0|1> -- Attempt to demodulate simple ASK tags"},
925 {"autocorr", CmdAutoCorr
, 1, "<window length> -- Autocorrelation over window"},
926 {"bitsamples", CmdBitsamples
, 0, "Get raw samples as bitstring"},
927 {"bitstream", CmdBitstream
, 1, "[clock rate] -- Convert waveform into a bitstream"},
928 {"buffclear", CmdBuffClear
, 1, "Clear sample buffer and graph window"},
929 {"dec", CmdDec
, 1, "Decimate samples"},
930 {"detectclock", CmdDetectClockRate
, 1, "Detect clock rate"},
931 {"dirthreshold", CmdDirectionalThreshold
, 1, "<thres up> <thres down> -- Max rising higher up-thres/ Min falling lower down-thres, keep rest as prev."},
932 {"fskdemod", CmdFSKdemod
, 1, "Demodulate graph window as a HID FSK"},
933 {"grid", CmdGrid
, 1, "<x> <y> -- overlay grid on graph window, use zero value to turn off either"},
934 {"hexsamples", CmdHexsamples
, 0, "<bytes> [<offset>] -- Dump big buffer as hex bytes"},
935 {"hide", CmdHide
, 1, "Hide graph window"},
936 {"hpf", CmdHpf
, 1, "Remove DC offset from trace"},
937 {"load", CmdLoad
, 1, "<filename> -- Load trace (to graph window"},
938 {"ltrim", CmdLtrim
, 1, "<samples> -- Trim samples from left of trace"},
939 {"mandemod", CmdManchesterDemod
, 1, "[i] [clock rate] -- Manchester demodulate binary stream (option 'i' to invert output)"},
940 {"manmod", CmdManchesterMod
, 1, "[clock rate] -- Manchester modulate a binary stream"},
941 {"norm", CmdNorm
, 1, "Normalize max/min to +/-500"},
942 {"plot", CmdPlot
, 1, "Show graph window (hit 'h' in window for keystroke help)"},
943 {"samples", CmdSamples
, 0, "[512 - 40000] -- Get raw samples for graph window"},
944 {"save", CmdSave
, 1, "<filename> -- Save trace (from graph window)"},
945 {"scale", CmdScale
, 1, "<int> -- Set cursor display scale"},
946 {"threshold", CmdThreshold
, 1, "<threshold> -- Maximize/minimize every value in the graph window depending on threshold"},
947 {"tune", CmdTuneSamples
, 0, "Get hw tune samples for graph window"},
948 {"zerocrossings", CmdZerocrossings
, 1, "Count time between zero-crossings"},
949 {NULL
, NULL
, 0, NULL
}
952 int CmdData(const char *Cmd
)
954 CmdsParse(CommandTable
, Cmd
);
958 int CmdHelp(const char *Cmd
)
960 CmdsHelp(CommandTable
);