(libnfc-less-bitutils-more-ponies) Fix build on windows:
- do not depends on byte swapping functions / macros; - add basic err.h functionalities.
This commit is contained in:
commit
086e24c407
9 changed files with 39 additions and 26 deletions
|
|
@ -33,8 +33,6 @@
|
|||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/endian.h>
|
||||
|
||||
#include <nfc/nfc.h>
|
||||
|
||||
#include <nfc/nfc-messages.h>
|
||||
|
|
@ -200,12 +198,10 @@ int main(int argc,char* argv[])
|
|||
transmit_bytes(abtHalt,4);
|
||||
|
||||
printf("\nFound tag with UID: ");
|
||||
if (szUidLen == 4)
|
||||
{
|
||||
printf("%08x\n", bswap32( *((uint32_t *)&abtUid)));
|
||||
} else {
|
||||
printf("%014llx\n",bswap64(*((uint64_t *) &abtUid))&0x00ffffffffffffffull);
|
||||
if (szUidLen == 7) {
|
||||
printf("%02x%02x%02x", abtUid[6], abtUid[5], abtUid[4]);
|
||||
}
|
||||
printf("%02x%02x%02x%02x\n", abtUid[3], abtUid[2], abtUid[1], abtUid[0]);
|
||||
|
||||
nfc_disconnect(pnd);
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -54,13 +54,14 @@ int main(int argc, const char* argv[])
|
|||
size_t i;
|
||||
nfc_target_info_t nti;
|
||||
nfc_device_desc_t *pnddDevices;
|
||||
const char* acLibnfcVersion;
|
||||
|
||||
if (argc > 1) {
|
||||
errx (1, "usage: %s", argv[0]);
|
||||
}
|
||||
|
||||
// Display libnfc version
|
||||
const char* acLibnfcVersion = nfc_version();
|
||||
acLibnfcVersion = nfc_version();
|
||||
printf("%s use libnfc %s\n", argv[0], acLibnfcVersion);
|
||||
|
||||
#ifdef HAVE_LIBUSB
|
||||
|
|
|
|||
|
|
@ -35,8 +35,6 @@
|
|||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <sys/endian.h>
|
||||
|
||||
#include <nfc/nfc.h>
|
||||
|
||||
#include "mifaretag.h"
|
||||
|
|
@ -466,14 +464,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',bswap32(*((uint32_t *)&pbtUID)));
|
||||
printf("Expected MIFARE Classic %cK card with UID: %02x%02x%02x%02x\n",b4K?'4':'1', pbtUID[3], pbtUID[2], pbtUID[1], pbtUID[0]);
|
||||
}
|
||||
}
|
||||
|
||||
// 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',bswap32(*((uint32_t *)&pbtUID)));
|
||||
printf("Found MIFARE Classic %cK card with UID: %02x%02x%02x%02x\n",b4K?'4':'1', pbtUID[3], pbtUID[2], pbtUID[1], pbtUID[0]);
|
||||
|
||||
uiBlocks = (b4K)?0xff:0x3f;
|
||||
|
||||
|
|
|
|||
|
|
@ -35,8 +35,6 @@
|
|||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <sys/endian.h>
|
||||
|
||||
#include <nfc/nfc.h>
|
||||
|
||||
#include "mifareultag.h"
|
||||
|
|
@ -217,9 +215,9 @@ int main(int argc, const char* argv[])
|
|||
}
|
||||
|
||||
|
||||
// Get the info from the current tag
|
||||
// Get the info from the current tag (UID is stored little-endian)
|
||||
pbtUID = nti.nai.abtUid;
|
||||
printf("Found MIFARE Ultralight card with uid: %08x\n", bswap32(*((uint32_t *)&pbtUID)));
|
||||
printf("Found MIFARE Ultralight card with uid: %02x%02x%02x%02x\n", pbtUID[3], pbtUID[2], pbtUID[1], pbtUID[0]);
|
||||
|
||||
if (bReadAction)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue