1

I'm trying the following script to test the reliability of shutting down/up the USB HUB on my R-Pi B. Unfortunately, it is hanging the unit and I need to manually reboot it. Any ideas?

while true
do
    /etc/init.d/networking stop
    echo 0 > /sys/devices/platform/bcm2708_usb/buspower;
    echo "Bus power stopping"
    sleep 10;
    echo 1 > /sys/devices/platform/bcm2708_usb/buspower;
    echo "Bus power starting"
    sleep 2;
    /etc/init.d/networking start
    sleep 5;
    ping google.com -c 2
    sleep 30;
done

Any ideas?

Update 13-May-2015:

I feel that I haven't provided enough details about my environment and the reasoning of this test. So, here we go...

The whole purpose of this reliability test is because the project I'm working on, the R-Pi will be running from a power pack and I need to save as much power as possible. So the idea is to disable the USB HUB while the R-Pi is in idle state and re-enable it whenever the unit has to interact with the user.

The research I have made, indicates that I could save up to 200mA by disabling this hub. So, I wanted to prove if these commands (that I have found in different forums) are reliable enough or not. And in my case they are not.

For this particular test, the unit is connected to an AC power supply (not the battery pack), it has a mouse, keyboard, monitor and wi-fi dongle attached to it. Since I have a 30 seconds sleep in my script, that gives me enough time to see if the unit is alive or not. I also have tried SSH (using Putty) without success.

8
  • Hanging how? What sort of terminal are you running this from? Commented May 12, 2015 at 0:17
  • If you take it out of the loop what is the last successful command?
    – rob
    Commented May 12, 2015 at 7:30
  • Have you checked the log?
    – goldilocks
    Commented May 12, 2015 at 8:58
  • 1) The monitor goes OFF, the R-Pi doesn't respond to mouse or keyboard. SSH session can't be established. 2) How do you suggest to check the last successful command? 3) How can I check the "log"? Where is this "log"?
    – jctlmm
    Commented May 14, 2015 at 2:11
  • Depends on the distro and configuration (usually, /etc/rsyslog.conf); the log directory is /var/log and on, e.g., Raspbian, a copy of everything should end up in /var/log/syslog. You have heard of these before right?
    – goldilocks
    Commented May 14, 2015 at 9:53

1 Answer 1

2

Well I am not sure if that is a good idea, because LAN is powered on the same CHIP as the USB HUB.

It may also be that you are trying to do these commands too quickly in that loop. You assume it takes that amount of time to come back up, but maybe there are other things that need to be reloaded and it hangs.

I cannot see why this would be beneficial.

3
  • I'm not using the LAN port. I'm only using the USB HUB where I have a WiFi dongle. I want to disable this hub when the unit is in idle state and re-enable it when the unit needs to perform an operation.
    – jctlmm
    Commented May 14, 2015 at 2:12
  • Are you complete sure issuing that command doesn't disable the internal HUB too?
    – Piotr Kula
    Commented May 14, 2015 at 12:11
  • When you say "internal HUB" are you referring to the USB HUB? If yes, the answer to your question is "yes", with that command I'm disabling both the LAN and USB ports. This is exactly what I want when the unit is in idle state, and I need to re-enable them (both LAN and USB) when the unit is interacting with the user.
    – jctlmm
    Commented May 14, 2015 at 22:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.