summaryrefslogtreecommitdiffstats
path: root/rootdir
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-07-29 12:59:32 -0400
committerMike Lockwood <lockwood@android.com>2011-07-29 12:59:32 -0400
commit7804cbf4833cba82bd38f6adaf567bcb8262c3ad (patch)
tree5b67b0082e6be45d03327223f49e9e6b342b064a /rootdir
parent22bfc4cca03197036c3b49e7c2cf47a0a23fce87 (diff)
downloadsystem_core-7804cbf4833cba82bd38f6adaf567bcb8262c3ad.zip
system_core-7804cbf4833cba82bd38f6adaf567bcb8262c3ad.tar.gz
system_core-7804cbf4833cba82bd38f6adaf567bcb8262c3ad.tar.bz2
Move some common USB configuration logic to init.rc
Change-Id: Ib75ccfd9c4aa8aace936370c33f33a922ca3c51f Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'rootdir')
-rw-r--r--rootdir/init.rc21
1 files changed, 21 insertions, 0 deletions
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 9556885..f843824 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -320,6 +320,25 @@ on property:vold.decrypt=trigger_shutdown_framework
class_reset late_start
class_reset main
+# Used to disable USB when switching states
+on property:sys.usb.config=none
+ stop adbd
+ write /sys/class/android_usb/android0/enable 0
+ write /sys/class/android_usb/android0/bDeviceClass 0
+ setprop sys.usb.state $sys.usb.config
+
+# adb only USB configuration
+# This should only be used during device bringup
+# and as a fallback if the USB manager fails to set a standard configuration
+on property:sys.usb.config=adb
+ write /sys/class/android_usb/android0/enable 0
+ write /sys/class/android_usb/android0/idVendor 18d1
+ write /sys/class/android_usb/android0/idProduct D002
+ write /sys/class/android_usb/android0/functions $sys.usb.config
+ write /sys/class/android_usb/android0/enable 1
+ start adbd
+ setprop sys.usb.state $sys.usb.config
+
# USB accessory configuration
on property:sys.usb.config=accessory
write /sys/class/android_usb/android0/enable 0
@@ -339,6 +358,8 @@ on property:sys.usb.config=accessory,adb
start adbd
setprop sys.usb.state $sys.usb.config
+# Used to set USB configuration at boot and to switch the configuration
+# when changing the default configuration
on property:persist.sys.usb.config=*
setprop sys.usb.config $persist.sys.usb.config