27 static const nfc_modulation nfc_ISO14443B = {
32 static const nfc_modulation nfc_ISO14443B2SR = {
33 .nmt = NMT_ISO14443B2SR,
37 static nfc_context *libnfc_context = (
void *) 0;
39 static void exitNfcContext() {
40 nfc_exit(libnfc_context);
46 static void nfcContextInit() {
47 if (!libnfc_context) {
48 nfc_init(&libnfc_context);
49 atexit(exitNfcContext);
72 nfc_device_set_property_bool(reader->
libnfc_reader, NP_INFINITE_SELECT,
true);
91 if (nfc_initiator_select_passive_target(reader->
libnfc_reader, nfc_ISO14443B2SR, (
void *) 0, 0, tmpTarget) < 0) {
108 static inline size_t nfcExchange(nfc_device *target,
const uint8_t *restrict tx_data,
const size_t tx_size,
109 uint8_t *restrict rx_data,
const size_t rx_size) {
110 return nfc_initiator_transceive_bytes(target, tx_data, tx_size, rx_data, rx_size, 0);
149 error = nfcSrix4kInit(reader);
158 #define SRIX_GET_UID 0x0B
159 #define SRIX_READ_BLOCK 0x08
160 #define SRIX_WRITE_BLOCK 0x09
176 if (nfc_initiator_target_is_present(reader->
libnfc_reader, (
void *) 0) < 0) {
182 }
while (nfcExchange(reader->
libnfc_reader, (
const uint8_t[]) {SRIX_READ_BLOCK, blockNum}, 2,
190 const uint8_t writeCommand[] = {
204 if (nfc_initiator_target_is_present(reader->
libnfc_reader, (
void *) 0) < 0) {
212 nfcExchange(reader->
libnfc_reader, writeCommand, 6, (
void *) 0, 0);
222 #undef SRIX_READ_BLOCK
223 #undef SRIX_WRITE_BLOCK