From c6c43afc8774aa6bedf52ab506d2a1b272b5d1cf Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Mon, 18 Oct 2010 12:22:04 +0000 Subject: [PATCH] Minor FIXME or XXX removes --- libnfc/chips/pn53x.c | 10 ++++------ libnfc/chips/pn53x.h | 4 ++-- libnfc/drivers/arygon.c | 4 ++-- libnfc/drivers/pn532_uart.c | 4 ++-- libnfc/drivers/pn53x_usb.c | 8 ++++---- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index a8db68e..43873a5 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -1,7 +1,8 @@ /*- * 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 * under the terms of the GNU Lesser General Public License as published by the @@ -32,7 +33,6 @@ #include #include -// FIXME: WTF are doing debug macros in this file? #include #include "pn53x.h" @@ -109,9 +109,8 @@ pn53x_init(nfc_device_t * pnd) return true; } -// XXX: Is this function correctly named ? 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 (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 -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 (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 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 - DBG ("Failed to get firmware revision for: %s", pnd->acName); pnd->pdc->disconnect (pnd); return false; } diff --git a/libnfc/chips/pn53x.h b/libnfc/chips/pn53x.h index 87099e0..e4da7dd 100644 --- a/libnfc/chips/pn53x.h +++ b/libnfc/chips/pn53x.h @@ -169,9 +169,9 @@ typedef enum { } pn53x_target_mode_t; 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); -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); bool pn53x_transceive (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szTx, byte_t * pbtRx, size_t * pszRx); diff --git a/libnfc/drivers/arygon.c b/libnfc/drivers/arygon.c index 4c49537..9f01da2 100644 --- a/libnfc/drivers/arygon.c +++ b/libnfc/drivers/arygon.c @@ -253,7 +253,7 @@ arygon_transceive (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szTx, #endif // 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; szRxBufLen -= sizeof (ack_frame); @@ -270,7 +270,7 @@ arygon_transceive (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szTx, #endif } - if (!pn53x_transceive_check_error_frame_callback (pnd, abtRxBuf, szRxBufLen)) + if (!pn53x_check_error_frame_callback (pnd, abtRxBuf, szRxBufLen)) return false; // When the answer should be ignored, just return a successful result diff --git a/libnfc/drivers/pn532_uart.c b/libnfc/drivers/pn532_uart.c index 715be44..51a163c 100644 --- a/libnfc/drivers/pn532_uart.c +++ b/libnfc/drivers/pn532_uart.c @@ -232,7 +232,7 @@ pn532_uart_transceive (nfc_device_t * pnd, const byte_t * pbtTx, const size_t sz #endif // 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; szRxBufLen -= sizeof (ack_frame); 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; } - if (!pn53x_transceive_check_error_frame_callback (pnd, abtRxBuf, szRxBufLen)) + if (!pn53x_check_error_frame_callback (pnd, abtRxBuf, szRxBufLen)) return false; // When the answer should be ignored, just return a successful result diff --git a/libnfc/drivers/pn53x_usb.c b/libnfc/drivers/pn53x_usb.c index 7a9a5de..3a7c8b8 100644 --- a/libnfc/drivers/pn53x_usb.c +++ b/libnfc/drivers/pn53x_usb.c @@ -229,7 +229,7 @@ pn53x_usb_connect (const nfc_device_desc_t * pndd, const char *target_name, int PRINT_HEX ("RX", abtRx, ret); #endif 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"); usb_close (us.pudh); // 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 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) { 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); #endif - if (!pn53x_transceive_check_ack_frame_callback (pnd, abtRx, ret)) + if (!pn53x_check_ack_frame_callback (pnd, abtRx, ret)) return false; 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 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; // When the answer should be ignored, just return a succesful result