ftdi->eeprom_size = FTDI_DEFAULT_EEPROM_SIZE;
+ ftdi->module_detach_mode = AUTO_DETACH_SIO_MODULE;
+
/* All fine. Now allocate the readbuffer */
return ftdi_read_data_set_chunksize(ftdi, 4096);
}
// 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;
+ if (ftdi->module_detach_mode == AUTO_DETACH_SIO_MODULE)
+ {
+ if (usb_detach_kernel_driver_np(ftdi->usb_dev, ftdi->interface) != 0 && errno != ENODATA)
+ detach_errno = errno;
+ }
#endif
#ifdef __WIN32__
INTERFACE_D = 4
};
+/** Automatic loading / unloading of kernel modules */
+enum ftdi_module_detach_mode
+{
+ AUTO_DETACH_SIO_MODULE = 0,
+ DONT_DETACH_SIO_MODULE = 1
+};
+
/* Shifting commands IN MPSSE Mode*/
#define MPSSE_WRITE_NEG 0x01 /* Write TDI/DO on negative TCK/SK edge*/
#define MPSSE_BITMODE 0x02 /* Write bits, not bytes */
char *async_usb_buffer;
/** Number of URB-structures we can buffer */
unsigned int async_usb_buffer_size;
+
+ /** Defines behavior in case a kernel module is already attached to the device */
+ enum ftdi_module_detach_mode module_detach_mode;
};
/**