[haiku-commits] r38405 - haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_floppy

  • From: pulkomandy@xxxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 27 Aug 2010 19:54:04 +0200 (CEST)

Author: pulkomandy
Date: 2010-08-27 19:54:04 +0200 (Fri, 27 Aug 2010)
New Revision: 38405
Changeset: http://dev.haiku-os.org/changeset/38405

Modified:
   haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_floppy/usb_disk.cpp
Log:
Use block read and block write instead of regular read and write commands. 
Mounting the device read-only now works. Writing 
is still not working.


Modified: 
haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_floppy/usb_disk.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_floppy/usb_disk.cpp     
2010-08-27 17:33:54 UTC (rev 38404)
+++ haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_floppy/usb_disk.cpp     
2010-08-27 17:54:04 UTC (rev 38405)
@@ -837,18 +837,23 @@
        uint8 commandBlock[12];
        memset(commandBlock, 0, sizeof(commandBlock));
 
-       commandBlock[0] = SCSI_READ_10;
+       commandBlock[0] = 0xA8;
        commandBlock[1] = lun->logical_unit_number << 5;
        commandBlock[2] = blockPosition >> 24;
        commandBlock[3] = blockPosition >> 16;
        commandBlock[4] = blockPosition >> 8;
        commandBlock[5] = blockPosition;
-       commandBlock[7] = *length >> 8;
-       commandBlock[8] = *length;
-       // TODO: blockCount ?
+       commandBlock[6] = blockCount >> 24;
+       commandBlock[7] = blockCount >> 16;
+       commandBlock[8] = blockCount >> 8;
+       commandBlock[9] = blockCount;
 
-       status_t result = usb_disk_operation(lun, commandBlock, buffer, length,
-               true);
+       status_t result;
+       do {
+               snooze(10000);
+               result = usb_disk_operation(lun, commandBlock, buffer, length,
+                       true);
+       } while (result != B_OK);
        return result;
 }
 
@@ -860,18 +865,24 @@
        uint8 commandBlock[12];
        memset(commandBlock, 0, sizeof(commandBlock));
 
-       commandBlock[0] = SCSI_WRITE_10;
+       commandBlock[0] = 0xAA;
        commandBlock[1] = lun->logical_unit_number << 5;
        commandBlock[2] = blockPosition >> 24;
        commandBlock[3] = blockPosition >> 16;
        commandBlock[4] = blockPosition >> 8;
        commandBlock[5] = blockPosition;
-       commandBlock[7] = *length >> 8;
-       commandBlock[8] = *length;
-       // TOOD: blockCount ?
+       commandBlock[6] = blockCount >> 24;
+       commandBlock[7] = blockCount >> 16;
+       commandBlock[8] = blockCount >> 8;
+       commandBlock[9] = blockCount;
 
-       status_t result = usb_disk_operation(lun, commandBlock, buffer, length,
-               false);
+       status_t result;
+       do {
+               snooze(10000);
+               result = usb_disk_operation(lun, commandBlock, buffer, length,
+                       true);
+       } while (result != B_OK);
+
        if (result == B_OK)
                lun->should_sync = true;
        return result;


Other related posts: