Click here to Skip to main content
Sign Up to vote bad
good
Hi~ i have little problem with USB devices (ex:Bluetooth or USB disk). If i want to know the power consumption of USB devices using C# or C/C++ API, is't possible?? Please give me some guide or advice. D'Oh! | :doh:
 

Thank you Smile | :)
Posted 2 Mar '10 - 6:55
cates327


3 solutions

A USB device specifies its power consumption expressed in 2mA units in the configuration descriptor (bMaxPower).
 
This shows how to obtain device configuration descriptor.
 
http://msdn.microsoft.com/en-us/library/windows/hardware/ff540174(v=vs.85).aspx[^]
 
About device configuration descriptors:
 
http://www.beyondlogic.org/usbnutshell/usb5.shtml#DeviceDescriptors[^]
  Permalink  
Comments
Jαved - 21 Jun '12 - 7:31
Good links +5.
I think you are out of luck.
You might be able to catch an OS level exception if the thing over-draws, but I don't think current is reported.
If you need it to test stuff, I'd recommend getting a good volt ohm meter and a short USB A male-female cable. Splice a milli Ohm high precision resister inline with the power wire in the cable and measure the voltage drop across the resister to get the current.
You may be able to get a VOM with a serial output (or even USB) and use it to read the current back into a computer.
  Permalink  
Seriously, a volt-ohm meter? My thinking is if Windows is able to display the power requirements of an attached USB device, there must be a way to do it in C#/C++. Anyone?
  Permalink  
Comments
pwasser - 20 Jun '12 - 22:53
A USB device specifies its power consumption expressed in 2mA units in the configuration descriptor.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 OriginalGriff 263
1 Sergey Alexandrovich Kryukov 254
2 Maciej Los 161
3 Tadit Dash 110
4 Richard MacCutchan 95
0 Sergey Alexandrovich Kryukov 10,264
1 OriginalGriff 7,917
2 CPallini 4,181
3 Rohan Leuva 3,522
4 Maciej Los 3,125


Advertise | Privacy | Mobile
Web02 | 2.6.130523.1 | Last Updated 20 Jun 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid