Bug 4062 - Kernel isn't reporting USB bus numbers in /sys
Summary: Kernel isn't reporting USB bus numbers in /sys
Status: CLOSED INVALID
Alias: None
Product: Drivers
Classification: Unclassified
Component: USB (show other bugs)
Hardware: i386 Linux
: P2 normal
Assignee: Greg Kroah-Hartman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-18 22:09 UTC by Kelly Price
Modified: 2005-02-22 15:04 UTC (History)
0 users

See Also:
Kernel Version: 2.6 Linus series, up to 2.6.10
Subsystem:
Regression: ---
Bisected commit-id:


Attachments

Description Kelly Price 2005-01-18 22:09:35 UTC
Distribution:  Slackware(previously detected) and Gentoo
Hardware Environment:  Athlon XP 1600+, 1.5 Gig RAM, 60 gig HD, VIA board
Software Environment:  Gentoo latest build
Problem Description:

Alot of folks are trying to "coldplug" USB devices, including scanners.  Many
modern motherboards now have two or more USB controllers on board, and many
users are plugging scanners into a secondary (or other than the primary) USB
controller's hub.

When many distro's boot with hotplug and coldplug utilities installed, coldplug
has to scan /sys/bus/usb and try to generate accurate pointers for /proc/bus/usb
to hand off to SANE or other utilites which use hotplug to configure a device
when plugged in.  However, for those scanners and other programs which need to
properly configure the device in /proc/bus/usb (chmoding/chowning the device
node), if it's not plugged into the primary USB, coldplug sends out the wrong
filename to configure it.

Unfortunately, in tracing coldplug's code, it confuses a device number for the
root hub as being the USB bus number -- which doesn't change from "1" no matter
what bus it is.  This makes most items look like they're in
/proc/bus/usb/001/00x when they're in /proc/bus/usb/00n/00x where n>1.

However, this isn't much of the code's fault because there's no USB bus number
even being reported in /sys.  Normal hotplugging (shoving the USB plug into the
socket) works as is, but the kernel's not giving coldplug what it needs on boot.

Steps to reproduce:

1.  Take any USB device, and locate what driver gets loaded.  Example:  A Sharp
Zaurus 5500SL plugged in would load usbnet.

2.  Code up a simple script, named after the driver, make it executable and put
it in /etc/hotplug/usb/.  Contents of said script are:

#!/bin/sh
logger -s $ACTION $DEVICE

3.  Plus in the device in any primary USB hub port, and reboot.  Note what is
logged.  (My Zaurus was on the second port on the primary hub and my system
reports logger: add /proc/bus/usb/001/003)

4.  Pull out the device and plug it into any secondary hub (like in the front of
the machine).  Reboot and note what's logged again.  (Betcha it reports
something similar to /proc/bus/usb/001/... )

A full debugging analysis is at http://bugs.gentoo.org/show_bug.cgi?id=72676
Comment 1 Greg Kroah-Hartman 2005-02-17 08:48:33 UTC
The bus number _is_ in sysfs, see the gentoo bug for where I point that out.

This is not a kernel issue, sorry.
Comment 2 Kelly Price 2005-02-22 14:45:18 UTC
Okay, then do this:

Tell linux-hotplug how to read the bus number on cold plugging, because
according to you, THEY HAVE IT WRONG.  You're on the linux-hotplug list, you got
a bug there.
Comment 3 Greg Kroah-Hartman 2005-02-22 15:04:20 UTC
Fine, submit a patch to the coldplug scripts.

But either way, this is not a kernel bug, so I'm closing it here.

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