From 62bd86174876d889d17c0a4d978c2eb7e979219660053637878947eb4af2d819 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sat, 18 Feb 2012 23:57:45 +0000 Subject: [PATCH] Accepting request 105827 from home:dimstar:branches:graphics Fix libusb usage... gphoto2 --auto-detect crashes without this patch.. as well as shotwell startup in some cases... OBS-URL: https://build.opensuse.org/request/show/105827 OBS-URL: https://build.opensuse.org/package/show/graphics/libgphoto2?expand=0&rev=60 --- libgphoto2-libusb.patch | 47 +++++++++++++++++++++++++++++++++++++++++ libgphoto2.changes | 8 +++++++ libgphoto2.spec | 7 ++++++ 3 files changed, 62 insertions(+) create mode 100644 libgphoto2-libusb.patch diff --git a/libgphoto2-libusb.patch b/libgphoto2-libusb.patch new file mode 100644 index 0000000..55ef138 --- /dev/null +++ b/libgphoto2-libusb.patch @@ -0,0 +1,47 @@ +--- libusb1.c.orig 2011-11-13 14:50:32.000000000 +0100 ++++ libusb1.c 2012-02-18 23:44:37.034378810 +0100 +@@ -85,7 +85,7 @@ + static libusb_device **devs = NULL; + + static ssize_t +-load_devicelist (void) { ++load_devicelist (libusb_context *ctx) { + time_t xtime; + + time(&xtime); +@@ -96,7 +96,7 @@ + devs = NULL; + } + if (!nrofdevs) +- nrofdevs = libusb_get_device_list (NULL, &devs); ++ nrofdevs = libusb_get_device_list (ctx, &devs); + return nrofdevs; + } + +@@ -114,7 +114,7 @@ + CHECK (gp_port_info_list_append (list, info)); + + libusb_init (NULL); +- nrofdevs = load_devicelist (); ++ nrofdevs = load_devicelist (NULL); + + for (d = 0; d < nrofdevs; d++) { + struct libusb_device_descriptor desc; +@@ -766,7 +766,7 @@ + return GP_ERROR_BAD_PARAMETERS; + } + +- nrofdevs = load_devicelist (); ++ nrofdevs = load_devicelist (port->pl->ctx); + + for (d = 0; d < nrofdevs; d++) { + struct libusb_device_descriptor desc; +@@ -1067,7 +1067,7 @@ + if (!class) + return GP_ERROR_BAD_PARAMETERS; + +- nrofdevs = load_devicelist (); ++ nrofdevs = load_devicelist (port->pl->ctx); + for (d = 0; d < nrofdevs; d++) { + struct libusb_device_descriptor desc; + struct libusb_config_descriptor *confdesc; diff --git a/libgphoto2.changes b/libgphoto2.changes index fafb398..655460e 100644 --- a/libgphoto2.changes +++ b/libgphoto2.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Sat Feb 18 22:59:56 UTC 2012 - dimstar@opensuse.org + +- Add libgphoto2-libusb.patch: Fix initialization of libusb 1.0. + The initialization of libusb was not always done with the default + context and if not done with the default context, the right one + needs to be passed to subsequent calls. + ------------------------------------------------------------------- Wed Jan 25 10:37:10 UTC 2012 - meissner@suse.com diff --git a/libgphoto2.spec b/libgphoto2.spec index 4a5b9f6..99163c0 100644 --- a/libgphoto2.spec +++ b/libgphoto2.spec @@ -15,6 +15,7 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # + Name: libgphoto2 BuildRequires: doxygen BuildRequires: fdupes @@ -42,6 +43,8 @@ Release: 0 Source0: libgphoto2-%{version}.tar.bz2 Source1: baselibs.conf Patch1: libgphoto2-4096files.patch +# PATCH-FIX-UPSTREAM libgphoto2-libusb.patch dimstar@opensuse.org -- Fix usage of libusb 1.0. Patch written by libusb maintainer Peter Stuge. +Patch2: libgphoto2-libusb.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build Recommends: %{name}-lang = %{version} @@ -76,6 +79,10 @@ These are its development libraries and headers. %prep %setup -q %patch1 -p1 +( +cd libgphoto2_port/libusb1/ +%patch2 +) %build #AUTOPOINT=true autoreconf -fi