簡體   English   中英

使用IOKit獲取IODeviceTree路徑

[英]Getting IODeviceTree path using IOKit

我正在嘗試使用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 我試圖簡單地更換kIOServicePlanekIODeviceTreePlane但它返回任何內容。 我沒有IOKit經驗,所以我可以肯定我在這里做的事情很明顯。

謝謝

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM