How to disable “allow the computer to turn off this device to save power” using C++?

755 Views Asked by At

I my C++ application, I need to disable this option for the hubs that I can find in "Device Manager/Universal Serial Bus controllers".

I have iterated in these hubs using SetupDiEnumDeviceInfo and SetupDiGetDeviceInstanceId, but after that I don't now what to do, maybe it's not the best way, I don't know.

I am using Visual Studio 2010 with Windows 10.

Someone can help me?

Grateful.

enter image description here

2

There are 2 best solutions below

0
On

My guess would be to use the WinUsb_SetPowerPolicy function. See the documentation for more detail

0
On

The class CIM_USBDevice : CIM_LogicalDevice might be able to help you with your problem. CIM_USBDevice class