diff --git a/include/nfc/nfc-types.h b/include/nfc/nfc-types.h index 47f2aad..8563552 100644 --- a/include/nfc/nfc-types.h +++ b/include/nfc/nfc-types.h @@ -162,9 +162,6 @@ typedef enum { NDO_FORCE_ISO14443_A = 0x42, } nfc_device_option_t; -//////////////////////////////////////////////////////////////////// -// nfc_reader_list_passive - using InListPassiveTarget - /** * @enum nfc_modulation_t * @brief NFC modulation @@ -176,14 +173,20 @@ typedef enum { NM_FELICA_212 = 0x01, /** JIS X 6319-4 (Sony Felica) http://en.wikipedia.org/wiki/FeliCa */ NM_FELICA_424 = 0x02, -/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 */ - NM_ISO14443B_106 = 0x03, -/** Jewel Topaz (Innovision Research & Development) */ +/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531) */ + NM_ISO14443B_106 = 0x03, +/** Jewel Topaz (Innovision Research & Development) (Not supported by PN531) */ NM_JEWEL_106 = 0x04, +/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */ + NM_ISO14443B_212 = 0x06, +/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */ + NM_ISO14443B_424 = 0x07, +/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */ + NM_ISO14443B_847 = 0x08, /** Active DEP */ - NM_ACTIVE_DEP = 0x05, + NM_ACTIVE_DEP, /** Passive DEP */ - NM_PASSIVE_DEP = 0x06 + NM_PASSIVE_DEP } nfc_modulation_t; /** diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index 5f26e8e..2ff935d 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -463,8 +463,36 @@ pn53x_InListPassiveTarget (nfc_device_t * pnd, byte_t abtCmd[sizeof (pncmd_initiator_list_passive)]; memcpy (abtCmd, pncmd_initiator_list_passive, sizeof (pncmd_initiator_list_passive)); - // FIXME PN531 doesn't support all available modulations abtCmd[2] = szMaxTargets; // MaxTg + + // XXX Is there is a better way to do this ? + switch(nmInitModulation) { + case NM_ISO14443A_106: + case NM_FELICA_212: + case NM_FELICA_424: + // all gone fine. + break; + case NM_ISO14443B_106: + case NM_JEWEL_106: + if(pnd->nc == NC_PN531) { + // These modulations are not supported by pn531 + pnd->iLastError = DENOTSUP; + return false; + } + break; + case NM_ISO14443B_212: + case NM_ISO14443B_424: + case NM_ISO14443B_847: + if(pnd->nc != NC_PN533) { + // These modulations are not supported by pn531 neither pn532 + pnd->iLastError = DENOTSUP; + return false; + } + break; + default: + pnd->iLastError = DENOTSUP; + return false; + } abtCmd[3] = nmInitModulation; // BrTy, the type of init modulation used for polling a passive tag // Set the optional initiator data (used for Felica, ISO14443B, Topaz Polling or for ISO14443A selecting a specific UID).