Remove unused prototypes in drivers/*.h

This commit is contained in:
Romuald Conty 2012-10-21 14:10:43 +00:00
parent 9afa3c6598
commit 6bc9d64fbb
12 changed files with 139 additions and 194 deletions

View file

@ -81,8 +81,10 @@
#define LOG_CATEGORY "libnfc.driver.acr122"
// Internal data struct
const struct pn53x_io acr122_pcsc_io;
// Prototypes
char *acr122_pcsc_firmware(nfc_device *pnd);
const char *supported_devices[] = {
@ -140,7 +142,7 @@ acr122_pcsc_free_scardcontext(void)
* @param pszDeviceFound number of devices found.
* @return true if succeeded, false otherwise.
*/
bool
static bool
acr122_pcsc_probe(nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound)
{
size_t szPos = 0;
@ -233,7 +235,7 @@ acr122_pcsc_connstring_decode(const nfc_connstring connstring, struct acr122_pcs
return 3;
}
nfc_device *
static nfc_device *
acr122_pcsc_open(const nfc_connstring connstring)
{
struct acr122_pcsc_descriptor ndd;
@ -324,7 +326,7 @@ error:
return NULL;
}
void
static void
acr122_pcsc_close(nfc_device *pnd)
{
SCardDisconnect(DRIVER_DATA(pnd)->hCard, SCARD_LEAVE_CARD);
@ -334,7 +336,7 @@ acr122_pcsc_close(nfc_device *pnd)
nfc_device_free(pnd);
}
int
static int
acr122_pcsc_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int timeout)
{
// FIXME: timeout is not handled
@ -405,7 +407,7 @@ acr122_pcsc_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, i
return NFC_SUCCESS;
}
int
static int
acr122_pcsc_receive(nfc_device *pnd, uint8_t *pbtData, const size_t szData, int timeout)
{
// FIXME: timeout is not handled

View file

@ -1,4 +1,4 @@
/**
/*-
* Public platform independent Near Field Communication (NFC) library
*
* Copyright (C) 2009 Roel Verdult
@ -17,24 +17,17 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*
*/
/**
* @file acr122_pcsc.h
* @brief Driver for ACR122 devices (behind PC/SC daemon)
*/
#ifndef __NFC_DRIVER_ACR122_PCSC_H__
# define __NFC_DRIVER_ACR122_PCSC_H__
#define __NFC_DRIVER_ACR122_PCSC_H__
# include <nfc/nfc-types.h>
bool acr122_pcsc_probe(nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound);
// Functions used by developer to handle connection to this device
nfc_device *acr122_pcsc_open(const nfc_connstring connstring);
int acr122_pcsc_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int timeout);
int acr122_pcsc_receive(nfc_device *pnd, uint8_t *pbtData, const size_t szData, int timeout);
void acr122_pcsc_close(nfc_device *pnd);
#include <nfc/nfc-types.h>
extern const struct nfc_driver acr122_pcsc_driver;

View file

@ -3,7 +3,7 @@
*
* Copyright (C) 2009 Roel Verdult
* Copyright (C) 2010, 2011 Romain Tartière
* Copyright (C) 2010, 2011 Romuald Conty
* Copyright (C) 2010, 2011, 2012 Romuald Conty
*
* 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
@ -201,11 +201,12 @@ const uint8_t acr122_usb_frame_template[] = {
// APDUs instructions
#define APDU_GetAdditionnalData 0xc0
// Internal data struct
const struct pn53x_io acr122_usb_io;
bool acr122_usb_get_usb_device_name(struct usb_device *dev, usb_dev_handle *udev, char *buffer, size_t len);
int acr122_usb_init(nfc_device *pnd);
int acr122_usb_ack(nfc_device *pnd);
// Prototypes
static int acr122_usb_init(nfc_device *pnd);
static int acr122_usb_ack(nfc_device *pnd);
static int acr122_usb_send_apdu(nfc_device *pnd,
const uint8_t ins, const uint8_t p1, const uint8_t p2, const uint8_t *const data, size_t data_len, const uint8_t le,
uint8_t *out, const size_t out_size);
@ -302,8 +303,8 @@ acr122_usb_get_end_points(struct usb_device *dev, struct acr122_usb_data *data)
}
}
bool
acr122_usb_probe(nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound)
static bool
acr122_usb_probe(nfc_connstring connstrings[], size_t connstrings_len, size_t *device_found)
{
usb_init();
@ -323,7 +324,7 @@ acr122_usb_probe(nfc_connstring connstrings[], size_t connstrings_len, size_t *p
return false;
}
*pszDeviceFound = 0;
*device_found = 0;
uint32_t uiBusIndex = 0;
struct usb_bus *bus;
@ -348,13 +349,13 @@ acr122_usb_probe(nfc_connstring connstrings[], size_t connstrings_len, size_t *p
usb_dev_handle *udev = usb_open(dev);
// Set configuration
// acr122_usb_get_usb_device_name (dev, udev, pnddDevices[*pszDeviceFound].acDevice, sizeof (pnddDevices[*pszDeviceFound].acDevice));
// acr122_usb_get_usb_device_name (dev, udev, pnddDevices[*device_found].acDevice, sizeof (pnddDevices[*device_found].acDevice));
log_put(LOG_CATEGORY, NFC_PRIORITY_TRACE, "device found: Bus %s Device %s Name %s", bus->dirname, dev->filename, acr122_usb_supported_devices[n].name);
usb_close(udev);
snprintf(connstrings[*pszDeviceFound], sizeof(nfc_connstring), "%s:%s:%s", ACR122_USB_DRIVER_NAME, bus->dirname, dev->filename);
(*pszDeviceFound)++;
snprintf(connstrings[*device_found], sizeof(nfc_connstring), "%s:%s:%s", ACR122_USB_DRIVER_NAME, bus->dirname, dev->filename);
(*device_found)++;
// Test if we reach the maximum "wanted" devices
if ((*pszDeviceFound) == connstrings_len) {
if ((*device_found) == connstrings_len) {
return true;
}
}
@ -397,7 +398,7 @@ acr122_usb_connstring_decode(const nfc_connstring connstring, struct acr122_usb_
return res;
}
bool
static bool
acr122_usb_get_usb_device_name(struct usb_device *dev, usb_dev_handle *udev, char *buffer, size_t len)
{
*buffer = '\0';
@ -604,7 +605,7 @@ acr122_build_frame_from_tama(nfc_device *pnd, const uint8_t *tama, const size_t
return (sizeof(struct ccid_header) + sizeof(struct apdu_header) + 1 + tama_len);
}
int
static int
acr122_usb_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, const int timeout)
{
int res;
@ -621,7 +622,7 @@ acr122_usb_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, co
}
#define USB_TIMEOUT_PER_PASS 200
int
static int
acr122_usb_receive(nfc_device *pnd, uint8_t *pbtData, const size_t szDataLen, const int timeout)
{
off_t offset = 0;

View file

@ -1,8 +1,9 @@
/**
/*-
* Public platform independent Near Field Communication (NFC) library
*
* Copyright (C) 2009 Roel Verdult
* Copyright (C) 2011 Romain Tartière
* Copyright (C) 2011, 2012 Romuald Conty
*
* 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
@ -16,24 +17,17 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*
*/
/**
* @file acr122_usb.h
* @brief Driver for ACR122 devices using direct USB connection (without PCSC)
*/
#ifndef __NFC_DRIVER_ACR122_USB_H__
# define __NFC_DRIVER_ACR122_USB_H__
#define __NFC_DRIVER_ACR122_USB_H__
# include <sys/time.h>
# include <nfc/nfc-types.h>
bool acr122_usb_probe(nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound);
nfc_device *acr122_usb_connect(const nfc_connstring connstring);
int acr122_usb_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int timeout);
int acr122_usb_receive(nfc_device *pnd, uint8_t *pbtData, const size_t szData, int timeout);
void acr122_usb_disconnect(nfc_device *pnd);
#include <nfc/nfc-types.h>
extern const struct nfc_driver acr122_usb_driver;

View file

@ -2,6 +2,7 @@
* Public platform independent Near Field Communication (NFC) library
*
* Copyright (C) 2011 Anugrah Redja Kusuma <anugrah.redja@gmail.com>
* Copyright (C) 2012 Romuald Conty
*
* 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
@ -46,6 +47,7 @@
#define ACR122S_DRIVER_NAME "ACR122S"
#define LOG_CATEGORY "libnfc.driver.acr122s"
// Internal data structs
struct acr122s_data {
serial_port port;
uint8_t seq;
@ -151,29 +153,8 @@ struct apdu_header {
#pragma pack(pop)
#define TRACE do { printf("%s:%d\n", __func__, __LINE__); } while (0)
#define DRIVER_DATA(pnd) ((struct acr122s_data *) (pnd->driver_data))
/**
* Print a debuggin hex string to stdout.
*
* @param caption is buffer label
* @param buf is buffer to be print
* @param buf_len is buffer length
*/
#if 0
static void
print_hex(const char *caption, uint8_t *buf, size_t buf_len)
{
printf("%s:", caption);
for (size_t i = 0; i < buf_len; i++) {
printf(" %02x", buf[i]);
}
puts("");
}
#endif
/**
* Fix a command frame with a valid prefix, checksum, and suffix.
*
@ -466,7 +447,7 @@ acr122s_connstring_decode(const nfc_connstring connstring, struct acr122s_descri
return 3;
}
bool
static bool
acr122s_probe(nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound)
{
/** @note: Due to UART bus we can't know if its really an ACR122S without
@ -545,7 +526,23 @@ acr122s_probe(nfc_connstring connstrings[], size_t connstrings_len, size_t *pszD
return true;
}
nfc_device *
static void
acr122s_close(nfc_device *pnd)
{
acr122s_deactivate_sam(pnd);
uart_close(DRIVER_DATA(pnd)->port);
#ifndef WIN32
// Release file descriptors used for abort mecanism
close(DRIVER_DATA(pnd)->abort_fds[0]);
close(DRIVER_DATA(pnd)->abort_fds[1]);
#endif
pn53x_data_free(pnd);
nfc_device_free(pnd);
}
static nfc_device *
acr122s_open(const nfc_connstring connstring)
{
serial_port sp;
@ -632,23 +629,7 @@ acr122s_open(const nfc_connstring connstring)
return pnd;
}
void
acr122s_close(nfc_device *pnd)
{
acr122s_deactivate_sam(pnd);
uart_close(DRIVER_DATA(pnd)->port);
#ifndef WIN32
// Release file descriptors used for abort mecanism
close(DRIVER_DATA(pnd)->abort_fds[0]);
close(DRIVER_DATA(pnd)->abort_fds[1]);
#endif
pn53x_data_free(pnd);
nfc_device_free(pnd);
}
int
static int
acr122s_send(nfc_device *pnd, const uint8_t *buf, const size_t buf_len, int timeout)
{
uart_flush_input(DRIVER_DATA(pnd)->port);
@ -665,7 +646,7 @@ acr122s_send(nfc_device *pnd, const uint8_t *buf, const size_t buf_len, int time
return NFC_SUCCESS;
}
int
static int
acr122s_receive(nfc_device *pnd, uint8_t *buf, size_t buf_len, int timeout)
{
void *abort_p;

View file

@ -2,6 +2,7 @@
* Public platform independent Near Field Communication (NFC) library
*
* Copyright (C) 2011 Anugrah Redja Kusuma <anugrah.redja@gmail.com>
* Copyright (C) 2012 Romuald Conty
*
* 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
@ -25,17 +26,8 @@
#ifndef __NFC_DRIVER_ACR122S_H__
#define __NFC_DRIVER_ACR122S_H__
#include <sys/time.h>
#include <nfc/nfc-types.h>
bool acr122s_probe(nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound);
nfc_device *acr122s_open(const nfc_connstring connstring);
void acr122s_close(nfc_device *pnd);
int acr122s_send(nfc_device *pnd, const uint8_t *buf, size_t buf_len, int timeout);
int acr122s_receive(nfc_device *pnd, uint8_t *buf, size_t buf_len, int timeout);
extern const struct nfc_driver acr122s_driver;
#endif

View file

@ -3,7 +3,7 @@
*
* Copyright (C) 2009 Roel Verdult
* Copyright (C) 2011 Romain Tartière
* Copyright (C) 2010, 2011 Romuald Conty
* Copyright (C) 2010, 2011, 2012 Romuald Conty
*
* 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
@ -70,6 +70,7 @@
#define DRIVER_DATA(pnd) ((struct arygon_data*)(pnd->driver_data))
// Internal data structs
const struct pn53x_io arygon_tama_io;
struct arygon_data {
@ -81,14 +82,16 @@ struct arygon_data {
#endif
};
// ARYGON frames
static const uint8_t arygon_error_none[] = "FF000000\x0d\x0a";
static const uint8_t arygon_error_incomplete_command[] = "FF0C0000\x0d\x0a";
static const uint8_t arygon_error_unknown_mode[] = "FF060000\x0d\x0a";
// Prototypes
int arygon_reset_tama(nfc_device *pnd);
void arygon_firmware(nfc_device *pnd, char *str);
bool
static bool
arygon_probe(nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound)
{
/** @note: Due to UART bus we can't know if its really an ARYGON without
@ -215,7 +218,23 @@ arygon_connstring_decode(const nfc_connstring connstring, struct arygon_descript
return 3;
}
nfc_device *
static void
arygon_close(nfc_device *pnd)
{
// Release UART port
uart_close(DRIVER_DATA(pnd)->port);
#ifndef WIN32
// Release file descriptors used for abort mecanism
close(DRIVER_DATA(pnd)->iAbortFds[0]);
close(DRIVER_DATA(pnd)->iAbortFds[1]);
#endif
pn53x_data_free(pnd);
nfc_device_free(pnd);
}
static nfc_device *
arygon_open(const nfc_connstring connstring)
{
struct arygon_descriptor ndd;
@ -287,25 +306,9 @@ arygon_open(const nfc_connstring connstring)
return pnd;
}
void
arygon_close(nfc_device *pnd)
{
// Release UART port
uart_close(DRIVER_DATA(pnd)->port);
#ifndef WIN32
// Release file descriptors used for abort mecanism
close(DRIVER_DATA(pnd)->iAbortFds[0]);
close(DRIVER_DATA(pnd)->iAbortFds[1]);
#endif
pn53x_data_free(pnd);
nfc_device_free(pnd);
}
#define ARYGON_TX_BUFFER_LEN (PN53x_NORMAL_FRAME__DATA_MAX_LEN + PN53x_NORMAL_FRAME__OVERHEAD + 1)
#define ARYGON_RX_BUFFER_LEN (PN53x_EXTENDED_FRAME__DATA_MAX_LEN + PN53x_EXTENDED_FRAME__OVERHEAD)
int
static int
arygon_tama_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int timeout)
{
int res = 0;
@ -366,7 +369,7 @@ arygon_abort(nfc_device *pnd)
return pn53x_check_communication(pnd);
}
int
static int
arygon_tama_receive(nfc_device *pnd, uint8_t *pbtData, const size_t szDataLen, int timeout)
{
uint8_t abtRxBuf[5];

View file

@ -1,9 +1,9 @@
/**
/*-
* Public platform independent Near Field Communication (NFC) library
*
* Copyright (C) 2009 Roel Verdult
* Copyright (C) 2011 Romain Tartière
* Copyright (C) 2010, 2011 Romuald Conty
* Copyright (C) 2010, 2011, 2012 Romuald Conty
*
* 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
@ -17,26 +17,17 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*
*/
/**
* @file arygon.h
* @brief Driver for PN53x-equipped ARYGON device connected using UART
*/
#ifndef __NFC_DRIVER_ARYGON_H__
# define __NFC_DRIVER_ARYGON_H__
#define __NFC_DRIVER_ARYGON_H__
# include <sys/time.h>
# include <nfc/nfc-types.h>
bool arygon_probe(nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound);
nfc_device *arygon_open(const nfc_connstring connstring);
void arygon_close(nfc_device *pnd);
int arygon_tama_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int timeout);
int arygon_tama_receive(nfc_device *pnd, uint8_t *pbtData, const size_t szDat, int timeouta);
#include <nfc/nfc-types.h>
extern const struct nfc_driver arygon_driver;

View file

@ -3,7 +3,7 @@
*
* Copyright (C) 2010 Roel Verdult
* Copyright (C) 2011 Romain Tartière
* Copyright (C) 2010, 2011 Romuald Conty
* Copyright (C) 2010, 2011, 2012 Romuald Conty
*
* 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
@ -47,11 +47,8 @@
#define PN532_UART_DRIVER_NAME "pn532_uart"
#define LOG_CATEGORY "libnfc.driver.pn532_uart"
int pn532_uart_ack(nfc_device *pnd);
int pn532_uart_wakeup(nfc_device *pnd);
// Internal data structs
const struct pn53x_io pn532_uart_io;
struct pn532_uart_data {
serial_port port;
#ifndef WIN32
@ -61,9 +58,13 @@ struct pn532_uart_data {
#endif
};
// Prototypes
int pn532_uart_ack(nfc_device *pnd);
int pn532_uart_wakeup(nfc_device *pnd);
#define DRIVER_DATA(pnd) ((struct pn532_uart_data*)(pnd->driver_data))
bool
static bool
pn532_uart_probe(nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound)
{
/** @note: Due to UART bus we can't know if its really a pn532 without
@ -194,7 +195,23 @@ pn532_connstring_decode(const nfc_connstring connstring, struct pn532_uart_descr
return 3;
}
nfc_device *
static void
pn532_uart_close(nfc_device *pnd)
{
// Release UART port
uart_close(DRIVER_DATA(pnd)->port);
#ifndef WIN32
// Release file descriptors used for abort mecanism
close(DRIVER_DATA(pnd)->iAbortFds[0]);
close(DRIVER_DATA(pnd)->iAbortFds[1]);
#endif
pn53x_data_free(pnd);
nfc_device_free(pnd);
}
static nfc_device *
pn532_uart_open(const nfc_connstring connstring)
{
struct pn532_uart_descriptor ndd;
@ -259,22 +276,6 @@ pn532_uart_open(const nfc_connstring connstring)
return pnd;
}
void
pn532_uart_close(nfc_device *pnd)
{
// Release UART port
uart_close(DRIVER_DATA(pnd)->port);
#ifndef WIN32
// Release file descriptors used for abort mecanism
close(DRIVER_DATA(pnd)->iAbortFds[0]);
close(DRIVER_DATA(pnd)->iAbortFds[1]);
#endif
pn53x_data_free(pnd);
nfc_device_free(pnd);
}
int
pn532_uart_wakeup(nfc_device *pnd)
{
@ -286,7 +287,7 @@ pn532_uart_wakeup(nfc_device *pnd)
}
#define PN532_BUFFER_LEN (PN53x_EXTENDED_FRAME__DATA_MAX_LEN + PN53x_EXTENDED_FRAME__OVERHEAD)
int
static int
pn532_uart_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int timeout)
{
int res = 0;
@ -347,7 +348,7 @@ pn532_uart_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, in
return NFC_SUCCESS;
}
int
static int
pn532_uart_receive(nfc_device *pnd, uint8_t *pbtData, const size_t szDataLen, int timeout)
{
uint8_t abtRxBuf[5];
@ -512,7 +513,7 @@ const struct nfc_driver pn532_uart_driver = {
.strerror = pn53x_strerror,
.initiator_init = pn53x_initiator_init,
.initiator_init_secure_element = pn532_initiator_init_secure_element, // No secure-element support
.initiator_init_secure_element = pn532_initiator_init_secure_element,
.initiator_select_passive_target = pn53x_initiator_select_passive_target,
.initiator_poll_target = pn53x_initiator_poll_target,
.initiator_select_dep_target = pn53x_initiator_select_dep_target,

View file

@ -1,9 +1,9 @@
/**
/*-
* Public platform independent Near Field Communication (NFC) library
*
* Copyright (C) 2010 Roel Verdult
* Copyright (C) 2011 Romain Tartière
* Copyright (C) 2010, 2011 Romuald Conty
* Copyright (C) 2010, 2011, 2012 Romuald Conty
*
* 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
@ -17,25 +17,17 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*
*/
/**
* @file pn532_uart.h
* @brief Driver for PN532 connected in UART (HSU)
*/
#ifndef __NFC_DRIVER_PN532_UART_H__
# define __NFC_DRIVER_PN532_UART_H__
#define __NFC_DRIVER_PN532_UART_H__
# include <sys/time.h>
# include <nfc/nfc-types.h>
bool pn532_uart_probe(nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound);
nfc_device *pn532_uart_open(const nfc_connstring connstring);
void pn532_uart_close(nfc_device *pnd);
int pn532_uart_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int timeout);
int pn532_uart_receive(nfc_device *pnd, uint8_t *pbtData, const size_t szData, int timeout);
#include <nfc/nfc-types.h>
extern const struct nfc_driver pn532_uart_driver;

View file

@ -3,7 +3,7 @@
*
* Copyright (C) 2009 Roel Verdult
* Copyright (C) 2010, 2011 Romain Tartière
* Copyright (C) 2010, 2011 Romuald Conty
* Copyright (C) 2010, 2011, 2012 Romuald Conty
*
* 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
@ -76,6 +76,7 @@ typedef enum {
SONY_RCS360
} pn53x_usb_model;
// Internal data structs
struct pn53x_usb_data {
usb_dev_handle *pudh;
pn53x_usb_model model;
@ -86,6 +87,8 @@ struct pn53x_usb_data {
};
const struct pn53x_io pn53x_usb_io;
// Prototypes
bool pn53x_usb_get_usb_device_name(struct usb_device *dev, usb_dev_handle *udev, char *buffer, size_t len);
int pn53x_usb_init(nfc_device *pnd);
@ -178,7 +181,7 @@ pn53x_usb_get_end_points(struct usb_device *dev, struct pn53x_usb_data *data)
}
}
bool
static bool
pn53x_usb_probe(nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound)
{
usb_init();
@ -308,7 +311,7 @@ pn53x_usb_get_usb_device_name(struct usb_device *dev, usb_dev_handle *udev, char
return false;
}
nfc_device *
static nfc_device *
pn53x_usb_open(const nfc_connstring connstring)
{
nfc_device *pnd = NULL;
@ -439,7 +442,7 @@ free_mem:
return pnd;
}
void
static void
pn53x_usb_close(nfc_device *pnd)
{
pn53x_usb_ack(pnd);
@ -466,7 +469,7 @@ pn53x_usb_close(nfc_device *pnd)
#define PN53X_USB_BUFFER_LEN (PN53x_EXTENDED_FRAME__DATA_MAX_LEN + PN53x_EXTENDED_FRAME__OVERHEAD)
int
static int
pn53x_usb_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, const int timeout)
{
uint8_t abtFrame[PN53X_USB_BUFFER_LEN] = { 0x00, 0x00, 0xff }; // Every packet must start with "00 00 ff"
@ -510,7 +513,7 @@ pn53x_usb_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, con
}
#define USB_TIMEOUT_PER_PASS 200
int
static int
pn53x_usb_receive(nfc_device *pnd, uint8_t *pbtData, const size_t szDataLen, const int timeout)
{
size_t len;

View file

@ -1,8 +1,9 @@
/**
/*-
* Public platform independent Near Field Communication (NFC) library
*
* Copyright (C) 2009 Roel Verdult
* Copyright (C) 2011 Romain Tartière
* Copyright (C) 2010, 2011 Romain Tartière
* Copyright (C) 2010, 2011, 2012 Romuald Conty
*
* 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
@ -16,8 +17,9 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*
*/
/**
* @file pn53x_usb.h
* @brief Drive for PN53x USB devices
*/
@ -25,18 +27,8 @@
#ifndef __NFC_DRIVER_PN53X_USB_H__
#define __NFC_DRIVER_PN53X_USB_H__
#include <sys/time.h>
#include <nfc/nfc-types.h>
#include "nfc-internal.h"
bool pn53x_usb_probe(nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound);
nfc_device *pn53x_usb_open(const nfc_connstring connstring);
int pn53x_usb_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int timeout);
int pn53x_usb_receive(nfc_device *pnd, uint8_t *pbtData, const size_t szData, int timeout);
void pn53x_usb_close(nfc_device *pnd);
extern const struct nfc_driver pn53x_usb_driver;
#endif // ! __NFC_DRIVER_PN53X_USB_H__