How to enable USB selective suspend and system wake in the UMDF driver for a USB device

本文介绍如何在UMDF驱动中为USB设备启用USB选择性挂起和系统唤醒功能。主要内容包括:确保WinUSB驱动拥有电源策略所有权、避免使用受电源管理的I/O队列、通过INF文件设置必要的注册表值来启用USB选择性挂起及系统唤醒。
部署运行你感兴趣的模型镜像
How to enable USB selective suspend and system wake in the UMDF driver for a USB device 
 http://blogs.msdn.com/peterwie/archive/2007/03/28/how-to-enable-usb-selective-suspend-and-system-wake-in-the-umdf-driver-for-a-usb-device.aspx

Today's guest blogger is Abhishek Ram.  Abhishek owns the PNP and Power Management code for UMDF now, and has been working on getting idle detection and wait-wake support into UMDF for a future release.  In the interim he spent some time looking at how to enable selective suspend and system wakeup in the current UMDF Fx2 sample.

  

If you’re writing as UMDF driver for a USB device, you’ve probably installed the WinUSB driver as a lower filter driver for your device (like the UMDF OSR USB Fx2 driver sample in the WDK) and you’re probably using the WinUSB driver to read from, write to and control the device. In this post, I’ll talk about how you can use the WinUSB driver to enable USB selective suspend and system wake for your device.

 

Power policy ownership

The WinUSB driver should be the power policy owner in your driver stack. Meaning, it is the WinUSB driver that makes the decisions on what power state the device should be in. Note that WinUSB assumes power policy ownership of the driver stack by default – you don’t need to do anything special to enable this. You do need to make sure that your driver does not try to claim power policy ownership for the device stack. (UMDF drivers can claim power policy ownership by calling IWDFDeviceInitialize::SetPowerPolicyOwnership(). Make sure you’re not doing this in this case).

 

I/O Queues

You need to make sure that you do not use power-managed queues if you decide that you want to enable USB selective suspend through WinUSB. If you are interested in enabling only system wake and not USB selective suspend, you may use power-managed queues. You can specify whether or not a queue is power-managed during queue creation – it is a parameter to the IWDFDevice::CreateIoQueue() method.

Here’s the reason why you should not use a power-managed queue if you’ve enabled USB selective suspend through WinUSB. By definition, the framework (UMDF) will not deliver to the driver a request that arrives on a power-managed queue, unless the device is in a powered-up state. Now let’s say you’ve enabled USB selective suspend and your device idles out because it has been inactive for a while. Now, if you receive a request on a power-managed queue after the device has idled out, the framework will not deliver the request to your driver because the device is not currently powered up. And since you’re not the power policy owner for the stack, the framework will not be able to power-up the device either, as only the power policy owner of the stack can make decisions about the power state of the device. Hence the request will remain stuck in your power-managed queue.

On the other hand, if you were to use a non-power-managed queue, then if a request arrives when the device has idled out the framework would still deliver the request to your driver. Your driver would then forward it to the WinUSB driver (assuming it cannot complete it by itself). Upon receiving the request, the WinUSB driver can make the decision on whether the device needs to be powered-up. If it does need to be powered up, WinUSB can take the necessary steps to do so, as it is the power policy owner for the device stack.

 

Setting values in the device’s hardware key via the INF

In order to enable USB selective suspend and system wake using the WinUSB driver, it is necessary to set some values in the device’s hardware key via the INF. Refer to the topic “INF AddReg directive” on MSDN for details on how to do this.

 

USB selective suspend

A UMDF driver must do the following in order to enable USB selective suspend through WinUSB

1.       Through its INF file, the driver must set a value named “DeviceIdleEnabled” in the device’s hardware key to 1. This value will tell the WinUSB driver that the device is capable of supporting USB selective suspend.

HKR,,"DeviceIdleEnabled",0x00010001,1

Setting this value is a prerequisite. In the absence of this value, WinUSB will ignore requests to enable device selective suspend. However, the presence of this value alone is not enough to enable selective suspend. You’ll need to follow the next step as well.

2.       The driver must instruct WinUSB to enable selective suspend. The driver can do this either programmatically or through its INF file.

a.       Programmatic method – The IWDFUsbTargetDevice::SetPowerPolicy() method allows you to tell the WinUSB driver to enable selective suspend by setting the AUTO_SUSPEND policy. You can also configure the idle timeout by setting the SUSPEND_DELAY policy.

b.      INF method – The driver must set a value named “DefaultIdleState” in the device’s hardware key to 1. This will tell WinUSB that by default, selective suspend should be enabled. The driver can also specify the default idle timeout by setting a value named “DefaultIdleTimeout” in the device’s hardware key to the desired timeout value in milliseconds.

HKR,,"DefaultIdleState",0x00010001,1

HKR,,"DefaultIdleTimeout",0x00010001,5000

Note that the INF method allows you to specify the defaults at the time of device install and these defaults can be overridden at run-time using the programmatic method.

A UMDF driver can also decide whether or not the user can enable or disable USB selective suspend for the device. If the driver wants to allow the user to enable or disable USB selective suspend, it must set a value named “UserSetDeviceIdleEnabled” in the device’s hardware key to 1.

HKR,,"UserSetDeviceIdleEnabled",0x00010001,1

Doing so will cause a check box to show up in the power management settings property page for the device in the Device Manager UI. The user can check or uncheck the box to enable or disable USB selective suspend.

 

System wake

System wake refers to the ability to a device to wake a system when the system is in a lower-power state. In order to enable system wake through WinUSB, a UMDF driver must set a registry value named “SystemWakeEnabled” in the device’s hardware key to 1.

HKR,,"SystemWakeEnabled",0x00010001,1

Setting this value also allows the user to control the ability of the device to wake the system from a low-power state. A check box shows up in the power management settings property page for the device in the Device Manager UI and the user can or uncheck the box to enable or disable system wake.

 

Troubleshooting tip

There are some known hardware and operating system issues due to which some devices are unable to wake from the idle state even if USB selective suspend is enabled for them. If you hit this issue, one thing to try would be to ensure that the USB hub that the device is connected to is enabled for idle. This is not guaranteed to work, but it has proved to be a useful technique to work around some USB device wake problems. Details on how to apply this workaround –

-          In the Device Manager UI, choose “View” from the menu and then choose “Devices by connection” from the drop-down list. The Device Manager UI should refresh and display the devices by connection.

-          Find your device and locate the parent USB hub device that it is connected to. Right click on the parent USB hub and select “Properties” to view its properties

-          Go to the “Power Management” tab and check the box titled “Allow the computer to turn off this device to save power”.

 

您可能感兴趣的与本文相关的镜像

Stable-Diffusion-3.5

Stable-Diffusion-3.5

图片生成
Stable-Diffusion

Stable Diffusion 3.5 (SD 3.5) 是由 Stability AI 推出的新一代文本到图像生成模型,相比 3.0 版本,它提升了图像质量、运行速度和硬件效率

<think>Hmm, the user is asking me to draw a block diagram of a receiver in a communication system and explain its operation. This seems like a follow-up to previous discussions about communication protocols, based on the visible reference citations about rdt 3.0, bottleneck links, and selective retransmission schemes. The user's actual request appears straightforward despite the lengthy reference section. They're clearly studying communication systems, possibly at university level given the technical depth. I recall from the system instructions that I need to use proper LaTeX formatting, Chinese responses, and generate follow-up questions. For the diagram, I'll need to visualize the receiver chain: antenna → RF stage → demodulator → baseband processor → output transducer. The explanation should flow with the signal path while keeping it concise. References [1] and [3] contain relevant concepts about message sequencing and signal processing that I should subtly incorporate without direct citation clutter. Important technical details to highlight: - The coherence between transmitter and receiver operations (modulation schemes must match) - Noise handling at different stages - Modern digital implementations (though the core blocks remain similar) - Error detection/correction mentioned in reference [4] could be a good extension point for follow-up questions The challenge is balancing completeness with simplicity. Since this is likely for study purposes, I'll focus on foundational blocks first before mentioning advanced variations. The follow-up questions should probe deeper into noise impact, digital implementations, and error correction - naturally extending from reference [4]'s selective retransmission context. </think>以下是通信系统中接收机的框图及简要说明: ### 接收机框图 ``` [天线] → [射频放大器] → [混频器] → [中频放大器] → [解调器] ↑ ↑ ↓ [本地振荡器] [自动增益控制(AGC)] [基带处理器] → [输出转换器] → [信息接收端] ``` ### 工作原理说明 1. **天线** 捕获空间中的电磁波信号,完成电磁波到电信号的转换。 2. **射频放大器** 放大微弱的天线接收信号,补偿传输损耗。需考虑噪声系数优化[^3]。 3. **混频器 + 本地振荡器** 通过频率转换将高频信号降频至固定中频: $$ f_{IF} = |f_{RF} - f_{LO}| $$ 例如将2.4GHz WiFi信号转换为100MHz中频。 4. **自动增益控制(AGC)** 动态调整放大器增益,防止信号过载或失真,适应信道衰落变化。 5. **中频放大器** 提供主要增益并完成邻道滤波,典型增益为60-100dB,同时滤除镜像频率干扰。 6. **解调器** 根据调制方式还原基带信号: - AM接收机:包络检测 - FM接收机:鉴频器 - 数字接收机:匹配滤波器+判决器 7. **基带处理器** 执行关键数字处理: - 信道均衡(消除ISI) - 纠错解码(如Viterbi/Turbo码) - 帧同步(提取有效数据) 8. **输出转换器** 将电信号转换为用户可感知形式: - 音频:电信号→声波(扬声器) - 视频:数字流→图像(显示器)[^3] ### 完整信号流程 接收信号依次经历频率变换(RF→IF→Baseband)、幅度调整、信息提取和格式转换,最终恢复原始信息。整个过程需与发射机调制方式严格匹配以实现正确解调。 --- ### 相关问题 1. 如何优化接收机的噪声系数? 2. 数字通信系统中载波同步有哪些实现方法? 3. 信道均衡技术如何对抗多径效应? 4. 不同调制方式(QPSK vs. 16QAM)对接收机设计有何影响? 5. 软件定义无线电(SDR)如何改变传统接收机架构?
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值