From: pete-cs Date: Wed, 19 Jun 2013 17:02:41 +0000 (+0000) Subject: handle scsi mode sense to get umass working under linux X-Git-Url: http://git.rot13.org/?p=goodfet;a=commitdiff_plain;h=c2657490044b31c65f541c6cb86a723718129b26 handle scsi mode sense to get umass working under linux git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@1605 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- diff --git a/client/USBMassStorage.py b/client/USBMassStorage.py index 22cfefc..252fabe 100644 --- a/client/USBMassStorage.py +++ b/client/USBMassStorage.py @@ -142,6 +142,17 @@ class USBMassStorageInterface(USBInterface): #diff = cbw.data_transfer_length - len(response) #response += bytes([0] * diff) + elif opcode == 0x1a or opcode == 0x5a: # Mode Sense (6 or 10) + page = cbw.cb[2] & 0x3f + + if self.verbose > 0: + print(self.name, "got SCSI Mode Sense, page code 0x%02x" % page) + + response = b'\x07\x00\x00\x00\x00\x00\x00\x1c' + if page != 0x3f: + print(self.name, "unkonwn page, returning empty page") + response = b'\x07\x00\x00\x00\x00\x00\x00\x00' + elif opcode == 0x1e: # Prevent/Allow Removal: feign success if self.verbose > 0: print(self.name, "got SCSI Prevent/Allow Removal")