summaryrefslogtreecommitdiff
path: root/libgphoto2_port
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2020-05-10 12:07:11 +0200
committerMarcus Meissner <marcus@jet.franken.de>2020-05-10 12:07:11 +0200
commit6f5fe96a13ac9ed87312da13ce0841b5a44f6e20 (patch)
treec847183cd43e4545f8cdbb65391920d53cb248c0 /libgphoto2_port
parent8efbba0b35d8191cd27be25366c475169b93ebdd (diff)
downloadlibgphoto2-6f5fe96a13ac9ed87312da13ce0841b5a44f6e20.tar.gz
allow switching usb interface and config
fixes https://github.com/gphoto/libgphoto2/issues/502
Diffstat (limited to 'libgphoto2_port')
-rw-r--r--libgphoto2_port/libusb1/libusb1.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libgphoto2_port/libusb1/libusb1.c b/libgphoto2_port/libusb1/libusb1.c
index df42486de..efdbf3b74 100644
--- a/libgphoto2_port/libusb1/libusb1.c
+++ b/libgphoto2_port/libusb1/libusb1.c
@@ -944,7 +944,7 @@ gp_libusb1_update (GPPort *port)
/* The interface changed. release the old, claim the new ... */
if (port->settings.usb.interface != port->pl->interface) {
GP_LOG_D ("changing interface %d -> %d", port->pl->interface, port->settings.usb.interface);
- if (LOG_ON_LIBUSB_E (libusb_release_interface (port->pl->dh, port->pl->interface))) {
+ if ((port->pl->interface != -1) && (LOG_ON_LIBUSB_E (libusb_release_interface (port->pl->dh, port->pl->interface)))) {
/* Not a hard error for now. -Marcus */
} else {
GP_LOG_D ("claiming interface %d", port->settings.usb.interface);
@@ -959,7 +959,7 @@ gp_libusb1_update (GPPort *port)
/* This can only be changed with the interface released.
* This is a hard requirement since 2.6.12.
*/
- if (LOG_ON_LIBUSB_E (libusb_release_interface (port->pl->dh, port->settings.usb.interface))) {
+ if ((port->pl->config != -1) && (LOG_ON_LIBUSB_E (libusb_release_interface (port->pl->dh, port->settings.usb.interface)))) {
ifacereleased = FALSE;
} else {
ifacereleased = TRUE;