X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2Fgoodfet.maxusbmass;h=d0562fa206e693447e1d97c570cf0eed56f3e3c6;hp=da42c90ccf8907382b9c739a99b3f8a25e4fed11;hb=353f324a84d67ed30c4ef59f6d7494d340b4ed42;hpb=b0ffd16b9a06f71372d7943b531cffd45b1bd728 diff --git a/client/goodfet.maxusbmass b/client/goodfet.maxusbmass index da42c90..d0562fa 100755 --- a/client/goodfet.maxusbmass +++ b/client/goodfet.maxusbmass @@ -11,6 +11,13 @@ import time; from GoodFETMAXUSB import *; +def zeros(length): + """Returns a list of zeroes of the specified length.""" + l=range(0,length); + for foo in l: + l[foo]=0; + return l; + class GoodFETMAXUSBMass(GoodFETMAXUSBDevice): """This emulates a USB Mass Storage device.""" @@ -277,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. @@ -290,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)0: - print "Perhaps I should send %i bytes of dummy data here." % dtlen; - sys.exit(1); + print "Sending %i bytes of dummy data here." % dtlen; + self.fifo_ep3in_tx(zeros(dtlen)); + #sys.exit(1); cbw=self.lastCBW; #Now we need to send the CSW. @@ -446,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();