We are trying to send a SCSI inquiry to a iOS Flash Drive. Connected via USB we can send the following inquiry command using libUsb and Java:
private byte[] getInquiryCommand(byte replyLength) {
// Command Block Wrapper (CBW)
ByteBuffer outBuffer = ByteBuffer.allocate(31); // ATTENTION!!!! WE NEED EXACTLY 31 BYTES! See: http://www.usb.org/developers/docs/devclass_docs/usbmassbulk_10.pdf
outBuffer.order(ByteOrder.LITTLE_ENDIAN);
outBuffer.putInt(0x43425355); // CBW Signature
outBuffer.putInt(0x84752008); // CBW Tag ~ command identifier
outBuffer.putInt((byte) 0x24); // CBW Data transfer length
outBuffer.put((byte) 0x80); // CBW Flags (0x80 = Data IN)
outBuffer.put((byte) 0x0); // CBW Lun
outBuffer.put((byte) 0x6); // CBW CB Length
// Inquiry Command
outBuffer.put((byte) 0x12); // operation code
outBuffer.put((byte) 0x01); // reserved, CmdDt, EVPD
outBuffer.put((byte) 0x80); // page code
outBuffer.put((byte) 0x00); // reserved (or allocation MSB)
outBuffer.put((byte) replyLength); // allocation (reply) length
outBuffer.put((byte) 0x00); // control
return outBuffer.array();
}
For this we are wrapping the SCSI command into the USB protocol. No we want to do the same thing with Swift and iOS. The problem is that we aren't in contact with the hardware manufacturer and we aren't member of the MFI program. We tried to send the same request in swift to a flash drive connected to a IPhone. But of course this doesn’t work because we are using the USB protocol to wrap the SCSI command, but we need to use some Lightning protocol Layer(That's what we believe...) This is the Request:
func getInquiryCommand() -> [UInt8]{
return [
0x55, // CBW Signature 1
0x53, // CBW Signature 2
0x42, // CBW Signature 3
0x43, // CBW Signature 4
0x08, // CBW Tag ~ command identifier 1
0x20, // CBW Tag ~ command identifier 2
0x75, // CBW Tag ~ command identifier 3
0x84, // CBW Tag ~ command identifier 4
0x24, // CBW Data transfer length
0x0, // CBW Data transfer length
0x0, // CBW Data transfer length
0x0, // CBW Data transfer length
0x80, // CBW Flags (0x80 = Data IN)
0x0, // CBW Lun
0x6, // CBW CB Length
// Inquiry Command
0x12, // operation code
0x01, // reserved, CmdDt, EVPD
0x80, // page code
0x00, // reserved (or allocation MSB)
127, // allocation (reply) length
0x00, // control
0x00, // Auf 31 Bytes auffüllen
0x00, // Auf 31 Bytes auffüllen
0x00, // Auf 31 Bytes auffüllen
0x00, // Auf 31 Bytes auffüllen
0x00, // Auf 31 Bytes auffüllen
0x00, // Auf 31 Bytes auffüllen
0x00, // Auf 31 Bytes auffüllen
0x00, // Auf 31 Bytes auffüllen
0x00, // Auf 31 Bytes auffüllen
0x00, // Auf 31 Bytes auffüllen
]
}
The protocol string for one of our devices is "com.allbond.protocol05".
Does anyone know if it's even possible to send a SCSI inquiry this way? We would also appreciate any further information to the topic.