I have Linux based development board on which DWC3 USB controller driver is present. I have implemented Link Power Management(L2 state) in the usb driver. Ubuntu is the host which on which my development board is connected via USB.
I need to perform regression testing of USB suspend-resume by using shell script. I have managed to write some portion of it,
**usb suspend-resume.sh**
path=1-10
echo auto > /sys/bus/usb/drivers/usb/$path/power/control
echo 10 > /sys/bus/usb/drivers/usb/$path/power/autosuspend
sleep 10
iteration="10"
count="0"
while [ $count -lt $iteration ]
do
rs=$(cat /sys/bus/usb/drivers/usb/$path/power/runtime_status)
if [ "$rs" = "suspended" ]
then
echo usb is suspended
sleep 5
count=$((count+1))
fi
done
Devices on Ubuntu 14.04: /dev/ttyACM0 /dev/ttyACM1 /dev/ttyACM2 /dev/ttyACM3
The above script could perform only suspend(every 10s) but i'm not able to proceed how to resume the device.