I need to power a Raspberry Pi through the USB port of another computer. Is there any way to detect on the PC if the RPi is powered on? Running dmesg
as well as lsusb
commands on the PC didn't show any meaningful changes. The RPi comes up however so it should draw some current.
-
Related - unix.stackexchange.com/questions/165447/…– slmCommented Aug 11, 2018 at 15:13
-
This question is a tad confusing - to me at least. You want to monitor the on/off state of your RPi from a PC that's supplying power to that RPi. Yet your question implies that you already know the state as you've gotten dmesg and lsusb listings (presumably) from the RPi? I'm sure that's not what you meant, but could you please edit your question to help clarify?– SeamusCommented Aug 11, 2018 at 19:27
-
Fixed. dmesg and lsusb where done on the PC powering the RPi. For most USB devices you see when they are attached/detached. But just drawing current seems not to be enough.– hid01Commented Aug 11, 2018 at 20:02
2 Answers
With lsusb
, this is the output from my USB mouse:
$ lsusb -v -d VVVV:DDDD
...
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 100mA
...
Device Status: 0x0000
(Bus Powered)
Specifically the Raspberry will always be powered on. At least the Raspberry I have doesn't have an power off switch, so as soon as it is connected to USB power, it will always be powered up.
There is / was an Windows (?) application which would monitor the sharing of data bandwidth on particular USB hub.This app would dynamically allocate data bandwidth to each USB device connected, If it still exists it could give you an indication that the RPi port is passing data hence has power. Again, on Windows , there is /was a way to check each active device "max power". That is part of USB device parameters coded in each USB device hardware.I cannot recall real tech name for these parameters. Of course that does not tell if the PC port is actually suppling any power. Logically - if the PC can check battery state on wireless mouse it should be reading the USB port power consumption and the user should be able to retrieve it. But logic sometimes does not apply.