Bug 18182 - hot-plugged USB devices lack configuration information
Summary: hot-plugged USB devices lack configuration information
Alias: None
Product: hal
Classification: Unclassified
Component: hald (show other bugs)
Version: unspecified
Hardware: Other Linux (All)
: medium normal
Assignee: David Zeuthen (not reading bugmail)
QA Contact:
Depends on:
Reported: 2008-10-22 12:21 UTC by Alex Kanavin
Modified: 2008-10-31 08:41 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Description Alex Kanavin 2008-10-22 12:21:54 UTC
Just noticed that hot-plugged USB devices lack configuration information from configuration descriptor, things that show up in lsusb as:

    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 

Cold-plugged USB devices do have it. I believe that hal tries to read this info too quickly, before it becomes available in sysfs. Probably this scheme could fix things:

if (value == NULL) {
Comment 1 Danny Kukawka 2008-10-23 09:02:19 UTC
As already in other cases: this looks like a kernel bug. 

See e.g. http://thread.gmane.org/gmane.comp.freedesktop.hal/12111 and the mails from Kay Sievers.
Comment 2 Alex Kanavin 2008-10-23 09:24:50 UTC
Kay, can you suggest how to proceed with this?
Comment 3 Kay Sievers 2008-10-23 12:29:39 UTC
If these sysfs values are not readable, especially if these files are not even created that time, it should be fixed in the kernel, yes.

There have been recent fixes for usb sysfs, which kernel version is it, where you see this?
Comment 4 Alex Kanavin 2008-10-23 13:24:18 UTC
It's from Fedora Rawhide (development branch).
Comment 5 Kay Sievers 2008-10-24 14:32:53 UTC
Ich talked to Alan Stern, the device configuration is activated later, only after the device is created, so this behavior is expected. The device config can change at any time, and HAL will not necessarily notice it. The current plan is to add "change" event to the kenrnel, emitted after a configuration change.
Comment 6 Kay Sievers 2008-10-31 08:41:53 UTC
The behavior is expected and not a bug in the kernel. The attributes are created, but return an empty string for unconfigured devices. New devices the USB bus creates have no configuration at the time the event is send.

We thought we could add additional events to the kernel, but unfortunatly, we can not add "change" events for the "usb_device" devices, as it breaks some udev rules regarding the /dev/bus/usb/* device nodes. This bug is fixed, but still exists in current distros, and prevents us from doing it right now.

It should be fixed in HAL, and I suggest these device values should always be updated if any interface belonging to the device is created or removed. That should cover most use cases.

In general, mirroring kernel configuration information like this is fragile, and can not work reliably without tight integration with the kernel. It is one of the things to keep in mind what DeviceKit should never do.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.