最近,我头疼地遇到了这个问题,我已经花了一个星期的时间来解决这个问题,但还是失败了。希望您能帮助我把这块石头踢开,非常感谢。
我的问题:
我们康尼生产用于iPhone的USB存储设备,此存储设备中实际上有一个SD卡。现在,我们要开发一个Mac应用程序来更新此存储设备的固件。但是,每次将存储设备连接到Mac时,Mac都会自动安装它,并且在调用 USBInterfaceOpen 时,始终会出现 kIOReturnExclusiveAccess 失败。
我还尝试编写无代码kext 来提高探测得分,但是仍然无法正常工作。我不知道我走错了路,还是写无代码的kext时出现了一些错误,例如,写了一些错误的IOClass,错误的包ID。
我的无代码kext info.plist是:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>14E46</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleIdentifier</key>
<string>com.mophie.MyDriverTest3</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>MyDriverTest3</string>
<key>CFBundlePackageType</key>
<string>KEXT</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0.3</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>6E35b</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>14D125</string>
<key>DTSDKName</key>
<string>macosx10.10</string>
<key>DTXcode</key>
<string>0640</string>
<key>DTXcodeBuild</key>
<string>6E35b</string>
<key>IOKitPersonalities</key>
<dict>
<key>MyDriverTest3</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.iokit.IOUSBFamily</string>
<key>IOClass</key>
<string>IOService</string>
<key>IOProviderClass</key>
<string>IOUSBDevice</string>
<key>bcdDevice</key>
<string>256</string>
<key>idProduct</key>
<integer>4369</integer>
<key>idVendor</key>
<integer>6631</integer>
</dict>
</dict>
<key>OSBundleRequired</key>
<string>Root</string>
</dict>
</plist>
以下是ioreg对我的存储设备的结果:
space pack@1a122000 <class IOUSBDevice, id 0x100001773, registered, matched, active, busy 0 (300 ms), retain 9>
+-o IOUSBCompositeDriver <class IOUSBCompositeDriver, id 0x100001775, !registered, !matched, active, busy 0, retain 4>
+-o IOUSBInterface@0 <class IOUSBInterface, id 0x100001776, registered, matched, active, busy 0 (293 ms), retain 8>
+-o IOUSBMassStorageClass <class IOUSBMassStorageClass, id 0x100001777, registered, matched, active, busy 0 (201 ms), retain 9>
+-o IOSCSIPeripheralDeviceNub <class IOSCSIPeripheralDeviceNub, id 0x100001779, registered, matched, active, busy 0 (99 ms), retain 7>
+-o IOSCSIPeripheralDeviceType00 <class IOSCSIPeripheralDeviceType00, id 0x10000177a, !registered, !matched, active, busy 0 (13 ms), retain 9>
+-o IOBlockStorageServices <class IOBlockStorageServices, id 0x10000177d, registered, matched, active, busy 0 (13 ms), retain 6>
+-o IOBlockStorageDriver <class IOBlockStorageDriver, id 0x10000177e, registered, matched, active, busy 0 (12 ms), retain 47>
+-o mophie SpacePack Media <class IOMedia, id 0x100001784, registered, matched, active, busy 0 (12 ms), retain 11>
+-o IOMediaBSDClient <class IOMediaBSDClient, id 0x100001785, registered, matched, active, busy 0 (0 ms), retain 6>
+-o IOFDiskPartitionScheme <class IOFDiskPartitionScheme, id 0x100001788, !registered, !matched, active, busy 0 (1 ms), retain 6>
+-o Untitled 1@1 <class IOMedia, id 0x10000178a, registered, matched, active, busy 0 (1 ms), retain 10>
+-o IOMediaBSDClient <class IOMediaBSDClient, id 0x10000178b, registered, matched, active, busy 0 (0 ms), retain 7>
希望您能在这个问题上对我有所帮助,非常感谢,非常感谢您的帮助!
最佳答案
几点:
IOUSBInterface
而不是IOUSBDevice
。 (例如,参见the FTDI example)IOService
的捆绑包标识符是com.apple.kpi.iokit
,而不是com.apple.iokit.IOUSBFamily
,尽管我怀疑这应该不是问题。 touch
Extensions目录。 kextutil -n
说什么? IOKitDebug
个性属性以查看您的kext是否甚至有机会与设备匹配? ioctl
。您可以通过ioctl将原始SCSI请求发送到SCSI设备。我不确定这是否适用于USB大容量存储类,但肯定适用于USB连接的SCSI(UAS)或任何其他“真正的” SCSI设备。显然,这仅在通过SCSI公开固件更新命令时才有用。 毕竟,如果您仍然无法解决问题,请提供与上述建议相关的更多信息!
关于kernel - USBInterfaceOpen始终报告kIOReturnExclusiveAccess错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31699051/