Skip to content

Commit

Permalink
check for HAVE_LIBUSB_OPTION_NO_DEVICE_DISCOVERY enum
Browse files Browse the repository at this point in the history
  • Loading branch information
msmeissn committed Nov 25, 2023
1 parent aecbc5d commit af2a91f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions libgphoto2_port/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,26 @@ GP_CHECK_LIBRARY([LIBUSB1],[libusb-1.0],[>= 1.0.0],
AC_DEFINE([HAVE_LIBUSB_WRAP_SYS_DEVICE], [1],
[Define if libusb-1.0 has libusb_wrap_sys_device])
])
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $LIBUSB1_CFLAGS"
AC_COMPILE_IFELSE([dnl
AC_LANG_PROGRAM([[
# include "libusb.h"
]], [[
enum libusb_option opt = LIBUSB_OPTION_NO_DEVICE_DISCOVERY;
]])dnl
], [dnl
AC_DEFINE([HAVE_LIBUSB_OPTION_NO_DEVICE_DISCOVERY], [1],
[whether we have LIBUSB_OPTION_NO_DEVICE_DISCOVERY])
AC_MSG_RESULT([yes])
], [dnl
AC_MSG_RESULT([no])
])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
], [],
[default-on],
[http://libusb.sourceforge.net/]
Expand Down
2 changes: 2 additions & 0 deletions libgphoto2_port/libusb1/libusb1.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ static int has_external_fd()
return 0;
if(external_sys_device.h)
return 1;
#ifdef HAVE_LIBUSB_OPTION_NO_DEVICE_DISCOVERY
libusb_set_option(NULL,LIBUSB_OPTION_NO_DEVICE_DISCOVERY,NULL);
#endif
C_LIBUSB (libusb_init (&external_sys_device.ctx), GP_ERROR_IO);
LOG_ON_LIBUSB_E(libusb_wrap_sys_device(external_sys_device.ctx,gp_port_usb_get_sys_device(),&external_sys_device.h));
external_sys_device.d = libusb_get_device(external_sys_device.h);
Expand Down

0 comments on commit af2a91f

Please sign in to comment.