(libnfc-less-bitutils-more-ponies) Get rid of bitutils.[hc] (part 1).
- New API function append_iso14443a_crc(); - Add a PRINT_HEX macro for driver debugging (replaces print_hex function from bitutils.c); - Move bit-mirroring related functions to libnfc/mirror-subr.[hc]; - Move iso14443 related functions to libnfc/iso14443-subr.c; - Move libnfc/bitutils.c hex-dumping code to examples/nfc-utils.c; - Replace calls to swap_endian32() and swap_endian64() functions with calls to bswap32() and bswap64 provided by endian.h. And while I am here: - Fix the DBG macro so that it does not throw warning at compile time.
This commit is contained in:
parent
5302930b09
commit
10baef235f
24 changed files with 328 additions and 343 deletions
|
|
@ -35,10 +35,12 @@
|
|||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <sys/endian.h>
|
||||
|
||||
#include <nfc/nfc.h>
|
||||
|
||||
#include "mifaretag.h"
|
||||
#include "bitutils.h"
|
||||
#include "nfc-utils.h"
|
||||
|
||||
static nfc_device_t* pnd;
|
||||
static nfc_target_info_t nti;
|
||||
|
|
@ -464,14 +466,14 @@ int main(int argc, const char* argv[])
|
|||
// Compare if key dump UID is the same as the current tag UID
|
||||
if (memcmp(nti.nai.abtUid,pbtUID,4) != 0)
|
||||
{
|
||||
printf("Expected MIFARE Classic %cK card with UID: %08x\n",b4K?'4':'1',swap_endian32(pbtUID));
|
||||
printf("Expected MIFARE Classic %cK card with UID: %08x\n",b4K?'4':'1',bswap32(*((uint32_t *)&pbtUID)));
|
||||
}
|
||||
}
|
||||
|
||||
// Get the info from the current tag
|
||||
pbtUID = nti.nai.abtUid;
|
||||
b4K = (nti.nai.abtAtqa[1] == 0x02);
|
||||
printf("Found MIFARE Classic %cK card with UID: %08x\n",b4K?'4':'1',swap_endian32(pbtUID));
|
||||
printf("Found MIFARE Classic %cK card with UID: %08x\n",b4K?'4':'1',bswap32(*((uint32_t *)&pbtUID)));
|
||||
|
||||
uiBlocks = (b4K)?0xff:0x3f;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue