Examining Driver Personality Information
Another way to get the keys and values you need to describe a device is to examine the driver personality information in a device’s on-disk driver.
Before a device driver is loaded, it is stored on disk or in ROM as a kernel extension, or KEXT. KEXTs are usually located in /System/Library/Extensions. A KEXT file on disk is a bundle that contains other files and folders. Each driver KEXT includes an information property list, in XML format, typically in a file named Info.plist. The property list includes one or more driver personalities—dictionaries whose properties specify which devices the driver is suitable to manage.
A KEXT usually stores its Info.plist file in its Contents directory. You can examine its property list with the Property List Editor application (which is located in /Developer/Applications), by displaying it in the Terminal application (using more or another text-display command), or by opening the property list with an application such as Xcode. Listing 3-3 shows a partial dictionary listing for the AppleFWAudio driver. It contains keys such as the class key and the provider class key, as well as values for these keys (the strings “AppleFWAudioDevice” and “IOFireWireAVCUnit,” respectively).
Listing 3-3 A partial listing of the personality dictionary for the AppleFWAudio driver
<key>IOKitPersonalities</key> |
<dict> |
<key>AppleFWAudioDevice (AVC)</key> |
<dict> |
<key>CFBundleIdentifier</key> |
<string>com.apple.driver.AppleFWAudio</string> |
<key>IOClass</key> |
<string>AppleFWAudioDevice</string> |
<key>IOProviderClass</key> |
<string>IOFireWireAVCUnit</string> |
... |
</dict> ... |
By examining a driver’s personality dictionary, your application can determine the keys and values to put in a matching dictionary to specify that driver’s device.
本文介绍如何通过检查设备驱动程序中的驱动个性信息来获取描述设备所需的键和值。具体方法包括查看存储在磁盘上的内核扩展文件(KEXT),以及使用Property List Editor等工具打开XML格式的信息属性列表。
986

被折叠的 条评论
为什么被折叠?



