diff options
Diffstat (limited to 'libgphoto2_port/libusb1/libusb1.c')
-rw-r--r-- | libgphoto2_port/libusb1/libusb1.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libgphoto2_port/libusb1/libusb1.c b/libgphoto2_port/libusb1/libusb1.c index c6b16aa91..c6a03dc5f 100644 --- a/libgphoto2_port/libusb1/libusb1.c +++ b/libgphoto2_port/libusb1/libusb1.c @@ -119,6 +119,7 @@ gp_port_library_list (GPPortInfoList *list) GPPortInfo info; int nrofdevices = 0; int d, i, i1, i2, unknownint; + libusb_context *ctx; /* generic matcher. This will catch passed XXX,YYY entries for instance. */ info.type = GP_PORT_USB; @@ -126,8 +127,8 @@ gp_port_library_list (GPPortInfoList *list) strcpy (info.path, "^usb:"); CHECK (gp_port_info_list_append (list, info)); - libusb_init (NULL); - gp_nrofdevs = load_devicelist (NULL); + libusb_init (&ctx); + gp_nrofdevs = load_devicelist (ctx); for (d = 0; d < gp_nrofdevs; d++) { /* Devices which are definitely not cameras. */ @@ -239,7 +240,9 @@ gp_port_library_list (GPPortInfoList *list) strcpy (info.path, "usb:"); CHECK (gp_port_info_list_append (list, info)); } - libusb_exit (NULL); + libusb_exit (ctx); + gp_nrofdevs = 0; + gp_devs = NULL; return (GP_OK); } |