使用 IOKit 获取 IODeviceTree 路径

发布于 2024-09-30 13:00:36 字数 745 浏览 1 评论 0原文

我正在尝试使用 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 的经验,所以我很确定我在这里做了一些明显的事情。

谢谢

I'm trying to get the IODeviceTree path of a device using the IOKit framework. I'm able to get the IOService path (IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@B/AppleMCP79AHCI) of the device using this code:

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);

However, I need to get the path for the device in the IODeviceTree plane. In the IODeviceTree plane, the path would be something like IODeviceTree:/PCI0@0/SATA@B. I tried simply replacing kIOServicePlane with kIODeviceTreePlane but it returned nothing. I have no experience with IOKit, so I'm pretty sure theres something obvious I'm doing here.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

执笏见 2024-10-07 13:00:36

弄清楚了,我只是使用了 IODeviceTree 中不存在的类名。

Figured it out, I was just using a class name that didn't exist in the IODeviceTree.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文