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: read_value(); if (value == NULL) { sleep_a_little_bit(); read_value(); }
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.
Kay, can you suggest how to proceed with this?
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?
It's 2.6.27.3-rc1 from Fedora Rawhide (development branch).
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.
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.