From: <mar...@us...> - 2014-05-26 12:12:46
|
Revision: 14957 http://sourceforge.net/p/gphoto/code/14957 Author: marcusmeissner Date: 2014-05-26 12:12:38 +0000 (Mon, 26 May 2014) Log Message: ----------- do not add the regex matcher for ^usb: if there is no USB support in system. handle missing usb support in gp_port_usb_update Modified Paths: -------------- trunk/libgphoto2/libgphoto2_port/libusb1/libusb1.c Modified: trunk/libgphoto2/libgphoto2_port/libusb1/libusb1.c =================================================================== --- trunk/libgphoto2/libgphoto2_port/libusb1/libusb1.c 2014-05-21 19:41:44 UTC (rev 14956) +++ trunk/libgphoto2/libgphoto2_port/libusb1/libusb1.c 2014-05-26 12:12:38 UTC (rev 14957) @@ -124,6 +124,11 @@ int nrofdevs = 0; struct libusb_device_descriptor *descs; + if (libusb_init (&ctx) != 0) { + gp_log (GP_LOG_ERROR, "libusb1", "libusb_init failed."); + return GP_ERROR_IO; + } + /* generic matcher. This will catch passed XXX,YYY entries for instance. */ gp_port_info_new (&info); gp_port_info_set_type (info, GP_PORT_USB); @@ -131,10 +136,6 @@ gp_port_info_set_path (info, "^usb:"); CHECK (gp_port_info_list_append (list, info)); - if (libusb_init (&ctx) != 0) { - gp_log (GP_LOG_ERROR, "libusb1", "libusb_init failed."); - return GP_ERROR_IO; - } nrofdevs = libusb_get_device_list (ctx, &devs); descs = malloc (sizeof(descs[0])*nrofdevs); for (i=0;i<nrofdevs;i++) { @@ -615,9 +616,10 @@ { int ret, ifacereleased = FALSE; - if (!port) + if (!port || !port->pl || !port->pl->ctx) return GP_ERROR_BAD_PARAMETERS; + gp_log (GP_LOG_DEBUG, "libusb1", "gp_port_usb_update(old int=%d, conf=%d, alt=%d) port %s, (new int=%d, conf=%d, alt=%d) port %s", port->settings.usb.interface, port->settings.usb.config, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |