libftdi Archives

Subject: In linusb-1.0, libusb_detach_kernel_driver is available unconditional

From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Tue, 18 May 2010 12:26:58 +0200
Hello,

currently libusb.h from
libusb-1_0-devel-1.0.2-2.2
doesn't define LIBUSB_HAS_GET_DRIVER_NP, and so libftdi-1.0 hasn't the
ability to disconnect a kernel driver. I think, we should remove the
#ifdef.

When there is a release of libusb-1.0-win32 , some more considerations need
to be made. Perhaps libusb-1.0/libusb.h needs to reintroduce
LIBUSB_HAS_GET_DRIVER_NP?

Bye
-- 
Uwe Bonnes                bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
>From 05703c0049d8c79580fd2e5fcaf1c967af9da6f8 Mon Sep 17 00:00:00 2001
From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 18 May 2010 12:07:36 +0200
Subject: In linusb-1.0, libusb_detach_kernel_driver is available unconditional

---
 src/ftdi.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/src/ftdi.c b/src/ftdi.c
index 5c25abd..60063f1 100644
--- a/src/ftdi.c
+++ b/src/ftdi.c
@@ -458,7 +458,6 @@ int ftdi_usb_open_dev(struct ftdi_context *ftdi, 
libusb_device *dev)
     cfg0 = config0->bConfigurationValue;
     libusb_free_config_descriptor (config0);
 
-#ifdef LIBUSB_HAS_GET_DRIVER_NP
     // Try to detach ftdi_sio kernel module.
     // Returns ENODATA if driver is not loaded.
     //
@@ -469,7 +468,6 @@ int ftdi_usb_open_dev(struct ftdi_context *ftdi, 
libusb_device *dev)
     ret = libusb_detach_kernel_driver(ftdi->usb_dev, ftdi->interface);
     if (ret < 0 && ret != LIBUSB_ERROR_NOT_FOUND)
         ftdi_error_return(-11, "libusb_detach_kernel_driver () failed");
-#endif
 
     if (libusb_get_configuration (ftdi->usb_dev, &cfg) < 0)
         ftdi_error_return(-12, "libusb_get_configuration () failed");
-- 
1.6.4.2


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread