[libmtp] Be more cautious when probing devices

Linus Walleij snirkel at fedoraproject.org
Thu Mar 31 23:09:08 UTC 2011


commit 6326d40cd9870107faca684b2d0ff1e6dad8ed2e
Author: Linus Walleij <linus.walleij at stericsson.com>
Date:   Fri Apr 1 01:08:56 2011 +0200

    Be more cautious when probing devices

 libmtp.spec           |    7 ++++++-
 probe-3-ep-only.patch |   18 ++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/libmtp.spec b/libmtp.spec
index efd560f..c954e5e 100644
--- a/libmtp.spec
+++ b/libmtp.spec
@@ -3,12 +3,13 @@
 
 Name:           libmtp
 Version:        1.0.6
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        A software library for MTP media players
 URL:            http://libmtp.sourceforge.net/
 
 Group:          System Environment/Libraries
 Source0:        http://download.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
+Patch0:		probe-3-ep-only.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 License:        LGPLv2+
 Requires:       udev
@@ -51,6 +52,7 @@ library for MTP media players.
 
 %prep
 %setup -q
+%patch0 -p1
 
 %build
 %configure --disable-static \
@@ -118,6 +120,9 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Fri Apr 01 2011 Linus Walleij <triad at df.lth.se> 1.0.6-2
+- Maybe fixing a probing issue on an input device.
+
 * Sat Feb 12 2011 Linus Walleij <triad at df.lth.se> 1.0.6-1
 - New upstream release fixing bugs & more things we patched.
 
diff --git a/probe-3-ep-only.patch b/probe-3-ep-only.patch
new file mode 100644
index 0000000..141dc9e
--- /dev/null
+++ b/probe-3-ep-only.patch
@@ -0,0 +1,18 @@
+diff --git a/src/libusb-glue.c b/src/libusb-glue.c
+index 5d7889b..3c0a124 100644
+--- a/src/libusb-glue.c
++++ b/src/libusb-glue.c
+@@ -284,6 +284,13 @@ static int probe_device_descriptor(struct usb_device *dev, FILE *dumpfile)
+ 	    &dev->config[i].interface[j].altsetting[k];
+ 
+ 	  /*
++	   * MTP interfaces have three endpoints, two bulk and one
++	   * interrupt. Don't probe anything else.
++	   */
++	  if (intf->bNumEndpoints != 3)
++	    continue;
++
++	  /*
+ 	   * We only want to probe for the OS descriptor if the
+ 	   * device is USB_CLASS_VENDOR_SPEC or one of the interfaces
+ 	   * in it is, so flag if we find an interface like this.


More information about the scm-commits mailing list