Author Topic: Script to turn USB on and off  (Read 1980 times)

Joelf

  • Jr. Member
  • **
  • Posts: 23
    • View Profile
Script to turn USB on and off
« on: April 29, 2017, 04:29:30 PM »
Raspberry Pi:

I'm trying to reset my USB plugs so that I can reset my controllers in case I leave one plugged in when I start attract mode.

I made a .sh file that looks like this, as per @hermine.potter awesome suggestion.

Code: [Select]
#!/usr/bin/env bash
echo 0 > /sys/devices/platform/bcm2708_usb/buspower
echo 1 > /sys/devices/platform/bcm2708_usb/buspower

The issue is the index has changed, and that folder can't be found AND i'm not entirely sure if this is what I need - I actually need to turn on the USB ports in a particular order so Attract mode doesn't get confused.

I'm not familiar with how the pi works, but

Would this help inspire a solution?
   
Code: [Select]
echo suspend > /sys/bus/usb/devices/usb1/power/level   # turn off
echo on > /sys/bus/usb/devices/usb1/power/level            # turn on

These are the USB devices I have...