I am trying to write an application in C++ which lists Information obtained from a USB device. I am following USBView (Github) utility's code for it.
When device is in D0
power state (fully powered), I am able to get string descriptors, but when device goes to a low power state (D2)
, I am not.
The IOCTL IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION
returns with the error "A device attached to the system is not functioning." USBView utility shows that string descriptors are not available when device is in a low power state.
This behaviour is odd, and nowhere in the USB spec did I find reference to it.
I have checked with 2 devices, and I get the same behaviour. I am able to get other descriptors such as Device Descriptor, BOS Descriptor, etc. even in D2
state.
Is there a way to get string descriptors when USB device is in low power state? If not, is there a way to momentarily turn it to D0 power state? Probably ACPI is the answer, but it is a very low level API which I am finding overwhelming to understand. Does Windows provide any high level API to set power states?