I have a tablet and a LAVA SimulCharge adapter.
I would like to disconnect all USB devices when power is disconnected and reconnect them when power is connected.
Is this possible to do via changes to init.usb.rc
?
(My device is Galaxy Tab S2 LTE android 6.0.1 rooted via SuperSU systemless root.)
I'm thinking something like
on property:sys.usb.config=*accessory?*
write /sys/class/android_usb/android0/enable 0
on property:sys.usb.config=*charging?* # or is it charging,accessory ?
write /sys/class/android_usb/android0/enable 1
Reason is that when the charger is disconnected from the LAVA adapter, this prevents the tablet from sleeping and drains baterry.
echo 0 > /sys/class/android_usb/android0/enable
and didn't work. ES File Explorer shows that this file has value 0, yet the USB is device is still connected and wakes up the tablet. – Madushan Sep 02 '16 at 07:36