[libgphoto2] Fix PTP devices not working in USB-3 ports (rhbz#819918)

Hans de Goede jwrdegoede at fedoraproject.org
Thu May 2 08:52:01 UTC 2013


commit fbbe8e12aa0146917d036a2ee9eedc15d75bd32d
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Thu May 2 10:55:50 2013 +0200

    Fix PTP devices not working in USB-3 ports (rhbz#819918)
    
    - Cleanup spec-file

 libgphoto2-ptp-usb3.patch |   19 ++++++++++
 libgphoto2.spec           |   89 ++++++++++++++++++++++-----------------------
 2 files changed, 63 insertions(+), 45 deletions(-)
---
diff --git a/libgphoto2-ptp-usb3.patch b/libgphoto2-ptp-usb3.patch
new file mode 100644
index 0000000..238d438
--- /dev/null
+++ b/libgphoto2-ptp-usb3.patch
@@ -0,0 +1,19 @@
+https://sourceforge.net/p/gphoto/code/14268/
+
+disable the default clear halt condition code.
+
+this does not work on some USB 3 controllers.
+
+--- a/camlibs/ptp2/library.c
++++ b/camlibs/ptp2/library.c
+@@ -1730,7 +1730,9 @@
+ 		params = NULL;
+ 		camera->pl = NULL;
+ 	}
+-	if ((camera->port!=NULL) && (camera->port->type == GP_PORT_USB)) {
++	/* This code hangs USB 3 devices after the first bulk image transmission.
++         * For some unknown reason. */
++	if (0 && (camera->port!=NULL) && (camera->port->type == GP_PORT_USB)) {
+ 		/* clear halt */
+ 		gp_port_usb_clear_halt
+ 				(camera->port, GP_PORT_USB_ENDPOINT_IN);
diff --git a/libgphoto2.spec b/libgphoto2.spec
index 9fb27f2..8eed15f 100644
--- a/libgphoto2.spec
+++ b/libgphoto2.spec
@@ -1,30 +1,29 @@
 %global udevdir %(pkg-config --variable=udevdir udev)
 
-Summary: Library for accessing digital cameras
-Name: libgphoto2
-Version: 2.5.1.1
-Release: 2%{?dist}
+Name:           libgphoto2
+Version:        2.5.1.1
+Release:        3%{?dist}
+Summary:        Library for accessing digital cameras
+Group:          Development/Libraries
 # GPLV2+ for the main lib (due to exif.c) and most plugins, some plugins GPLv2
-License: GPLv2+ and GPLv2
-Group: Development/Libraries
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-Source0: http://downloads.sourceforge.net/gphoto/libgphoto2-%{version}.tar.bz2
-Patch1: gphoto2-pkgcfg.patch
-Patch2: gphoto2-storage.patch
-Patch3: gphoto2-ixany.patch
-Patch4: gphoto2-device-return.patch
-Url: http://www.gphoto.org/
-Requires: lockdev
-BuildRequires: libusb1-devel, libusb-devel >= 0.1.5
-BuildRequires: lockdev-devel
-BuildRequires: libexif-devel
-BuildRequires: libjpeg-devel
-BuildRequires: pkgconfig, sharutils
-BuildRequires: libtool-ltdl-devel, popt-devel
-BuildRequires: gd-devel
-BuildRequires: systemd
-Obsoletes: gphoto2 < 2.4.0-11
-Obsoletes: gphoto2-devel < 2.4.0-11
+License:        GPLv2+ and GPLv2
+URL:            http://www.gphoto.org/
+Source0:        http://downloads.sourceforge.net/gphoto/libgphoto2-%{version}.tar.bz2
+Patch1:         gphoto2-pkgcfg.patch
+Patch2:         gphoto2-storage.patch
+Patch3:         gphoto2-ixany.patch
+Patch4:         gphoto2-device-return.patch
+Patch5:         libgphoto2-ptp-usb3.patch
+BuildRequires:  libusb1-devel, libusb-devel >= 0.1.5
+BuildRequires:  lockdev-devel
+BuildRequires:  libexif-devel
+BuildRequires:  libjpeg-devel
+BuildRequires:  pkgconfig, sharutils
+BuildRequires:  libtool-ltdl-devel, popt-devel
+BuildRequires:  gd-devel
+BuildRequires:  systemd
+Requires:       lockdev
+Obsoletes:      gphoto2 < 2.4.0-11
 
 %description
 libgphoto2 is a library that can be used by applications to access
@@ -32,14 +31,14 @@ various digital cameras. libgphoto2 itself is not a GUI application,
 opposed to gphoto. There are GUI frontends for the gphoto2 library,
 however, such as gtkam for example.
 
+
 %package devel
-Summary: Headers and links to compile against the libgphoto2 library
-Group: Development/Libraries
-Requires: %{name} = %{version}-%{release}
-Requires: pkgconfig, libusb-devel >= 0.1.5, libexif-devel
-Obsoletes: gphoto2 < 2.4.0-11
-Obsoletes: gphoto2-devel < 2.4.0-11
-Provides: gphoto2-devel = %{version}-%{release}
+Summary:        Headers and links to compile against the libgphoto2 library
+Group:          Development/Libraries
+Requires:       %{name}%{?_isa} = %{version}-%{release}
+Requires:       libusb-devel >= 0.1.5, libexif-devel
+Obsoletes:      gphoto2-devel < 2.4.0-11
+Provides:       gphoto2-devel = %{version}-%{release}
 
 %description devel
 libgphoto2 is a library that can be used by applications to access
@@ -50,14 +49,16 @@ however, such as gtkam for example.
 This package contains files needed to compile applications that
 use libgphoto2.
 
+
 %prep
 %setup -q
 %patch1 -p1 -b .pkgcfg
 %patch2 -p1 -b .storage
 %patch3 -p1 -b .ixany
 %patch4 -p1 -b .device-return
+%patch5 -p1
 
-for i in AUTHORS COPYING libgphoto2_port/AUTHORS libgphoto2_port/COPYING.LIB `find -name 'README.*'`; do
+for i in AUTHORS ChangeLog COPYING libgphoto2_port/AUTHORS libgphoto2_port/COPYING.LIB `find -name 'README.*'`; do
 	mv ${i} ${i}.old
 	iconv -f ISO-8859-1 -t UTF-8 < ${i}.old > ${i}
 	touch -r ${i}.old ${i} || :
@@ -81,10 +82,9 @@ Cflags: -I${includedir} -I${includedir}/gphoto2
 EOF
 sed 's/Name: gphoto2/Name: gphoto2-port/' < gphoto2.pc.in > gphoto2-port.pc.in
 
+
 %build
 export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
-#libusb and libusb have shoved their .pc files into /lib[64]/pkgconfig
-export PKG_CONFIG_PATH=/%{_lib}/pkgconfig
 %configure \
 	udevscriptdir='%{udevdir}' \
 	--with-drivers=all \
@@ -100,10 +100,9 @@ sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libgphoto2_port/
 
 make %{?_smp_mflags}
 
-%install
-rm -rf "${RPM_BUILD_ROOT}"
 
-make mandir=%{_mandir} DESTDIR=$RPM_BUILD_ROOT install
+%install
+%make_install INSTALL="install -p" mandir=%{_mandir}
 
 pushd packaging/linux-hotplug/
 export LIBDIR=$RPM_BUILD_ROOT%{_libdir}
@@ -132,11 +131,12 @@ rm -rf %{buildroot}%{_libdir}/*.la
 %find_lang %{name}_port-10
 cat libgphoto2*.lang >> %{name}.lang
 
-%clean
-rm -rf "${RPM_BUILD_ROOT}"
+
+%post -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
+
 
 %files -f %{name}.lang
-%defattr(-,root,root)
 %doc AUTHORS COPYING README NEWS
 %dir %{_libdir}/libgphoto2_port
 %dir %{_libdir}/libgphoto2_port/*
@@ -148,12 +148,7 @@ rm -rf "${RPM_BUILD_ROOT}"
 %{_udevrulesdir}/40-libgphoto2.rules
 %{udevdir}/check-ptp-camera
 
-%post -p /sbin/ldconfig
-
-%postun -p /sbin/ldconfig
-
 %files devel
-%defattr(-,root,root)
 %doc %{_docdir}/%{name}
 %{_datadir}/libgphoto2
 %{_bindir}/gphoto2-config*
@@ -164,6 +159,10 @@ rm -rf "${RPM_BUILD_ROOT}"
 %{_mandir}/man3/*
 
 %changelog
+* Thu May  2 2013 Hans de Goede <hdegoede at redhat.com> - 2.5.1.1-3
+- Fix PTP devices not working in USB-3 ports (rhbz#819918)
+- Cleanup spec-file
+
 * Tue Apr 23 2013 Tim Waugh <twaugh at redhat.com> 2.5.1.1-2
 - Use _udevrulesdir macro.
 


More information about the scm-commits mailing list