I wrote this script to reset a USB controller:
echo -n '1-2' | tee /sys/bus/usb/drivers/usb/unbind sleep 0.5 echo -n '1-2' | tee /sys/bus/usb/drivers/usb/bind
I can then run it like so:
q201:/data # sh foobar.sh 1-21-2q201:/data #
But I cannot run it like this:
q201:/data # su -c "sh /data/foobar.sh" tee: /sys/bus/usb/drivers/usb/unbind: Permission denied 1-2tee: /sys/bus/usb/drivers/usb/bind: Permission denied 1-2 1|q201:/data #
It only works when I am connected to SSHDroid on my rooted device, other apps such as Kernel Adiutor, Script Manager fail to run the script and get the same permission denied error that I get when I try to run it with su.
The su binary that came with my android device does not prompt to grant permission. It just gives it to any apps that ask.
I just want this script to run via other apps, and/or on startup.