#include #include "nfc-utils.h" static const byte_t OddParity[256] = { 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1 }; byte_t oddparity(const byte_t bt) { return OddParity[bt]; } void oddparity_bytes_ts(const byte_t* pbtData, const size_t szLen, byte_t* pbtPar) { size_t szByteNr; // Calculate the parity bits for the command for (szByteNr=0; szByteNr0) { printf(" INF: "); print_hex(nbi.abtInf,nbi.szInfLen); } printf(" PARAMS: %02x %02x %02x %02x\n",nbi.btParam1,nbi.btParam2,nbi.btParam3,nbi.btParam4); } /** * @brief Tries to parse arguments to find device descriptions. * @return Returns the list of found device descriptions. */ nfc_device_desc_t* parse_device_desc(int argc, const char *argv[], size_t* szFound) { nfc_device_desc_t* pndd = 0; int arg; *szFound = 0; // Get commandline options for (arg=1;arg arg+1) { char buffer[256]; pndd = malloc(sizeof(nfc_device_desc_t)); strncpy(buffer, argv[++arg], 256); // Driver. pndd->pcDriver = (char *)malloc(256); strcpy(pndd->pcDriver, strtok(buffer, ":")); // Port. pndd->pcPort = (char *)malloc(256); strcpy(pndd->pcPort, strtok(NULL, ":")); // Speed. sscanf(strtok(NULL, ":"), "%u", &pndd->uiSpeed); *szFound = 1; } break; } } return pndd; }