nfc_abort_command() function returns now 0 on success and libnfc error code on failure and fix some warnings.
This commit is contained in:
parent
8b07a5f4c7
commit
c80ebdca25
10 changed files with 14 additions and 14 deletions
|
@ -63,7 +63,7 @@ void stop_polling (int sig)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
print_usage (char* progname)
|
print_usage (const char* progname)
|
||||||
{
|
{
|
||||||
printf ("usage: %s [-v]\n", progname);
|
printf ("usage: %s [-v]\n", progname);
|
||||||
printf (" -v\t verbose display\n");
|
printf (" -v\t verbose display\n");
|
||||||
|
|
|
@ -66,7 +66,7 @@ extern "C" {
|
||||||
NFC_EXPORT bool nfc_get_default_device (nfc_connstring *connstring);
|
NFC_EXPORT bool nfc_get_default_device (nfc_connstring *connstring);
|
||||||
NFC_EXPORT nfc_device *nfc_connect (const nfc_connstring connstring);
|
NFC_EXPORT nfc_device *nfc_connect (const nfc_connstring connstring);
|
||||||
NFC_EXPORT void nfc_disconnect (nfc_device *pnd);
|
NFC_EXPORT void nfc_disconnect (nfc_device *pnd);
|
||||||
NFC_EXPORT bool nfc_abort_command (nfc_device *pnd);
|
NFC_EXPORT int nfc_abort_command (nfc_device *pnd);
|
||||||
NFC_EXPORT void nfc_list_devices (nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound);
|
NFC_EXPORT void nfc_list_devices (nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound);
|
||||||
NFC_EXPORT int nfc_idle (nfc_device *pnd);
|
NFC_EXPORT int nfc_idle (nfc_device *pnd);
|
||||||
|
|
||||||
|
|
|
@ -538,7 +538,7 @@ arygon_reset_tama (nfc_device *pnd)
|
||||||
return NFC_SUCCESS;
|
return NFC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
int
|
||||||
arygon_abort_command (nfc_device *pnd)
|
arygon_abort_command (nfc_device *pnd)
|
||||||
{
|
{
|
||||||
if (pnd) {
|
if (pnd) {
|
||||||
|
@ -549,7 +549,7 @@ arygon_abort_command (nfc_device *pnd)
|
||||||
DRIVER_DATA (pnd)->abort_flag = true;
|
DRIVER_DATA (pnd)->abort_flag = true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return true;
|
return NFC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -481,7 +481,7 @@ pn532_uart_ack (nfc_device *pnd)
|
||||||
return (uart_send (DRIVER_DATA(pnd)->port, pn53x_ack_frame, sizeof (pn53x_ack_frame), 0));
|
return (uart_send (DRIVER_DATA(pnd)->port, pn53x_ack_frame, sizeof (pn53x_ack_frame), 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
int
|
||||||
pn532_uart_abort_command (nfc_device *pnd)
|
pn532_uart_abort_command (nfc_device *pnd)
|
||||||
{
|
{
|
||||||
if (pnd) {
|
if (pnd) {
|
||||||
|
@ -492,7 +492,7 @@ pn532_uart_abort_command (nfc_device *pnd)
|
||||||
DRIVER_DATA (pnd)->abort_flag = true;
|
DRIVER_DATA (pnd)->abort_flag = true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return true;
|
return NFC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct pn53x_io pn532_uart_io = {
|
const struct pn53x_io pn532_uart_io = {
|
||||||
|
|
|
@ -781,11 +781,11 @@ pn53x_usb_set_property_bool (nfc_device *pnd, const nfc_property property, const
|
||||||
return NFC_SUCCESS;
|
return NFC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
int
|
||||||
pn53x_usb_abort_command (nfc_device *pnd)
|
pn53x_usb_abort_command (nfc_device *pnd)
|
||||||
{
|
{
|
||||||
DRIVER_DATA (pnd)->abort_flag = true;
|
DRIVER_DATA (pnd)->abort_flag = true;
|
||||||
return true;
|
return NFC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct pn53x_io pn53x_usb_io = {
|
const struct pn53x_io pn53x_usb_io = {
|
||||||
|
|
|
@ -151,7 +151,7 @@ struct nfc_driver_t {
|
||||||
int (*device_set_property_bool) (struct nfc_device *pnd, const nfc_property property, const bool bEnable);
|
int (*device_set_property_bool) (struct nfc_device *pnd, const nfc_property property, const bool bEnable);
|
||||||
int (*device_set_property_int) (struct nfc_device *pnd, const nfc_property property, const int value);
|
int (*device_set_property_int) (struct nfc_device *pnd, const nfc_property property, const int value);
|
||||||
|
|
||||||
bool (*abort_command) (struct nfc_device *pnd);
|
int (*abort_command) (struct nfc_device *pnd);
|
||||||
int (*idle) (struct nfc_device *pnd);
|
int (*idle) (struct nfc_device *pnd);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -676,7 +676,7 @@ nfc_idle (nfc_device *pnd)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Abort current running command
|
* @brief Abort current running command
|
||||||
* @return Returns \c true if action was successfully performed; otherwise returns \c false.
|
* @return Returns 0 on success, otherwise returns libnfc's error code.
|
||||||
*
|
*
|
||||||
* @param pnd \a nfc_device struct pointer that represent currently used device
|
* @param pnd \a nfc_device struct pointer that represent currently used device
|
||||||
*
|
*
|
||||||
|
@ -685,7 +685,7 @@ nfc_idle (nfc_device *pnd)
|
||||||
*
|
*
|
||||||
* @note The blocking function (ie. nfc_target_init()) will failed with DEABORT error.
|
* @note The blocking function (ie. nfc_target_init()) will failed with DEABORT error.
|
||||||
*/
|
*/
|
||||||
bool
|
int
|
||||||
nfc_abort_command (nfc_device *pnd)
|
nfc_abort_command (nfc_device *pnd)
|
||||||
{
|
{
|
||||||
HAL (abort_command, pnd);
|
HAL (abort_command, pnd);
|
||||||
|
|
|
@ -54,7 +54,7 @@ nfc_initiator_mifare_cmd (nfc_device *pnd, const mifare_cmd mc, const uint8_t ui
|
||||||
size_t szRx = sizeof(abtRx);
|
size_t szRx = sizeof(abtRx);
|
||||||
size_t szParamLen;
|
size_t szParamLen;
|
||||||
uint8_t abtCmd[265];
|
uint8_t abtCmd[265];
|
||||||
bool bEasyFraming;
|
//bool bEasyFraming;
|
||||||
|
|
||||||
abtCmd[0] = mc; // The MIFARE Classic command
|
abtCmd[0] = mc; // The MIFARE Classic command
|
||||||
abtCmd[1] = ui8Block; // The block address (1K=0x00..0x39, 4K=0x00..0xff)
|
abtCmd[1] = ui8Block; // The block address (1K=0x00..0x39, 4K=0x00..0xff)
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
static nfc_device *pnd;
|
static nfc_device *pnd;
|
||||||
|
|
||||||
void
|
void
|
||||||
print_usage (char* progname)
|
print_usage (const char* progname)
|
||||||
{
|
{
|
||||||
printf ("usage: %s [-v]\n", progname);
|
printf ("usage: %s [-v]\n", progname);
|
||||||
printf (" -v\t verbose display\n");
|
printf (" -v\t verbose display\n");
|
||||||
|
|
|
@ -577,7 +577,7 @@ main (int argc, const char *argv[])
|
||||||
uint8_t fileUid[4];
|
uint8_t fileUid[4];
|
||||||
memcpy (fileUid, mtKeys.amb[0].mbm.abtUID, 4);
|
memcpy (fileUid, mtKeys.amb[0].mbm.abtUID, 4);
|
||||||
// Compare if key dump UID is the same as the current tag UID, at least for the first 4 bytes
|
// Compare if key dump UID is the same as the current tag UID, at least for the first 4 bytes
|
||||||
if (memcmp (nt.nti.nai.abtUid, fileUid, 4) != 0) {
|
if (memcmp (pbtUID, fileUid, 4) != 0) {
|
||||||
printf ("Expected MIFARE Classic card with UID starting as: %02x%02x%02x%02x\n",
|
printf ("Expected MIFARE Classic card with UID starting as: %02x%02x%02x%02x\n",
|
||||||
fileUid[0], fileUid[1], fileUid[2], fileUid[3]);
|
fileUid[0], fileUid[1], fileUid[2], fileUid[3]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue