configure.ac rework
- Put libusb and PC/SC check in m4 macros. - Suppress --disable-pcsclite and --disable-libusb - Add --with-drivers option: we now could choose which driver to build. without this option a default set is build (ATM all drivers except PN532_UART)
This commit is contained in:
parent
b747573dc7
commit
b55400a0d5
13 changed files with 230 additions and 122 deletions
95
configure.ac
95
configure.ac
|
@ -61,6 +61,9 @@ then
|
||||||
fi
|
fi
|
||||||
AC_SUBST([DEBUG_CFLAGS])
|
AC_SUBST([DEBUG_CFLAGS])
|
||||||
|
|
||||||
|
# Handle --with-drivers option
|
||||||
|
LIBNFC_ARG_WITH_DRIVERS
|
||||||
|
|
||||||
# Serial autoprobing support (default:no)
|
# Serial autoprobing support (default:no)
|
||||||
AC_ARG_ENABLE([serial-autoprobe],AS_HELP_STRING([--enable-serial-autoprobe],[Allow serial ports to be probed (can seriously disturb connected serial devices)]),[enable_serial_autoprobe=$enableval],[enable_serial_autoprobe="no"])
|
AC_ARG_ENABLE([serial-autoprobe],AS_HELP_STRING([--enable-serial-autoprobe],[Allow serial ports to be probed (can seriously disturb connected serial devices)]),[enable_serial_autoprobe=$enableval],[enable_serial_autoprobe="no"])
|
||||||
|
|
||||||
|
@ -72,30 +75,6 @@ then
|
||||||
CFLAGS="$CFLAGS -DSERIAL_AUTOPROBE_ENABLED"
|
CFLAGS="$CFLAGS -DSERIAL_AUTOPROBE_ENABLED"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# PCSC-lite support (default: yes)
|
|
||||||
AC_ARG_ENABLE([pcsc-lite],AS_HELP_STRING([--disable-pcsc-lite],[Disable PCSC-lite dependency (removes ACR122 support)]),[enable_pcsc_lite=$enableval],[enable_pcsc_lite="yes"])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING(for pcsc-lite support)
|
|
||||||
AC_MSG_RESULT($enable_pcsc_lite)
|
|
||||||
|
|
||||||
if test x"$enable_pcsc_lite" = "xno"
|
|
||||||
then
|
|
||||||
WITH_PCSC=0
|
|
||||||
fi
|
|
||||||
AM_CONDITIONAL(PCSC_LITE_ENABLED, [test x"$enable_pcsc_lite" = xyes])
|
|
||||||
|
|
||||||
# libusb support (default: yes)
|
|
||||||
AC_ARG_ENABLE([libusb],AS_HELP_STRING([--disable-libusb],[Disable libusb dependency (removes PN531USB and PN533USB support)]),[enable_libusb=$enableval],[enable_libusb="yes"])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING(for libusb support)
|
|
||||||
AC_MSG_RESULT($enable_libusb)
|
|
||||||
|
|
||||||
if test x"$enable_libusb" = "xno"
|
|
||||||
then
|
|
||||||
WITH_LIBUSB=0
|
|
||||||
fi
|
|
||||||
AM_CONDITIONAL(LIBUSB_ENABLED, [test x"$enable_libusb" = xyes])
|
|
||||||
|
|
||||||
# Documentation (default: no)
|
# Documentation (default: no)
|
||||||
AC_ARG_ENABLE([doc],AS_HELP_STRING([--enable-doc],[Enable documentation generation.]),[enable_doc=$enableval],[enable_doc="no"])
|
AC_ARG_ENABLE([doc],AS_HELP_STRING([--enable-doc],[Enable documentation generation.]),[enable_doc=$enableval],[enable_doc="no"])
|
||||||
|
|
||||||
|
@ -114,73 +93,15 @@ AM_CONDITIONAL(DOC_ENABLED, [test x"$enable_doc" = xyes])
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
PKG_CONFIG_REQUIRES=""
|
PKG_CONFIG_REQUIRES=""
|
||||||
## libusb
|
|
||||||
if test "x$enable_libusb" = "xyes"; then
|
|
||||||
WITH_USB=0
|
|
||||||
|
|
||||||
# Search using pkg-config
|
LIBNFC_CHECK_LIBUSB
|
||||||
if test x"$PKG_CONFIG" != "x"; then
|
LIBNFC_CHECK_PCSC
|
||||||
PKG_CHECK_MODULES([LIBUSB], [libusb], [WITH_USB=1], [WITH_USB=0])
|
|
||||||
if test x"$WITH_USB" = "x1"; then
|
|
||||||
if test x"$PKG_CONFIG_REQUIRES" != x""; then
|
|
||||||
PKG_CONFIG_REQUIRES="$PKG_CONFIG_REQUIRES,"
|
|
||||||
fi
|
|
||||||
PKG_CONFIG_REQUIRES="$PKG_CONFIG_REQUIRES libusb"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Search using libusb-config
|
|
||||||
if test x"$WITH_USB" = "x0"; then
|
|
||||||
AC_PATH_PROG(LIBUSB_CONFIG,libusb-config)
|
|
||||||
if test x"$LIBUSB_CONFIG" != "x" ; then
|
|
||||||
LIBUSB_CFLAGS=`$LIBUSB_CONFIG --cflags`
|
|
||||||
LIBUSB_LIBS=`$LIBUSB_CONFIG --libs`
|
|
||||||
WITH_USB=1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Search the library and headers directly (last chance)
|
|
||||||
if test x"$WITH_USB" = "x0"; then
|
|
||||||
AC_CHECK_HEADER(usb.h, [], [AC_MSG_ERROR([The libusb headers are missing])])
|
|
||||||
AC_CHECK_LIB(usb, libusb_init, [], [AC_MSG_ERROR([The libusb library is missing])])
|
|
||||||
|
|
||||||
LIBUSB_LIBS="-lusb"
|
|
||||||
WITH_USB=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test x"$WITH_USB" = "x0"; then
|
|
||||||
AC_MSG_ERROR([libusb is mandatory.])
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_SUBST(LIBUSB_LIBS)
|
|
||||||
AC_SUBST(LIBUSB_CFLAGS)
|
|
||||||
fi
|
|
||||||
|
|
||||||
## libpcsclite
|
|
||||||
if test "x$enable_pcsc_lite" = "xyes"; then
|
|
||||||
case "$host" in
|
|
||||||
*darwin*)
|
|
||||||
AC_MSG_WARN(Using darwin PCSC Framework)
|
|
||||||
LIBPCSCLITE_LIBS="-Wl,-framework,PCSC"
|
|
||||||
LIBPCSCLITE_CFLAGS="-I/System/Library/Frameworks/PCSC.framework/Headers"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
PKG_CHECK_MODULES([LIBPCSCLITE], [libpcsclite], [WITH_PCSC=1], [WITH_PCSC=0])
|
|
||||||
if test x"$WITH_PCSC" = "x0" ; then
|
|
||||||
AC_MSG_ERROR([libpcsclite is mandatory.])
|
|
||||||
fi
|
|
||||||
if test x"$PKG_CONFIG_REQUIRES" != x""; then
|
|
||||||
PKG_CONFIG_REQUIRES="$PKG_CONFIG_REQUIRES,"
|
|
||||||
fi
|
|
||||||
PKG_CONFIG_REQUIRES="$PKG_CONFIG_REQUIRES libpcsclite"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
AC_SUBST(LIBPCSCLITE_LIBS)
|
|
||||||
AC_SUBST(LIBPCSCLITE_CFLAGS)
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_SUBST(PKG_CONFIG_REQUIRES)
|
AC_SUBST(PKG_CONFIG_REQUIRES)
|
||||||
|
|
||||||
|
AM_CONDITIONAL(LIBUSB_ENABLED, [test "$HAVE_LIBUSB" = "1"])
|
||||||
|
AM_CONDITIONAL(PCSC_ENABLED, [test "$HAVE_PCSC" = "1"])
|
||||||
|
|
||||||
# Defines and C flags
|
# Defines and C flags
|
||||||
CFLAGS="$CFLAGS -std=c99"
|
CFLAGS="$CFLAGS -std=c99"
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,26 @@
|
||||||
SUBDIRS = chips buses drivers .
|
SUBDIRS = chips buses drivers .
|
||||||
|
|
||||||
# set the include path found by configure
|
# set the include path found by configure
|
||||||
INCLUDES= $(all_includes) $(LIBNFC_CFLAGS)
|
INCLUDES = $(all_includes) $(LIBNFC_CFLAGS)
|
||||||
|
|
||||||
|
noinst_HEADERS = chips.h buses.h drivers.h bitutils.h
|
||||||
lib_LTLIBRARIES = libnfc.la
|
lib_LTLIBRARIES = libnfc.la
|
||||||
libnfc_la_SOURCES = nfc.c bitutils.c
|
libnfc_la_SOURCES = nfc.c bitutils.c
|
||||||
libnfc_la_LDFLAGS = -no-undefined -version-info=0:0:0
|
libnfc_la_LDFLAGS = -no-undefined -version-info=0:0:0
|
||||||
libnfc_la_CFLAGS =
|
libnfc_la_CFLAGS = @DRIVERS_CFLAGS@
|
||||||
libnfc_la_LIBADD = \
|
libnfc_la_LIBADD = \
|
||||||
$(top_builddir)/libnfc/chips/libnfcchips.la \
|
$(top_builddir)/libnfc/chips/libnfcchips.la \
|
||||||
$(top_builddir)/libnfc/buses/libnfcbuses.la \
|
$(top_builddir)/libnfc/buses/libnfcbuses.la \
|
||||||
$(top_builddir)/libnfc/drivers/libnfcdrivers.la
|
$(top_builddir)/libnfc/drivers/libnfcdrivers.la
|
||||||
|
|
||||||
if PCSC_LITE_ENABLED
|
if PCSC_ENABLED
|
||||||
libnfc_la_CFLAGS += @LIBPCSCLITE_CFLAGS@ -DHAVE_PCSC_LITE
|
libnfc_la_CFLAGS += @libpcsclite_CFLAGS@ -DHAVE_PCSC
|
||||||
libnfc_la_LIBADD += @LIBPCSCLITE_LIBS@
|
libnfc_la_LIBADD += @libpcsclite_LIBS@
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if LIBUSB_ENABLED
|
if LIBUSB_ENABLED
|
||||||
libnfc_la_CFLAGS += @LIBUSB_CFLAGS@ -DHAVE_LIBUSB
|
libnfc_la_CFLAGS += @libusb_CFLAGS@ -DHAVE_LIBUSB
|
||||||
libnfc_la_LIBADD += @LIBUSB_LIBS@
|
libnfc_la_LIBADD += @libusb_LIBS@
|
||||||
endif
|
endif
|
||||||
|
|
||||||
EXTRA_DIST = CMakeLists.txt chips.h buses.h drivers.h bitutils.h
|
EXTRA_DIST = CMakeLists.txt
|
||||||
|
|
|
@ -27,33 +27,50 @@
|
||||||
|
|
||||||
#include <nfc/nfc-types.h>
|
#include <nfc/nfc-types.h>
|
||||||
|
|
||||||
#ifdef HAVE_PCSC_LITE
|
#if defined (DRIVER_ACR122_ENABLED)
|
||||||
#include "drivers/acr122.h"
|
#include "drivers/acr122.h"
|
||||||
#endif /* HAVE_PCSC_LITE */
|
#endif /* DRIVER_ACR122_ENABLED */
|
||||||
|
|
||||||
#ifdef HAVE_LIBUSB
|
#if defined (DRIVER_PN531_USB_ENABLED) || defined (DRIVER_PN533_USB_ENABLED)
|
||||||
#include "drivers/pn53x_usb.h"
|
#include "drivers/pn53x_usb.h"
|
||||||
#include "drivers/pn531_usb.h"
|
#endif /* DRIVER_PN531_USB_ENABLED || DRIVER_PN533_USB_ENABLED */
|
||||||
#include "drivers/pn533_usb.h"
|
|
||||||
#endif /* HAVE_LIBUSB */
|
|
||||||
|
|
||||||
#include "drivers/arygon.h"
|
#if defined (DRIVER_PN531_USB_ENABLED)
|
||||||
#include "drivers/pn532_uart.h"
|
#include "drivers/pn531_usb.h"
|
||||||
|
#endif /* DRIVER_PN531_USB_ENABLED */
|
||||||
|
|
||||||
|
#if defined (DRIVER_PN533_USB_ENABLED)
|
||||||
|
#include "drivers/pn533_usb.h"
|
||||||
|
#endif /* DRIVER_PN533_USB_ENABLED */
|
||||||
|
|
||||||
|
#if defined (DRIVER_ARYGON_ENABLED)
|
||||||
|
#include "drivers/arygon.h"
|
||||||
|
#endif /* DRIVER_ARYGON_ENABLED */
|
||||||
|
|
||||||
|
#if defined (DRIVER_PN532_UART_ENABLED)
|
||||||
|
#include "drivers/pn532_uart.h"
|
||||||
|
#endif /* DRIVER_PN532_UART_ENABLED */
|
||||||
|
|
||||||
#define DRIVERS_MAX_DEVICES 16
|
#define DRIVERS_MAX_DEVICES 16
|
||||||
#define MAX_FRAME_LEN 264
|
#define MAX_FRAME_LEN 264
|
||||||
|
|
||||||
static const struct driver_callbacks drivers_callbacks_list[] = {
|
static const struct driver_callbacks drivers_callbacks_list[] = {
|
||||||
// Driver Name Pick Device List Devices Connect Transceive Disconnect
|
// Driver Name Pick Device List Devices Connect Transceive Disconnect
|
||||||
#ifdef HAVE_PCSC_LITE
|
#if defined (DRIVER_ACR122_ENABLED)
|
||||||
{ ACR122_DRIVER_NAME, acr122_pick_device, acr122_list_devices, acr122_connect, acr122_transceive, acr122_disconnect },
|
{ ACR122_DRIVER_NAME, acr122_pick_device, acr122_list_devices, acr122_connect, acr122_transceive, acr122_disconnect },
|
||||||
#endif /* HAVE_PCSC_LITE */
|
#endif /* DRIVER_ACR122_ENABLED */
|
||||||
#ifdef HAVE_LIBUSB
|
#if defined (DRIVER_PN531_USB_ENABLED)
|
||||||
{ PN531_USB_DRIVER_NAME, pn531_usb_pick_device, pn531_usb_list_devices, pn531_usb_connect, pn53x_usb_transceive, pn53x_usb_disconnect },
|
{ PN531_USB_DRIVER_NAME, pn531_usb_pick_device, pn531_usb_list_devices, pn531_usb_connect, pn53x_usb_transceive, pn53x_usb_disconnect },
|
||||||
{ PN533_USB_DRIVER_NAME, pn533_usb_pick_device, pn533_usb_list_devices, pn533_usb_connect, pn53x_usb_transceive, pn53x_usb_disconnect },
|
#endif /* DRIVER_PN531_USB_ENABLED */
|
||||||
#endif /* HAVE_LIBUSB */
|
#if defined (DRIVER_PN533_USB_ENABLED)
|
||||||
{ PN532_UART_DRIVER_NAME, pn532_uart_pick_device, pn532_uart_list_devices, pn532_uart_connect, pn532_uart_transceive, pn532_uart_disconnect },
|
{ PN533_USB_DRIVER_NAME, pn533_usb_pick_device, pn533_usb_list_devices, pn533_usb_connect, pn53x_usb_transceive, pn53x_usb_disconnect },
|
||||||
|
#endif /* DRIVER_PN533_USB_ENABLED */
|
||||||
|
#if defined (DRIVER_ARYGON_ENABLED)
|
||||||
{ ARYGON_DRIVER_NAME, arygon_pick_device, arygon_list_devices, arygon_connect, arygon_transceive, arygon_disconnect }
|
{ ARYGON_DRIVER_NAME, arygon_pick_device, arygon_list_devices, arygon_connect, arygon_transceive, arygon_disconnect }
|
||||||
|
#endif /* DRIVER_ARYGON_ENABLED */
|
||||||
|
#if defined (DRIVER_PN532_UART_ENABLED)
|
||||||
|
{ PN532_UART_DRIVER_NAME, pn532_uart_pick_device, pn532_uart_list_devices, pn532_uart_connect, pn532_uart_transceive, pn532_uart_disconnect },
|
||||||
|
#endif /* DRIVER_PN532_UART_ENABLED */
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __NFC_DRIVERS_H__
|
#endif // __NFC_DRIVERS_H__
|
||||||
|
|
|
@ -1,23 +1,19 @@
|
||||||
# set the include path found by configure
|
# set the include path found by configure
|
||||||
INCLUDES= $(all_includes) $(LIBNFC_CFLAGS)
|
INCLUDES= $(all_includes) $(LIBNFC_CFLAGS)
|
||||||
|
|
||||||
noinst_HEADERS = arygon.h pn532_uart.h
|
noinst_HEADERS = acr122.h arygon.h pn531_usb.h pn532_uart.h pn533_usb.h pn53x_usb.h
|
||||||
noinst_LTLIBRARIES = libnfcdrivers.la
|
noinst_LTLIBRARIES = libnfcdrivers.la
|
||||||
libnfcdrivers_la_SOURCES = arygon.c pn532_uart.c
|
libnfcdrivers_la_SOURCES = acr122.c arygon.c pn531_usb.c pn532_uart.c pn533_usb.c pn53x_usb.c
|
||||||
libnfcdrivers_la_CFLAGS = -I$(top_srcdir)/libnfc -I$(top_srcdir)/libnfc/buses
|
libnfcdrivers_la_CFLAGS = @DRIVERS_CFLAGS@ -I$(top_srcdir)/libnfc -I$(top_srcdir)/libnfc/buses
|
||||||
libnfcdrivers_la_LIBADD =
|
libnfcdrivers_la_LIBADD =
|
||||||
|
|
||||||
if PCSC_LITE_ENABLED
|
if PCSC_ENABLED
|
||||||
noinst_HEADERS += acr122.h
|
libnfcdrivers_la_CFLAGS += @libpcsclite_CFLAGS@
|
||||||
libnfcdrivers_la_CFLAGS += @LIBPCSCLITE_CFLAGS@ -DHAVE_PCSC_LITE
|
libnfcdrivers_la_LIBADD += @libpcsclite_LIBS@
|
||||||
libnfcdrivers_la_SOURCES += acr122.c
|
|
||||||
libnfcdrivers_la_LIBADD += @LIBPCSCLITE_LIBS@
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if LIBUSB_ENABLED
|
if LIBUSB_ENABLED
|
||||||
noinst_HEADERS += pn531_usb.h pn533_usb.h pn53x_usb.h
|
libnfcdrivers_la_CFLAGS += @libusb_CFLAGS@
|
||||||
libnfcdrivers_la_CFLAGS += @LIBUSB_CFLAGS@ -DHAVE_LIBUSB
|
libnfcdrivers_la_LIBADD += @libusb_LIBS@
|
||||||
libnfcdrivers_la_SOURCES += pn531_usb.c pn533_usb.c pn53x_usb.c
|
|
||||||
libnfcdrivers_la_LIBADD += @LIBUSB_LIBS@
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
* @brief
|
* @brief
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef DRIVER_ACR122_ENABLED
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif // HAVE_CONFIG_H
|
#endif // HAVE_CONFIG_H
|
||||||
|
@ -361,3 +363,5 @@ bool acr122_led_red(const nfc_device_spec_t nds, bool bOn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // DRIVER_ACR122_ENABLED
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
* UART connection can be direct (host<->arygon_uc) or could be provided by internal USB to serial interface (e.g. host<->ftdi_chip<->arygon_uc)
|
* UART connection can be direct (host<->arygon_uc) or could be provided by internal USB to serial interface (e.g. host<->ftdi_chip<->arygon_uc)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef DRIVER_ARYGON_ENABLED
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif // HAVE_CONFIG_H
|
#endif // HAVE_CONFIG_H
|
||||||
|
@ -297,3 +299,6 @@ bool arygon_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, const s
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // DRIVER_ARYGON_ENABLED
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
Thanks to d18c7db and Okko for example code
|
Thanks to d18c7db and Okko for example code
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef DRIVER_PN531_USB_ENABLED
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif // HAVE_CONFIG_H
|
#endif // HAVE_CONFIG_H
|
||||||
|
@ -70,3 +72,6 @@ nfc_device_t* pn531_usb_connect(const nfc_device_desc_t* pndd)
|
||||||
{
|
{
|
||||||
return pn53x_usb_connect(pndd, pndd->acDevice, NC_PN531);
|
return pn53x_usb_connect(pndd, pndd->acDevice, NC_PN531);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // DRIVER_PN531_USB_ENABLED
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
* @brief PN532 driver using UART bus (UART, RS232, etc.)
|
* @brief PN532 driver using UART bus (UART, RS232, etc.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef DRIVER_PN532_UART_ENABLED
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif // HAVE_CONFIG_H
|
#endif // HAVE_CONFIG_H
|
||||||
|
@ -310,3 +312,6 @@ pn532_uart_wakeup(const nfc_device_spec_t nds)
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // DRIVER_PN532_UART_ENABLED
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
Thanks to d18c7db and Okko for example code
|
Thanks to d18c7db and Okko for example code
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef DRIVER_PN533_USB_ENABLED
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif // HAVE_CONFIG_H
|
#endif // HAVE_CONFIG_H
|
||||||
|
@ -68,3 +70,6 @@ nfc_device_t* pn533_usb_connect(const nfc_device_desc_t* pndd)
|
||||||
{
|
{
|
||||||
return pn53x_usb_connect(pndd, pndd->acDevice, NC_PN533);
|
return pn53x_usb_connect(pndd, pndd->acDevice, NC_PN533);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // DRIVER_PN533_USB_ENABLED
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
Thanks to d18c7db and Okko for example code
|
Thanks to d18c7db and Okko for example code
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if defined (DRIVER_PN531_USB_ENABLED) || defined (DRIVER_PN533_USB_ENABLED)
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <usb.h>
|
#include <usb.h>
|
||||||
|
@ -329,3 +331,5 @@ bool pn53x_usb_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, cons
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // DRIVER_PN531_USB_ENABLED || DRIVER_PN533_USB_ENABLED
|
||||||
|
|
52
m4/libnfc_check_libusb.m4
Normal file
52
m4/libnfc_check_libusb.m4
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
dnl Check for LIBUSB
|
||||||
|
dnl On success, HAVE_LIBUSB is set to 1 and PKG_CONFIG_REQUIRES is filled when
|
||||||
|
dnl libusb is found using pkg-config
|
||||||
|
|
||||||
|
AC_DEFUN([LIBNFC_CHECK_LIBUSB],
|
||||||
|
[
|
||||||
|
if test x"$libusb_required" = "xyes"; then
|
||||||
|
HAVE_LIBUSB=0
|
||||||
|
|
||||||
|
# Search using pkg-config
|
||||||
|
if test x"$PKG_CONFIG" != "x"; then
|
||||||
|
PKG_CHECK_MODULES([libusb], [libusb], [HAVE_LIBUSB=1], [HAVE_LIBUSB=0])
|
||||||
|
if test x"$HAVE_LIBUSB" = "x1"; then
|
||||||
|
if test x"$PKG_CONFIG_REQUIRES" != x""; then
|
||||||
|
PKG_CONFIG_REQUIRES="$PKG_CONFIG_REQUIRES,"
|
||||||
|
fi
|
||||||
|
PKG_CONFIG_REQUIRES="$PKG_CONFIG_REQUIRES libusb"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(for libusb)
|
||||||
|
|
||||||
|
# Search using libusb-config
|
||||||
|
if test x"$HAVE_LIBUSB" = "x0"; then
|
||||||
|
AC_PATH_PROG(libusb_CONFIG,libusb-config)
|
||||||
|
if test x"$libusb_CONFIG" != "x" ; then
|
||||||
|
libusb_CFLAGS=`$libusb_CONFIG --cflags`
|
||||||
|
libusb_LIBS=`$libusb_CONFIG --libs`
|
||||||
|
HAVE_LIBUSB=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Search the library and headers directly (last chance)
|
||||||
|
if test x"$HAVE_LIBUSB" = "x0"; then
|
||||||
|
AC_CHECK_HEADER(usb.h, [], [AC_MSG_ERROR([The libusb headers are missing])])
|
||||||
|
AC_CHECK_LIB(usb, libusb_init, [], [AC_MSG_ERROR([The libusb library is missing])])
|
||||||
|
|
||||||
|
libusb_LIBS="-lusb"
|
||||||
|
HAVE_LIBUSB=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test x"$HAVE_LIBUSB" = "x0"; then
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
AC_MSG_ERROR([libusb is mandatory.])
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_SUBST(libusb_LIBS)
|
||||||
|
AC_SUBST(libusb_CFLAGS)
|
||||||
|
fi
|
||||||
|
])
|
29
m4/libnfc_check_pcsc.m4
Normal file
29
m4/libnfc_check_pcsc.m4
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
dnl Check for PCSC presence (if required)
|
||||||
|
dnl On success, HAVE_PCSC is set to 1 and PKG_CONFIG_REQUIRES is filled when
|
||||||
|
dnl libpcsclite is found using pkg-config
|
||||||
|
|
||||||
|
AC_DEFUN([LIBNFC_CHECK_PCSC],
|
||||||
|
[
|
||||||
|
if test "x$pcsc_required" = "xyes"; then
|
||||||
|
case "$host" in
|
||||||
|
*darwin*)
|
||||||
|
AC_MSG_CHECKING(for PC/SC)
|
||||||
|
libpcsclite_LIBS="-Wl,-framework,PCSC"
|
||||||
|
libpcsclite_CFLAGS="-I/System/Library/Frameworks/PCSC.framework/Headers"
|
||||||
|
AC_MSG_RESULT(yes: darwin PC/SC framework)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
PKG_CHECK_MODULES([libpcsclite], [libpcsclite], [HAVE_PCSC=1], [HAVE_PCSC=0])
|
||||||
|
if test x"$HAVE_PCSC" = "x0" ; then
|
||||||
|
AC_MSG_ERROR([libpcsclite is mandatory.])
|
||||||
|
fi
|
||||||
|
if test x"$PKG_CONFIG_REQUIRES" != x""; then
|
||||||
|
PKG_CONFIG_REQUIRES="$PKG_CONFIG_REQUIRES,"
|
||||||
|
fi
|
||||||
|
PKG_CONFIG_REQUIRES="$PKG_CONFIG_REQUIRES libpcsclite"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
AC_SUBST(libpcsclite_LIBS)
|
||||||
|
AC_SUBST(libpcsclite_CFLAGS)
|
||||||
|
fi
|
||||||
|
])
|
64
m4/libnfc_drivers.m4
Normal file
64
m4/libnfc_drivers.m4
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
dnl Handle drivers arguments list
|
||||||
|
|
||||||
|
AC_DEFUN([LIBNFC_ARG_WITH_DRIVERS],
|
||||||
|
[
|
||||||
|
AC_MSG_CHECKING(which drivers to build)
|
||||||
|
AC_ARG_WITH(drivers,
|
||||||
|
AC_HELP_STRING([[[[--with-drivers=driver@<:@,driver...@:>@]]]], [Only use specific drivers (default set)]),
|
||||||
|
[ case "${withval}" in
|
||||||
|
yes | no)
|
||||||
|
dnl ignore calls without any arguments
|
||||||
|
DRIVER_BUILD_LIST="default"
|
||||||
|
AC_MSG_RESULT(default drivers)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
DRIVER_BUILD_LIST=`echo ${withval} | sed "s/,/ /g"`
|
||||||
|
AC_MSG_RESULT(${DRIVER_BUILD_LIST})
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
],
|
||||||
|
[
|
||||||
|
DRIVER_BUILD_LIST="default"
|
||||||
|
AC_MSG_RESULT(default drivers)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
case "${DRIVER_BUILD_LIST}" in
|
||||||
|
default)
|
||||||
|
DRIVER_BUILD_LIST="acr122 arygon pn531_usb pn533_usb"
|
||||||
|
;;
|
||||||
|
all)
|
||||||
|
DRIVER_BUILD_LIST="acr122 arygon pn531_usb pn533_usb pn532_uart"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
DRIVERS_CFLAGS=""
|
||||||
|
|
||||||
|
for driver in ${DRIVER_BUILD_LIST}
|
||||||
|
do
|
||||||
|
case "${driver}" in
|
||||||
|
acr122)
|
||||||
|
pcsc_required="yes"
|
||||||
|
DRIVERS_CFLAGS="$DRIVERS_CFLAGS -DDRIVER_ACR122_ENABLED"
|
||||||
|
;;
|
||||||
|
pn531_usb)
|
||||||
|
libusb_required="yes"
|
||||||
|
DRIVERS_CFLAGS="$DRIVERS_CFLAGS -DDRIVER_PN531_USB_ENABLED"
|
||||||
|
;;
|
||||||
|
pn533_usb)
|
||||||
|
libusb_required="yes"
|
||||||
|
DRIVERS_CFLAGS="$DRIVERS_CFLAGS -DDRIVER_PN533_USB_ENABLED"
|
||||||
|
;;
|
||||||
|
arygon)
|
||||||
|
DRIVERS_CFLAGS="$DRIVERS_CFLAGS -DDRIVER_ARYGON_ENABLED"
|
||||||
|
;;
|
||||||
|
pn532_uart)
|
||||||
|
DRIVERS_CFLAGS="$DRIVERS_CFLAGS -DDRIVER_PN532_UART_ENABLED"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
AC_MSG_ERROR([Unknow driver: $driver])
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
AC_SUBST(DRIVERS_CFLAGS)
|
||||||
|
])
|
Loading…
Reference in a new issue