summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffy Chen <jeffy.chen@rock-chips.com>2016-01-26 18:45:16 +0800
committerleozwang <leozwang@google.com>2016-02-02 12:35:34 -0800
commitd24b5a0d14a46c637c9458a42e9db023dbbbaaf5 (patch)
treead6c0240f3d344940b255b8104cb13bcc6fd2a58
parent0eb9c4c02f2afddc12e4c03badf05d3e09a71b2e (diff)
downloadkylin-d24b5a0d14a46c637c9458a42e9db023dbbbaaf5.tar.gz
Update init.usb.*.rc for adb
Base on android's dragonboard version, fix adb not working after restart adbd. Bug: 26041478 Change-Id: Ic524ba2f3c98e8eeee8e8d12d1d655b1e8a1cd5f Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
-rw-r--r--base_product/kylin.mk14
-rw-r--r--init.rk3036.rc35
-rw-r--r--init.usb.rk3036.rc43
3 files changed, 52 insertions, 40 deletions
diff --git a/base_product/kylin.mk b/base_product/kylin.mk
index 2f6007f..02d5e54 100644
--- a/base_product/kylin.mk
+++ b/base_product/kylin.mk
@@ -24,13 +24,13 @@ PRODUCT_DEVICE := kylin
soc_name := rk3036
PRODUCT_COPY_FILES += \
- device/rockchip/kylin/init.rk3036.rc:root/init.rk3036.rc \
- system/core/rootdir/init.usb.rc:root/init.usb.rc \
- system/core/rootdir/ueventd.rc:root/ueventd.rc \
-
-PRODUCT_COPY_FILES += \
- device/rockchip/kylin/fstab:root/fstab.${soc_name} \
- device/rockchip/kylin/provision-device:provision-device
+ device/rockchip/kylin/init.rk3036.rc:root/init.rk3036.rc \
+ system/core/rootdir/init.usb.rc:root/init.usb.rc \
+ system/core/rootdir/init.usb.configfs.rc:root/init.usb.configfs.rc \
+ device/rockchip/kylin/init.usb.rk3036.rc:root/init.usb.rk3036.rc \
+ system/core/rootdir/ueventd.rc:root/ueventd.rc \
+ device/rockchip/kylin/fstab:root/fstab.${soc_name} \
+ device/rockchip/kylin/provision-device:provision-device
# Default Keystore HAL
DEVICE_PACKAGES += \
diff --git a/init.rk3036.rc b/init.rk3036.rc
index a2cc503..42e60fb 100644
--- a/init.rk3036.rc
+++ b/init.rk3036.rc
@@ -14,40 +14,9 @@
# limitations under the License.
#
+import init.usb.${ro.hardware}.rc
+
on fs
# /dev/block/by-name so that we can use the same fstabs everywhere.
symlink /dev/block/platform/1021c000.dwmmc/by-name /dev/block/by-name
mount_all /fstab.${ro.hardware}
-
- mount configfs none /sys/kernel/config
- mkdir /sys/kernel/config/usb_gadget/g1
- mkdir /sys/kernel/config/usb_gadget/g1/functions/ffs.adb
-
- mkdir /dev/usb-ffs 0770 shell shell
- mkdir /dev/usb-ffs/adb 0770 shell shell
- mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
-
- write /sys/kernel/config/usb_gadget/g1/idVendor 0x2207
- write /sys/kernel/config/usb_gadget/g1/idProduct 0x0006
- mkdir /sys/kernel/config/usb_gadget/g1/strings/0x409
- write /sys/kernel/config/usb_gadget/g1/strings/0x409/serialnumber "0123456789"
- write /sys/kernel/config/usb_gadget/g1/strings/0x409/manufacturer "ROCKCHIP"
- write /sys/kernel/config/usb_gadget/g1/strings/0x409/product "ADB Gadget"
-
- mkdir /sys/kernel/config/usb_gadget/g1/configs/c.1
- mkdir /sys/kernel/config/usb_gadget/g1/configs/c.1/strings/0x409
- write /sys/kernel/config/usb_gadget/g1/configs/c.1/strings/0x409/configuration "Conf 1"
- symlink /sys/kernel/config/usb_gadget/g1/functions/ffs.adb /sys/kernel/config/usb_gadget/g1/configs/c.1/ffs.adb
- start adbd
-
-on property:sys.usb.config=adb
- write /sys/kernel/config/usb_gadget/g1/UDC "10180000.usb"
- write /sys/class/udc/10180000.usb/soft_connect "disconnect"
- write /sys/class/udc/10180000.usb/soft_connect "connect"
- setprop sys.usb.state ${sys.usb.config}
-
-on property:usb_speed.switch=high
- write /sys/kernel/debug/10180000.usb/config "0"
-
-on property:usb_speed.switch=full
- write /sys/kernel/debug/10180000.usb/config "1"
diff --git a/init.usb.rk3036.rc b/init.usb.rk3036.rc
new file mode 100644
index 0000000..e86bd8d
--- /dev/null
+++ b/init.usb.rk3036.rc
@@ -0,0 +1,43 @@
+#
+# Copyright 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+on boot
+ mkdir /dev/usb-ffs 0770 shell shell
+ mkdir /dev/usb-ffs/adb 0770 shell shell
+
+ mount configfs none /config
+ mkdir /config/usb_gadget/g1 0770 shell shell
+ write /config/usb_gadget/g1/idVendor 0x2207
+ mkdir /config/usb_gadget/g1/strings/0x409 0770
+ write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
+ write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer}
+ write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model}
+ mkdir /config/usb_gadget/g1/functions/ffs.adb
+ mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell
+ mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell
+ symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/ffs.adb
+ mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
+ setprop sys.usb.configfs 1
+ setprop sys.usb.controller "10180000.usb"
+
+on property:sys.usb.config=none && property:sys.usb.configfs=1
+ setprop sys.usb.ffs.ready 0
+
+on property:init.svc.adbd=stopped
+ setprop sys.usb.ffs.ready 0
+
+on property:sys.usb.config=adb && property:sys.usb.configfs=1
+ write /config/usb_gadget/g1/idProduct 0x0006