FREEFARE(3)
π FREEFARE π β like, the generic target manipulation girlies (section 3 of the manual, library functions manual, iykyk)
okay so bestie, welcome to the Mifare card manipulation library, aka libfreefare, and you link against it with -lfreefare. this page is all about the generic target manipulation functions and honestly? they ate. π
β¨ SYNOPSIS β¨
#include <freefare.h>
MifareTag *
freefare_get_tags(nfc_device_t *device);
enum mifare_tag_type {
ULTRALIGHT,
CLASSIC_1K,
CLASSIC_4K
};
enum mifare_tag_type
freefare_get_tag_type(MifareTag tag);
const char *
freefare_get_tag_friendly_name(MifareTag tag);
char *
freefare_get_tag_uid(MifareTag tag);
void
freefare_free_tag(MifareTag tags);
void
freefare_free_tags(MifareTag *tags);
πΈ DESCRIPTION πΈ
the freefare_*() family of functions is giving agnostic access to the MifareTag that's vibing on a given NFC device. no cap, it doesn't care what kind of tag it is, it just handles it. π
freefare_get_tags() returns a NULL-terminated list of MifareTag present on device. this list has to be freed after usage, and you've got exactly two ways to do that bestie, pick your fighter:
- calling the
freefare_free_tags()function. literally every tag in the list gets automatically freed for you. so convenient. π«Ά - calling the
freefare_free_tag()function to free each tag in the list individually, and then freeing the list itself using thefree()function.
β οΈ okay so listen, this part matters. because of the nature of the target detection process, any previously detected target will be in an inconsistent state after a call tofreefare_get_tags(). it's the programmer's responsibility to free these targets before calling thefreefare_get_tags()function. do not skip this. this is the vibe check. π
information about a given MifareTag can be gathered using the freefare_get_tag_type(), freefare_get_tag_uid() and freefare_get_tag_friendly_name() functions. they're the little info-gathering trio and they're iconic. π
β RETURN VALUES β
unless stated otherwise, all functions return a value greater than or equal to 0 on success or -1 on failure. that's it, that's the whole mood. π
π¦ SEE ALSO π¦
π AUTHORS π
these two literally built it, show some respect:
- Romain Tartiere
<romain@blogreen.org> - Romuald Conty
<romuald@libnfc.org>
and that's the whole page bestie!! this came from the Debian crew, dated March 30, 2010 β yeah she's an older queen but she still slays πβ¨ go free your tags, stay consistent, and don't forget the NULL terminator. mwah ππ¦π
π¦ where this page comes from
- debian bookworm: libfreefare-doc 0.4.0-2.1 Β· LGPL-3.0-or-later
- debian trixie: libfreefare-doc 0.4.0-2.3 Β· LGPL-3.0-or-later
- nixos 26.05: libfreefare 0.4.0
- nixpkgs unstable: libfreefare 0.4.0
- ubuntu jammy: libfreefare-doc 0.4.0-2.1build1 Β· LGPL-3.0-or-later
- ubuntu noble: libfreefare-doc 0.4.0-2.3build2 Β· LGPL-3.0-or-later
- ubuntu questing: libfreefare-doc 0.4.0-2.3build2
- ubuntu resolute: libfreefare-doc 0.4.0-2.3build3 Β· LGPL-3.0-or-later
- ubuntu stonking: libfreefare-doc 0.4.0-2.4build1 Β· LGPL-3.0-or-later
- Copyright (C) 2010 Romain Tartiere
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms