libftdi-git Archives

Subject: A library to talk to FTDI chips branch, master, updated. v1.4-7-g5bf1c1e

From: libftdi-git@xxxxxxxxxxxxxxxxxxxxxxx
To: libftdi-git@xxxxxxxxxxxxxxxxxxxxxxx
Date: Tue, 6 Feb 2018 21:17:42 +0100 (CET)
The branch, master has been updated
       via  5bf1c1e3ff1616fda20c26cc3e3df7b807744c99 (commit)
      from  5193cc2344f13828c0f280135718eb741ec85237 (commit)


- Log -----------------------------------------------------------------
commit 5bf1c1e3ff1616fda20c26cc3e3df7b807744c99
Author: Robby McKilliam <robby.mckilliam@xxxxxxxxxxx>
Date:   Thu Dec 14 09:24:35 2017 +1030

    Add kernel driver auto attach/detach
    
    Introduce new detach mode:
    AUTO_DETACH_REATACH_SIO_MODULE
    
    Tested on linux (Ubuntu 16.04 and Raspbian Stretch) with an FT230.

-----------------------------------------------------------------------

Summary of changes:
 src/ftdi.c |    5 +++++
 src/ftdi.h |    3 ++-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/ftdi.c b/src/ftdi.c
index e7904b3..52266d0 100644
--- a/src/ftdi.c
+++ b/src/ftdi.c
@@ -614,6 +614,11 @@ int ftdi_usb_open_dev(struct ftdi_context *ftdi, 
libusb_device *dev)
         if (libusb_detach_kernel_driver(ftdi->usb_dev, ftdi->interface) !=0)
             detach_errno = errno;
     }
+    else if (ftdi->module_detach_mode == AUTO_DETACH_REATACH_SIO_MODULE)
+    {
+        if (libusb_set_auto_detach_kernel_driver(ftdi->usb_dev, 1) != 
LIBUSB_SUCCESS)
+            detach_errno = errno;
+    }
 
     if (libusb_get_configuration (ftdi->usb_dev, &cfg) < 0)
         ftdi_error_return(-12, "libusb_get_configuration () failed");
diff --git a/src/ftdi.h b/src/ftdi.h
index b3e596e..f170881 100644
--- a/src/ftdi.h
+++ b/src/ftdi.h
@@ -84,7 +84,8 @@ enum ftdi_interface
 enum ftdi_module_detach_mode
 {
     AUTO_DETACH_SIO_MODULE = 0,
-    DONT_DETACH_SIO_MODULE = 1
+    DONT_DETACH_SIO_MODULE = 1,
+    AUTO_DETACH_REATACH_SIO_MODULE = 2
 };
 
 /* Shifting commands IN MPSSE Mode*/


hooks/post-receive
-- 
A library to talk to FTDI chips

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

Current Thread
  • A library to talk to FTDI chips branch, master, updated. v1.4-7-g5bf1c1e, libftdi-git <=