libftdi Archives

Subject: Re: from bb-mode back to uart

From: Xiaofan Chen <xiaofanc@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Sat, 16 Jul 2011 19:43:57 +0800
On Sat, Jul 16, 2011 at 7:35 PM, Uwe Bonnes
<bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> libusb-1 knows the call
> int libusb_attach_kernel_driver(libusb_device_handle *dev, int interface);
>
> and libftdi could call it. However the circumstances when to call it need to
> be aggreed on. Calling libusb_attach_kernel_driver on close unconditionally
> is wrong on many occacion, to name when you call a libftdi programm many
> times without using the serial driver in between. So either we
> - add a flag to ftdi_usb_close()
> - or we add some flag in the ftdi_context that we can set with some call and
> evaluate on ftdi_usb_close()
>
> Opinions?

Since the code has already the following, I think the second option
is probably better.
 ftdi->module_detach_mode = AUTO_DETACH_SIO_MODULE;

  61 /** Automatic loading / unloading of kernel modules */
  62 enum ftdi_module_detach_mode
  63 {
  64     AUTO_DETACH_SIO_MODULE = 0,
  65     DONT_DETACH_SIO_MODULE = 1
  66 };

Just add one more, something like this.

 ftdi->module_reattach_mode = AUTO_REATTACH_SIO_MODULE = 0;

 /** Automatic re-attach kernel modules upon close or not */
 enum ftdi_module_reattach_mode
 {
     AUTO_REATTACH_SIO_MODULE = 0,
     DONT_REATTACH_SIO_MODULE = 1
 };


-- 
Xiaofan

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

Current Thread