Change byte_t type to uint8_t (Fixes Issue 147)
This commit is contained in:
parent
ce846931bc
commit
784a2f86a2
43 changed files with 442 additions and 444 deletions
|
|
@ -51,14 +51,14 @@
|
|||
|
||||
#define MAX_FRAME_LEN 264
|
||||
|
||||
static byte_t abtRx[MAX_FRAME_LEN];
|
||||
static uint8_t abtRx[MAX_FRAME_LEN];
|
||||
static size_t szRxBits;
|
||||
static size_t szRx = sizeof(abtRx);
|
||||
static byte_t abtRawUid[12];
|
||||
static byte_t abtAtqa[2];
|
||||
static byte_t abtSak;
|
||||
static byte_t abtAts[MAX_FRAME_LEN];
|
||||
static byte_t szAts = 0;
|
||||
static uint8_t abtRawUid[12];
|
||||
static uint8_t abtAtqa[2];
|
||||
static uint8_t abtSak;
|
||||
static uint8_t abtAts[MAX_FRAME_LEN];
|
||||
static uint8_t szAts = 0;
|
||||
static size_t szCL = 1;//Always start with Cascade Level 1 (CL1)
|
||||
static nfc_device *pnd;
|
||||
|
||||
|
|
@ -67,15 +67,15 @@ bool force_rats = false;
|
|||
bool iso_ats_supported = false;
|
||||
|
||||
// ISO14443A Anti-Collision Commands
|
||||
byte_t abtReqa[1] = { 0x26 };
|
||||
byte_t abtSelectAll[2] = { 0x93, 0x20 };
|
||||
byte_t abtSelectTag[9] = { 0x93, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
byte_t abtRats[4] = { 0xe0, 0x50, 0x00, 0x00 };
|
||||
byte_t abtHalt[4] = { 0x50, 0x00, 0x00, 0x00 };
|
||||
uint8_t abtReqa[1] = { 0x26 };
|
||||
uint8_t abtSelectAll[2] = { 0x93, 0x20 };
|
||||
uint8_t abtSelectTag[9] = { 0x93, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
uint8_t abtRats[4] = { 0xe0, 0x50, 0x00, 0x00 };
|
||||
uint8_t abtHalt[4] = { 0x50, 0x00, 0x00, 0x00 };
|
||||
#define CASCADE_BIT 0x04
|
||||
|
||||
static bool
|
||||
transmit_bits (const byte_t * pbtTx, const size_t szTxBits)
|
||||
transmit_bits (const uint8_t * pbtTx, const size_t szTxBits)
|
||||
{
|
||||
// Show transmitted command
|
||||
if (!quiet_output) {
|
||||
|
|
@ -97,7 +97,7 @@ transmit_bits (const byte_t * pbtTx, const size_t szTxBits)
|
|||
|
||||
|
||||
static bool
|
||||
transmit_bytes (const byte_t * pbtTx, const size_t szTx)
|
||||
transmit_bytes (const uint8_t * pbtTx, const size_t szTx)
|
||||
{
|
||||
// Show transmitted command
|
||||
if (!quiet_output) {
|
||||
|
|
|
|||
|
|
@ -63,9 +63,9 @@ int
|
|||
main (int argc, const char *argv[])
|
||||
{
|
||||
nfc_target nt;
|
||||
byte_t abtRx[MAX_FRAME_LEN];
|
||||
uint8_t abtRx[MAX_FRAME_LEN];
|
||||
size_t szRx = sizeof(abtRx);
|
||||
byte_t abtTx[] = "Hello World!";
|
||||
uint8_t abtTx[] = "Hello World!";
|
||||
|
||||
if (argc > 1) {
|
||||
printf ("Usage: %s\n", argv[0]);
|
||||
|
|
|
|||
|
|
@ -61,10 +61,10 @@ void stop_dep_communication (int sig)
|
|||
int
|
||||
main (int argc, const char *argv[])
|
||||
{
|
||||
byte_t abtRx[MAX_FRAME_LEN];
|
||||
uint8_t abtRx[MAX_FRAME_LEN];
|
||||
size_t szRx = sizeof(abtRx);
|
||||
size_t szDeviceFound;
|
||||
byte_t abtTx[] = "Hello Mars!";
|
||||
uint8_t abtTx[] = "Hello Mars!";
|
||||
#define MAX_DEVICE_COUNT 2
|
||||
nfc_connstring connstrings[MAX_DEVICE_COUNT];
|
||||
nfc_list_devices (connstrings, MAX_DEVICE_COUNT, &szDeviceFound);
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ static uint8_t __nfcforum_tag2_memory_area[] = {
|
|||
|
||||
#define HALT 0x50
|
||||
int
|
||||
nfcforum_tag2_io (struct nfc_emulator *emulator, const byte_t *data_in, const size_t data_in_len, byte_t *data_out, const size_t data_out_len)
|
||||
nfcforum_tag2_io (struct nfc_emulator *emulator, const uint8_t *data_in, const size_t data_in_len, uint8_t *data_out, const size_t data_out_len)
|
||||
{
|
||||
int res = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@
|
|||
#define MAX_FRAME_LEN (264)
|
||||
#define SAK_ISO14443_4_COMPLIANT 0x20
|
||||
|
||||
static byte_t abtRx[MAX_FRAME_LEN];
|
||||
static uint8_t abtRx[MAX_FRAME_LEN];
|
||||
static size_t szRx = sizeof(abtRx);
|
||||
static nfc_device *pnd;
|
||||
static bool quiet_output = false;
|
||||
|
|
@ -71,7 +71,7 @@ intr_hdlr (void)
|
|||
}
|
||||
|
||||
bool
|
||||
target_io( nfc_target * pnt, const byte_t * pbtInput, const size_t szInput, byte_t * pbtOutput, size_t *pszOutput )
|
||||
target_io( nfc_target * pnt, const uint8_t * pbtInput, const size_t szInput, uint8_t * pbtOutput, size_t *pszOutput )
|
||||
{
|
||||
bool loop = true;
|
||||
*pszOutput = 0;
|
||||
|
|
@ -137,7 +137,7 @@ bool
|
|||
nfc_target_emulate_tag(nfc_device* pnd, nfc_target * pnt)
|
||||
{
|
||||
size_t szTx;
|
||||
byte_t abtTx[MAX_FRAME_LEN];
|
||||
uint8_t abtTx[MAX_FRAME_LEN];
|
||||
bool loop = true;
|
||||
|
||||
if (!nfc_target_init (pnd, pnt, abtRx, &szRx)) {
|
||||
|
|
|
|||
|
|
@ -56,14 +56,14 @@
|
|||
|
||||
#define MAX_FRAME_LEN 264
|
||||
|
||||
static byte_t abtRecv[MAX_FRAME_LEN];
|
||||
static uint8_t abtRecv[MAX_FRAME_LEN];
|
||||
static size_t szRecvBits;
|
||||
static nfc_device *pnd;
|
||||
|
||||
// ISO14443A Anti-Collision response
|
||||
byte_t abtAtqa[2] = { 0x04, 0x00 };
|
||||
byte_t abtUidBcc[5] = { 0xDE, 0xAD, 0xBE, 0xEF, 0x62 };
|
||||
byte_t abtSak[9] = { 0x08, 0xb6, 0xdd };
|
||||
uint8_t abtAtqa[2] = { 0x04, 0x00 };
|
||||
uint8_t abtUidBcc[5] = { 0xDE, 0xAD, 0xBE, 0xEF, 0x62 };
|
||||
uint8_t abtSak[9] = { 0x08, 0xb6, 0xdd };
|
||||
|
||||
void
|
||||
intr_hdlr (void)
|
||||
|
|
@ -88,7 +88,7 @@ print_usage (char *argv[])
|
|||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
byte_t *pbtTx = NULL;
|
||||
uint8_t *pbtTx = NULL;
|
||||
size_t szTxBits;
|
||||
bool quiet_output = false;
|
||||
|
||||
|
|
@ -104,12 +104,12 @@ main (int argc, char *argv[])
|
|||
printf ("Quiet mode.\n");
|
||||
quiet_output = true;
|
||||
} else if ((arg == argc - 1) && (strlen (argv[arg]) == 8)) { // See if UID was specified as HEX string
|
||||
byte_t abtTmp[3] = { 0x00, 0x00, 0x00 };
|
||||
uint8_t abtTmp[3] = { 0x00, 0x00, 0x00 };
|
||||
printf ("[+] Using UID: %s\n", argv[arg]);
|
||||
abtUidBcc[4] = 0x00;
|
||||
for (i = 0; i < 4; ++i) {
|
||||
memcpy (abtTmp, argv[arg] + i * 2, 2);
|
||||
abtUidBcc[i] = (byte_t) strtol ((char *) abtTmp, NULL, 16);
|
||||
abtUidBcc[i] = (uint8_t) strtol ((char *) abtTmp, NULL, 16);
|
||||
abtUidBcc[4] ^= abtUidBcc[i];
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -50,11 +50,11 @@
|
|||
#define MAX_FRAME_LEN 264
|
||||
#define MAX_DEVICE_COUNT 2
|
||||
|
||||
static byte_t abtReaderRx[MAX_FRAME_LEN];
|
||||
static byte_t abtReaderRxPar[MAX_FRAME_LEN];
|
||||
static uint8_t abtReaderRx[MAX_FRAME_LEN];
|
||||
static uint8_t abtReaderRxPar[MAX_FRAME_LEN];
|
||||
static size_t szReaderRxBits;
|
||||
static byte_t abtTagRx[MAX_FRAME_LEN];
|
||||
static byte_t abtTagRxPar[MAX_FRAME_LEN];
|
||||
static uint8_t abtTagRx[MAX_FRAME_LEN];
|
||||
static uint8_t abtTagRxPar[MAX_FRAME_LEN];
|
||||
static size_t szTagRxBits;
|
||||
static nfc_device *pndReader;
|
||||
static nfc_device *pndTag;
|
||||
|
|
|
|||
|
|
@ -58,11 +58,11 @@ main (int argc, const char *argv[])
|
|||
const char *acLibnfcVersion;
|
||||
bool result;
|
||||
|
||||
byte_t abtRx[PN53x_EXTENDED_FRAME__DATA_MAX_LEN];
|
||||
uint8_t abtRx[PN53x_EXTENDED_FRAME__DATA_MAX_LEN];
|
||||
size_t szRx = sizeof(abtRx);
|
||||
const byte_t pncmd_diagnose_communication_line_test[] = { Diagnose, 0x00, 0x06, 'l', 'i', 'b', 'n', 'f', 'c' };
|
||||
const byte_t pncmd_diagnose_rom_test[] = { Diagnose, 0x01 };
|
||||
const byte_t pncmd_diagnose_ram_test[] = { Diagnose, 0x02 };
|
||||
const uint8_t pncmd_diagnose_communication_line_test[] = { Diagnose, 0x00, 0x06, 'l', 'i', 'b', 'n', 'f', 'c' };
|
||||
const uint8_t pncmd_diagnose_rom_test[] = { Diagnose, 0x01 };
|
||||
const uint8_t pncmd_diagnose_ram_test[] = { Diagnose, 0x02 };
|
||||
|
||||
if (argc > 1) {
|
||||
errx (1, "usage: %s", argv[0]);
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ main (int argc, const char *argv[])
|
|||
|
||||
case PSM_DUAL_CARD:
|
||||
{
|
||||
byte_t abtRx[MAX_FRAME_LEN];
|
||||
uint8_t abtRx[MAX_FRAME_LEN];
|
||||
size_t szRx = sizeof(abtRx);
|
||||
|
||||
nfc_target nt = {
|
||||
|
|
|
|||
|
|
@ -72,8 +72,8 @@
|
|||
int main(int argc, const char* argv[])
|
||||
{
|
||||
nfc_device* pnd;
|
||||
byte_t abtRx[MAX_FRAME_LEN];
|
||||
byte_t abtTx[MAX_FRAME_LEN];
|
||||
uint8_t abtRx[MAX_FRAME_LEN];
|
||||
uint8_t abtTx[MAX_FRAME_LEN];
|
||||
size_t szRx = sizeof(abtRx);
|
||||
size_t szTx;
|
||||
extern FILE* stdin;
|
||||
|
|
@ -154,7 +154,7 @@ int main(int argc, const char* argv[])
|
|||
szTx = 0;
|
||||
for(int i = 0; i<MAX_FRAME_LEN-10; i++) {
|
||||
int size;
|
||||
byte_t byte;
|
||||
uint8_t byte;
|
||||
while (isspace(cmd[offset])) {
|
||||
offset++;
|
||||
}
|
||||
|
|
@ -175,7 +175,7 @@ int main(int argc, const char* argv[])
|
|||
continue;
|
||||
}
|
||||
printf("Tx: ");
|
||||
print_hex((byte_t*)abtTx,szTx);
|
||||
print_hex((uint8_t*)abtTx,szTx);
|
||||
|
||||
szRx = sizeof(abtRx);
|
||||
if (!pn53x_transceive (pnd, abtTx, szTx, abtRx, &szRx, NULL)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue