[libnfc] push by yob...@gmail.com - nfc_initiator_target_is_present(): Support Jewel on 2014-02-02 23:24 GMT

2 views
Skip to first unread message

lib...@googlecode.com

unread,
Feb 2, 2014, 6:24:54 PM2/2/14
to libnfc-...@googlegroups.com
Revision: 7254e1b2eac5
Author: Philippe Teuwen <yob...@gmail.com>
Date: Sun Feb 2 23:24:23 2014 UTC
Log: nfc_initiator_target_is_present(): Support Jewel

http://code.google.com/p/libnfc/source/detail?r=7254e1b2eac5

Modified:
/libnfc/chips/pn53x.c

=======================================
--- /libnfc/chips/pn53x.c Sat Feb 1 01:32:57 2014 UTC
+++ /libnfc/chips/pn53x.c Sun Feb 2 23:24:23 2014 UTC
@@ -1796,6 +1796,26 @@
}
return ret;
}
+
+static int pn53x_ISO14443A_Jewel_is_present(struct nfc_device *pnd)
+{
+ int ret;
+ log_put(LOG_GROUP, LOG_CATEGORY,
NFC_LOG_PRIORITY_DEBUG, "%s", "target_is_present(): Ping Jewel");
+ uint8_t abtCmd[1] = {0x78};
+ int failures = 0;
+ while (failures < 2) {
+ if ((ret = nfc_initiator_transceive_bytes(pnd, abtCmd, sizeof(abtCmd),
NULL, 0, -1)) < 1) {
+ if ((ret == NFC_ERFTRANS) && (CHIP_DATA(pnd)->last_status_byte ==
0x01)) { // Timeout
+ return NFC_ETGRELEASED;
+ } else { // Other errors can appear when card is tired-off, let's
try again
+ failures++;
+ }
+ } else {
+ return NFC_SUCCESS;
+ }
+ }
+ return ret;
+}

static int pn53x_ISO14443A_MFUL_is_present(struct nfc_device *pnd)
{
@@ -1957,6 +1977,8 @@
ret = pn53x_ISO14443B_4_is_present(pnd);
break;
case NMT_JEWEL:
+ ret = pn53x_ISO14443A_Jewel_is_present(pnd);
+ break;
case NMT_ISO14443BI:
case NMT_ISO14443B2SR:
case NMT_ISO14443B2CT:
Reply all
Reply to author
Forward
0 new messages