Commit | Line | Data |
---|---|---|
5c14297f | 1 | # Copyright (c) 2009-2012, 2014-2015, The Linux Foundation. All rights reserved. |
2 | # | |
3 | # Redistribution and use in source and binary forms, with or without | |
4 | # modification, are permitted provided that the following conditions are met: | |
5 | # * Redistributions of source code must retain the above copyright | |
6 | # notice, this list of conditions and the following disclaimer. | |
7 | # * Redistributions in binary form must reproduce the above copyright | |
8 | # notice, this list of conditions and the following disclaimer in the | |
9 | # documentation and/or other materials provided with the distribution. | |
10 | # * Neither the name of The Linux Foundation nor | |
11 | # the names of its contributors may be used to endorse or promote | |
12 | # products derived from this software without specific prior written | |
13 | # permission. | |
14 | # | |
15 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
16 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
17 | # IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
18 | # NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
19 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
20 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
21 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
22 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
23 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
24 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
25 | # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
26 | # | |
27 | ||
25a38d01 JA |
28 | on init |
29 | write /proc/sys/kernel/hung_task_timeout_secs 0 | |
30 | mount configfs none /config nodev noexec nosuid | |
31 | mkdir /config/usb_gadget/g1 | |
32 | mkdir /config/usb_gadget/g1/strings/0x409 | |
33 | mkdir /config/usb_gadget/g1/configs/c.1 | |
34 | mkdir /config/usb_gadget/g1/configs/c.1/strings/0x409 | |
35 | mkdir /config/usb_gadget/g1/functions/mtp.mtp 0770 shell shell | |
36 | mkdir /config/usb_gadget/g1/functions/ffs.adb 0770 shell shell | |
37 | mkdir /dev/usb-ffs 0770 shell shell | |
38 | mkdir /dev/usb-ffs/adb 0770 shell shell | |
39 | mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 | |
40 | setprop sys.usb.configfs 0 | |
41 | restorecon_recursive /dev/usb-ffs/adb | |
42 | ||
5c14297f | 43 | on fs |
25a38d01 JA |
44 | wait /dev/block/platform/${ro.boot.bootdevice} |
45 | symlink /dev/block/platform/${ro.boot.bootdevice} /dev/block/bootdevice | |
5c14297f | 46 | |
47 | on boot | |
d169c45b | 48 | setprop sys.usb.config adb |
25a38d01 JA |
49 | write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno} |
50 | write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer} | |
51 | write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model} | |
52 | write /config/usb_gadget/g1/configs/c.1/strings/0x409/configuration "default" | |
53 | write /config/usb_gadget/g1/configs/c.1/MaxPower 0x3f | |
54 | write /config/usb_gadget/g1/bcdDevice "0x0409" | |
55 | symlink /config/usb_gadget/g1/functions/mtp.mtp /config/usb_gadget/g1/configs/c.1/mtp.mtp | |
56 | symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/c.1/ffs.adb | |
57 | write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1 | |
58 | write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100" | |
59 | write /config/usb_gadget/g1/os_desc/use 1 | |
60 | symlink /config/usb_gadget/g1/configs/c.1 /config/usb_gadget/g1/os_desc/c.1 | |
61 | ||
62 | on property:sys.usb.ffs.ready=1 | |
63 | write /sys/class/android_usb/android0/enable 0 | |
64 | write /config/usb_gadget/g1/idProduct 0x2e81 | |
65 | write /config/usb_gadget/g1/idVendor 0x22b8 | |
66 | write /sys/class/android_usb/android0/functions adb | |
67 | write /config/usb_gadget/g1/UDC "13200000.dwc3" | |
68 | write /sys/class/android_usb/android0/enable 1 |