From 2d4bdf28a1a73409b993314d8a6f205c48b7aba7 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Mon, 18 Jan 2010 11:23:07 +0000 Subject: [PATCH] Serial autoprobing is now DISABLED as default, fix Issue 58. --- CMakeLists.txt | 8 ++++---- configure.ac | 8 ++++---- src/CMakeLists.txt | 6 +++--- src/lib/drivers/arygon.c | 7 ++++--- src/lib/drivers/pn532_uart.c | 6 +++--- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 31009701..ce15d5ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ INCLUDE(UseDoxygen) SET(LIBNFC_DEBUG_OUTPUT OFF CACHE BOOL "Debug output of communication with the NFC chip") SET(LIBNFC_PCSC ON CACHE BOOL "Enable PC/SC support (ACR122)") SET(LIBNFC_USB ON CACHE BOOL "Enable direct USB communication support (PN531 and PN533)") -SET(LIBNFC_DISABLE_SERIAL_AUTOPROBE OFF CACHE BOOL "Disable serial autoprobe") +SET(LIBNFC_SERIAL_AUTOPROBE_ENABLED OFF CACHE BOOL "Allow serial ports to be probed (can seriously disturb connected serial devices)") IF(DEFINED CMAKE_INSTALL_LIBDIR) SET(libdir ${CMAKE_INSTALL_LIBDIR}) @@ -42,9 +42,9 @@ IF(NOT DEFINED SHARE_INSTALL_PREFIX) SET(SHARE_INSTALL_PREFIX share) ENDIF(NOT DEFINED SHARE_INSTALL_PREFIX) -IF(LIBNFC_DISABLE_SERIAL_AUTOPROBE) - ADD_DEFINITIONS("-DDISABLE_SERIAL_AUTOPROBE") -ENDIF(LIBNFC_DISABLE_SERIAL_AUTOPROBE) +IF(LIBNFC_SERIAL_AUTOPROBE_ENABLED) + ADD_DEFINITIONS("-DSERIAL_AUTOPROBE_ENABLED") +ENDIF(LIBNFC_SERIAL_AUTOPROBE_ENABLED) IF(LIBNFC_DEBUG_OUTPUT) ADD_DEFINITIONS(-DDEBUG -g3) diff --git a/configure.ac b/configure.ac index 35f4c17b..2862b470 100644 --- a/configure.ac +++ b/configure.ac @@ -58,15 +58,15 @@ then fi AC_SUBST([DEBUG_CFLAGS]) -# Serial autoprobing support (default:yes) -AC_ARG_ENABLE([serial-autoprobe],AS_HELP_STRING([--disable-serial-autoprobe],[Disable serial autoprobing]),[enable_serial_autoprobe=$enableval],[enable_serial_autoprobe="yes"]) +# 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_MSG_CHECKING(for serial autoprobe flag) AC_MSG_RESULT($enable_serial_autoprobe) -if test x"$enable_serial_autoprobe" = "xno" +if test x"$enable_serial_autoprobe" = "xyes" then - CFLAGS="$CFLAGS -DDISABLE_SERIAL_AUTOPROBE" + CFLAGS="$CFLAGS -DSERIAL_AUTOPROBE_ENABLED" fi # PCSC-lite support (default: yes) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bfb6e05d..9ecb1a2a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,9 +2,9 @@ IF(LIBNFC_VERBOSE_OUTPUT) ADD_DEFINITIONS("-DDEBUG") ENDIF(LIBNFC_VERBOSE_OUTPUT) -IF(LIBNFC_DISABLE_SERIAL_AUTOPROBE) - ADD_DEFINITIONS("-DDISABLE_SERIAL_AUTOPROBE") -ENDIF(LIBNFC_DISABLE_SERIAL_AUTOPROBE) +IF(LIBNFC_SERIAL_AUTOPROBE_ENABLED) + ADD_DEFINITIONS("-DSERIAL_AUTOPROBE_ENABLED") +ENDIF(LIBNFC_SERIAL_AUTOPROBE_ENABLED) IF(LIBNFC_LANG_C99 AND NOT MSVC) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") diff --git a/src/lib/drivers/arygon.c b/src/lib/drivers/arygon.c index 09c372cb..b93b0098 100644 --- a/src/lib/drivers/arygon.c +++ b/src/lib/drivers/arygon.c @@ -95,10 +95,10 @@ nfc_device_t* arygon_connect(const nfc_device_desc_t* pndd) nfc_device_t* pnd = NULL; if( pndd == NULL ) { -#ifdef DISABLE_SERIAL_AUTOPROBE +#ifndef SERIAL_AUTOPROBE_ENABLED INFO("Sorry, serial auto-probing have been disabled at compile time."); return NULL; -#else +#else /* SERIAL_AUTOPROBE_ENABLED */ DBG("Trying to find ARYGON device on serial port: %s# at %d bauds.",SERIAL_STRING, SERIAL_DEFAULT_PORT_SPEED); // I have no idea how MAC OS X deals with multiple devices, so a quick workaround for (uiDevNr=0; uiDevNr