I am aware from https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/comparing-usb-device-states-to-wdm-device-states that:
Device power states in the WDM model can be summarized as follows:
- D0 - The working state. The device is fully powered.
- D1/D2 - The intermediate sleep states. These states allow the device to be armed for remote wakeup.
- D3 - The deepest sleep state. Devices in state D3 cannot be armed for remote wakeup.
So, for a device, I can seemingly see this state in Windows (10) Device Manager/ [right-click device node/Properties]/ Details/ Property: Power data/ Value: Current power state - and in the example below, the power state of my chosen device is apparently D0:
However, if I use USBView (Github), then - for the same example device - I get:
... that its current power state is D2 (that is, PowerDeviceD2).
So, now I don't really know which source to trust, as the information supplied is contradictory.
But in any case - is there a way (a compiled program, maybe a Powershell script, even some C/C++ code that I should compile myself, with or without administrative privileges) - that would allow me to obtain the correct power state a particular USB device to be in, at the current time (from the perspective of Windows), from the command line?
(I would love if this kind of a utility just dumped all of the USB devices connected to the PC, along with their power states, to the terminal as a list; however, I would be more than pleased if I also have to enter USB VID:PID for an individual USB device manually)

