Serial autoprobing is now DISABLED as default, fix Issue 58.

This commit is contained in:
Romuald Conty 2010-01-18 11:23:07 +00:00
parent 1e2ccbf9ff
commit 2d4bdf28a1
5 changed files with 18 additions and 17 deletions

View file

@ -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")

View file

@ -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<DRIVERS_MAX_DEVICES; uiDevNr++)
@ -120,7 +120,8 @@ nfc_device_t* arygon_connect(const nfc_device_desc_t* pndd)
if (sp == CLAIMED_SERIAL_PORT) DBG("Serial port already claimed: %s",acConnect);
#endif /* DEBUG */
}
#endif
#endif /* SERIAL_AUTOPROBE_ENABLED */
// Test if we have found a device
if (uiDevNr == DRIVERS_MAX_DEVICES) return NULL;
} else {

View file

@ -96,10 +96,10 @@ pn532_uart_list_devices(nfc_device_desc_t pnddDevices[], size_t szDevices, size_
* have serious problem with other device on this bus */
*pszDeviceFound = 0;
#ifdef DISABLE_SERIAL_AUTOPROBE
#ifndef SERIAL_AUTOPROBE_ENABLED
INFO("Sorry, serial auto-probing have been disabled at compile time.");
return false;
#else /* DISABLE_SERIAL_AUTOPROBE */
#else /* SERIAL_AUTOPROBE_ENABLED */
// I have no idea how MAC OS X deals with multiple devices, so a quick workaround
for (iDevice=0; iDevice<DRIVERS_MAX_DEVICES; iDevice++)
@ -134,7 +134,7 @@ pn532_uart_list_devices(nfc_device_desc_t pnddDevices[], size_t szDevices, size_
if (sp == CLAIMED_SERIAL_PORT) DBG("Serial port already claimed: %s",acConnect);
#endif /* DEBUG */
}
#endif
#endif /* SERIAL_AUTOPROBE_ENABLED */
return true;
}