From 13d3b38eee9710f7730610db786951a1bc6e92a9 Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Thu, 2 Apr 2020 20:26:46 +0300 Subject: [PATCH] byte order according to http://apps4android.org/nfc-specifications/NFCForum-TS-Type-2-Tag_1.1.pdf page 10, sample: page 31 --- client/mifare/ndef.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/client/mifare/ndef.c b/client/mifare/ndef.c index 8974334eb..a563e9fd5 100644 --- a/client/mifare/ndef.c +++ b/client/mifare/ndef.c @@ -450,11 +450,11 @@ int NDEFDecodeAndPrint(uint8_t *ndef, size_t ndefLen, bool verbose) { if (len != 3) { PrintAndLogEx(WARNING, "NDEF Lock Control block size must be 3 instead of %d.", len); } else { - uint8_t ByteOffset = (ndef[indx] >> 4) & 0x0f; - uint8_t PagesAddr = ndef[indx] & 0x0f; + uint8_t PagesAddr = (ndef[indx] >> 4) & 0x0f; + uint8_t ByteOffset = ndef[indx] & 0x0f; uint8_t Size = ndef[indx + 1]; - uint8_t BytesPerPage = (ndef[indx + 2] >> 4) & 0x0f; - uint8_t BytesLockedPerLockBit = ndef[indx + 2] & 0x0f; + uint8_t BytesLockedPerLockBit = (ndef[indx + 2] >> 4) & 0x0f; + uint8_t BytesPerPage = ndef[indx + 2] & 0x0f; PrintAndLogEx(SUCCESS, "PagesAddr. number of pages: %d", PagesAddr); PrintAndLogEx(SUCCESS, "ByteOffset. number of bytes: %d", ByteOffset); PrintAndLogEx(SUCCESS, "Size. size in bits of the lock area: %d. bytes approx: %d", Size, Size / 8); @@ -474,7 +474,7 @@ int NDEFDecodeAndPrint(uint8_t *ndef, size_t ndefLen, bool verbose) { uint8_t PagesAddr = (ndef[indx] >> 4) & 0x0f; uint8_t ByteOffset = ndef[indx] & 0x0f; uint8_t Size = ndef[indx + 1]; - uint8_t BytesPerPage = (ndef[indx + 2] >> 4) & 0x0f; + uint8_t BytesPerPage = ndef[indx + 2] & 0x0f; PrintAndLogEx(SUCCESS, "PagesAddr. number of pages: %d", PagesAddr); PrintAndLogEx(SUCCESS, "ByteOffset. number of bytes: %d", ByteOffset); PrintAndLogEx(SUCCESS, "Size. size in bits of the reserved area: %d. bytes approx: %d", Size, Size / 8);