#!/bin/bash

for dev in /sys/bus/usb/devices/*/power/control; do
  if [ -f "$dev" ] && grep -qx "auto" "$dev"; then
    echo "Setting $dev to on"
    echo 'on' | sudo tee $dev >/dev/null
  fi
done
