Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 01 Oct 2013 13:45:21 +0200
From:      Hans Petter Selasky <hans.petter.selasky@bitfrost.no>
To:        Artyom Mirgorodskiy <artyom.mirgorodsky@gmail.com>
Cc:        gnome@FreeBSD.org, "freebsd-current@freebsd.org" <freebsd-current@freebsd.org>
Subject:   Re: gphoto2 bus error
Message-ID:  <524AB5D1.1000503@bitfrost.no>
In-Reply-To: <2203393.ZaYDNWG94H@notebook.alkar.net>
References:  <1430354.OSvlCO8lK8@notebook.alkar.net> <60028529.ObLm6B0bQB@notebook.alkar.net> <524AA6A3.6050203@bitfrost.no> <2203393.ZaYDNWG94H@notebook.alkar.net>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------000902030100020203080203
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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


--------------000902030100020203080203
Content-Type: text/x-patch;
 name="libgphoto2.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="libgphoto2.patch"

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);
 }

--------------000902030100020203080203--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?524AB5D1.1000503>