I am using SCSIPeripheralsDriverKit/IOUserSCSIPeripheralDeviceType00 to develop a Dext driver, which has only two classes: MyUserSCSIPeripheralDeviceType00 and MyUserClient,
MyUserClient is responsible for receiving APP commands and passing them to MyUserSCSIPeripheralDeviceType00->UserSendCDB(),
After the device is connected to the computer, the driver can match the device and start, calling MyUserSCSIPeripheralDeviceType00-->init(), MyUserSCSIPeripheralDeviceType00-->Start(),
Any command sent by the APP to MyUserSCSIPeripheralDeviceType00 will return a failure: kIOReturnUnsupported (0xe00002c7), including UserSendCDB(), UserReportMediumBlockSize(),
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IOKitPersonalities</key>
<dict>
<key>MySCSIDriver</key>
<dict>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleIdentifierKernel</key>
<string>com.apple.kpi.iokit</string>
<key>IOClass</key>
<string>IOUserService</string>
<key>IOMatchCategory</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>IOProviderClass</key>
<string>IOSCSIPeripheralDeviceNub</string>
<key>IOResourceMatch</key>
<string>IOKit</string>
<key>IOUserClass</key>
<string>MyUserSCSIPeripheralDeviceType00</string>
<key>IOUserServerName</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>UserClientProperties</key>
<dict>
<key>IOClass</key>
<string>IOUserUserClient</string>
<key>IOUserClass</key>
<string>MyUserClient</string>
</dict>
<key>bConfigurationValue</key>
<integer>1</integer>
<key>bInterfaceNumber</key>
<integer>0</integer>
<key>bcdDevice</key>
<integer>1</integer>
<key>idProduct</key>
<string>*</string>
<key>idVendor</key>
<integer>12345</integer>
<key>Peripheral Device Type</key>
<integer>0</integer>
<key>IOKitDebug</key>
<integer>65535</integer>
</dict>
</dict>
</dict>
</plist>
This is the method that receives client calls
kern_return_t MyUserSCSIPeripheralDeviceType00::HandleExternalStruct(IOUserClientMethodArguments* arguments)
{
kern_return_t ret = kIOReturnSuccess;
SCSIType00OutParameters command;
SCSIType00InParameters response;
SCSI_Sense_Data sense;
UInt64 fSenseAddr = (intptr_t)&sense;
bzero((void *)&command, sizeof(SCSIType00OutParameters));
bzero((void *)&response, sizeof(SCSIType00InParameters));
bool test = TEST_UNIT_READY(&command, &response, fSenseAddr);
// test is true
ret = this->UserSendCDB(command, &response);
// ret is kIOReturnUnsupported (0xe00002c7)
UInt64 blockSize;
kern_return_t sizeRet = this->UserReportMediumBlockSize(&blockSize);
// sizeRet is kIOReturnUnsupported (0xe00002c7)
};
// Not called. As per the documentation, this should be called during enumeration.
kern_return_t IMPL(I4UserSCSIPeripheralDeviceType00, UserDetermineDeviceCharacteristics)
{
//
*result = true;
return kIOReturnSuccess;
}
SCSIControllerDriverKit
RSS for tagDevelop drivers for SCSI protocol-based devices.
Posts under SCSIControllerDriverKit tag
2 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I'm currently working on developing a PCI driver using PCIDriverKit, but I'm encountering challenges, particularly with the driver's extension. I need some insights on the APIs and methods to follow the best practices in generating PCI drivers for retrieving PCI devices information and running NVMe commands on the devices.