48

Is there a way to check how much power a USB device requires?

Why do I need this?

I need to connect an LTE USB stick to my Raspberry Pi, and don't know how much power it needs. We got it quite easily on Windows, but haven't found a way to do it on Linux.

5 Answers 5

37

Take a look at this SuperUser Q&A titled: How do you check how much power a USB port can deliver?, specifically my answer.

lsusb -v

You can get the maximum power using lsusb -v, for example:

$ lsusb -v|egrep "^Bus|MaxPower"
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    MaxPower                0mA
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    MaxPower                0mA
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    MaxPower                0mA
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    MaxPower                0mA
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    MaxPower                0mA
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    MaxPower                0mA
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    MaxPower                0mA
Bus 001 Device 003: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
    MaxPower              100mA
Bus 003 Device 002: ID 046d:c517 Logitech, Inc. LX710 Cordless Desktop Laser
    MaxPower               98mA
Bus 001 Device 004: ID 04a9:1069 Canon, Inc. S820
    MaxPower                2mA
Bus 001 Device 005: ID 05ac:120a Apple, Inc. iPod Nano
    MaxPower              500mA
    MaxPower              500mA
3
  • 11
    I don't think that it is a correct answer. My arduino is reported as using 100mA even when I'm putting it to sleep (where other have measured a power consumption of about 56mA then). If I make my Arduino active, it is also reported as 100mA...
    – Huygens
    Jul 29, 2015 at 18:13
  • Can you please suggest the similar command for Windows?
    – Suncatcher
    Jul 10, 2017 at 10:36
  • @Huygens is correct! This is reporting the amount of current the device is requesting...not the amount it's actually drawing from the system. I haven't discovered a way in the OS to get a report of the actual current being drawn. I don't know if this information is available.
    – Chris
    Dec 12, 2019 at 23:03
24

You could also have a look at usb-devices:

$ usb-devices | grep 'Product=\|MxPwr'
S:  Product=EHCI Host Controller
C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
S:  Product=EHCI Host Controller
C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
S:  Product=USB Keykoard
C:  #Ifs= 2 Cfg#= 1 Atr=a0 MxPwr=98mA
S:  Product=USB Receiver
C:  #Ifs= 2 Cfg#= 1 Atr=a0 MxPwr=98mA
S:  Product=DW375 Bluetooth Module
C:  #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=100mA
S:  Product=5880
C:  #Ifs= 2 Cfg#= 0 Atr=c0 MxPwr=100mA
13

There's a bMaxPower file in the device's sysfs folder. But I do not think it is going to be very useful. You'll be able to find that the device "requested" 500mA just to comply with the standard but not the actual current drain.

5
$ watch -n1 'lsusb -v|egrep "^Bus|MaxPower"'

And refresh every second

Cada 1,0s: lsusb -v|egrep "^Bus|MaxPower"                               Mecaro: Fri Dec  1 00:15:54 2017

Couldn't open device, some information will be missing
Couldn't open device, some information will be missing
Couldn't open device, some information will be missing
Couldn't open device, some information will be missing
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    MaxPower                0mA
Bus 002 Device 002: ID 046d:c31c Logitech, Inc. Keyboard K120
    MaxPower               90mA
Bus 002 Device 005: ID 04fc:0538 Sunplus Technology Co., Ltd Wireless Optical Mouse 2.4G [Bright]
    MaxPower              100mA
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    MaxPower                0mA
2

You probably either solved your problem or moved on by now, but this information is available on the manufacturer's web site most of the time. It is also written on every usb device I've used.

The real answer for live measurement is probably that it is not possible to get this information from the OS. My guess is that all of this is negotiated at the wire level and actually controlled by additional voltage regulators / resistors.

Furthermore, the availability of devices specifically designed for this is for me the final hint that no "easy" solution exists.

1
  • 12
    The "manufacturer's web site" is of little use when you're making your own USB device ;-)
    – dr. Sybren
    Jul 2, 2016 at 9:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .