0

This has been asked a few times, but I haven't found any actual resolution to how to accomplish this. I will admit, I am a Linux programmer, not MACOS, so this is a very different world, but this shouldn't be so difficult.

I am attempting to send a Vendor command to a USB stick. It is a 16 byte CDB command that I want to send, with 32 bytes of payload, and read back 4096 bytes of payload.

I find I can iterate to the drive using the Vendor ID and Product ID, open the DeviceInterface, but I cannot open the InterfaceInterface. It shows it is already open. I assume this is the block driver holding the drive.

I find also there is an API IOConnectCallStructMethod() which seems to be something interesting, but the API is documented so sparcely on apple.com.

Any hints, nudges, help, examples, are greatly appreciated.

/dan

1 Answers1

0

I don't think you can do this as easy as you did it on Linux. You can read a bit about your approach here, however, no traces that will work: How do I pass SCSI (CDB) commands through a USB connection

What will work for sure, is writing a pass-through scsi driver (with kernel extensions or maybe now driverkit), which will match with your device, then take some command from userspace the way you want it to, and pass to the device, forwarding the answer back. Weird, but this is the way Apple claims to be true one. See for details

Sending a specific SCSI command to a SCSI device in Mac OS X

https://lists.apple.com/archives/darwin-dev/2009/Aug/msg00047.html

Write a kext that enables SCSI command passing to a USB device

https://kunyichen.wordpress.com/2018/01/17/note-scsi-pass-through-mode-on-macos-x/

https://www.smartmontools.org/ticket/25

Arthur Bulakaiev
  • 1,207
  • 8
  • 17