X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/815f3f255960c429f62435cc7506ff597385b2cf..5a956258d3d8416f1cd2259319eae784d008a46b:/armsrc/appmain.c diff --git a/armsrc/appmain.c b/armsrc/appmain.c index a14d8fb8..b231cae1 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -26,7 +26,7 @@ int kvsprintf(char const *fmt, void *arg, int radix, va_list ap); // is the order in which they go out on the wire. //============================================================================= -BYTE ToSend[256]; +BYTE ToSend[512]; int ToSendMax; static int ToSendBit; struct common_area common_area __attribute__((section(".commonarea"))); @@ -34,7 +34,7 @@ struct common_area common_area __attribute__((section(".commonarea"))); void BufferClear(void) { memset(BigBuf,0,sizeof(BigBuf)); - DbpString("Buffer cleared"); + Dbprintf("Buffer cleared (%i bytes)",sizeof(BigBuf)); } void ToSendReset(void) @@ -76,6 +76,9 @@ void DbpString(char *str) UsbCommand c; c.cmd = CMD_DEBUG_PRINT_STRING; c.arg[0] = strlen(str); + if(c.arg[0] > sizeof(c.d.asBytes)) { + c.arg[0] = sizeof(c.d.asBytes); + } memcpy(c.d.asBytes, str, c.arg[0]); UsbSendPacket((BYTE *)&c, sizeof(c)); @@ -565,11 +568,14 @@ void ListenReaderField(int limit) void UsbPacketReceived(BYTE *packet, int len) { UsbCommand *c = (UsbCommand *)packet; + UsbCommand ack; + ack.cmd = CMD_ACK; switch(c->cmd) { #ifdef WITH_LF case CMD_ACQUIRE_RAW_ADC_SAMPLES_125K: AcquireRawAdcSamples125k(c->arg[0]); + UsbSendPacket((BYTE*)&ack, sizeof(ack)); break; #endif @@ -596,8 +602,8 @@ void UsbPacketReceived(BYTE *packet, int len) #endif case CMD_READER_LEGIC_RF: - LegicRfReader(); - break; + LegicRfReader(c->arg[0], c->arg[1]); + break; #ifdef WITH_ISO15693 case CMD_SIMTAG_ISO_15693: @@ -718,13 +724,15 @@ void UsbPacketReceived(BYTE *packet, int len) case CMD_DOWNLOADED_SIM_SAMPLES_125K: { BYTE *b = (BYTE *)BigBuf; memcpy(b+c->arg[0], c->d.asBytes, 48); + //Dbprintf("copied 48 bytes to %i",b+c->arg[0]); + UsbSendPacket((BYTE*)&ack, sizeof(ack)); break; } #ifdef WITH_LF case CMD_SIMULATE_TAG_125K: LED_A_ON(); - SimulateTagLowFrequency(c->arg[0], 1); + SimulateTagLowFrequency(c->arg[0], c->arg[1], 1); LED_A_OFF(); break; #endif @@ -794,7 +802,7 @@ void UsbPacketReceived(BYTE *packet, int len) } break; default: - DbpString("unknown command"); + Dbprintf("%s: 0x%04x","unknown command:",c->cmd); break; } }