diff --git a/examples/felica-lite-dump.c b/examples/felica-lite-dump.c index df77be9..6fce594 100644 --- a/examples/felica-lite-dump.c +++ b/examples/felica-lite-dump.c @@ -51,10 +51,6 @@ main (void) } for (int i = 0; tags[i]; i++) { - int r = felica_connect (tags[i]); - if (r < 0) - errx (EXIT_FAILURE, "Cannot connect to FeliCa target"); - printf ("Dumping %s tag %s\n", freefare_get_tag_friendly_name (tags[i]), freefare_get_tag_uid (tags[i])); printf ("Number\tName\tData\n"); @@ -92,8 +88,6 @@ main (void) } printf ("\n"); } - - felica_disconnect (tags[i]); } freefare_free_tags (tags); diff --git a/examples/felica-read-ndef.c b/examples/felica-read-ndef.c index 0c5bc77..2de63e0 100644 --- a/examples/felica-read-ndef.c +++ b/examples/felica-read-ndef.c @@ -91,10 +91,6 @@ main (int argc, char *argv[]) } for (int i = 0; (!error) && tags[i]; i++) { - int r = felica_connect (tags[i]); - if (r < 0) - errx (EXIT_FAILURE, "Cannot connect to FeliCa target"); - int block = 1; uint8_t ndef_message[NDEF_BUFFER_SIZE]; int ndef_space_left = NDEF_BUFFER_SIZE; @@ -153,8 +149,6 @@ main (int argc, char *argv[]) err (EXIT_FAILURE, "Can't write NDEF message"); fclose (f); - - felica_disconnect (tags[i]); } freefare_free_tags (tags); diff --git a/libfreefare/felica.c b/libfreefare/felica.c index ef06130..50898ff 100644 --- a/libfreefare/felica.c +++ b/libfreefare/felica.c @@ -64,47 +64,9 @@ felica_tag_free (FreefareTag tag) -int -felica_connect (FreefareTag tag) -{ - ASSERT_INACTIVE (tag); - ASSERT_FELICA (tag); - - nfc_target pnti; - nfc_modulation modulation = { - .nmt = NMT_FELICA, - .nbr = NBR_212, - }; - if (nfc_initiator_select_passive_target (tag->device, modulation, tag->info.nti.nfi.abtId, 0, &pnti) >= 0) { - tag->active = 1; - } else { - errno = EIO; - return -1; - } - return 0; -} - -int -felica_disconnect (FreefareTag tag) -{ - ASSERT_ACTIVE (tag); - ASSERT_FELICA (tag); - - if (nfc_initiator_deselect_target (tag->device) >= 0) { - tag->active = 0; - } else { - errno = EIO; - return -1; - } - return 0; -} - - - ssize_t felica_read_ex (FreefareTag tag, uint16_t service, uint8_t block_count, uint8_t blocks[], uint8_t *data, size_t length) { - ASSERT_ACTIVE (tag); ASSERT_FELICA (tag); assert (block_count <= MAX_BLOCK_COUNT); @@ -158,7 +120,6 @@ felica_read (FreefareTag tag, uint16_t service, uint8_t block, uint8_t *data, si ssize_t felica_write_ex (FreefareTag tag, uint16_t service, uint8_t block_count, uint8_t blocks[], uint8_t *data, size_t length) { - ASSERT_ACTIVE (tag); ASSERT_FELICA (tag); DEBUG_FUNCTION(); diff --git a/libfreefare/freefare.h b/libfreefare/freefare.h index ca89a40..f0ca291 100644 --- a/libfreefare/freefare.h +++ b/libfreefare/freefare.h @@ -70,9 +70,6 @@ void freefare_perror (FreefareTag tag, const char *string); #define FELICA_SC_RW 0x0009 #define FELICA_SC_RO 0x000b -int felica_connect (FreefareTag tag); -int felica_disconnect (FreefareTag tag); - ssize_t felica_read (FreefareTag tag, uint16_t service, uint8_t block, uint8_t *data, size_t length); ssize_t felica_read_ex (FreefareTag tag, uint16_t service, uint8_t block_count, uint8_t blocks[], uint8_t *data, size_t length); ssize_t felica_write (FreefareTag tag, uint16_t service, uint8_t block, uint8_t *data, size_t length); diff --git a/test/felica_fixture.c b/test/felica_fixture.c index 3beb9fd..a2a421a 100644 --- a/test/felica_fixture.c +++ b/test/felica_fixture.c @@ -51,8 +51,6 @@ cut_setup (void) for (int i=0; tags[i]; i++) { if (freefare_get_tag_type(tags[i]) == FELICA) { tag = tags[i]; - res = felica_connect (tag); - cut_assert_equal_int (0, res, cut_message ("felica_connect() failed")); return; } } @@ -67,9 +65,6 @@ cut_setup (void) void cut_teardown (void) { - if (tag) - mifare_classic_disconnect (tag); - if (tags) { freefare_free_tags (tags); tags = NULL;