example: Jewel support in nfc-list and nfc-poll. (Many thanks to Phil)
This commit is contained in:
parent
cab6d19c5a
commit
8672c809bd
4 changed files with 50 additions and 12 deletions
|
@ -181,16 +181,15 @@ main (int argc, const char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// List Jewel targets
|
// List Jewel targets
|
||||||
if (nfc_initiator_list_passive_targets(pnd, NM_JEWEL_106, anti, MAX_TARGET_COUNT, &szTargetFound )) {
|
if (nfc_initiator_list_passive_targets(pnd, NM_JEWEL_106, anti, MAX_TARGET_COUNT, &szTargetFound )) {
|
||||||
size_t n;
|
size_t n;
|
||||||
printf("%d Jewel passive target(s) was found%s\n", (int)szTargetFound, (szTargetFound==0)?".\n":":"); for(n=0; n<szTargetFound; n++) {
|
printf("%d Jewel passive target(s) was found%s\n", (int)szTargetFound, (szTargetFound==0)?".\n":":");
|
||||||
printf("Jewel support is missing in libnfc, feel free to contribute.\n");
|
for(n=0; n<szTargetFound; n++) {
|
||||||
|
print_nfc_jewel_info (anti[n].nji);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
nfc_disconnect (pnd);
|
nfc_disconnect (pnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,8 +72,8 @@ main (int argc, const char *argv[])
|
||||||
|
|
||||||
const byte_t btPollNr = 20;
|
const byte_t btPollNr = 20;
|
||||||
const byte_t btPeriod = 2;
|
const byte_t btPeriod = 2;
|
||||||
const nfc_target_type_t nttArray[4] = {NTT_GENERIC_PASSIVE_106, NTT_GENERIC_PASSIVE_212, NTT_GENERIC_PASSIVE_424, NTT_ISO14443B_106};
|
const nfc_target_type_t nttArray[5] = {NTT_GENERIC_PASSIVE_106, NTT_GENERIC_PASSIVE_212, NTT_GENERIC_PASSIVE_424, NTT_ISO14443B_106, NTT_JEWEL_106};
|
||||||
const size_t szTargetTypes = 4;
|
const size_t szTargetTypes = 5;
|
||||||
|
|
||||||
nfc_target_t antTargets[2];
|
nfc_target_t antTargets[2];
|
||||||
size_t szTargetFound;
|
size_t szTargetFound;
|
||||||
|
@ -120,20 +120,50 @@ main (int argc, const char *argv[])
|
||||||
uint8_t n;
|
uint8_t n;
|
||||||
printf ("%ld target(s) have been found.\n", (unsigned long) szTargetFound);
|
printf ("%ld target(s) have been found.\n", (unsigned long) szTargetFound);
|
||||||
for (n = 0; n < szTargetFound; n++) {
|
for (n = 0; n < szTargetFound; n++) {
|
||||||
printf ("T%d: targetType=%02x, ", n + 1, antTargets[n].ntt);
|
printf ("T%d: targetType=%02x ", n + 1, antTargets[n].ntt);
|
||||||
printf ("targetData:\n");
|
|
||||||
switch(antTargets[n].ntt) {
|
switch(antTargets[n].ntt) {
|
||||||
|
case NTT_JEWEL_106:
|
||||||
|
printf ("(Innovision Jewel tag), targetData:\n");
|
||||||
|
print_nfc_jewel_info (antTargets[n].nti.nji);
|
||||||
|
break;
|
||||||
case NTT_MIFARE:
|
case NTT_MIFARE:
|
||||||
case NTT_ISO14443A_106:
|
printf ("(Mifare card), targetData:\n");
|
||||||
print_nfc_iso14443a_info (antTargets[n].nti.nai);
|
print_nfc_iso14443a_info (antTargets[n].nti.nai);
|
||||||
break;
|
break;
|
||||||
case NTT_FELICA_212:
|
case NTT_FELICA_212:
|
||||||
case NTT_FELICA_424:
|
printf ("(FeliCa 212 kbps card), targetData:\n");
|
||||||
print_nfc_felica_info (antTargets[n].nti.nfi);
|
print_nfc_felica_info (antTargets[n].nti.nfi);
|
||||||
break;
|
break;
|
||||||
|
case NTT_FELICA_424:
|
||||||
|
printf ("(FeliCa 212 kbps card), targetData:\n");
|
||||||
|
print_nfc_felica_info (antTargets[n].nti.nfi);
|
||||||
|
break;
|
||||||
|
case NTT_ISO14443A_106:
|
||||||
|
printf ("(Passive 106 kbps ISO/IEC 14443-4A card), targetData:\n");
|
||||||
|
print_nfc_iso14443a_info (antTargets[n].nti.nai);
|
||||||
|
break;
|
||||||
case NTT_ISO14443B_TCL_106:
|
case NTT_ISO14443B_TCL_106:
|
||||||
|
printf ("(Passive 106 kbps ISO/IEC 14443-4B card), targetData:\n");
|
||||||
print_nfc_iso14443b_info (antTargets[n].nti.nbi);
|
print_nfc_iso14443b_info (antTargets[n].nti.nbi);
|
||||||
break;
|
break;
|
||||||
|
case NTT_DEP_PASSIVE_106:
|
||||||
|
printf ("(DEP passive 106 kbps)\n");
|
||||||
|
break;
|
||||||
|
case NTT_DEP_PASSIVE_212:
|
||||||
|
printf ("(DEP passive 212 kbps)\n");
|
||||||
|
break;
|
||||||
|
case NTT_DEP_PASSIVE_424:
|
||||||
|
printf ("(DEP passive 424 kbps)\n");
|
||||||
|
break;
|
||||||
|
case NTT_DEP_ACTIVE_106:
|
||||||
|
printf ("(DEP active 106 kbps)\n");
|
||||||
|
break;
|
||||||
|
case NTT_DEP_ACTIVE_212:
|
||||||
|
printf ("(DEP active 212 kbps)\n");
|
||||||
|
break;
|
||||||
|
case NTT_DEP_ACTIVE_424:
|
||||||
|
printf ("(DEP active 424 kbps)\n");
|
||||||
|
break;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -132,6 +132,15 @@ print_nfc_felica_info (const nfc_felica_info_t nfi)
|
||||||
print_hex (nfi.abtPad, 8);
|
print_hex (nfi.abtPad, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
print_nfc_jewel_info (const nfc_jewel_info_t nji)
|
||||||
|
{
|
||||||
|
printf (" JEWELID: ");
|
||||||
|
print_hex (nji.btId, 4);
|
||||||
|
printf (" SENS_RES: ");
|
||||||
|
print_hex (nji.btSensRes, 2);
|
||||||
|
}
|
||||||
|
|
||||||
#define PI_ISO14443_4_SUPPORTED 0x01
|
#define PI_ISO14443_4_SUPPORTED 0x01
|
||||||
#define PI_NAD_SUPPORTED 0x01
|
#define PI_NAD_SUPPORTED 0x01
|
||||||
#define PI_CID_SUPPORTED 0x02
|
#define PI_CID_SUPPORTED 0x02
|
||||||
|
|
|
@ -414,8 +414,8 @@ nfc_initiator_list_passive_targets (nfc_device_t * pnd, const nfc_modulation_t n
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
szTargetFound++;
|
szTargetFound++;
|
||||||
// deselect has no effect on FeliCa cards so we'll stop after one...
|
// deselect has no effect on FeliCa and Jewel cards so we'll stop after one...
|
||||||
if (nmInitModulation == NM_FELICA_212 || nmInitModulation == NM_FELICA_424) {
|
if (nmInitModulation == NM_FELICA_212 || nmInitModulation == NM_FELICA_424 || nmInitModulation == NM_JEWEL_106) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue