Can you programmatically find out how much power a USB device is requesting in windows?

I don’t have to see real-time graphics or anything else, but as I understand it, if you connect a USB device, it becomes equal to 100 mA, then after some negotiations it will increase the power to 300 mA or 500 mA, etc. d. until the device stops requesting.

Does anyone know anyway to see all the USB ports on the machine and that they are "allowed" for output?

change update:

in windows, preferably using the .net language

+6
c # windows usb
source share
4 answers

It should be available somewhere, because if (in XP) you go to the device manager and select one of the USB root hubs, then it is the power tab in the properties dialog box, which describes in detail the power requested by devices connected to to each port.

I am not a Windows programmer, so I do not know how to find out programmatically.

+4
source share

A shot in the dark, but if this data is anywhere, it will be in WMI, or you can get information from the ETW usbhub / usbport route.

+1
source share

I found some interesting files in / sys but couldn't find anything with it.

On Ubuntu Linux, run root and cd in / sys / bus / usb / devices / usb 1

root@pjb-desktop :/sys/bus/usb/devices/usb1# ls 1-0:1.0 bDeviceSubClass configuration idVendor speed authorized bmAttributes descriptors manufacturer subsystem authorized_default bMaxPacketSize0 dev maxchild uevent bcdDevice bMaxPower devnum power urbnum bConfigurationValue bNumConfigurations driver product version bDeviceClass bNumInterfaces ep_00 quirks bDeviceProtocol busnum idProduct serial root@pjb-desktop :/sys/bus/usb/devices/usb1# cat bMaxPower 0mA 

It seems to show the current one.

Ok lets a little creative here ...

 cat /sys/bus/usb/devices/usb?/bMaxPower0mA 0mA 0mA 0mA 0mA 0mA 0mA 0mA 

will list all of them.

I tried to plug in a USB drive and activated it so that the LED blinks. I could not feel any changes in these indications. There is also a power folder, but I did not find anything where I could decrypt.

So excuse me if this is a dead end, but I think with a slightly closer look you can find what you need.

0
source share

You can simply connect 5 V) (or a slightly higher voltage, i.e. 6 or 7) the adapter with the highest current rating that you have at hand (you will probably be pressed to find even more than 750 mA), but this only depending on the requirements required by the attached devices. To determine how much or an ideal adapter, put the meter in the circuit and put your devices in highest power mode and read your meter (installed on the DC amplifier).

-one
source share

All Articles