libftdi: (tomj) build .spec file via configure. Enable async mode automatically for...
authorThomas Jarosch <opensource@intra2net.com>
Mon, 2 Jun 2008 11:41:29 +0000 (11:41 +0000)
committerThomas Jarosch <opensource@intra2net.com>
Mon, 2 Jun 2008 11:41:29 +0000 (11:41 +0000)
ChangeLog
Makefile.am
configure.in
libftdi.spec.in [moved from libftdi.spec with 87% similarity]
src/ftdi.c

index 21385d7..e29943c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,8 @@
 New in 0.13
 -----------
+* Build .spec file via configuere.in (Intra2net)
 * Fixed "libusb-config --cflags" call (Mike Frysinger and Intra2net)
-* Always set usb configuration (Mike Frysinger)
+* Always set usb configuration (Mike Frysinger and Intra2net)
 * Improved libusb-win32 support (Mike Frysinger)
 
 New in 0.12
index 473fdb4..801ccf5 100644 (file)
@@ -4,7 +4,7 @@ AUTOMAKE_OPTIONS = foreign 1.4
 
 SUBDIRS = src examples doc
 
-EXTRA_DIST = libftdi.spec COPYING.LIB README AUTHORS ChangeLog libftdi-config.in
+EXTRA_DIST = libftdi.spec libftdi.spec.in COPYING.LIB README AUTHORS ChangeLog libftdi-config.in
 
 bin_SCRIPTS = libftdi-config
 
index 66c109a..290ed42 100644 (file)
@@ -32,21 +32,24 @@ else
    AC_MSG_RESULT(yes)
 fi
 
+ENABLE_ASYNC_MODE=0
 AC_ARG_WITH(async-mode,
 [  --with-async-mode       enable experimental async mode. Linux only.],
 [
   AC_MSG_CHECKING(for experimental linux async mode)
   if test "$withval" != "no"; then
+    ENABLE_ASYNC_MODE=1
     CFLAGS="$CFLAGS -DLIBFTDI_LINUX_ASYNC_MODE"
     AC_MSG_RESULT(yes)
   else
     AC_MSG_RESULT(no)
   fi
 ])
+AC_SUBST(ENABLE_ASYNC_MODE)
 
 dnl check for doxygen
 AC_PATH_PROG(DOXYGEN, doxygen)
 AM_CONDITIONAL(HAVE_DOXYGEN, test -n $DOXYGEN)
 
 AC_OUTPUT([libftdi-config],[chmod a+x libftdi-config])
-AC_OUTPUT(Makefile src/Makefile examples/Makefile doc/Doxyfile doc/Makefile libftdi.pc)
+AC_OUTPUT(Makefile src/Makefile examples/Makefile doc/Doxyfile doc/Makefile libftdi.pc libftdi.spec)
similarity index 87%
rename from libftdi.spec
rename to libftdi.spec.in
index 18a9b50..a3e2456 100644 (file)
@@ -1,6 +1,7 @@
+%define    enable_async_mode @ENABLE_ASYNC_MODE@
 Summary:   Library to program and control the FTDI USB controller
 Name:      libftdi
-Version:   0.13
+Version:   @VERSION@
 Release:   1
 Copyright: LGPL
 Group:     System Environment/Libraries
@@ -26,7 +27,13 @@ Header files and static libraries for libftdi
 %setup -q
 
 %build
-./configure --prefix=%{prefix} --with-async-mode
+
+PARAMS=""
+./configure --prefix=%{prefix} \
+%if %{enable_async_mode}
+    --with-async-mode \
+%endif
+
 make
 
 %install
index e269021..74b5631 100644 (file)
@@ -354,8 +354,13 @@ int ftdi_usb_open_dev(struct ftdi_context *ftdi, struct usb_device *dev)
         ftdi_error_return(-4, "usb_open() failed");
 
 #ifdef LIBUSB_HAS_GET_DRIVER_NP
-    // Try to detach ftdi_sio kernel module
-    // Returns ENODATA if driver is not loaded
+    // Try to detach ftdi_sio kernel module.
+    // Returns ENODATA if driver is not loaded.
+    //
+    // The return code is kept in a separate variable and only parsed
+    // if usb_set_configuration() or usb_claim_interface() fails as the
+    // detach operation might be denied and everything still works fine.
+    // Likely scenario is a static ftdi_sio kernel module.
     if (usb_detach_kernel_driver_np(ftdi->usb_dev, ftdi->interface) != 0 && errno != ENODATA)
         detach_errno = errno;
 #endif