use libusb_attach_kernel_driver only when OS is Linux
This commit is contained in:
parent
d8a6f90ab3
commit
d210d2c67e
|
|
@ -123,6 +123,12 @@ target_link_libraries(openFPGALoader
|
|||
${LIBUSB_LIBRARIES}
|
||||
${LIBFTDI_LIBRARIES}
|
||||
)
|
||||
|
||||
# libusb_attach_kernel_driver is only available on Linux.
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
add_definitions(-DATTACH_KERNEL)
|
||||
endif()
|
||||
|
||||
if(ENABLE_UDEV)
|
||||
include_directories(${LIBUDEV_INCLUDE_DIRS})
|
||||
target_link_libraries(openFPGALoader ${LIBUDEV_LIBRARIES})
|
||||
|
|
|
|||
|
|
@ -131,11 +131,14 @@ int FTDIpp_MPSSE::close_device()
|
|||
fprintf(stderr, "release interface failed %d\n", rtn);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
#ifdef ATTACH_KERNEL
|
||||
/* libusb_attach_kernel_driver is only available on Linux. */
|
||||
if (_ftdi->module_detach_mode == AUTO_DETACH_SIO_MODULE) {
|
||||
rtn = libusb_attach_kernel_driver(_ftdi->usb_dev, _ftdi->interface);
|
||||
if( rtn != 0)
|
||||
fprintf(stderr, "detach error %d\n", rtn);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
ftdi_usb_close_internal();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue