[libusb] adds USB access error logging

jvcelak jvcelak at fedoraproject.org
Tue Sep 14 15:12:54 UTC 2010


commit 55969989432b239ce9d4eb8e778a6d681b030e24
Author: Jan Vcelak <jvcelak at redhat.com>
Date:   Tue Sep 14 16:51:46 2010 +0200

    adds USB access error logging
    
    Upstream Ticket: #44
    Resolves: #628356

 libusb-documentation.patch            |   31 +++++++++++++++++++++++++++++++
 libusb-error-access-log-message.patch |   30 ++++++++++++++++++++++++++++++
 libusb.spec                           |   11 ++++++++++-
 3 files changed, 71 insertions(+), 1 deletions(-)
---
diff --git a/libusb-documentation.patch b/libusb-documentation.patch
new file mode 100644
index 0000000..ea2149d
--- /dev/null
+++ b/libusb-documentation.patch
@@ -0,0 +1,31 @@
+From 511324a538a034f7f0766b7689ed50ed4e21ee43 Mon Sep 17 00:00:00 2001
+From: Daniel Drake <dsd at gentoo.org>
+Date: Thu, 17 Sep 2009 23:49:53 +0545
+Subject: [PATCH] Document breakage from internal handle structure change
+
+Code exists which expects usb_dev_handle to always have the same
+contents as it did in libusb-0.1.12. Such code will not work with the
+compat layer since the structure has changed.
+---
+ README |    5 +++++
+ 1 files changed, 5 insertions(+), 0 deletions(-)
+
+diff --git a/README b/README
+index 15f17a5..97ab68d 100644
+--- a/README
++++ b/README
+@@ -29,6 +29,11 @@ Known quirks/differences from libusb-0.1:
+  5. Error codes returned on certain events may not exactly match the error
+     codes returned by libusb-0.1. Patches accepted to bring us closer to the
+     behaviour of libusb-0.1 on Linux.
++ 6. The internal structure of usb_dev_handle is different from libusb-0.1. Of
++    course, since this is a purely internal structure, that shouldn't cause
++    any problems. In reality, some libusb-0.1 users make assumptions about what
++    is inside (bad programming practice) and those assumptions are no longer
++    true, resulting in broken software.
+ 
+ libusb homepage:
+ http://libusb.sourceforge.net
+-- 
+1.7.2.2
+
diff --git a/libusb-error-access-log-message.patch b/libusb-error-access-log-message.patch
new file mode 100644
index 0000000..73ea598
--- /dev/null
+++ b/libusb-error-access-log-message.patch
@@ -0,0 +1,30 @@
+From ccb66689c0e04db4ac8474e573ca2e5f055f5d7b Mon Sep 17 00:00:00 2001
+From: Daniel Drake <dan at reactivated.net>
+Date: Tue, 22 Jun 2010 18:19:15 -0500
+Subject: [PATCH] Add log message for open permission denied errors
+
+This message was previously in libusb but is being removed (ticket #44).
+Move it here so that this caveat (also documented in README) is more
+obvious.
+---
+ libusb/core.c |    4 ++++
+ 1 files changed, 4 insertions(+), 0 deletions(-)
+
+diff --git a/libusb/core.c b/libusb/core.c
+index 62fae8c..3da15c6 100644
+--- a/libusb/core.c
++++ b/libusb/core.c
+@@ -659,6 +659,10 @@ API_EXPORTED usb_dev_handle *usb_open(struct usb_device *dev)
+ 
+ 	r = libusb_open((libusb_device *) dev->dev, &udev->handle);
+ 	if (r < 0) {
++		if (r == LIBUSB_ERROR_ACCESS) {
++			usbi_info("Device open failed due to a permission denied error.");
++			usbi_info("libusb requires write access to USB device nodes.");
++		}
+ 		usbi_err("could not open device, error %d", r);
+ 		free(udev);
+ 		errno = libusb_to_errno(r);
+-- 
+1.7.2.2
+
diff --git a/libusb.spec b/libusb.spec
index c9d8219..aa16be2 100644
--- a/libusb.spec
+++ b/libusb.spec
@@ -1,7 +1,7 @@
 Name: libusb
 Epoch: 1
 Version: 0.1.3
-Release: 2%{?dist}
+Release: 3%{?dist}
 Summary: A library which allows userspace access to USB devices
 Group: System Environment/Libraries
 License: LGPLv2+
@@ -9,6 +9,9 @@ URL: http://sourceforge.net/projects/libusb/
 Source0: http://prdownloads.sourceforge.net/libusb/libusb-compat-%{version}.tar.bz2
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
+Patch0: libusb-documentation.patch
+Patch1: libusb-error-access-log-message.patch
+
 BuildRequires: libusb1-devel
 
 %description
@@ -40,6 +43,8 @@ this one.
 
 %prep
 %setup -q -n libusb-compat-%{version}
+%patch0 -p1 -b documentation
+%patch1 -p1 -b error-access-log-message
 
 %build
 %configure
@@ -73,6 +78,10 @@ rm -rf %{buildroot}
 %{_libdir}/libusb.a
 
 %changelog
+* Tue Sep 14 2010 Jan Vcelak <jvcelak at redhat.com> 0.1.3-3
+- add USB access error logging (#628356)
+- update README
+
 * Sat Aug 28 2010 Rex Dieter <rdieter at fedoraproject.org> 1:0.1.3-2
 - fix epoch-related bustage
 


More information about the scm-commits mailing list