can anyone point me at literature describing how to locate/access an IOUSBMassStorageDriver?

i have a usb device and am writing an OS X app which sends it commands. it shows up in the ioRegistry as a IOUSBMassStorageDriver. i want to send it some commands but can't find specific enough information about how to do this. the following code finds a plain vanilla usb driver which apparently is not able to actually deliver my commands to the device. any help is appreciated. a book, a tutorial, sample code, anything which is specific about IOUSBMassStorageDriver


let matchingDict = { IOProviderClass : IOUSBDevice, idProduct : 58113, idVendor : 1238 }

var matchedIterator:io_iterator_t = 0

var removalIterator:io_iterator_t = 0

let notifyPort:IONotificationPortRef = IONotificationPortCreate(kIOMasterPortDefault)

IONotificationPortSetDispatchQueue(notifyPort, DispatchQueue(label: "IODetector"))


let matchingCallback:IOServiceMatchingCallback = { (userData, iterator) in

// Convert self to a void pointer, store that in the context, and convert it

let this = Unmanaged<TLUSBDeviceMonitor>.fromOpaque(userData!).takeUnretainedValue()

this.rawDeviceAdded(iterator: iterator)

}


let removalCallback: IOServiceMatchingCallback = {

(userData, iterator) in

let this = Unmanaged<TLUSBDeviceMonitor>.fromOpaque(userData!).takeUnretainedValue()

this.rawDeviceRemoved(iterator: iterator)

}


let selfPtr = Unmanaged.passUnretained(self).toOpaque()


IOServiceAddMatchingNotification(notifyPort, kIOFirstMatchNotification, matchingDict, matchingCallback, selfPtr, &matchedIterator)

IOServiceAddMatchingNotification(notifyPort, kIOTerminatedNotification, matchingDict, removalCallback, selfPtr, &removalIterator)

i want to send it some commands

What sort of commands? If you’re talking about SCSI commands, I believe that case is covered by QA1179 Sending SCSI or ATA commands to storage devices.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

yes, i want to send some vendor specific scsi commands. i can get the interface for "IOUSBDevice" but not for "SCSITask" (nor for anything i can think of which starts with SCSITask). the IOUSBDevice plugin ignores commands i send it, probably because i am not constructing them correctly. here is my code. the command is an unsigned 8 bit integer. the IOUSBDevRequest object is obviously NOT a proper SCSI command block. do you know of literature describing how to construct SCSI commands for submission to the IOUSBDevice interface? i also would love to find detailed and helpful descriptions of the parameters to the IOUSBDevRequest constructor.


var deviceRequest = IOUSBDevRequest(bmRequestType: UInt8(kUSBInterface),

bRequest: command,

wValue: 0,

wIndex: 0,

wLength: UInt16(0),

pData: nil,

wLenDone: UInt32(0))


kernelResponse = interface.DeviceRequest(deviceInfo.deviceIFHandle, &deviceRequest)


alternatively, what is/are the correct key:value(s) to use for device matching which will return the interface for a SCSITask?

How does MacOS send SCSI instructions to USB devices?Is it convenient to talk about it?I also encountered in the project the need to send SCSI instructions to USB devices.

I also encountered in the project the need to send SCSI instructions
to USB devices.

What sort of USB device? A mass storage device? Or something else?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Actually, scratch that. Let’s talk about this over on the specific thread you created for it.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
can anyone point me at literature describing how to locate/access an IOUSBMassStorageDriver?
 
 
Q