FREEFARE_ERROR(3)

πŸŽ€ NAME πŸŽ€

okay bestie, so this page is all about the error-reporting girlies in the freefare crew β€” we're talking freefare_strerror, freefare_strerror_r, freefare_perror, and mifare_desfire_last_picc_error. they are literally the Error Reporting Functions, and they exist so you're never just staring at a card going "why are you like this 😭". this is FREEFARE_ERROR(3) from the Library Functions Manual, and she's here to translate card drama into actual words.


πŸ’– LIBRARY πŸ’–

she lives in the Mifare card manipulation library, aka libfreefare, and you link her with -lfreefare. that's the whole vibe.


✨ SYNOPSIS ✨

#include <freefare.h>

const char *
freefare_strerror(MifareTag tag);

int
freefare_strerror_r(MifareTag tag, char *buffer, size_t len);

void
freefare_strerror(MifareTag tag, char *string);

uint8_t
mifare_desfire_last_pcd_error(MifareTag tag);

uint8_t
mifare_desfire_last_picc_error(MifareTag tag);
yes bestie, the third one really does say freefare_strerror in there. that's what the page says, so that's what you get. i don't make the rules, i just deliver them with sparkle ✨

πŸ¦‹ DESCRIPTION πŸ¦‹

the freefare_strerror() functions return the error string that matches the last PCD or PICC error that happened while using tag. it's giving "translator for card feelings", and honestly? iconic.

the freefare_strerror_r() function does the same thing as freefare_strerror(), except the error message gets copied into buffer, and the absolute max size it'll write is len chars. so like, bring your own buffer, bestie. len is the ceiling, no cap 🧒.

the freefare_strerror() function prints the last PCD or PICC error that happened with tag straight to stderr. it doesn't return the string, it just yells it into the void for you. very main character energy.

the mifare_desfire_last_pcd_error() function returns the error code of the last function call from the library. so the library's most recent oopsie, quantified. πŸ’…

the mifare_desfire_last_picc_error() function returns the error code that tag handed back from the last command that ran on it. the card's own little confession, fr fr.


🌸 RETURN VALUES 🌸

  • freefare_strerror() returns the error message. that's it, that's the tea.
  • freefare_strerror_r() returns 0 on success, -1 on failure.
  • mifare_desfire_last_pcd_error() and mifare_desfire_last_picc_error() return an error code β€” or 0 if no error occurred, or if tag is not a Mifare DESFire target.

so if you're getting 0 back and going "but something's wrong??", check whether tag is even a Mifare DESFire target first, bestie. she said "not my department" πŸ™ˆ


🌈 SEE ALSO 🌈


πŸ‘‘ AUTHORS πŸ‘‘

Romain Tartiere <romain@il4p.org> β€” the one who wrote her, we stan. 🫢


and that's a wrap on the FREEFARE_ERROR(3) page, brought to you by the Debian crew, dated September 28, 2010, version FREEFARE_ERROR(3). she's an oldie but a goodie and she ate, no notes. mwah πŸ’‹βœ¨