Hello community,

here is the log from the commit of package libusb-compat for openSUSE:Factory 
checked in at 2012-04-12 09:38:49
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libusb-compat (Old)
 and      /work/SRC/openSUSE:Factory/.libusb-compat.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libusb-compat", Maintainer is "[email protected]"

Changes:
--------
--- /work/SRC/openSUSE:Factory/libusb-compat/libusb-compat.changes      
2012-02-15 16:16:51.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.libusb-compat.new/libusb-compat.changes 
2012-04-12 09:38:53.000000000 +0200
@@ -1,0 +2,6 @@
+Wed Apr  4 17:33:15 CEST 2012 - [email protected]
+
+- Properly emulate error codes of usb_detach_kernel_driver_np()
+  (bnc#683307).
+
+-------------------------------------------------------------------

New:
----
  libusb-compat-usb_detach_kernel_driver_np-error.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libusb-compat.spec ++++++
--- /var/tmp/diff_new_pack.PDpZJZ/_old  2012-04-12 09:38:54.000000000 +0200
+++ /var/tmp/diff_new_pack.PDpZJZ/_new  2012-04-12 09:38:54.000000000 +0200
@@ -25,6 +25,8 @@
 Release:        0
 Source:         %{name}-%{version}.tar.bz2
 Source2:        baselibs.conf
+# PATCH-FIX-UPSTREAM libusb-compat-usb_detach_kernel_driver_np-error.patch 
bnc683307 [email protected] -- Properly emulate error codes of 
usb_detach_kernel_driver_np().
+Patch:          libusb-compat-usb_detach_kernel_driver_np-error.patch
 BuildRequires:  libtool
 BuildRequires:  libusb-1_0-devel
 BuildRequires:  pkg-config
@@ -71,7 +73,10 @@
 %package devel
 Summary:        libusb-1.0 Compatibility Layer for libusb-0.1
 Group:          Development/Libraries/C and C++
-Requires:       libusb-0_1-4 = 0.1.13 libusb-1_0-features-in-0_1-api 
libusb-1_0-devel glibc-devel
+Requires:       glibc-devel
+Requires:       libusb-0_1-4 = 0.1.13
+Requires:       libusb-1_0-devel
+Requires:       libusb-1_0-features-in-0_1-api
 # Update of libusb from openSUSE < 11.1 SLE < 11:
 Provides:       libusb-devel = 0.1.13
 Obsoletes:      libusb-devel < 0.1.13
@@ -90,12 +95,15 @@
 
 %prep
 %setup -q
+%patch -p1
 
 %build
 %if %suse_version > 1100
 autoreconf -f -i
 %endif
-%configure --with-pic --disable-static
+%configure\
+       --with-pic\
+       --disable-static
 make %{?jobs:-j%jobs}
 
 %install

++++++ libusb-compat-usb_detach_kernel_driver_np-error.patch ++++++
>From 4c9f8bcad07a8b9e79a885d9d1d7bc86549cc868 Mon Sep 17 00:00:00 2001
From: Stanislav Brabec <[email protected]>
Date: Wed Apr  4 17:44:24 CEST 2012
Subject: Fix usb_detach_kernel_driver_np() error mapping.

usb_detach_kernel_driver_np from the compat library returns different
error messages than the old libusb0. It causes problems for drivers
that expect exact error code.

Convert libusb1 errors to back to libusb0 errors to get 1:1 mapping of
kernel error codes.

Affected software:
lirc-0.8.7/daemons/hw_srm7500libusb.c: srm7500_initialize_usbdongle()
The function continues if usb_detach_kernel_driver_np() finishes with no
error or if it returns -ENODATA. But the compat layer returns -ENOENT
and the driver considers this error as fatal.

Upstream bug reference:
http://www.libusb.org/ticket/42
Upstream mailing list reference:
http://sourceforge.net/mailarchive/forum.php?thread_name=1325706952.5095.49.camel%40oct.suse.cz&forum_name=libusb-devel
Downstream bug reference:
https://bugzilla.novell.com/show_bug.cgi?id=683307
---
 libusb/core.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/libusb/core.c b/libusb/core.c
index 04b1822..e26f21b 100644
--- a/libusb/core.c
+++ b/libusb/core.c
@@ -916,6 +916,22 @@ API_EXPORTED int usb_get_driver_np(usb_dev_handle *dev, 
int interface,
 
 API_EXPORTED int usb_detach_kernel_driver_np(usb_dev_handle *dev, int 
interface)
 {
-       return compat_err(libusb_detach_kernel_driver(dev->handle, interface));
+       int r = compat_err(libusb_detach_kernel_driver(dev->handle, interface));
+       switch (r) {
+       case LIBUSB_SUCCESS:
+               return 0;
+       case LIBUSB_ERROR_NOT_FOUND:
+               return -ENODATA;
+       case LIBUSB_ERROR_INVALID_PARAM:
+               return -EINVAL;
+       case LIBUSB_ERROR_NO_DEVICE:
+               return -ENODEV;
+       case LIBUSB_ERROR_OTHER:
+               return -errno;
+       /* default can be reached in libusb-1.0 only in non-Linux 
implementations,
+        * mostly with LIBUSB_ERROR_NOT_SUPPORTED. */
+       default:
+               return -ENOSYS;
+       }
 }
 
-- 
1.7.7
-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to