summaryrefslogtreecommitdiffstats
path: root/rootdir
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-06-22 08:36:53 -0400
committerMike Lockwood <lockwood@android.com>2011-06-22 08:36:53 -0400
commit535164e9d9649a83d4d63829f3389f2bea339fe1 (patch)
treecfdb15ad3b2c25b8624b126947ba8b7c51dc9e96 /rootdir
parent07edefe4cecbddaf6282e556e04a1e1ef21c404a (diff)
downloadsystem_core-535164e9d9649a83d4d63829f3389f2bea339fe1.zip
system_core-535164e9d9649a83d4d63829f3389f2bea339fe1.tar.gz
system_core-535164e9d9649a83d4d63829f3389f2bea339fe1.tar.bz2
Reimplement the "adb root" command to more closely match its previous behavior
The adb gadget driver used to reset the USB bus when the adbd daemon exited, and the host side adb relied on this behavior to force it to reconnect with the new adbd instance after init relaunches it. The new gadget drivers no longer automatically reset the USB bus when adbd is restarted which caused adb to hang since it was no longer forced to reconnect with the device. We attempted to work around this on the host side adb, but that work around has not been reliable. This change adds a property trigger on the service.adb.root system property which will reset the USB bus and restart the adbd daemon when adbd sets the property to 1. This should be much closer to the previous behavior and will hopefully fix some problems with automated testing. Change-Id: I177c37400009a3d83f21a5f9431f94fd1cc19b9b Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'rootdir')
-rw-r--r--rootdir/init.rc12
1 files changed, 12 insertions, 0 deletions
diff --git a/rootdir/init.rc b/rootdir/init.rc
index dc209f3..c1fd077 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -375,6 +375,18 @@ service adbd /sbin/adbd
on property:ro.kernel.qemu=1
start adbd
+# This property trigger has added to imitiate the previous behavior of "adb root".
+# The adb gadget driver used to reset the USB bus when the adbd daemon exited,
+# and the host side adb relied on this behavior to force it to reconnect with the
+# new adbd instance after init relaunches it. So now we force the USB bus to reset
+# here when adbd sets the service.adb.root property to 1. We also restart adbd here
+# rather than waiting for init to notice its death and restarting it so the timing
+# of USB resetting and adb restarting more closely matches the previous behavior.
+on property:service.adb.root=1
+ write /sys/class/android_usb/android0/enable 0
+ restart adbd
+ write /sys/class/android_usb/android0/enable 1
+
service servicemanager /system/bin/servicemanager
class core
user system