On 10/01/13 13:11, Artyom Mirgorodskiy wrote:
I removed old libraries:

ls /usr/lib/libusb*
/usr/lib/libusb.a        /usr/lib/libusb_p.a      /usr/lib/libusbhid.so.4
/usr/lib/libusb.so@      /usr/lib/libusbhid.a     /usr/lib/libusbhid_p.a
/usr/lib/libusb.so.3     /usr/lib/libusbhid.so@

and reinstall gphoto2 and libgphoto2
and have the same result :(


Hi,

I quickly looked at the gphoto code and see some bugs there. Can you try the attached patch?

cd /usr/ports/graphics/libgphoto2

make clean extract patch

cd /usr/ports/graphics/libgphoto2/work/libgphoto2-2.4.14

cat libgphoto2.patch | patch -p1

cd /usr/ports/graphics/libgphoto2

make all deinstall install

--HPS

diff --git a/libgphoto2_port/libusb1/libusb1.c b/libgphoto2_port/libusb1/libusb1.c
index c6b16aa..74b722f 100644
--- a/libgphoto2_port/libusb1/libusb1.c
+++ b/libgphoto2_port/libusb1/libusb1.c
@@ -84,6 +84,14 @@ static int gp_nrofdevs = 0;
 static struct libusb_device_descriptor	*gp_descs;
 static libusb_device			**gp_devs;
 
+static void
+free_devicelist(void)
+{
+	if (gp_devs != NULL)
+		libusb_free_device_list (gp_devs, 1);
+	gp_devs = NULL;
+}
+
 static ssize_t
 load_devicelist (libusb_context *ctx) {
 	time_t	xtime;
@@ -91,7 +99,7 @@ load_devicelist (libusb_context *ctx) {
 	time(&xtime);
 	if (xtime != gp_devslastchecked) {
 		if (gp_nrofdevs)
-			libusb_free_device_list (gp_devs, 1);
+			free_devicelist();
 		free (gp_descs);
 		gp_nrofdevs = 0;
 		gp_devs = NULL;
@@ -267,12 +275,14 @@ static int gp_port_usb_init (GPPort *port)
 static int
 gp_port_usb_exit (GPPort *port)
 {
+	/* devices must be freed before exiting the USB context */
+	free_devicelist();
+
 	if (port->pl) {
 		libusb_exit (port->pl->ctx);
 		free (port->pl);
 		port->pl = NULL;
 	}
-	if (gp_devs) libusb_free_device_list (gp_devs, 1);
 	free (gp_descs);
 	return (GP_OK);
 }
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to