From: Thomas Jarosch Date: Mon, 2 Jun 2008 11:41:29 +0000 (+0000) Subject: libftdi: (tomj) build .spec file via configure. Enable async mode automatically for... X-Git-Tag: v0.13~2 X-Git-Url: http://developer.intra2net.com/git/?p=libftdi;a=commitdiff_plain;h=22592e17174af9b6e1f628866de6a9caf45ad7dd libftdi: (tomj) build .spec file via configure. Enable async mode automatically for Intra2net builds. Document detach_errno code. --- diff --git a/ChangeLog b/ChangeLog index 21385d7..e29943c 100644 --- 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 diff --git a/Makefile.am b/Makefile.am index 473fdb4..801ccf5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/configure.in b/configure.in index 66c109a..290ed42 100644 --- a/configure.in +++ b/configure.in @@ -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) diff --git a/libftdi.spec b/libftdi.spec.in similarity index 87% rename from libftdi.spec rename to libftdi.spec.in index 18a9b50..a3e2456 100644 --- a/libftdi.spec +++ b/libftdi.spec.in @@ -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 diff --git a/src/ftdi.c b/src/ftdi.c index e269021..74b5631 100644 --- a/src/ftdi.c +++ b/src/ftdi.c @@ -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