我正在爲我的USB設備在OS X上的kext驅動程序工作。在此驅動程序中,我有一個指向對象IOUSBDevice *device
(它可以在start()和probe( )函數),我有一個問題:有可能在probe()函數中打開設備(device->open(this, kIOServiceSeize)
),但在其他函數open()
中返回false,因爲它看起來像經典驅動程序在設備上進行控制。防止經典驅動程序在OS X上打開USB設備
我發現文章User-Mode USB Device Arbitration並試圖創建「骨架」kext設置「ClassicMustNotSeize」屬性爲true,但它似乎不工作,我仍然無法打開設備。
<?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>English</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.sample.iokit.ClassicNotSeizeDriver</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>KEXT</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>IOKitPersonalities</key>
<dict>
<key>MyUSBDevice</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.driver.AppleUSBMergeNub</string>
<key>IOClass</key>
<string>AppleUSBMergeNub</string>
<key>IOProviderClass</key>
<string>IOUSBDevice</string>
<key>IOProviderMergeProperties</key>
<dict>
<key>ClassicMustNotSeize</key>
<true/>
</dict>
<key>idProduct</key>
<integer>1</integer>
<key>idVendor</key>
<integer>10978</integer>
</dict>
</dict>
<key>OSBundleLibraries</key>
<dict>
<key>com.apple.driver.AppleUSBMergeNub</key>
<string>1.8.3b1</string>
<key>com.apple.iokit.IOUSBFamily</key>
<string>1.8</string>
</dict>
</dict>
</plist>
是否有可能以編程方式設置「ClassicMustNotSeize」屬性,例如在我的驅動程序的probe()函數中?
我想:
device->setProperty("ClassicMustNotSeize", true);
而且好像也不起作用。