I need low power operation when connected to an external USB device with the RZ/A1. I'd like to power down the USB hub ( R8A66597 ) on boot, wait a long period of time, and then power it up again and do something with the USB device, power it down again and repeat.
I've tried some tricks with the sysfs interface in Linux, but it does't seem to cut power like I'd like.
How can I accomplish this? Thanks.
# Function to enable USB Device
enableUsb () {
echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo -e "enableUsb (): $1"
echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
for u in /sys/bus/usb/devices/$1; do
echo "Authorizing USB: $u/authorized"
echo 1 > $u/authorized
done
echo 1 >/sys/bus/usb/drivers_autoprobe
for X in /sys/bus/usb/devices/*; do
foundFile=`echo $X | cut -d "/" -f 6`
if [ -z "${foundFile//[^.]/}" ]; then
none="1"
else
echo $foundFile > /sys/bus/usb/drivers_probe
fi
done
echo 0 >/sys/bus/usb/drivers_autoprobe
#echo "Binding USB: $1 > /sys/bus/usb/drivers/usb/bind"
#echo "$1" > /sys/bus/usb/drivers/usb/bind
}
# Function to disable USB Device
disableUsb () {
echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo -e "disableUsb (): $1"
echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "$1" > /sys/bus/usb/drivers/usb/unbind
for u in /sys/bus/usb/devices/$1; do
echo "Un-Authorizing USB: $u"
echo 0 > $u/authorized
done
}