On Mon, Jan 21, 2002 at 09:52:41PM +0100, Duncan Sands 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.

Fair enough.  Here's a patch against 2.5.3-pre2 that fixes this.  I'll
include it in the next round of patches to Linus.

thanks,

greg k-h


diff -Nru a/drivers/usb/inode.c b/drivers/usb/inode.c
--- a/drivers/usb/inode.c       Mon Jan 21 13:04:28 2002
+++ b/drivers/usb/inode.c       Mon Jan 21 13:04:28 2002
@@ -688,6 +688,12 @@
        if (dev->dentry == NULL)
                return;
 
+       /* Set the size of the device's file to be
+        * equal to the size of the device descriptor. */
+       if (dev->dentry->d_inode)
+               dev->dentry->d_inode->i_size = 
+                       sizeof (struct usb_device_descriptor);
+
        usbfs_update_special();
        usbdevfs_conn_disc_event();
 }

_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to