Modification to set PN53X_REG_CIU_TxAuto, PN53X_REG_CIU_CWGsP & PN53X_REG_CIU_ModGsP registers values before init.
Avoids a dummy scan in B mode before
This becomes more consistent with all other pass by pointer of most structures.
Additionally, this should lessen stack memory usage, as building strings with str_nfc_target would push the target (283 bytes) plus then a copy of the info objects (up to 275) onto the stack as it dives into the sprintf functions.
Lastly, this makes my attempt at a .NET wrapper easier, as I can make passing by pointer work, but passing by value seems to bomb on the interop right now.
* in main():
** errx()/err()/return -> exit()
** return values -> EXIT_SUCCESS & EXIT_FAILURE
* out of main:
** err()/errx()/exit() -> return
** change retval from size_t to int to allow returning errors
** don't use EXIT_SUCCESS / EXIT_FAILURE as retvals
* add nfc_close() & nfc_exit() to exit() on errors
* add missing fclose() on errors
* add missing test if (pnd == NULL)
* unify style if (pnd == / != NULL)
* remove goto's
* few related fixes
* remove if(pnd!=NULL) test on nfc_close() calls
WARNING: This commit do not contains a fully cleaned code:
- Only nfc-list have been tested
- Some -commented- code is not used ATM
- Some printf-as-debug remain in this commit
... but that a bit usable so... happy hacking ;-)
- nfc_device is now an opaque type;
- PN53x specific errors are not public anymore;
- nfc_device_name() renamed to nfc_device_get_name() for the sake of consistency;
- examples/*, utils/* uses the new nfc_device_get_name() function instead of access directly to struct's content;
- new error defined: NFC_ERFTRANS for notifying about RF transmission error, its used by mifare.c to detect permissions error on mifare;
- drivers initiator_transceive_bytes() function now returns libnfc's error code on failure (<0), and received bytes count on success (>=0);
- remove some unused errors.
- Provide a nfc_get_default_device() that allow to grab the connstring stored
in LIBNFC_DEFAULT_DEVICE environnement variable or returns the first
available device if not set;
- nfc_connect(NULL) now takes the default device (see
nfc_get_default_device());
- Removes nfc_driver_desc_t from public types
- Defines nfc_connstring as char[1024]
- examples/*: use nfc_connstring
- examples/nfc-poll: now uses only the default device (instead of all devices
availables)
- Removes parse_args() from nfc-utils.[hc]