On Mon, Jan 21, 2002, Duncan Sands <[EMAIL PROTECTED]> wrote: > On Monday 21 January 2002 9:29 pm, Greg KH wrote: > > On Mon, Jan 21, 2002 at 10:18:15AM +0100, Duncan Sands wrote: > > > There seems to be a problem with file sizes in the 2.5.2 (ok 2.5.2-dj3) > > > kernel (size = 0): > > > > > > $ ls -l /proc/bus/usb/001/ > > > total 2 > > > -rw-r--r-- 1 root root 0 Jan 21 10:06 001 > > > -rw-r--r-- 1 root root 0 Jan 21 10:15 002 > > > > > > It should be (size = 18) > > > > Why should it be 18, just because a previous kernel said so? :) > > Because that's how big it is? (= how much info it contains). > > > Seriously, does this break anything because the file size is reported as > > 0? I can change the size to be the same size as the "struct > > usb_device_descriptor" like previous kernels if it has broken anything. > > Yes, it breaks the user space driver for the Alcatel speedtouch adsl modem. > The driver scans the files in /proc/bus/usb trying to find the modem. It checks > whether the file is the same size as "struct usb_device_descriptor" (sanity check > I suppose) before reading it.
That's not safe to do with any filesystem (virtual or physical). There's always a race between determining the file size and reading. Not to mention there were some kernels (IIRC) that send the device descriptor but set the file size to 0. You should just read and if you get 0, then there's nothing (really old kernels), or if you get 18, then it's the config descriptor. I've been thinking about sending the cached config descriptors as well if you read enough. JE _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
