我正在尝试使用IOKit框架获取设备的IODeviceTree路径。我可以使用以下代码获取设备的IOService路径(IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@B/AppleMCP79AHCI
):
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:/PCI0@0/SATA@B
。我尝试将kIOServicePlane
替换为kIODeviceTreePlane
,但它没有返回任何内容。我没有IOKit
的经验,所以我很确定我在这里做的很明显。
由于
答案 0 :(得分:0)
想出来,我只是使用了IODeviceTree中不存在的类名。