Replace wrong decoded ISO14443-B data by ATTRIB_RES field.
New issue Summary: Improve ISO 14443-B data (ATTRIB_RES) decoding Before this revision, pn53x_decode_target_data() wrongly decode ISO14443-B. Currently, whole ATTRIB_RES field is stored in nfc_target_info_t struct. I do not find the correct documentation to fix it better than this, but at least it now retrieves a correct value.
This commit is contained in:
parent
2d6c0f5f1a
commit
e2a2557396
3 changed files with 7 additions and 36 deletions
|
@ -137,14 +137,8 @@ print_nfc_iso14443b_info (const nfc_iso14443b_info_t nbi)
|
|||
{
|
||||
printf (" ATQB: ");
|
||||
print_hex (nbi.abtAtqb, 12);
|
||||
printf (" ID: ");
|
||||
print_hex (nbi.abtId, 4);
|
||||
printf (" CID: %02x\n", nbi.btCid);
|
||||
if (nbi.szInfLen > 0) {
|
||||
printf (" INF: ");
|
||||
print_hex (nbi.abtInf, nbi.szInfLen);
|
||||
}
|
||||
printf (" PARAMS: %02x %02x %02x %02x\n", nbi.btParam1, nbi.btParam2, nbi.btParam3, nbi.btParam4);
|
||||
printf (" ATTRIB_RES: ");
|
||||
print_hex (nbi.abtAttribRes, nbi.szAttribRes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -230,14 +230,8 @@ typedef struct {
|
|||
*/
|
||||
typedef struct {
|
||||
byte_t abtAtqb[12];
|
||||
byte_t abtId[4];
|
||||
byte_t btParam1;
|
||||
byte_t btParam2;
|
||||
byte_t btParam3;
|
||||
byte_t btParam4;
|
||||
byte_t btCid;
|
||||
size_t szInfLen;
|
||||
byte_t abtInf[64];
|
||||
size_t szAttribRes;
|
||||
byte_t abtAttribRes[64];
|
||||
} nfc_iso14443b_info_t;
|
||||
|
||||
/**
|
||||
|
|
|
@ -321,7 +321,6 @@ 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 ui8AttribResLen;
|
||||
switch (ntt) {
|
||||
case NTT_MIFARE:
|
||||
case NTT_GENERIC_PASSIVE_106:
|
||||
|
@ -372,25 +371,9 @@ pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_
|
|||
memcpy (pnti->nbi.abtAtqb, pbtRawData, 12);
|
||||
pbtRawData += 12;
|
||||
|
||||
// Store temporarily the ATTRIB_RES length
|
||||
ui8AttribResLen = *(pbtRawData++);
|
||||
|
||||
// Store the 4 bytes ID
|
||||
memcpy (pnti->nbi.abtId, pbtRawData, 4);
|
||||
pbtRawData += 4;
|
||||
|
||||
pnti->nbi.btParam1 = *(pbtRawData++);
|
||||
pnti->nbi.btParam2 = *(pbtRawData++);
|
||||
pnti->nbi.btParam3 = *(pbtRawData++);
|
||||
pnti->nbi.btParam4 = *(pbtRawData++);
|
||||
|
||||
// Test if the Higher layer (INF) is available
|
||||
if (ui8AttribResLen > 8) {
|
||||
pnti->nbi.szInfLen = *(pbtRawData++);
|
||||
memcpy (pnti->nbi.abtInf, pbtRawData, pnti->nbi.szInfLen);
|
||||
} else {
|
||||
pnti->nbi.szInfLen = 0;
|
||||
}
|
||||
// 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);
|
||||
break;
|
||||
|
||||
case NTT_FELICA_212:
|
||||
|
|
Loading…
Reference in a new issue