Minor FIXME or XXX removes

This commit is contained in:
Romuald Conty 2010-10-18 12:22:04 +00:00
parent 65da34398d
commit c6c43afc87
5 changed files with 14 additions and 16 deletions

View file

@ -1,7 +1,8 @@
/*- /*-
* Public platform independent Near Field Communication (NFC) library * Public platform independent Near Field Communication (NFC) library
* *
* Copyright (C) 2009, 2010, Roel Verdult, Romuald Conty * Copyright (C) 2009, Roel Verdult, Romuald Conty
* Copyright (C) 2010, Roel Verdult, Romuald Conty, Romain Tartière
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the * under the terms of the GNU Lesser General Public License as published by the
@ -32,7 +33,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <nfc/nfc.h> #include <nfc/nfc.h>
// FIXME: WTF are doing debug macros in this file?
#include <nfc/nfc-messages.h> #include <nfc/nfc-messages.h>
#include "pn53x.h" #include "pn53x.h"
@ -109,9 +109,8 @@ pn53x_init(nfc_device_t * pnd)
return true; return true;
} }
// XXX: Is this function correctly named ?
bool bool
pn53x_transceive_check_ack_frame_callback (nfc_device_t * pnd, const byte_t * pbtRxFrame, const size_t szRxFrameLen) pn53x_check_ack_frame_callback (nfc_device_t * pnd, const byte_t * pbtRxFrame, const size_t szRxFrameLen)
{ {
if (szRxFrameLen >= sizeof (pn53x_ack_frame)) { if (szRxFrameLen >= sizeof (pn53x_ack_frame)) {
if (0 == memcmp (pbtRxFrame, pn53x_ack_frame, sizeof (pn53x_ack_frame))) { if (0 == memcmp (pbtRxFrame, pn53x_ack_frame, sizeof (pn53x_ack_frame))) {
@ -135,7 +134,7 @@ pn53x_transceive_check_ack_frame_callback (nfc_device_t * pnd, const byte_t * pb
} }
bool bool
pn53x_transceive_check_error_frame_callback (nfc_device_t * pnd, const byte_t * pbtRxFrame, const size_t szRxFrameLen) pn53x_check_error_frame_callback (nfc_device_t * pnd, const byte_t * pbtRxFrame, const size_t szRxFrameLen)
{ {
if (szRxFrameLen >= sizeof (pn53x_error_frame)) { if (szRxFrameLen >= sizeof (pn53x_error_frame)) {
if (0 == memcmp (pbtRxFrame, pn53x_error_frame, sizeof (pn53x_error_frame))) { if (0 == memcmp (pbtRxFrame, pn53x_error_frame, sizeof (pn53x_error_frame))) {
@ -757,7 +756,6 @@ pn53x_get_firmware_version (nfc_device_t * pnd)
// TODO Read more info here: there are modulation capabilities info to know if ISO14443B is supported // TODO Read more info here: there are modulation capabilities info to know if ISO14443B is supported
if (!pn53x_transceive (pnd, pncmd_get_firmware_version, 2, abtFw, &szFwLen)) { if (!pn53x_transceive (pnd, pncmd_get_firmware_version, 2, abtFw, &szFwLen)) {
// Failed to get firmware revision??, whatever...let's disconnect and clean up and return err // Failed to get firmware revision??, whatever...let's disconnect and clean up and return err
DBG ("Failed to get firmware revision for: %s", pnd->acName);
pnd->pdc->disconnect (pnd); pnd->pdc->disconnect (pnd);
return false; return false;
} }

View file

@ -169,9 +169,9 @@ typedef enum {
} pn53x_target_mode_t; } pn53x_target_mode_t;
bool pn53x_init(nfc_device_t * pnd); bool pn53x_init(nfc_device_t * pnd);
bool pn53x_transceive_check_ack_frame_callback (nfc_device_t * pnd, const byte_t * pbtRxFrame, bool pn53x_check_ack_frame_callback (nfc_device_t * pnd, const byte_t * pbtRxFrame,
const size_t szRxFrameLen); const size_t szRxFrameLen);
bool pn53x_transceive_check_error_frame_callback (nfc_device_t * pnd, const byte_t * pbtRxFrame, bool pn53x_check_error_frame_callback (nfc_device_t * pnd, const byte_t * pbtRxFrame,
const size_t szRxFrameLen); const size_t szRxFrameLen);
bool pn53x_transceive (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szTx, byte_t * pbtRx, bool pn53x_transceive (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szTx, byte_t * pbtRx,
size_t * pszRx); size_t * pszRx);

View file

@ -253,7 +253,7 @@ arygon_transceive (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szTx,
#endif #endif
// WARN: UART is a per byte reception, so you usually receive ACK and next frame the same time // WARN: UART is a per byte reception, so you usually receive ACK and next frame the same time
if (!pn53x_transceive_check_ack_frame_callback (pnd, abtRxBuf, szRxBufLen)) if (!pn53x_check_ack_frame_callback (pnd, abtRxBuf, szRxBufLen))
return false; return false;
szRxBufLen -= sizeof (ack_frame); szRxBufLen -= sizeof (ack_frame);
@ -270,7 +270,7 @@ arygon_transceive (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szTx,
#endif #endif
} }
if (!pn53x_transceive_check_error_frame_callback (pnd, abtRxBuf, szRxBufLen)) if (!pn53x_check_error_frame_callback (pnd, abtRxBuf, szRxBufLen))
return false; return false;
// When the answer should be ignored, just return a successful result // When the answer should be ignored, just return a successful result

View file

@ -232,7 +232,7 @@ pn532_uart_transceive (nfc_device_t * pnd, const byte_t * pbtTx, const size_t sz
#endif #endif
// WARN: UART is a per byte reception, so you usually receive ACK and next frame the same time // WARN: UART is a per byte reception, so you usually receive ACK and next frame the same time
if (!pn53x_transceive_check_ack_frame_callback (pnd, abtRxBuf, szRxBufLen)) if (!pn53x_check_ack_frame_callback (pnd, abtRxBuf, szRxBufLen))
return false; return false;
szRxBufLen -= sizeof (ack_frame); szRxBufLen -= sizeof (ack_frame);
memmove (abtRxBuf, abtRxBuf + sizeof (ack_frame), szRxBufLen); memmove (abtRxBuf, abtRxBuf + sizeof (ack_frame), szRxBufLen);
@ -258,7 +258,7 @@ pn532_uart_transceive (nfc_device_t * pnd, const byte_t * pbtTx, const size_t sz
return false; return false;
} }
if (!pn53x_transceive_check_error_frame_callback (pnd, abtRxBuf, szRxBufLen)) if (!pn53x_check_error_frame_callback (pnd, abtRxBuf, szRxBufLen))
return false; return false;
// When the answer should be ignored, just return a successful result // When the answer should be ignored, just return a successful result

View file

@ -229,7 +229,7 @@ pn53x_usb_connect (const nfc_device_desc_t * pndd, const char *target_name, int
PRINT_HEX ("RX", abtRx, ret); PRINT_HEX ("RX", abtRx, ret);
#endif #endif
if (ret == 6) { // we got the ACK/NACK properly if (ret == 6) { // we got the ACK/NACK properly
if (!pn53x_transceive_check_ack_frame_callback (pnd, abtRx, ret)) { if (!pn53x_check_ack_frame_callback (pnd, abtRx, ret)) {
DBG ("usb_bulk_read failed getting ACK"); DBG ("usb_bulk_read failed getting ACK");
usb_close (us.pudh); usb_close (us.pudh);
// we failed to use the specified device // we failed to use the specified device
@ -312,7 +312,7 @@ pn53x_usb_transceive (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szT
#endif #endif
ret = usb_bulk_write (pus->pudh, pus->uiEndPointOut, (char *) abtTx, szTx + 7, USB_TIMEOUT); ret = usb_bulk_write (pus->pudh, pus->uiEndPointOut, (char *) abtTx, szTx + 7, USB_TIMEOUT);
// XXX This little hack is a well know problem of libusb, see http://www.libusb.org/ticket/6 for more details // HACK This little hack is a well know problem of USB, see http://www.libusb.org/ticket/6 for more details
if ((ret % pus->wMaxPacketSize) == 0) { if ((ret % pus->wMaxPacketSize) == 0) {
usb_bulk_write (pus->pudh, pus->uiEndPointOut, "\0", 0, USB_TIMEOUT); usb_bulk_write (pus->pudh, pus->uiEndPointOut, "\0", 0, USB_TIMEOUT);
} }
@ -335,7 +335,7 @@ pn53x_usb_transceive (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szT
PRINT_HEX ("RX", abtRx, ret); PRINT_HEX ("RX", abtRx, ret);
#endif #endif
if (!pn53x_transceive_check_ack_frame_callback (pnd, abtRx, ret)) if (!pn53x_check_ack_frame_callback (pnd, abtRx, ret))
return false; return false;
ret = usb_bulk_read (pus->pudh, pus->uiEndPointIn, (char *) abtRx, BUFFER_LENGTH, USB_TIMEOUT); ret = usb_bulk_read (pus->pudh, pus->uiEndPointIn, (char *) abtRx, BUFFER_LENGTH, USB_TIMEOUT);
@ -355,7 +355,7 @@ pn53x_usb_transceive (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szT
#endif #endif
usb_bulk_write (pus->pudh, pus->uiEndPointOut, (char *) ack_frame, 6, USB_TIMEOUT); usb_bulk_write (pus->pudh, pus->uiEndPointOut, (char *) ack_frame, 6, USB_TIMEOUT);
if (!pn53x_transceive_check_error_frame_callback (pnd, abtRx, ret)) if (!pn53x_check_error_frame_callback (pnd, abtRx, ret))
return false; return false;
// When the answer should be ignored, just return a succesful result // When the answer should be ignored, just return a succesful result