Added empty handles for ejecting a disk and padding the INQUIRY.
authortravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Thu, 22 Nov 2012 00:43:32 +0000 (00:43 +0000)
committertravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Thu, 22 Nov 2012 00:43:32 +0000 (00:43 +0000)
Mode sense is next in Mass Storage emulation.

git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@1341 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

client/goodfet.maxusbmass

index de25c6e..d0562fa 100755 (executable)
@@ -284,7 +284,7 @@ class GoodFETMAXUSBMass(GoodFETMAXUSBDevice):
             #print "Responding to CB inquiry.";
             response=[
                 0x00, # 00 for Direct, 1F for "no floppy"
-                0x80, # make 0x80 for removable media
+                0x80, # make 0x80 for removable media, 0x00 for fixed
                 0x00, # Version
                 0x01, # Response Data Format
                 0x1f, #Additional length.
@@ -297,6 +297,8 @@ class GoodFETMAXUSBMass(GoodFETMAXUSBDevice):
                 ord('0'),ord('.'),ord('0'),ord('1')]
             #print "Sending %i byte reply to %i byte query." % (
             #        len(response),dtlen);
+            while len(response)<dtlen:
+                response=response+[0];
             #while not(self.rreg(rEPIRQ)&bmIN3BAVIRQ):
             #    #Wait for the packet to complete before sending the next.
             #    print "Waiting to complete inquiry."
@@ -380,6 +382,10 @@ class GoodFETMAXUSBMass(GoodFETMAXUSBDevice):
         elif verb==0x2A: #WRITE SECTOR
             print "Haven't implemented WRITE SECTOR.";
             #sys.exit();
+        elif verb==0x1B: #EJECT/RETRACT DISK
+            print "Haven't implemented SCSI Start Stop Unit Command (1B)";
+            print "https://en.wikipedia.org/wiki/SCSI_Start_Stop_Unit_Command";
+            #sys.exit();
         else:
             print "ERROR: Unknown SCSI command block verb %02x." % verb;
             status=1; #Command Failed
@@ -461,6 +467,7 @@ class GoodFETMAXUSBMassFile(GoodFETMAXUSBMass):
                                        self.datafilelen%512);
             sys.exit();
         return self.datafilelen/512-1;
+
 if(len(sys.argv)==1):
     print "Usage: %s disk.img\n" % sys.argv[0];
     sys.exit();