From b52308d0712a89b51602844eae37fbc6979968af Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Thu, 29 Aug 2013 22:23:01 +0200 Subject: [PATCH] TypeB ProtocolInfo: limit mask for ISO14443-4 support flag --- libnfc/target-subr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libnfc/target-subr.c b/libnfc/target-subr.c index b846b6e..b99b28c 100644 --- a/libnfc/target-subr.c +++ b/libnfc/target-subr.c @@ -544,7 +544,9 @@ snprint_nfc_iso14443b_info(char *dst, size_t size, const nfc_iso14443b_info *pnb const int iMaxFrameSizes[] = { 16, 24, 32, 40, 48, 64, 96, 128, 256 }; off += snprintf(dst + off, size - off, "* Maximum frame sizes: %d bytes\n", iMaxFrameSizes[((pnbi->abtProtocolInfo[1] & 0xf0) >> 4)]); } - if ((pnbi->abtProtocolInfo[1] & 0x0f) == PI_ISO14443_4_SUPPORTED) { + if ((pnbi->abtProtocolInfo[1] & 0x01) == PI_ISO14443_4_SUPPORTED) { + // in principle low nibble could only be 0000 or 0001 and other values are RFU + // but in practice we found 0011 so let's use only last bit for -4 compatibility off += snprintf(dst + off, size - off, "* Protocol types supported: ISO/IEC 14443-4\n"); } off += snprintf(dst + off, size - off, "* Frame Waiting Time: %.4g ms\n", 256.0 * 16.0 * (1 << ((pnbi->abtProtocolInfo[2] & 0xf0) >> 4)) / 13560.0);