Henning Meier-Geinitz wrote: > Hi, > > On Thu, Sep 16, 2004 at 08:48:26AM +0200, Bertrik Sikken wrote: > >>In the 2.6.x range of kernels there is a weird issue (=bug?), i.e. >>there is a race between the hotplug event and the creation of the >>libusb 'device file' (in /proc/bus/usb). > > > Uh, really? That makes the whole idea of hot-plug void. It hasn't > happened for me, as far as I remember? > > >>The libusbscanner hotplug script does not take this into account >>so it may happen sometimes that the script tries to update permission >>for a file that doesn't exist yet. >>As far as I know, this race will be looked at in the next kernel >>series, > > > So the fix will be there in 2 or three years? Strange.
Yes, there really is a problem, but it may have been fixed in the some of the 'generic' hotplug scripts already (I noticed a couple of sleeps here and there in usb.agent and usb.rc on my MDK10.1 system). I definitely had this problem earlier (with just about every USB device, scanner/minidisc/pendrive), but when I tried to reproduce it a moment ago but I didn't run into it anymore. So maybe I was a little paranoid. Here's a thread from linux-hotplug-devel that discusses the problem: http://marc.theaimsgroup.com/?l=linux-hotplug-devel&m=108034761409426&w=2 (cut and paste it together if the link wraps) >>but for now you can use a dirty hack like a 'sleep 1' at the top of >>the hotplug script. > > > Should we use that? Or is there a less ugly way e.g. by checking if > the device file is already there? I'm not sure. Maybe it has really been 'fixed' in the latest hotplug package, in which case I think we need to know the exact version in which it was fixed. Instead of a sleep we could also use a loop to wait for the device (even uglier?). BTW I noticed that the cvs version of sane now has a work-around (by Jochen Eisinger) claiming "# latest hotplug doesn't set DEVICE on 2.6.x kernels" I think this observation is also caused by a hotplug race. Regards, Bertrik