On Mon, Apr 05, 2004 at 08:39:56AM -0300, Marcelo Tosatti wrote:
> On Tue, Mar 30, 2004 at 01:56:14PM -0800, Greg KH wrote:
> > On Tue, Mar 30, 2004 at 12:44:09AM +0200, [EMAIL PROTECTED] wrote:
> > > datafab.c has an often-seen bug: the SCSI READ_CAPACITY command
> > > does not need the number of sectors but the last sector.
> >
> > Applied, thanks.
>
> Hi guys,
>
> We also probably need this for 2.4 ?
Yes. I planned to send you one, but have no time.
Now that you ask, here is the patch, not compiled, not tested.
Andries
--- datafab.c~ 2003-06-13 16:51:37.000000000 +0200
+++ datafab.c 2004-04-05 14:41:24.000000000 +0200
@@ -695,20 +695,24 @@
}
if (srb->cmnd[0] == READ_CAPACITY) {
+ unsigned int max_sector;
+
info->ssize = 0x200; // hard coded 512 byte sectors as per ATA spec
rc = datafab_id_device(us, info);
if (rc != USB_STOR_TRANSPORT_GOOD)
return rc;
- US_DEBUGP("datafab_transport: READ_CAPACITY: %ld sectors, %ld bytes
per sector\n",
+ US_DEBUGP("datafab_transport: READ_CAPACITY: "
+ "%ld sectors, %ld bytes per sector\n",
info->sectors, info->ssize);
// build the reply
//
- ptr[0] = (info->sectors >> 24) & 0xFF;
- ptr[1] = (info->sectors >> 16) & 0xFF;
- ptr[2] = (info->sectors >> 8) & 0xFF;
- ptr[3] = (info->sectors) & 0xFF;
+ max_sector = info->sectors - 1;
+ ptr[0] = (max_sector >> 24) & 0xFF;
+ ptr[1] = (max_sector >> 16) & 0xFF;
+ ptr[2] = (max_sector >> 8) & 0xFF;
+ ptr[3] = (max_sector) & 0xFF;
ptr[4] = (info->ssize >> 24) & 0xFF;
ptr[5] = (info->ssize >> 16) & 0xFF;
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel