setPowerState 总是在启动后调用吗?

发布于 2024-11-02 11:12:27 字数 513 浏览 5 评论 0原文

我正在为 OS X 上的 USB 设备开发内核驱动程序。添加 setPowerState 处理程序后,我注意到它在 start 后立即调用唤醒事件方法被调用。在 OS X 10.6 上,当我加载驱动程序以及插入 USB 设备时,会发生这种情况。kernel.log

显示我在每个方法调用中所做的 iolog 条目:

...(attach device)
MyDriver: Initializing
MyDriver: Probing
MyDriver: Starting
MyDriver: Waking
...(detach device)
MyDriver: Stopping
MyDriver: Freeing

我可以预期每次启动后都会发生唤醒吗?

如果是这样,将我的大部分初始化代码放入 setPowerState 处理程序(知道它将在启动后调用)是否合理?

OS X 10.4 和 10.5 也是如此吗?

I'm developing a kernel driver for a USB device on OS X. After adding the setPowerState handler, I'm noticing that it's called for a wake event immediately after the start method is called. This happens on OS X 10.6 when I load the driver, and when I plug the USB device in.

The kernel.log shows the iolog entries I'm making on each method call:

...(attach device)
MyDriver: Initializing
MyDriver: Probing
MyDriver: Starting
MyDriver: Waking
...(detach device)
MyDriver: Stopping
MyDriver: Freeing

Can I expect wakeup to occur after start every time?

If so is it reasonable to put most of my initialization code into the setPowerState handler, knowing it will be called after start?

Is this true for OS X 10.4 and 10.5 as well?

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

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

发布评论

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

评论(1

千と千尋 2024-11-09 11:12:27

是的,您可以,只要您的驱动程序已正确连接到电源层并已正确初始化电源管理(请参阅下面实施基本电源管理标题下的链接。

这不仅合理,而且是请注意,唯一不在 setPowerState 中且位于 start 或其他位置的初始化代码是仅加载一次且具有预期的电源状态处理代码的内容。睡眠和唤醒事件开始

请参阅此处。Mac

OS X 版本中 setPowerState 之间的唯一区别是,在 Mac OS X 10.5 及更高版本中,setPowerState 在其自己的线程中调用,而10.4 它作为现有线程的一部分被调用。

Yes you can, provide your have your driver is correctly connected to the Power Plane and has correctly initialised Power Managment (see the link below under the Implementing Basic Power Management heading.

It is not only reasonable but it is expected. Note that the only initialization code that make not be in setPowerState and that is in start or elsewhere is stuff that is only loaded the once and has power state handling code for sleep and wake events in start.

For more information see here.

The only difference between setPowerState in Mac OS X versions is that in Mac OS X 10.5 and newer, setPowerState is called in its own thread, whilst 10.4 it is called as part of the existing thread.

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