简体   繁体   English

ioreg 列出多个 dex

[英]ioreg list multiple dext

I have written a system extension using DriverKit and USBDriverKit that seems to work well (running with developer mode on, SIP off, ... still waiting for entitlements).我已经使用 DriverKit 和 USBDriverKit 编写了一个似乎运行良好的系统扩展(在开发人员模式下运行,SIP 关闭,...仍在等待权利)。

When I plug my USB device and in terminal I type ioreg | grep com.myinc.mydriver当我插入 USB 设备并在终端中输入ioreg | grep com.myinc.mydriver ioreg | grep com.myinc.mydriver I see one entry: ioreg | grep com.myinc.mydriver我看到一个条目:

+-o IOUserServer(com.myinc.mydriver ... registered, matched, active, busy 0 (0ms), retain 13

I unplug the device and do another ioreg and I get the same but with retain 9.我拔下设备并执行另一个ioreg ,我得到了相同的但保留9。

If I plug my device, then another ioreg now shows 2 entries (the previous one and a new one).如果我插入我的设备,那么另一个ioreg现在会显示 2 个条目(前一个条目和一个新条目)。

Is this normal?这是正常的吗? Why is the previous one still active?为什么上一个还活跃?

In my dext I check that my Stop and free functions are called and I cannot think of anything I have missed.在我的 dex 中,我检查我的 Stop 和 free 函数是否被调用,我想不出我错过了什么。

Can someone please explain this to me or point me toward what I may have forgotten to do?有人可以向我解释这一点或向我指出我可能忘记做的事情吗? Does retain 9 have anything to do with what I do in my code?保留 9 与我在代码中所做的事情有什么关系吗?

I figured out my problem and will leave an answer here in case it helps someone else...我想出了我的问题,并会在这里留下答案,以防它对其他人有帮助...

I obtained my IOUSBHostInterface object using CopyInterface() (from IOUSBHostDevice ).我使用CopyInterface() (来自IOUSBHostDevice )获得了我的IOUSBHostInterface对象。 Then on this object I called Open() .然后在这个对象上我调用了Open()

In my Stop() implementation I called Close() on my interface object but I forgot to call release .在我的Stop()实现中,我在接口对象上调用了Close()但我忘记调用release

Now when I disconnect my device, once all my free() functions are called, in the console I get the message "no service left, exiting".现在,当我断开设备连接时,一旦调用了所有free()函数,在控制台中我就会收到消息“没有服务,正在退出”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM