某dac設(shè)備插上mac后接剩,試圖用代碼打開,返回錯誤代碼設(shè)備被獨占萨咳,在cocoachina以及csdn懊缺、Stack Overflow上所搜可以得知,只需要制作一個codeless kext即可在設(shè)備插上的時候阻止被系統(tǒng)捕獲培他。
ioregistery是必須的工具
SampleUSBAudioOverrideDriver 蘋果給了一個demo但是并沒有在此基礎(chǔ)上修改得到正確的結(jié)果鹃两,還是自己新建了一個工程,修改info.plist得到了結(jié)果舀凛。
github上搜索codeless kext 得到的比較有參考性俊扳。
<?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>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.leo.kext.test3</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>KEXT</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright ? 2018年 </string>
<key>OSBundleLibraries</key>
<dict>
<key>com.apple.kpi.libkern</key>
<string>10.2</string>
</dict>
<key>IOKitPersonalities</key>
<dict>
<key>SampleUSBAudioDevice</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.kpi.iokit</string>
<key>IOClass</key>
<string>IOService</string>
<key>IOProviderClass</key>
<string>IOUSBInterface</string>
<key>bConfigurationValue</key>
<integer>1</integer>
<key>bInterfaceNumber</key>
<integer>0</integer>
<key>bcdDevice</key>
<integer>0x001</integer>
<key>idProduct</key>
<integer>001</integer>
<key>idVendor</key>
<integer>001</integer>
</dict>
</dict>
</dict>
</plist>
驅(qū)動安裝上以后在ioregistry中對應(yīng)設(shè)備下會出現(xiàn)一個ioservice 這樣就對了
不過能打開但是還不能寫入,暫時擱置了猛遍。
測試用的代碼在github上叫 LTIOUSB