Fix ISO14443-B ATTRIB_RES decoding. (Thanks to Phil)

This commit is contained in:
Romuald Conty 2010-09-23 10:12:10 +00:00
parent c6f074ba96
commit 7e2ddedfc1
3 changed files with 9 additions and 7 deletions

View file

@ -137,8 +137,6 @@ print_nfc_iso14443b_info (const nfc_iso14443b_info_t nbi)
{
printf (" ATQB: ");
print_hex (nbi.abtAtqb, 12);
printf (" ATTRIB_RES: ");
print_hex (nbi.abtAttribRes, nbi.szAttribRes);
}
/**

View file

@ -229,9 +229,10 @@ typedef struct {
* @brief NFC ISO14443B tag information
*/
typedef struct {
/** abtAtqb store ATQB (Answer To reQuest of type B) */
byte_t abtAtqb[12];
size_t szAttribRes;
byte_t abtAttribRes[64];
/** ui8CardIdentifier store CID (Card Identifier) attributted by PCD to the PICC */
uint8_t ui8CardIdentifier;
} nfc_iso14443b_info_t;
/**

View file

@ -321,6 +321,8 @@ bool
pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_t nc, nfc_target_type_t ntt,
nfc_target_info_t * pnti)
{
uint8_t szAttribRes;
switch (ntt) {
case NTT_MIFARE:
case NTT_GENERIC_PASSIVE_106:
@ -371,9 +373,10 @@ pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_
memcpy (pnti->nbi.abtAtqb, pbtRawData, 12);
pbtRawData += 12;
// FIXME This part is not correct: ATTRIB_RES should be decoded but I can't find the right document that explains how to CORRECTLY decode this frame
pnti->nbi.szAttribRes = *(pbtRawData++);
memcpy (pnti->nbi.abtAttribRes, pbtRawData, pnti->nbi.szAttribRes);
szAttribRes = *(pbtRawData++);
if (szAttribRes) {
pnti->nbi.ui8CardIdentifier = *(pbtRawData++);
}
break;
case NTT_FELICA_212: