2010-11-03 52 views
0

我试图获取使用IOKit框架的设备的IODeviceTree路径。我能够获得使用此代码的设备的IOService的路径(IOService:/AppleACPIPlatformExpert/[email protected]/AppleACPIPCI/[email protected]/AppleMCP79AHCI):使用IOKit获取IODeviceTree路径

CFMutableDictionaryRef matchingDict = NULL; 
matchingDict = IOServiceMatching("AppleMCP79AHCI"); 
io_service_t sataService; 
io_string_t path; 
sataService = IOServiceGetMatchingService(kIOMasterPortDefault, matchingDict); 
IORegistryEntryGetPath(sataService, kIOServicePlane, path); 
NSLog(@"%s", path); 

不过,我需要的路径在IODeviceTree平面的设备。在IODeviceTree平面上,路径将类似于IODeviceTree:/[email protected]/[email protected]。我试图用kIODeviceTreePlane代替kIOServicePlane,但它什么都没有返回。我没有IOKit的经验,所以我很确定这里有一些明显的东西。

感谢

回答

0

想通了,我只是使用未在IODeviceTree存在的类名。