]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
fix USB send data timing issue in CMD_DOWNLOADED_SIM_SAMPLES_125K
authoradam@algroup.co.uk <adam@algroup.co.uk@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Fri, 29 Jan 2010 09:28:47 +0000 (09:28 +0000)
committeradam@algroup.co.uk <adam@algroup.co.uk@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Fri, 29 Jan 2010 09:28:47 +0000 (09:28 +0000)
armsrc/appmain.c
client/command.c

index 674c891741e62e5abdaf17fa61eaf20f663b33bc..4321d9469afabb0f0bf52e755aeee8b7e8083ad3 100644 (file)
@@ -716,9 +716,12 @@ void UsbPacketReceived(BYTE *packet, int len)
                }\r
 \r
                case CMD_DOWNLOADED_SIM_SAMPLES_125K: {\r
+                       UsbCommand ack;\r
                        BYTE *b = (BYTE *)BigBuf;\r
                        memcpy(b+c->arg[0], c->d.asBytes, 48);\r
                        //Dbprintf("copied 48 bytes to %i",b+c->arg[0]);\r
+                       ack.cmd = CMD_ACK;\r
+                       UsbSendPacket((BYTE*)&ack, sizeof(ack));\r
                        break;\r
                }\r
 \r
index 8ecbc6847d0119fd9aa5f09ee579c02796f29c03..0d954258c0a8511c47183e02ca7c37753b04daef 100644 (file)
@@ -688,6 +688,7 @@ static void CmdLosim(char *str)
        /* convert to bitstream if necessary */\r
        ChkBitstream(str);\r
 \r
+       PrintToScrollback("Sending data, please wait...");\r
        for (i = 0; i < GraphTraceLen; i += 48) {\r
                UsbCommand c={CMD_DOWNLOADED_SIM_SAMPLES_125K, {i, 0, 0}};\r
                int j;\r
@@ -695,8 +696,10 @@ static void CmdLosim(char *str)
                        c.d.asBytes[j] = GraphBuffer[i+j];\r
                }\r
                SendCommand(&c);\r
+               wait_for_response(CMD_ACK);\r
        }\r
 \r
+       PrintToScrollback("Starting simulator...");\r
        UsbCommand c={CMD_SIMULATE_TAG_125K, {GraphTraceLen, gap, 0}};\r
        SendCommand(&c);\r
 }\r
@@ -3063,14 +3066,19 @@ void UsbCommandReceived(UsbCommand *c)
        /* Maybe it's a response: */\r
        switch(current_command) {\r
                case CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K:\r
-               if (c->cmd != CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K) goto unexpected_response;\r
-               int i;\r
-               for(i=0; i<48; i++) sample_buf[i] = c->d.asBytes[i];\r
-               received_command = c->cmd;\r
-               return;\r
-       default:\r
-       unexpected_response:\r
-               PrintToScrollback("unrecognized command %08x\n", c->cmd);\r
-               break;\r
+                       if (c->cmd != CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K) goto unexpected_response;\r
+                       int i;\r
+                       for(i=0; i<48; i++) sample_buf[i] = c->d.asBytes[i];\r
+                       received_command = c->cmd;\r
+                       return;\r
+               case CMD_DOWNLOADED_SIM_SAMPLES_125K:\r
+                       if (c->cmd != CMD_ACK) goto unexpected_response;\r
+                       // got ACK\r
+                       received_command = c->cmd;\r
+                       return;\r
+               default:\r
+               unexpected_response:\r
+                       PrintToScrollback("unrecognized command %08x\n", c->cmd);\r
+                       break;\r
        }\r
 }\r
Impressum, Datenschutz