libftdi Archives

Subject: Re: Kernel driver auto attach/detach

From: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Cc: Robby McKilliam <robby.mckilliam@xxxxxxxxxxx>
Date: Thu, 28 Dec 2017 15:47:09 +0100
Hi Robby,

On Friday, 15 December 2017 05:52:28 CET Robby McKilliam wrote:
> I've used libusb's *libusb_set_auto_detach_kernel_driver*
> 
> http://libusb.sourceforge.net/api-1.0/group__dev.html#
> ga1656d6b7272d4c82f842b20a834b1467
> 
> to automatically detach and attach the kernel driver.
> 
> Patch here
> 
> https://github.com/robbymckilliam/libftdi/commit/
> 75a9219b7e3160bca863911d2790f646bc8243ee
> 
> This should leave the driver unattached (same behaviour as before) in the
> case that the host does not support auto attaching/detaching.
> 
> Tested on linux (Ubuntu 16.04 and Raspbian Stretch) with an FT230X. On OSX
> it still appears to be necessary to unload the kernels FTDI drivers as
> described here
> 
> https://github.com/libusb/libusb/wiki/FAQ#How_can_I_run_libusb_applications_
> under_Mac_OS_X_if_there_is_already_a_kernel_extension_installed_for_the_devi
> ce

thanks for your patch. I'm a bit unsure to apply it like it is as it might 
break existing applications that manually re-attach the kernel driver and then 
fail.

libftdi already has an "enum ftdi_module_detach_mode" in ftdi.h

What about introducing a new mode (AUTO_DETACH_REATACH_SIO_MODULE?)
that will re-attach the driver and the default mode will be the current 
behavior? Can you look into cooking up such a patch?

Cheers,
Thomas


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

Current Thread