Contents

UserSendCDB

Sends a vendor-specific Command Descriptor Block (CDB) to the device.

Declaration

virtual kern_return_t UserSendCDB(SCSIType00OutParameters command, SCSIType00InParameters *response);

Parameters

Return Value

A value that indicates the result of sending the CDB. kIOReturnSuccess indicates success. kIOReturnNotPrivileged means that exclusive access isn’t available. kIOReturnBadArgument indicates that the command provided bad arguments. For all other error definitions, see IOKit Constants.

Discussion

Call this method to deliver vendor-specific 16-byte commands to the external drive that this dext matches.

The dext class can call this method to send a custom 16-byte CDB to the device. You need to obtain exclusive access to send vendor-specific commands, those with an opcode between 0xC0 and 0xFF. To manage exclusive access, use the UserSuspendServices and UserResumeServices APIs. If the command fails with a check condition status, these APIs return the sense data, but only if the caller provided a valid sense buffer in SCSIType00OutParameters.

For ATA passthrough commands, the API uses Descriptor format sense data, with an ATA Status Return Descriptor. Have your dext class set the fSenseLengthRequested field in SCSIType00OutParameters to 22 bytes; this represents 8 bytes for the Descriptor format sense data and 14 bytes for the ATA Status Return Descriptor. For all other commands, the API uses Fixed format sense data. In these cases, have your dext class set fSenseLengthRequested to 18 bytes. These APIs fail if the sense buffer is larger than 22 bytes.

See Also

Sending commands to the device