Bug 178994

Summary: Device search order
Product: [Fedora] Fedora Reporter: Linus Walleij <triad>
Component: libusbAssignee: Jindrich Novy <jnovy>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: pknirsch
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-01-27 09:25:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 177650, 178543    

Description Linus Walleij 2006-01-26 10:04:57 UTC
Debian has applied the following patch to libusb-0.1.11:

--- libusb-0.1.11.orig/linux.c
+++ libusb-0.1.11/linux.c
@@ -633,14 +633,11 @@
   }

   if (!usb_path[0]) {
-    if (check_usb_vfs("/proc/bus/usb")) {
-      strncpy(usb_path, "/proc/bus/usb", sizeof(usb_path) - 1);
-      usb_path[sizeof(usb_path) - 1] = 0;
-    } else if (check_usb_vfs("/sys/bus/usb")) { /* 2.6 Kernel with sysfs */
-      strncpy(usb_path, "/sys/bus/usb", sizeof(usb_path) -1);
+    if (check_usb_vfs("/dev/bus/usb")) {
+      strncpy(usb_path, "/dev/bus/usb", sizeof(usb_path) - 1);
       usb_path[sizeof(usb_path) - 1] = 0;
-    } else if (check_usb_vfs("/dev/usb")) {
-      strncpy(usb_path, "/dev/usb", sizeof(usb_path) - 1);
+    } else if (check_usb_vfs("/proc/bus/usb")) {
+      strncpy(usb_path, "/proc/bus/usb", sizeof(usb_path) - 1);
       usb_path[sizeof(usb_path) - 1] = 0;
     } else
       usb_path[0] = 0; /* No path, no USB support */

This has been done so that devices in /dev/bus/usb be tried first,
then /proc/bus/usb, and never try /sys/bus/usb.

Can this be applied to Fedoras libusb also? (Or is it already?) 
It is in line with the rest of our architectural choices.

Comment 1 Linus Walleij 2006-01-26 10:10:13 UTC
Notice: udev was altered to provide the devices in /dev/bus/usb,
not in /dev/usb as libusb expects, so this is also a consistency
issue.

Comment 2 Jindrich Novy 2006-01-26 12:28:19 UTC
Looks good to me. I'm looking at the upstream discussion you contributed, so if
there's no fatal objection to it, I'll apply it today.

Comment 3 Linus Walleij 2006-01-27 07:46:41 UTC
The patch has been applied to upstream CVS and will be in libusb 0.1.12,
so it's quite safe I guess.

Comment 4 Jindrich Novy 2006-01-27 09:25:34 UTC
Applied since libusb-0.1.11-2. Thanks!