From 780440dffea8590ececd1a38dd5c413cbe0c6d49 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Tue, 7 May 2013 21:24:17 +0200 Subject: [PATCH] Exclude device descriptors for unsupported devices. Currently all device descriptors are included, regardless of whether the device is actually supported by the library. If IrDA or USB support is unavailable, a dummy backend is build which will always fail with DC_STATUS_UNSUPPORTED. Thus there is no point in listing those devices as being supported. Doing so will only confuse end-users. --- configure.ac | 4 ++++ src/descriptor.c | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/configure.ac b/configure.ac index c8b806f..6d13c9b 100644 --- a/configure.ac +++ b/configure.ac @@ -89,6 +89,10 @@ AC_CHECK_HEADERS([sys/socket.h linux/types.h linux/irda.h], [irda_linux=yes], [i # endif ]) +if test "$irda_win32" = "yes" || test "$irda_linux" = "yes"; then + AC_DEFINE([HAVE_IRDA], [1], [IrDA support]) +fi + AM_CONDITIONAL([IRDA], [test "$irda_win32" = "yes" || test "$irda_linux" = "yes"]) # Checks for header files. diff --git a/src/descriptor.c b/src/descriptor.c index 1f57af2..8a6b80b 100644 --- a/src/descriptor.c +++ b/src/descriptor.c @@ -19,6 +19,10 @@ * MA 02110-1301 USA */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include @@ -77,6 +81,7 @@ static const dc_descriptor_t g_descriptors[] = { /* Uwatec Memomouse */ {"Uwatec", "Memomouse", DC_FAMILY_UWATEC_MEMOMOUSE, 0}, /* Uwatec Smart */ +#ifdef HAVE_IRDA {"Uwatec", "Smart Pro", DC_FAMILY_UWATEC_SMART, 0x10}, {"Uwatec", "Galileo", DC_FAMILY_UWATEC_SMART, 0x11}, {"Uwatec", "Aladin Tec", DC_FAMILY_UWATEC_SMART, 0x12}, @@ -85,6 +90,7 @@ static const dc_descriptor_t g_descriptors[] = { {"Uwatec", "Smart Tec", DC_FAMILY_UWATEC_SMART, 0x18}, {"Uwatec", "Galileo Trimix",DC_FAMILY_UWATEC_SMART, 0x19}, {"Uwatec", "Smart Z", DC_FAMILY_UWATEC_SMART, 0x1C}, +#endif /* Reefnet */ {"Reefnet", "Sensus", DC_FAMILY_REEFNET_SENSUS, 1}, {"Reefnet", "Sensus Pro", DC_FAMILY_REEFNET_SENSUSPRO, 2}, @@ -172,7 +178,9 @@ static const dc_descriptor_t g_descriptors[] = { {"Apeks", "Quantum X", DC_FAMILY_ZEAGLE_N2ITION3, 0}, {"DiveRite", "NiTek Trio", DC_FAMILY_ZEAGLE_N2ITION3, 0}, /* Atomic Aquatics Cobalt */ +#ifdef HAVE_LIBUSB {"Atomic Aquatics", "Cobalt", DC_FAMILY_ATOMICS_COBALT, 0}, +#endif /* Shearwater Predator */ {"Shearwater", "Predator", DC_FAMILY_SHEARWATER_PREDATOR, 2}, /* Shearwater Petrel */