[libnfc] 2 new revisions pushed by yob...@gmail.com on 2014-03-11 23:38 GMT

3 views
Skip to first unread message

lib...@googlecode.com

unread,
Mar 11, 2014, 7:39:11 PM3/11/14
to libnfc-...@googlegroups.com
master moved from e57dc8a746d5 to bd92f74a585d

2 new revisions:

Revision: 9a254712b58f
Author: Philippe Teuwen <yob...@gmail.com>
Date: Tue Mar 11 23:28:39 2014 UTC
Log: nfc_initiator_select_passive_target(): validate modulation and
baud ra...
http://code.google.com/p/libnfc/source/detail?r=9a254712b58f

Revision: bd92f74a585d
Author: Philippe Teuwen <yob...@gmail.com>
Date: Tue Mar 11 23:35:43 2014 UTC
Log: Update ChangeLog
http://code.google.com/p/libnfc/source/detail?r=bd92f74a585d

==============================================================================
Revision: 9a254712b58f
Author: Philippe Teuwen <yob...@gmail.com>
Date: Tue Mar 11 23:28:39 2014 UTC
Log: nfc_initiator_select_passive_target(): validate modulation and
baud rate

http://code.google.com/p/libnfc/source/detail?r=9a254712b58f

Modified:
/libnfc/nfc.c

=======================================
--- /libnfc/nfc.c Tue Mar 11 22:52:47 2014 UTC
+++ /libnfc/nfc.c Tue Mar 11 23:28:39 2014 UTC
@@ -158,6 +158,8 @@
#endif /* DRIVER_ARYGON_ENABLED */
}

+static int
+nfc_device_validate_modulation(nfc_device *pnd, const nfc_mode mode, const
nfc_modulation *nm);

/** @ingroup lib
* @brief Register an NFC device driver with libnfc.
@@ -526,6 +528,9 @@
uint8_t *abtInit = NULL;
uint8_t abtTmpInit[MAX(12, szInitData)];
size_t szInit = 0;
+ int res;
+ if ((res = nfc_device_validate_modulation(pnd, N_INITIATOR, &nm)) !=
NFC_SUCCESS)
+ return res;
if (szInitData == 0) {
// Provide default values, if any
prepare_initiator_data(nm, &abtInit, &szInit);
@@ -1206,6 +1211,38 @@
{
HAL(get_supported_baud_rate, pnd, mode, nmt, supported_br);
}
+
+/** @ingroup data
+ * @brief Validate combination of modulation and baud rate on the
currently used device.
+ * @return Returns 0 on success, otherwise returns libnfc's error code
(negative value)
+ * @param pnd \a nfc_device struct pointer that represent currently used
device
+ * @param mode \a nfc_mode.
+ * @param nm \a nfc_modulation.
+ *
+ */
+static int
+nfc_device_validate_modulation(nfc_device *pnd, const nfc_mode mode, const
nfc_modulation *nm)
+{
+ int res;
+ const nfc_modulation_type *nmt;
+ if ((res = nfc_device_get_supported_modulation(pnd, mode, &nmt)) < 0) {
+ return res;
+ }
+ for (int i = 0; nmt[i]; i++) {
+ if (nmt[i] == nm->nmt) {
+ const nfc_baud_rate *nbr;
+ if ((res = nfc_device_get_supported_baud_rate(pnd, mode, nmt[i],
&nbr)) < 0) {
+ return res;
+ }
+ for (int j = 0; nbr[j]; j++) {
+ if (nbr[j] == nm->nbr)
+ return NFC_SUCCESS;
+ }
+ return NFC_EINVARG;
+ }
+ }
+ return NFC_EINVARG;
+}

/* Misc. functions */


==============================================================================
Revision: bd92f74a585d
Author: Philippe Teuwen <yob...@gmail.com>
Date: Tue Mar 11 23:35:43 2014 UTC
Log: Update ChangeLog

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

Modified:
/ChangeLog

=======================================
--- /ChangeLog Mon Feb 24 14:56:33 2014 UTC
+++ /ChangeLog Tue Mar 11 23:35:43 2014 UTC
@@ -1,5 +1,20 @@
+TBD - 1.7.x
+-----------
+Fixes:
+ - Remove unreachable code
+ - nfc_emulate_uid: cleaner exit on interrupt
+ - Fix reporting of modulations and baud rates by nfc-scan-device -v
+
+Improvements:
+ - Allow ISO14443A to be used at higher baud rates
+ - nfc_initiator_select_passive_target() now checks against
+ reported modulations and baud rates for current device
+
+Changes:
+ - nfc_get_supported_baud_rate() takes now a "mode" parameter
+
Feb 24, 2014 - 1.7.1
-------------------
+--------------------

Fixes:
- Fix several issues reported by Coverity Scan
Reply all
Reply to author
Forward
0 new messages