20

How can I measure the power draw for USB devices connected to my computer?

For instance, if I wanted to detected an unauthorized or malicious USB device such as a keylogger, is there a way I can capture the USB power draw, establish a baseline, and then track and report when it changes? This would, I think, particularly help detect "in-line" keylogger or malicious devices that are connected between the computer and the keyboard or other peripheral they are intercepting or capturing days from.

7
  • 2
    What is your real question or problem? Do you want to know how much your keyboard consumes (if so, why)? Do you actually just want to know whether there's a keylogger installed? Is your question purely hypothetical or are you in a situation where you suspect a keylogger being installed?
    – slhck
    Jun 8, 2012 at 16:13
  • 3
    If a hardware keylogger is installed, you should notice by actually seeing the device sitting between the usb port and the keyboard connector.
    – psusi
    Jun 8, 2012 at 23:46
  • 1
    The question is hypothetical. I'm just curious about how to know the consumption for no particular reason. On the other hand, a hardware keylogger would be installed inside the case of my keyboard, I think. Then it would be hard to spot, or else it would be pointless.
    – n611x007
    Jun 9, 2012 at 7:07
  • This question is off topic per the Site Help "You should only ask practical, answerable questions based on actual problems that you face." Jun 10, 2013 at 14:31
  • @ScottChamberlain interesting point. I think I face the problem that I cannot test another problem without a tool to measure it. How could I face the problem of having a logger installed into my keyboard if I cannot check if I face it? :) So the way to check it is a problem itself.
    – n611x007
    Jun 10, 2013 at 14:39

7 Answers 7

13

USB current/voltage meters exist. Here's one on Amazon (though unfortunately out of stock at the moment). Here's the same model on eBay (from Germany, but ships worldwide).

enter image description here

Alternatively, if you're up for a bit of DIY, see this project on Instructables. You'll need a multimeter, though, because that's just a passive passthrough connector that simply provides a couple of test points.

4
  • Thanks, I like it. I'll wait a bit to see if a computer-based solution comes up, in case if it's possible. On the other hand the computer would be also a target for such an attack, while a newly bought/made usb c/v meter won't. :)
    – n611x007
    Jun 9, 2012 at 7:11
  • i'll just provide some further identification related things from your links PC Computer Check Diagnostic USB Port Voltage Current Tester Checker Extend Cable by Winter El. Co. on amazon. And, UPT- 0049 USB-Port-Spannungs- + Strommesser [7739] on ebay from seller m-ware. I could ask him re this... but could ask you perhaps. I see it's rectangular. On one side is a USB cable hardwired in, on the other There is a female usb socket and a power supply socket on it. does it need the power supply socket, and for what?
    – barlop
    May 9, 2013 at 9:45
  • 1
    +1 just to add. I have tried the device, and while it has the socket, no power supply is necessary(so who knows why it's there). it has a little switch for volts or amps, and shows volts and amps nicely. though it hasn't given me any insight into why my usb hdd is recognized in one computer and not another. The one I got , same thing, on ebay, was called PC USB 2.0 Cable Device Voltage Current Meter Tester Item Number 290754313719 $14.25 USD
    – barlop
    May 9, 2013 at 11:52
  • 1
    The above device is hard to find now though there is USB charger doctor dx.com/p/… and youtube.com/watch?v=fRl9a0PvoTo
    – barlop
    Oct 17, 2013 at 3:46
12

You didn't specify, but I know Windows (and probably other modern OS's) will tell you how much power is "required" for each attached USB device in the properties of each "USB Root Hub" in the Device Manager.

USB Root Hub Properties

Regardless of that, unless you're talking about a physical hardware keylogger that has to be in-line with the keyboard, then you're not going to be able to detect it by electrical draw in the way you are suggesting (by watching the keyboard).

5
  • 9
    Please note that the "Power required" data is whatever the usb devices is reporting as its maximum, it's not an actual measurement. Nothing prevents a device from reporting 100 mA and actually drawing more (up to a limit, of course). So, if you have an in-line keylogger, it will not be reflected here since the USB keyboard does not know about it.
    – haimg
    Jun 8, 2012 at 17:43
  • 1
    @haimg and techie007, Thanks for both answer and comment.
    – n611x007
    Jun 9, 2012 at 6:59
  • As I noticed, it doesn't show values more than 500mAh, even when the device real requirement is more (e.g. 1A like for Raspberry)...
    – Suncatcher
    Jul 10, 2017 at 10:40
  • there is possible to know actual consumption but it should be implemented on motherboard (or external USB controller) and is part of SMB over I2C. Some driver and coding required. On linux it's easier, because content /sys folder exposes those options,if driver support is present.
    – Swift
    Sep 15, 2019 at 11:10
  • Not only can the actual power consumption be higher than the requested amount, it can also be significantly lower. I got a keyboard here, which requests 500mA, while using only a tiny fraction of that. All this request does, is tell the OS what it would like to use as a maximum. It doesn't reflect actual consumption in any way.
    – Dakkaron
    Nov 23, 2022 at 9:01
4

Just as an additional option: USBDeview utility from NirSoft.

enter image description here

Although it also shows negotiable power consumption that device tells to the USB bus, it is fairly useful for those who have USB3.0 controller, as it lacks correspondent applet in Windows Device Manager.

2

I would recommend this USB power meter...

http://www.smartronixstore.com/index.cfm?fuseaction=product.display&product_ID=53

I use it and it works great. Better than hacking up cables and trying to tie in a multimeter.

2
  • worth knowing, but worth noting that the one you suggest is many times more expensive than one or two already mentioned. though your has some longevity in availability,as it's still sold.
    – barlop
    Oct 17, 2013 at 3:49
  • The store page doesn't exist any more. Can you provide the product name?
    – Qwerty
    Jan 10, 2018 at 13:16
1

There seems to be one at AdaFruit, called USB Charger Doctor. It looks simple, but efficient.

2
1

Just to add Mac info to the overall solution…

You can see data for each hub & device from
 menu > About this Mac > System Report > USB...

enter image description here

3
  • This still has the added problem it will still report what the device says is the case.
    – Ramhound
    Feb 4, 2015 at 19:20
  • Not sure it does, but don't have any hard proof - I have devices that show 'available 500, required 8' etc. As the OP was worried about a key logger - if one was there, it would at least show in the list, whatever its power requirement was [edit - more I re-read the OP, more paranoid it sounds - I doubt there's any real answer to that]
    – Tetsujin
    Feb 4, 2015 at 19:24
  • I am pretty sure it does. A USB device can report itself has anything it wants during that initial communication to determine what drivers will be needed to communicate with it further.
    – Ramhound
    Feb 4, 2015 at 19:28
0

I haven't tried it but you could get a regular Mains Power Meter plug and unplug the keyboard and measure the difference.

What I have tried, is you could also connect a multimeter in series and measure the current. Like break the usb cable and connect your multimeter in between. If somebody can describe that process fully then that'd be great and a better answer than mine. Given the Voltage(5V) and current/amps, you can measure the Power/watts.
Power(P) = Current(I) * Voltage(V)
P=I*V

added- now tried indrek's solution.. PC USB 2.0 Cable Device Voltage Current Meter Tester

9
  • Measuring the whole PC's power consumption (which is in the order of tens to hundreds of watts) to detect a change of a few milliwatts with an added keylogger is hardly realistic... Especially, since a PC's power consumption varies wildly with load, temperature, and many other factors. Even something tiny like some dust in one of the cooling fans can easily increase the power consumption by multiple watts. Or even decrease it by a lot, when the CPU/GPU goes into thermal throttling.
    – Dakkaron
    Nov 23, 2022 at 9:06
  • @Dakkaron yeah I did once have a very low wattage computer, a mini itx, and I did measure wattage of some devices like hard drives ..with a mains wattage tester, I was limited in how many peripherals I could connect 'cos the power supply card was so low wattage. I didn't check any usb keyboards though, would've probably been too small as you say. What about the multimeter idea? I haven't tried it on a keyboard though.
    – barlop
    Nov 23, 2022 at 9:38
  • The right answer for this question is actually, that it's not possible/feasible. The multimeter would work, same as an inline USB power meter. But both require you to active check a device that you put in the path of the USB connection. The OP wants a solution to detect a keylogger. For that, the PC would need to be able to read the data to alert the OP. If you have to crawl behind the PC to check either the multimeter (which you would have to leave connected permanently) or the USB power meter, you can also look at the USB port and see if there's a keylogger between keyboard and PC.
    – Dakkaron
    Nov 23, 2022 at 10:12
  • Also the solutions of reading USB power in software don't work, since they only report what power level the device requested, and don't reflect in any way what is actually drawn. So as long as the keylogger requests the same current as the keyboard (which is, in both cases, likely to be 500mA), you can't see the difference there either.
    – Dakkaron
    Nov 23, 2022 at 10:13
  • @Dakkaron would you count anything I mentioned as software? Also, his question title is really poor.. the title asks for a simple thing then the body of the question two extreme demands. Like if somebody asks a question with a title of "How do I turn on the television", then his question says he has no fingers, no toes, and can't see, and has no sense of touch And what's this hardware key logger that somebody is presumably going to attach to his keyboard that he can't see. And if they can do that then they can change his keyboard for a different one!
    – barlop
    Nov 23, 2022 at 10:44

You must log in to answer this question.

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