Bug 178994 - Device search order
Summary: Device search order
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: libusb
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jindrich Novy
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 177650 178543
TreeView+ depends on / blocked
 
Reported: 2006-01-26 10:04 UTC by Linus Walleij
Modified: 2013-07-02 23:13 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2006-01-27 09:25:34 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

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!


Note You need to log in before you can comment on or make changes to this bug.