1# 2# Copyright (C) 2016 The Android Open-Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16 17on early-boot 18 mkdir /config/usb_gadget/g1 0770 19 mkdir /config/usb_gadget/g1/strings/0x409 0770 20 write /config/usb_gadget/g1/bcdUSB 0x0200 21 write /config/usb_gadget/g1/idVendor 0x18d1 22 write /config/usb_gadget/g1/bcdDevice 0x0440 23 write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno} 24 write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer} 25 write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model} 26 mkdir /config/usb_gadget/g1/functions/accessory.gs2 27 mkdir /config/usb_gadget/g1/functions/audio_source.gs3 28 mkdir /config/usb_gadget/g1/functions/midi.gs5 29 mkdir /config/usb_gadget/g1/functions/ffs.adb 30 mkdir /config/usb_gadget/g1/functions/ffs.mtp 31 mkdir /config/usb_gadget/g1/functions/ffs.ptp 32 mkdir /config/usb_gadget/g1/functions/diag.diag 33 mkdir /config/usb_gadget/g1/functions/diag.diag_mdm 34 mkdir /config/usb_gadget/g1/functions/cser.dun.0 35 mkdir /config/usb_gadget/g1/functions/cser.nmea.1 36 mkdir /config/usb_gadget/g1/functions/gsi.rmnet 37 mkdir /config/usb_gadget/g1/functions/gsi.rndis 38 mkdir /config/usb_gadget/g1/functions/gsi.dpl 39 mkdir /config/usb_gadget/g1/functions/qdss.qdss 40 mkdir /config/usb_gadget/g1/functions/qdss.qdss_mdm 41 mkdir /config/usb_gadget/g1/configs/b.1 0770 42 mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 43 write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1 44 write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100" 45 mkdir /dev/usb-ffs 0775 shell shell 46 mkdir /dev/usb-ffs/adb 0770 shell shell 47 mount functionfs adb /dev/usb-ffs/adb rmode=0770,fmode=0660,uid=2000,gid=2000,no_disconnect=1 48 mkdir /dev/usb-ffs/mtp 0770 mtp mtp 49 mkdir /dev/usb-ffs/ptp 0770 mtp mtp 50 mount functionfs mtp /dev/usb-ffs/mtp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1 51 mount functionfs ptp /dev/usb-ffs/ptp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1 52 setprop sys.usb.mtp.device_type 3 53 setprop sys.usb.controller "a600000.dwc3" 54 symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1 55 write /sys/module/libcomposite/parameters/disable_l1_for_hs "y" 56 write /config/usb_gadget/g1/functions/gsi.rndis/rndis_class_id 1 57 58on property:init.svc.console=running 59 write /sys/class/power_supply/usb/moisture_detection_enabled 0 60 61on property:vendor.usb.contaminantdisable=true 62 write /sys/class/power_supply/usb/moisture_detection_enabled 0 63 64on boot 65 setprop sys.usb.configfs 2 66 67on property:sys.usb.config=none && property:sys.usb.configfs=1 68 rm /config/usb_gadget/g1/configs/b.1/f1 69 rm /config/usb_gadget/g1/configs/b.1/f2 70 rm /config/usb_gadget/g1/configs/b.1/f3 71 rm /config/usb_gadget/g1/configs/b.1/f4 72 rm /config/usb_gadget/g1/configs/b.1/f5 73 rm /config/usb_gadget/g1/configs/b.1/f6 74 rm /config/usb_gadget/g1/configs/b.1/f7 75 rm /config/usb_gadget/g1/configs/b.1/f8 76 rm /config/usb_gadget/g1/configs/b.1/f9 77 78on charger 79 mkdir /config/usb_gadget/g1 0770 80 mkdir /config/usb_gadget/g1/strings/0x409 0770 81 write /config/usb_gadget/g1/bcdUSB 0x0200 82 write /config/usb_gadget/g1/idVendor 0x18d1 83 write /config/usb_gadget/g1/bcdDevice 0x0440 84 write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno} 85 write /config/usb_gadget/g1/strings/0x409/manufacturer Google 86 write /config/usb_gadget/g1/strings/0x409/product Pixel 87 mkdir /config/usb_gadget/g1/functions/midi.gs5 88 mkdir /config/usb_gadget/g1/configs/b.1 0770 89 mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 90 symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1 91 setprop sys.usb.controller "a600000.dwc3" 92 93on property:ro.bootmode=charger 94 setprop sys.usb.config midi 95 96on property:sys.usb.config=midi && property:sys.usb.configfs=1 97 write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "midi" 98 rm /config/usb_gadget/g1/configs/b.1/f1 99 rm /config/usb_gadget/g1/configs/b.1/f2 100 rm /config/usb_gadget/g1/configs/b.1/f3 101 rm /config/usb_gadget/g1/configs/b.1/f4 102 write /config/usb_gadget/g1/idVendor 0x18d1 103 write /config/usb_gadget/g1/idProduct 0x4eea 104 symlink /config/usb_gadget/g1/functions/midi.gs5 /config/usb_gadget/g1/configs/b.1/f1 105 write /config/usb_gadget/g1/UDC ${sys.usb.controller} 106 setprop sys.usb.state ${sys.usb.config} 107