]> cvs.zerfleddert.de Git - proxmark3-svn/commitdiff
bugfixes in iso14443a.c and hf 14a reader
authorpwpiwi <pwpiwi@users.noreply.github.com>
Tue, 23 Dec 2014 10:11:52 +0000 (11:11 +0100)
committerpwpiwi <pwpiwi@users.noreply.github.com>
Tue, 23 Dec 2014 10:21:42 +0000 (11:21 +0100)
- introduced with the big frame and parity support (commit 6a1f2d82): tag responses with len%8 == 0 were dropped  - thanks iceman for testing and finding
- after unsuccessful hf 14a reader the field stayed on. Thanks to iceman for proposing the fix.

armsrc/iso14443a.c
client/cmdhf14a.c

index b1d3690f768968ef390d0e77aabbaa670194331f..a4632aa543cff67e05fb3b1d4c74cc56c95ca76a 100644 (file)
@@ -395,7 +395,11 @@ static RAMFUNC bool MillerDecoding(uint8_t bit, uint32_t non_real_time)
                                        } else if (Uart.len & 0x0007) {                                                         // there are some parity bits to store
                                                Uart.parityBits <<= (8 - (Uart.len&0x0007));                    // left align remaining parity bits
                                                Uart.parity[Uart.parityLen++] = Uart.parityBits;                // and store them
                                        } else if (Uart.len & 0x0007) {                                                         // there are some parity bits to store
                                                Uart.parityBits <<= (8 - (Uart.len&0x0007));                    // left align remaining parity bits
                                                Uart.parity[Uart.parityLen++] = Uart.parityBits;                // and store them
+                                       }
+                                       if (Uart.len) {
                                                return TRUE;                                                                                    // we are finished with decoding the raw data sequence
                                                return TRUE;                                                                                    // we are finished with decoding the raw data sequence
+                                       } else {
+                                               UartReset();                                                                                    // Nothing received - try again
                                        }
                                }
                                if (Uart.state == STATE_START_OF_COMMUNICATION) {                               // error - must not follow directly after SOC
                                        }
                                }
                                if (Uart.state == STATE_START_OF_COMMUNICATION) {                               // error - must not follow directly after SOC
@@ -558,6 +562,8 @@ static RAMFUNC int ManchesterDecoding(uint8_t bit, uint16_t offset, uint32_t non
                                } else if (Demod.len & 0x0007) {                                                // there are some parity bits to store
                                        Demod.parityBits <<= (8 - (Demod.len&0x0007));          // left align remaining parity bits
                                        Demod.parity[Demod.parityLen++] = Demod.parityBits;     // and store them
                                } else if (Demod.len & 0x0007) {                                                // there are some parity bits to store
                                        Demod.parityBits <<= (8 - (Demod.len&0x0007));          // left align remaining parity bits
                                        Demod.parity[Demod.parityLen++] = Demod.parityBits;     // and store them
+                               }
+                               if (Demod.len) {
                                        return TRUE;                                                                            // we are finished with decoding the raw data sequence
                                } else {                                                                                                // nothing received. Start over
                                        DemodReset();
                                        return TRUE;                                                                            // we are finished with decoding the raw data sequence
                                } else {                                                                                                // nothing received. Start over
                                        DemodReset();
@@ -1631,7 +1637,7 @@ bool EmLogTrace(uint8_t *reader_data, uint16_t reader_len, uint32_t reader_Start
 //-----------------------------------------------------------------------------
 static int GetIso14443aAnswerFromTag(uint8_t *receivedResponse, uint8_t *receivedResponsePar, uint16_t offset)
 {
 //-----------------------------------------------------------------------------
 static int GetIso14443aAnswerFromTag(uint8_t *receivedResponse, uint8_t *receivedResponsePar, uint16_t offset)
 {
-       uint16_t c;
+       uint32_t c;
        
        // Set FPGA mode to "reader listen mode", no modulation (listen
        // only, since we are receiving, not transmitting).
        
        // Set FPGA mode to "reader listen mode", no modulation (listen
        // only, since we are receiving, not transmitting).
index 917411349f7f2bc4a91ae8ec79f282ef6cacf49c..c997607652c9c8b632a6dffcf239efd5c23d31e1 100644 (file)
@@ -191,6 +191,11 @@ int CmdHF14AReader(const char *Cmd)
        
        if(select_status == 0) {
                PrintAndLog("iso14443a card select failed");
        
        if(select_status == 0) {
                PrintAndLog("iso14443a card select failed");
+               // disconnect
+               c.arg[0] = 0;
+               c.arg[1] = 0;
+               c.arg[2] = 0;
+               SendCommand(&c);
                return 0;
        }
 
                return 0;
        }
 
Impressum, Datenschutz