]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/legicrfsim.c
Legic TagSim: increased reader timeout (#771)
[proxmark3-svn] / armsrc / legicrfsim.c
index 07a0a62db2b5ab905ca19f2d1dac85a9f0012f17..1411fbea6d85e7326127e4c5cc32da58863d6322 100644 (file)
@@ -19,6 +19,7 @@
 #include "legic_prng.h"
 #include "legic.h"
 #include "crc.h"
+#include "usb_cdc.h"  // for usb_poll_validate_length
 
 static uint8_t* legic_mem;      /* card memory, used for sim */
 static legic_card_select_t card;/* metadata of currently selected card */
@@ -50,7 +51,7 @@ static uint32_t last_frame_end; /* ts of last bit of previews rx or tx frame */
 #define RWD_TIME_PAUSE        4 /* 18.9us */
 #define RWD_TIME_1           21 /* RWD_TIME_PAUSE 18.9us off + 80.2us on = 99.1us */
 #define RWD_TIME_0           13 /* RWD_TIME_PAUSE 18.9us off + 42.4us on = 61.3us */
-#define RWD_CMD_TIMEOUT      40 /* 40 * 99.1us (arbitrary value) */
+#define RWD_CMD_TIMEOUT     120 /* 120 * 99.1us (arbitrary value) */
 #define RWD_MIN_FRAME_LEN     6 /* Shortest frame is 6 bits */
 #define RWD_MAX_FRAME_LEN    23 /* Longest frame is 23 bits */
 
@@ -283,7 +284,7 @@ static void init_tag() {
   SetAdcMuxFor(GPIO_MUXSEL_HIPKD);
 
   // configure SSC with defaults
-  FpgaSetupSsc();
+  FpgaSetupSsc(FPGA_MAJOR_MODE_HF_SIMULATOR);
 
   // first pull output to low to prevent glitches then re-claim GPIO_SSC_DOUT
   LOW(GPIO_SSC_DOUT);
@@ -439,7 +440,7 @@ void LegicRfSimulate(uint8_t cardtype) {
 
   LED_A_ON();
   DbpString("Starting Legic emulator, press button to end");
-  while(!BUTTON_PRESS()) {
+  while(!BUTTON_PRESS() && !usb_poll_validate_length()) {
     WDT_HIT();
 
     // wait for carrier, restart after timeout
Impressum, Datenschutz