]> cvs.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/appmain.c
Andreas fix for LEGIC MIM1024
[proxmark3-svn] / armsrc / appmain.c
index 4321d9469afabb0f0bf52e755aeee8b7e8083ad3..b231cae1e27b1623eb734b886aed489efe5986e7 100644 (file)
@@ -76,6 +76,9 @@ void DbpString(char *str)
        UsbCommand c;\r
        c.cmd = CMD_DEBUG_PRINT_STRING;\r
        c.arg[0] = strlen(str);\r
        UsbCommand c;\r
        c.cmd = CMD_DEBUG_PRINT_STRING;\r
        c.arg[0] = strlen(str);\r
+       if(c.arg[0] > sizeof(c.d.asBytes)) {\r
+               c.arg[0] = sizeof(c.d.asBytes);\r
+       }\r
        memcpy(c.d.asBytes, str, c.arg[0]);\r
 \r
        UsbSendPacket((BYTE *)&c, sizeof(c));\r
        memcpy(c.d.asBytes, str, c.arg[0]);\r
 \r
        UsbSendPacket((BYTE *)&c, sizeof(c));\r
@@ -565,11 +568,14 @@ void ListenReaderField(int limit)
 void UsbPacketReceived(BYTE *packet, int len)\r
 {\r
        UsbCommand *c = (UsbCommand *)packet;\r
 void UsbPacketReceived(BYTE *packet, int len)\r
 {\r
        UsbCommand *c = (UsbCommand *)packet;\r
+       UsbCommand ack;\r
+       ack.cmd = CMD_ACK;\r
 \r
        switch(c->cmd) {\r
 #ifdef WITH_LF\r
                case CMD_ACQUIRE_RAW_ADC_SAMPLES_125K:\r
                        AcquireRawAdcSamples125k(c->arg[0]);\r
 \r
        switch(c->cmd) {\r
 #ifdef WITH_LF\r
                case CMD_ACQUIRE_RAW_ADC_SAMPLES_125K:\r
                        AcquireRawAdcSamples125k(c->arg[0]);\r
+                       UsbSendPacket((BYTE*)&ack, sizeof(ack));\r
                        break;\r
 #endif\r
 \r
                        break;\r
 #endif\r
 \r
@@ -596,8 +602,8 @@ void UsbPacketReceived(BYTE *packet, int len)
 #endif\r
 \r
                case CMD_READER_LEGIC_RF:\r
 #endif\r
 \r
                case CMD_READER_LEGIC_RF:\r
-                       LegicRfReader();\r
-                       break;\r
+                       LegicRfReader(c->arg[0], c->arg[1]);\r
+                       break;
 \r
 #ifdef WITH_ISO15693\r
                case CMD_SIMTAG_ISO_15693:\r
 \r
 #ifdef WITH_ISO15693\r
                case CMD_SIMTAG_ISO_15693:\r
@@ -716,11 +722,9 @@ void UsbPacketReceived(BYTE *packet, int len)
                }\r
 \r
                case CMD_DOWNLOADED_SIM_SAMPLES_125K: {\r
                }\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
                        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
                        UsbSendPacket((BYTE*)&ack, sizeof(ack));\r
                        break;\r
                }\r
Impressum, Datenschutz