Advertisement
Guest User

Untitled

a guest
Nov 30th, 2014
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. From 08c902abfc4384a4de443daa3610928a12ad1007 Mon Sep 17 00:00:00 2001
  2. From: Enio <enioarda@gmail.com>
  3. Date: Sun, 30 Nov 2014 15:07:28 +0100
  4. Subject: [PATCH] Added "data tune" command to collect tuning samples from
  5. FREE_BUFFER_OFFSET to show with "data plot".
  6.  
  7. ---
  8. armsrc/appmain.c | 2 +-
  9. client/cmddata.c | 21 +++++++++++++++++++++
  10. client/cmddata.h | 1 +
  11. 3 files changed, 23 insertions(+), 1 deletion(-)
  12.  
  13. diff --git a/armsrc/appmain.c b/armsrc/appmain.c
  14. index a3f507d..8f676c8 100644
  15. --- a/armsrc/appmain.c
  16. +++ b/armsrc/appmain.c
  17. @@ -203,7 +203,7 @@ void MeasureAntennaTuning(void)
  18.  
  19. LED_B_ON();
  20. DbpString("Measuring antenna characteristics, please wait...");
  21. - memset(dest,0,sizeof(FREE_BUFFER_SIZE));
  22. + memset(dest,0,FREE_BUFFER_SIZE);
  23.  
  24. /*
  25. * Sweeps the useful LF range of the proxmark from
  26. diff --git a/client/cmddata.c b/client/cmddata.c
  27. index 7d9ec1b..beb7bbe 100644
  28. --- a/client/cmddata.c
  29. +++ b/client/cmddata.c
  30. @@ -479,6 +479,26 @@ int CmdSamples(const char *Cmd)
  31. return 0;
  32. }
  33.  
  34. +int CmdTuneSamples(const char *Cmd)
  35. +{
  36. + int cnt = 0;
  37. + int n = 255;
  38. + uint8_t got[255];
  39. +
  40. + PrintAndLog("Reading %d samples\n", n);
  41. + GetFromBigBuf(got,n,7256); // armsrc/apps.h: #define FREE_BUFFER_OFFSET 7256
  42. + WaitForResponse(CMD_ACK,NULL);
  43. + for (int j = 0; j < n; j++) {
  44. + GraphBuffer[cnt++] = ((int)got[j]) - 128;
  45. + }
  46. +
  47. + PrintAndLog("Done! Divisor 89 is 134khz, 95 is 125khz.\n");
  48. + PrintAndLog("\n");
  49. + GraphTraceLen = n;
  50. + RepaintGraphWindow();
  51. + return 0;
  52. +}
  53. +
  54. int CmdLoad(const char *Cmd)
  55. {
  56. FILE *f = fopen(Cmd, "r");
  57. @@ -906,6 +926,7 @@ static command_t CommandTable[] =
  58. {"norm", CmdNorm, 1, "Normalize max/min to +/-500"},
  59. {"plot", CmdPlot, 1, "Show graph window (hit 'h' in window for keystroke help)"},
  60. {"samples", CmdSamples, 0, "[512 - 40000] -- Get raw samples for graph window"},
  61. + {"tune", CmdTuneSamples, 0, "Get hw tune samples for graph window"},
  62. {"save", CmdSave, 1, "<filename> -- Save trace (from graph window)"},
  63. {"scale", CmdScale, 1, "<int> -- Set cursor display scale"},
  64. {"threshold", CmdThreshold, 1, "<threshold> -- Maximize/minimize every value in the graph window depending on threshold"},
  65. diff --git a/client/cmddata.h b/client/cmddata.h
  66. index 716c9c3..8dcefc3 100644
  67. --- a/client/cmddata.h
  68. +++ b/client/cmddata.h
  69. @@ -35,6 +35,7 @@ int CmdManchesterMod(const char *Cmd);
  70. int CmdNorm(const char *Cmd);
  71. int CmdPlot(const char *Cmd);
  72. int CmdSamples(const char *Cmd);
  73. +int CmdTuneSamples(const char *Cmd);
  74. int CmdSave(const char *Cmd);
  75. int CmdScale(const char *Cmd);
  76. int CmdThreshold(const char *Cmd);
  77. --
  78. 2.1.3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement