summaryrefslogtreecommitdiff
path: root/libgphoto2_port/libusb1
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2015-06-16 12:27:10 +0000
committerMarcus Meissner <marcus@jet.franken.de>2015-06-16 12:27:10 +0000
commit866b9f31130e5f0246444e07630c14e47c0bb425 (patch)
tree0031f850d39b99c111fd904bd13fcb687412a472 /libgphoto2_port/libusb1
parent7ae733b64deae31d4947340a4e89bfff56786dd9 (diff)
downloadlibgphoto2-866b9f31130e5f0246444e07630c14e47c0bb425.tar.gz
comments
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@15463 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'libgphoto2_port/libusb1')
-rw-r--r--libgphoto2_port/libusb1/libusb1.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libgphoto2_port/libusb1/libusb1.c b/libgphoto2_port/libusb1/libusb1.c
index cb4eb28a4..35ab545db 100644
--- a/libgphoto2_port/libusb1/libusb1.c
+++ b/libgphoto2_port/libusb1/libusb1.c
@@ -442,10 +442,11 @@ gp_libusb1_close (GPPort *port)
if (port->pl->dh == NULL)
return GP_OK;
+ /* Catch up on pending ones */
tv.tv_sec = 0;
tv.tv_usec = 1000;
LOG_ON_LIBUSB_E (libusb_handle_events_timeout(port->pl->ctx, &tv));
- /* Cancel and free the async transfers */
+ /* Now cancel and free the async transfers */
for (i = 0; i < sizeof(port->pl->transfers)/sizeof(port->pl->transfers[0]); i++) {
if (port->pl->transfers[i]) {
GP_LOG_D("canceling transfer %d:%p (status %d)",i, port->pl->transfers[i], port->pl->transfers[i]->status);
@@ -456,7 +457,7 @@ gp_libusb1_close (GPPort *port)
}
}
}
- /* Do just one loop ... this should be sufficient and avoids endless loops. */
+ /* Do just one round ... this should be sufficient and avoids endless loops. */
haveone = 0;
for (i = 0; i < sizeof(port->pl->transfers)/sizeof(port->pl->transfers[0]); i++) {
if (port->pl->transfers[i]) {
@@ -467,6 +468,7 @@ gp_libusb1_close (GPPort *port)
if (haveone)
LOG_ON_LIBUSB_E (libusb_handle_events(port->pl->ctx));
+
if (libusb_release_interface (port->pl->dh,
port->settings.usb.interface) < 0) {
int saved_errno = errno;